Пример #1
0
 /**
  *
  * static pass by ref setupCategoriesMatrix(&$categories)
  * takes in an array of categories and modifes them adding display information
  *
  * @param unknown_type $categories
  */
 public static function setupCategoriesMatrix(&$categories)
 {
     global $ACLActions, $current_user;
     $names = array();
     $disabled = array();
     foreach ($categories as $cat_name => $category) {
         foreach ($category as $type_name => $type) {
             foreach ($type as $act_name => $action) {
                 $names[$act_name] = translate($ACLActions[$type_name]['actions'][$act_name]['label'], 'ACLActions');
                 $categories[$cat_name][$type_name][$act_name]['accessColor'] = ACLAction::AccessColor($action['aclaccess']);
                 if ($type_name == 'module') {
                     if ($act_name != 'aclaccess' && $categories[$cat_name]['module']['access']['aclaccess'] == ACL_ALLOW_DISABLED) {
                         $categories[$cat_name][$type_name][$act_name]['accessColor'] = 'darkgray';
                         $disabled[] = $cat_name;
                     }
                 }
                 $categories[$cat_name][$type_name][$act_name]['accessName'] = ACLAction::AccessName($action['aclaccess']);
                 $categories[$cat_name][$type_name][$act_name]['accessLabel'] = ACLAction::AccessLabel($action['aclaccess']);
                 if ($cat_name == 'Users' && $act_name == 'admin') {
                     $categories[$cat_name][$type_name][$act_name]['accessOptions'][ACL_ALLOW_DEFAULT] = ACLAction::AccessName(ACL_ALLOW_DEFAULT);
                     $categories[$cat_name][$type_name][$act_name]['accessOptions'][ACL_ALLOW_DEV] = ACLAction::AccessName(ACL_ALLOW_DEV);
                 } else {
                     $categories[$cat_name][$type_name][$act_name]['accessOptions'] = ACLAction::getAccessOptions($act_name, $type_name);
                 }
             }
         }
     }
     if (!is_admin($current_user)) {
         foreach ($disabled as $cat_name) {
             unset($categories[$cat_name]);
         }
     }
     return $names;
 }
Пример #2
0
 /**
  * 
  * static pass by ref setupCategoriesMatrix(&$categories)
  * takes in an array of categories and modifes them adding display information
  *
  * @param unknown_type $categories
  */
 function setupCategoriesMatrix(&$categories)
 {
     global $ACLActions, $current_user;
     $names = array();
     $disabled = array();
     foreach ($categories as $cat_name => $category) {
         foreach ($category as $type_name => $type) {
             $setup_names = false;
             if (empty($names)) {
                 $names = array();
                 $setup_names = true;
                 if (!empty($names)) {
                     $tdwidth = 100 / sizeof($names);
                 }
             }
             foreach ($type as $act_name => $action) {
                 if ($setup_names) {
                     $names[] = translate($ACLActions[$type_name]['actions'][$act_name]['label'], 'ACLActions');
                 }
                 $categories[$cat_name][$type_name][$act_name]['accessColor'] = ACLAction::AccessColor($action['aclaccess']);
                 if ($type_name == 'module') {
                     if ($act_name != 'aclaccess' && $categories[$cat_name]['module']['access']['aclaccess'] == ACL_ALLOW_DISABLED) {
                         $categories[$cat_name][$type_name][$act_name]['accessColor'] = 'darkgray';
                         $disabled[] = $cat_name;
                     }
                 }
                 $categories[$cat_name][$type_name][$act_name]['accessName'] = ACLAction::AccessName($action['aclaccess']);
                 $categories[$cat_name][$type_name][$act_name]['accessOptions'] = ACLAction::getAccessOptions($act_name, $type_name);
             }
         }
     }
     if (!is_admin($current_user)) {
         foreach ($disabled as $cat_name) {
             unset($categories[$cat_name]);
         }
     }
     return $names;
 }