1
0

BxTimelineGridCommon.php 2.0 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 BxTimelineGridCommon 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'];
  20. $this->_aStatusValues = array('active', 'hidden');
  21. $this->_sManageType = BX_DOL_MANAGE_TOOLS_COMMON;
  22. }
  23. protected function _getCellSwitcher ($mixedValue, $sKey, $aField, $aRow)
  24. {
  25. if(!$this->_switcherState2Checked($aRow['status_admin']))
  26. return parent::_getCellDefault('', $sKey, $aField, $aRow);
  27. return parent::_getCellSwitcher ($mixedValue, $sKey, $aField, $aRow);
  28. }
  29. protected function _getCellStatusAdmin($mixedValue, $sKey, $aField, $aRow)
  30. {
  31. $CNF = &$this->_oModule->_oConfig->CNF;
  32. if(!empty($CNF['T']['filter_item_' . $mixedValue]))
  33. $mixedValue = $CNF['T']['filter_item_' . $mixedValue];
  34. else
  35. $mixedValue = '_undefined';
  36. return parent::_getCellDefault(_t($mixedValue), $sKey, $aField, $aRow);
  37. }
  38. protected function _isRowDisabled($aRow)
  39. {
  40. if(parent::_isRowDisabled($aRow))
  41. return true;
  42. return !$this->_switcherState2Checked($aRow['status_admin']);
  43. }
  44. protected function _getDataSql($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage)
  45. {
  46. $iProfileId = bx_get_logged_profile_id();
  47. $this->_aOptions['source'] .= $this->_oModule->_oDb->prepareAsString(" AND (`owner_id`=? OR (`system`='0' AND `object_owner_id`=?))", $iProfileId, $iProfileId);
  48. return parent::_getDataSql($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage);
  49. }
  50. }
  51. /** @} */