Example #1
0
 /**
  * @url GET navBar
  * @param array $roleIds
  */
 public function getNavBar($roleIds = null)
 {
     try {
         $session = Session::singleton();
         $session->activateRoles($roleIds);
         // top level interfaces
         foreach ($session->getInterfacesForNavBar() as $ifc) {
             $top[] = array('id' => $ifc->id, 'label' => $ifc->label, 'link' => '/' . $ifc->id);
         }
         // new interfaces
         foreach ($session->getInterfacesToCreateAtom() as $ifc) {
             $new[] = array('id' => $ifc->id, 'label' => $ifc->label, 'link' => '/' . $ifc->id);
         }
         return array('top' => $top, 'new' => $new, 'refreshMenu' => $GLOBALS['navBar']['refreshMenu'], 'appMenu' => $GLOBALS['navBar']['appMenu'], 'roleMenu' => $GLOBALS['navBar']['roleMenu'], 'defaultSettings' => array('notifications' => Notifications::getDefaultSettings(), 'switchAutoCommit' => Config::get('interfaceAutoCommitChanges', 'transactions'), 'cacheGetCalls' => Config::get('interfaceCacheGetCalls', 'transactions')), 'notifications' => Notifications::getAll(), 'session' => array('id' => $session->id, 'loggedIn' => Session::sessionUserLoggedIn()), 'sessionRoles' => $session->getSessionRoles(), 'sessionVars' => Session::getSessionVars());
     } catch (Exception $e) {
         throw new RestException($e->getCode(), $e->getMessage());
     }
 }
Example #2
0
 /**
  * @url GET navBar
  * @param int $roleId
  */
 public function getNavBar($roleId = 0)
 {
     try {
         $session = Session::singleton();
         $session->setRole($roleId);
         // top level interfaces
         foreach ($session->role->getInterfacesForNavBar() as $ifc) {
             $top[] = array('id' => $ifc->id, 'label' => $ifc->label, 'link' => '/' . $ifc->id);
         }
         // new interfaces
         foreach ($session->role->getInterfacesToCreateAtom() as $ifc) {
             $new[] = array('id' => $ifc->id, 'label' => $ifc->label, 'link' => '/' . $ifc->id);
         }
         // roles
         $roles = array();
         $allRoles = Config::get('loginEnabled') ? Role::getAllSessionRoles() : Role::getAllRoleObjects();
         foreach ((array) $allRoles as $role) {
             $roles[] = array('id' => $role->id, 'label' => $role->label);
         }
         return array('top' => $top, 'new' => $new, 'refreshMenu' => $GLOBALS['navBar']['refreshMenu'], 'appMenu' => $GLOBALS['navBar']['appMenu'], 'roleMenu' => $GLOBALS['navBar']['roleMenu'], 'roles' => $roles, 'defaultSettings' => array('notifications' => Notifications::getDefaultSettings()), 'notifications' => Notifications::getAll(), 'session' => array('id' => $session->id, 'loggedIn' => Session::sessionUserLoggedIn(), 'sessionRoles' => $roles), 'sessionVars' => Session::getSessionVars());
     } catch (Exception $e) {
         throw new RestException($e->getCode(), $e->getMessage());
     }
 }