コード例 #1
0
 /**
  * Get the menu structure and return it
  *
  * @param string $mtype the type of menu sought - default all returned
  *
  * @return array menu structure
  */
 public function get($mtype = null)
 {
     static $menu = null;
     $account_id = $GLOBALS['phpgw_info']['user']['account_id'];
     if (!$menu) {
         $menu = phpgwapi_cache::user_get('phpgwapi', 'menu', $account_id, true, true);
     }
     if (!$menu) {
         $menu = self::load();
         phpgwapi_cache::user_set('phpgwapi', 'menu', $menu, $account_id, true, true);
     }
     if (!is_null($mtype) && isset($menu[$mtype])) {
         return $menu[$mtype];
     }
     return $menu;
 }
コード例 #2
0
 public function update_bookmark()
 {
     $location_code = phpgw::get_var('location_code', 'string');
     $user_id = $GLOBALS['phpgw_info']['user']['account_id'];
     $bookmarks = phpgwapi_cache::user_get('controller', "location_bookmark", $user_id);
     if ($bookmarks && is_array($bookmarks) && isset($bookmarks[$location_code])) {
         unset($bookmarks[$location_code]);
         $status = lang('deleted');
     } else {
         if (!is_array($bookmarks)) {
             $bookmarks = array();
         }
         $bookmarks[$location_code] = true;
         $status = lang('added');
     }
     phpgwapi_cache::user_set('controller', "location_bookmark", $bookmarks, $user_id);
     return array('status' => $status);
 }
コード例 #3
0
 /**
  * Reads ACL records from database and return array along with storing it
  *
  * @param string $account_type the type of accounts sought accounts|groups
  *
  * @return array Array with ACL records
  */
 protected function _read_repository($account_type = 'both', $app_id = '', $location_id = '')
 {
     if (!$this->_account_id) {
         $this->set_account_id($this->_account_id, false);
     }
     if (!$app_id && $account_type != 'accounts') {
         $data = phpgwapi_cache::user_get('phpgwapi', 'acl_data', $this->_account_id);
         if (!is_null($data)) {
             $this->_data[$this->_account_id] = $data;
             return;
             // nothing more to do
         }
     } elseif ($account_type != 'accounts') {
         $data = phpgwapi_cache::user_get('phpgwapi', "acl_data_{$app_id}_{$location_id}", $this->_account_id);
         if (!is_null($data)) {
             $this->_data[$this->_account_id][$app_id][$location_id] = $data;
             return;
             // nothing more to do
         }
     }
     switch ($GLOBALS['phpgw_info']['server']['account_repository']) {
         case 'ldap':
             $this->_read_repository_ldap($account_type, $app_id, $location_id);
             break;
         default:
             $this->_read_repository_sql($account_type, $app_id, $location_id);
     }
     if ($account_type != 'accounts') {
         if (!$app_id && $this->_data[$this->_account_id]) {
             phpgwapi_cache::user_set('phpgwapi', 'acl_data', $this->_data[$this->_account_id], $this->_account_id);
         } else {
             if (isset($this->_data[$this->_account_id][$app_id][$location_id]) && is_array($this->_data[$this->_account_id][$app_id][$location_id])) {
                 //						throw new Exception("user_set ({$app_id}, {$location_id}) not set");
                 phpgwapi_cache::user_set('phpgwapi', "acl_data_{$app_id}_{$location_id}", $this->_data[$this->_account_id][$app_id][$location_id], $this->_account_id);
             }
         }
     }
 }