public function __construct(database $db, User $user, $menu) { $this->db =& $db; $this->user =& $user; $this->ajax = Kit::GetParam('ajax', _REQUEST, _BOOL, false); $this->q = Kit::GetParam('q', _REQUEST, _WORD); $this->userid = Kit::GetParam('userid', _SESSION, _INT); $usertypeid = Kit::GetParam('usertype', _SESSION, _INT); if ($menu == '') { $this->message = __('No menu provided'); return false; } if (!($this->theMenu = $user->MenuAuth($menu))) { $this->message = __('No permissions for this menu.'); return false; } // Set some information about this menu $this->current = 0; $this->numberItems = count($this->theMenu); // We dont want to do 0 items if ($this->numberItems == 0) { $this->numberItems = -1; } $this->message = $this->numberItems . ' menu items loaded'; return true; }
public function __construct(User $user, $menu) { $this->user =& $user; if ($menu == '') { $this->message = __('No menu provided'); return false; } if (!($this->theMenu = $user->MenuAuth($menu))) { $this->message = __('No permissions for this menu.'); return false; } // Set some information about this menu $this->current = 0; $this->numberItems = count($this->theMenu); // We dont want to do 0 items if ($this->numberItems == 0) { $this->numberItems = -1; } $this->message = $this->numberItems . ' menu items loaded'; return true; }