Esempio n. 1
0
 /**
  * Constructor hook method.
  *
  * @param array $config
  */
 public function initialize(array $config)
 {
     parent::initialize($config);
     $_config = ['redirect' => ['action' => 'index'], 'messages' => ['noAction' => __d('union', 'Action not found.'), 'noChose' => __d('union', 'Please choose only one item for this operation')]];
     $config = Hash::merge($_config, $config);
     $this->config($config);
 }
Esempio n. 2
0
 /**
  * Startup callback.
  *
  * @param Event $event
  */
 public function startup(Event $event)
 {
     parent::startup($event);
     if ($this->_controller->isAdmin() && $this->_controller->Auth->user('id')) {
         $this->__userAdminNavBar();
     }
 }
Esempio n. 3
0
 /**
  * Component constructor.
  *
  * @param ComponentRegistry $registry
  * @param array $config
  */
 public function __construct(ComponentRegistry $registry, array $config = [])
 {
     parent::__construct($registry, $config);
     if ($controller = $registry->getController()) {
         $this->_controller = $controller;
         $this->_LinksTable = TableRegistry::get('Union/Menus.Links');
     }
 }
Esempio n. 4
0
 /**
  * Before filter callback.
  *
  * @return void
  */
 public function beforeFilter()
 {
     parent::beforeFilter();
     $userId = $this->Auth->user('id');
     $isUpdateLastAction = $this->Cookie->check($this->_cookieName);
     if ($userId && !$isUpdateLastAction) {
         $this->_setCookieOptions($userId);
         $this->_updateLastAction($userId);
     }
 }