Beispiel #1
0
 public static function buildJSONTree($lang = 'en-US')
 {
     $u = Qdmvc_Helper::getCurrentUser();
     $debug_mode = isset($_GET['debugmode']) ? $_GET['debugmode'] : 0;
     $re = array();
     foreach (static::getIndex() as $key => $config) {
         if (!$u->hasPermission(null, null, $key)) {
             continue;
         }
         //quocdunginfo, performance
         $tmp = array();
         $active = isset($config['Active']) ? $config['Active'] : true;
         $p_id = isset($config['ParentId']) ? $config['ParentId'] : -1;
         if (!$active) {
             continue;
         }
         $text = isset($config['Caption']) && isset($config['Caption'][$lang]) ? $config['Caption'][$lang] : $key;
         $tmp['title'] = $debug_mode == 1 ? $key : $text;
         $tmp['key'] = $key;
         $tmp['parentid'] = $p_id;
         if (!Qdmvc_Helper::isNullOrEmpty($config['PageType']) && $config['PageType'] == 'Folder') {
             $tmp['title'] = '[' . $tmp['title'] . ']';
             $tmp['value'] = '';
             $tmp['folder'] = true;
         } else {
             $tmp['value'] = Qdmvc_Helper::getCompactPageListLink($key);
         }
         array_push($re, $tmp);
     }
     return json_encode($re);
 }
Beispiel #2
0
 protected function checkPermission($method_name)
 {
     $class_name = $this->getCalledClassName();
     //get Permissions
     $u = Qdmvc_Helper::getCurrentUser();
     if ($u != null) {
         if (!$u->hasPermission($class_name, $method_name)) {
             $this->pushMsg('You are not allowed to call ' . $class_name . '|' . $method_name, 'error');
             return false;
         }
     }
     return true;
 }
Beispiel #3
0
 protected function checkPermission()
 {
     //get Permissions
     $u = Qdmvc_Helper::getCurrentUser();
     return $u->hasPermission(null, null, $this->getPage());
 }