当前位置: 首页>>代码示例>>PHP>>正文


PHP ca_lists::getListItemsAsHierarchy方法代码示例

本文整理汇总了PHP中ca_lists::getListItemsAsHierarchy方法的典型用法代码示例。如果您正苦于以下问题:PHP ca_lists::getListItemsAsHierarchy方法的具体用法?PHP ca_lists::getListItemsAsHierarchy怎么用?PHP ca_lists::getListItemsAsHierarchy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ca_lists的用法示例。


在下文中一共展示了ca_lists::getListItemsAsHierarchy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Edit

 public function Edit()
 {
     $t_role = $this->getRoleObject();
     $t_screen = new ca_editor_ui_screens();
     $o_dm = Datamodel::load();
     $t_list = new ca_lists();
     $va_role_vars = $t_role->get('vars');
     $va_bundle_access_settings = $va_role_vars['bundle_access_settings'];
     $vn_default_bundle_access_level = (int) $this->request->config->get('default_bundle_access_level');
     $va_bundle_list = $va_table_names = array();
     foreach (ca_users::$s_bundlable_tables as $vs_table) {
         $t_instance = $o_dm->getInstanceByTableName($vs_table, true);
         $va_table_names[$vs_table] = caUcFirstUTF8Safe($t_instance->getProperty('NAME_PLURAL'));
         $va_available_bundles = $t_screen->getAvailableBundles($vs_table);
         foreach ($va_available_bundles as $vs_bundle_name => $va_bundle_info) {
             $vn_access = isset($va_bundle_access_settings[$vs_table . '.' . $vs_bundle_name]) ? $va_bundle_access_settings[$vs_table . '.' . $vs_bundle_name] : $vn_default_bundle_access_level;
             $va_bundle_list[$vs_table][$vs_bundle_name] = array('bundle_info' => $va_bundle_info, 'access' => $vn_access);
         }
     }
     $this->view->setVar('bundle_list', $va_bundle_list);
     $vn_default_type_access_level = (int) $this->request->config->get('default_type_access_level');
     $va_type_list = array();
     $va_type_access_settings = $va_role_vars['type_access_settings'];
     foreach (ca_users::$s_bundlable_tables as $vs_table) {
         $t_instance = $o_dm->getInstanceByTableName($vs_table, true);
         if (!($vs_list_code = $t_instance->getTypeListCode())) {
             continue;
         }
         $va_table_names[$vs_table] = caUcFirstUTF8Safe($t_instance->getProperty('NAME_PLURAL'));
         $va_types = $t_list->getListItemsAsHierarchy($vs_list_code, array('additionalTableToJoin' => 'ca_list_item_labels'));
         if (is_array($va_types)) {
             foreach ($va_types as $vn_i => $va_type_info) {
                 $vn_item_id = $va_type_info['NODE']['item_id'];
                 $vn_access = isset($va_type_access_settings[$vs_table . '.' . $vn_item_id]) ? $va_type_access_settings[$vs_table . '.' . $vn_item_id] : $vn_default_type_access_level;
                 $va_type_info['NODE']['level'] = $va_type_info['LEVEL'];
                 $va_type_list[$vs_table][$vn_item_id] = array('type_info' => $va_type_info['NODE'], 'access' => $vn_access);
             }
         }
     }
     $vn_default_source_access_level = (int) $this->request->config->get('default_source_access_level');
     $va_source_list = array();
     $va_source_access_settings = $va_role_vars['source_access_settings'];
     foreach (ca_users::$s_bundlable_tables as $vs_table) {
         $t_instance = $o_dm->getInstanceByTableName($vs_table, true);
         if (!($vs_list_code = $t_instance->getSourceListCode())) {
             continue;
         }
         $va_table_names[$vs_table] = caUcFirstUTF8Safe($t_instance->getProperty('NAME_PLURAL'));
         $va_sources = $t_list->getListItemsAsHierarchy($vs_list_code, array('additionalTableToJoin' => 'ca_list_item_labels'));
         if (is_array($va_sources)) {
             foreach ($va_sources as $vn_i => $va_source_info) {
                 $vn_item_id = $va_source_info['NODE']['item_id'];
                 $vn_access = isset($va_source_access_settings[$vs_table . '.' . $vn_item_id]) ? $va_source_access_settings[$vs_table . '.' . $vn_item_id] : $vn_default_source_access_level;
                 $va_source_info['NODE']['level'] = $va_source_info['LEVEL'];
                 $va_source_list[$vs_table][$vn_item_id] = array('source_info' => $va_source_info['NODE'], 'access' => $vn_access, 'default' => $vn_item_id == $va_source_access_settings[$vs_table . '_default_id']);
             }
         }
     }
     $va_access_status_list = array();
     if (is_array($va_access_statuses = $t_list->getListItemsAsHierarchy('access_statuses', array('additionalTableToJoin' => 'ca_list_item_labels')))) {
         $va_access_status_settings = $va_role_vars['access_status_settings'];
         foreach ($va_access_statuses as $vn_i => $va_access_status_info) {
             if (!$va_access_status_info['NODE']['parent_id']) {
                 continue;
             }
             $vn_item_id = $va_access_status_info['NODE']['item_id'];
             $va_access_status_info['NODE']['level'] = $va_access_status_info['LEVEL'];
             $vn_access = isset($va_access_status_settings[$vn_item_id]) ? $va_access_status_settings[$vn_item_id] : null;
             $va_access_status_list[$vn_item_id] = array('access_status_info' => $va_access_status_info['NODE'], 'access' => $vn_access);
         }
     }
     $this->view->setVar('type_list', $va_type_list);
     $this->view->setVar('source_list', $va_source_list);
     $this->view->setVar('access_status_list', $va_access_status_list);
     $this->view->setVar('table_display_names', $va_table_names);
     $this->render('role_edit_html.php');
 }
开发者ID:idiscussforum,项目名称:providence,代码行数:77,代码来源:RolesController.php


注:本文中的ca_lists::getListItemsAsHierarchy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。