BxTimelineGridAdministration.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php defined('BX_DOL') or die('hack attempt');
  2. /**
  3. * Copyright (c) UNA, Inc - https://una.io
  4. * MIT License - https://opensource.org/licenses/MIT
  5. *
  6. * @defgroup Timeline Timeline
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. require_once('BxTimelineGridManageTools.php');
  12. class BxTimelineGridAdministration extends BxTimelineGridManageTools
  13. {
  14. public function __construct ($aOptions, $oTemplate = false)
  15. {
  16. $this->MODULE = 'bx_timeline';
  17. parent::__construct ($aOptions, $oTemplate);
  18. $CNF = &$this->_oModule->_oConfig->CNF;
  19. $this->_sStatusField = $CNF['FIELD_STATUS_ADMIN'];
  20. $this->_aStatusValues = array('active', 'hidden', 'pending');
  21. }
  22. protected function _getCellStatus($mixedValue, $sKey, $aField, $aRow)
  23. {
  24. return parent::_getCellDefault(_t('_bx_timeline_txt_status_' . $mixedValue), $sKey, $aField, $aRow);
  25. }
  26. protected function _getCellOwnerId($mixedValue, $sKey, $aField, $aRow)
  27. {
  28. $iProfile = $this->_oModule->_oConfig->isSystem($aRow['type'], $aRow['action']) ? $aRow['owner_id'] : $aRow['object_id'];
  29. if($this->_bIsApi)
  30. return ['type' => 'profile', 'data' => BxDolProfile::getData($iProfile)];
  31. $oProfile = $this->_getProfileObject($iProfile);
  32. $sProfile = $oProfile->getDisplayName();
  33. $sAccountEmail = '';
  34. $sManageAccountUrl = '';
  35. if($oProfile && $oProfile instanceof BxDolProfile && BxDolAcl::getInstance()->isMemberLevelInSet(128)) {
  36. $sAccountEmail = $oProfile->getAccountObject()->getEmail();
  37. $sManageAccountUrl = $this->_getManageAccountUrl($sAccountEmail);
  38. }
  39. $mixedValue = $this->_oTemplate->parseHtmlByName('author_link.html', array(
  40. 'href' => $oProfile->getUrl(),
  41. 'title' => $sProfile,
  42. 'content' => $sProfile,
  43. 'bx_if:show_account' => array(
  44. 'condition' => !empty($sManageAccountUrl),
  45. 'content' => array(
  46. 'href' => $sManageAccountUrl,
  47. 'title' => _t($this->_oModule->_oConfig->CNF['T']['grid_txt_account_manager']),
  48. 'content' => $sAccountEmail
  49. )
  50. )
  51. ));
  52. return parent::_getCellDefault($mixedValue, $sKey, $aField, $aRow);
  53. }
  54. }
  55. /** @} */