| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- <?php defined('BX_DOL') or die('hack attempt');
- /**
- * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
- * CC-BY License - http://creativecommons.org/licenses/by/3.0/
- *
- * @defgroup Timeline Timeline
- * @ingroup DolphinModules
- *
- * @{
- */
- bx_import('BxTemplMenu');
- /**
- * 'Item' menu.
- */
- class BxTimelineMenuItemManage extends BxTemplMenu
- {
- protected $_aEvent;
- protected $_oModule;
- public function __construct($aObject, $oTemplate = false)
- {
- parent::__construct($aObject, $oTemplate);
- $this->_oModule = BxDolModule::getInstance('bx_timeline');
- $this->addMarkers(array(
- 'js_object_view' => $this->_oModule->_oConfig->getJsObject('view'),
- ));
- }
- public function setEvent($aEvent)
- {
- if(empty($aEvent) || !is_array($aEvent))
- return;
- $this->_aEvent = $aEvent;
- $this->addMarkers(array(
- 'content_id' => $aEvent['id'],
- ));
- }
- public function isVisible()
- {
- if(!isset($this->_aObject['menu_items']))
- $this->_aObject['menu_items'] = $this->_oQuery->getMenuItems();
- $bVisible = false;
- foreach ($this->_aObject['menu_items'] as $a) {
- if((isset($a['active']) && !$a['active']) || (isset($a['visible_for_levels']) && !$this->_isVisible($a)))
- continue;
-
- $bVisible = true;
- break;
- }
- return $bVisible;
- }
- /**
- * Check if menu items is visible.
- * @param $a menu item array
- * @return boolean
- */
- protected function _isVisible ($a)
- {
- if(!parent::_isVisible($a))
- return false;
- $sCheckFuncName = '';
- $aCheckFuncParams = array();
- switch ($a['name']) {
- case 'item-delete':
- $sCheckFuncName = 'isAllowedDelete';
- if(!empty($this->_aEvent))
- $aCheckFuncParams = array($this->_aEvent);
- break;
- }
- if(!$sCheckFuncName || !method_exists($this->_oModule, $sCheckFuncName))
- return true;
- return call_user_func_array(array($this->_oModule, $sCheckFuncName), $aCheckFuncParams) === true;
- }
- }
- /** @} */
|