| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- <?php defined('BX_DOL') or die('hack attempt');
- /**
- * Copyright (c) UNA, Inc - https://una.io
- * MIT License - https://opensource.org/licenses/MIT
- * @defgroup Tasks Tasks
- * @ingroup UnaModules
- *
- * @{
- */
- class BxTasksMenuTimers extends BxTemplMenuCustom
- {
- protected $_sModule;
- protected $_oModule;
- protected $_iProfileId;
- protected $_bShowAsButton;
- protected $_bShowTitle;
- public function __construct($aObject, $oTemplate = false)
- {
- parent::__construct($aObject, $oTemplate);
- $this->_sModule = 'bx_tasks';
- $this->_oModule = BxDolModule::getInstance($this->_sModule);
- $this->_iProfileId = 0;
- $this->_bShowAsButton = true;
- $this->_bShowTitle = true;
- }
- public function setParams($iProfileId)
- {
- $this->_iProfileId = $iProfileId;
- }
- protected function getMenuItemsRaw()
- {
- $sJsObject = $this->_oModule->_oConfig->getJsObject('timer');
- return [
- ['name' => 'clear-all', 'class' => '', 'link' => 'javascript:void(0)', 'onclick' => 'javascript:' . $sJsObject . '.clearAll(this, ' . $this->_iProfileId . ')', 'target' => '_self', 'title' => _t('_bx_tasks_txt_timers_clear')],
- ['name' => 'log-all', 'class' => '', 'link' => 'javascript:void(0)', 'onclick' => 'javascript:' . $sJsObject . '.logAll(this, ' . $this->_iProfileId . ')', 'target' => '_self', 'title' => _t('_bx_tasks_txt_timers_log')],
- ];
- }
- protected function _getMenuItemClearAll($aItem)
- {
- if($this->_bIsApi) {
- return array_merge($aItem, [
- 'display_type' => 'callback',
- 'data' => [
- 'request_url' => $this->_sModule . '/process_timer/¶ms[]=clear_all¶ms[]=0¶ms[]=' . $this->_iProfileId,
- 'on_callback' => 'hide'
- ]
- ]);
- }
- return true;
- }
- protected function _getMenuItemLogAll($aItem)
- {
- if($this->_bIsApi) {
- return array_merge($aItem, [
- 'display_type' => 'callback',
- 'data' => [
- 'request_url' => $this->_sModule . '/process_timer/¶ms[]=log_all¶ms[]=0¶ms[]=' . $this->_iProfileId,
- 'on_callback' => 'hide'
- ]
- ]);
- }
- return true;
- }
- protected function _getMenuItemDefault($aItem)
- {
- if($this->_bIsApi)
- return $aItem;
- $aItem['class_wrp'] = 'bx-tasks-timer-action' . (!empty($aItem['class_wrp']) ? ' ' . $aItem['class_wrp'] : '');
- if($this->_bShowAsButton)
- $aItem['class_link'] = 'bx-btn' . (isset($aItem['primary']) && (int)$aItem['primary'] == 1 ? ' bx-btn-primary' : '') . (!empty($aItem['class_link']) ? ' ' . $aItem['class_link'] : '');
- if(!$this->_bShowTitle)
- $aItem['bx_if:title']['condition'] = false;
- return parent::_getMenuItemDefault ($aItem);
- }
- }
- /** @} */
|