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


PHP array_collection_to_list函数代码示例

本文整理汇总了PHP中array_collection_to_list函数的典型用法代码示例。如果您正苦于以下问题:PHP array_collection_to_list函数的具体用法?PHP array_collection_to_list怎么用?PHP array_collection_to_list使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: run

 public function run($ctype_name = false)
 {
     $user = cmsUser::getInstance();
     $template = cmsTemplate::getInstance();
     $counts = $this->model->getTasksCounts($user->id);
     $is_moderator = $this->model->isUserModerator($user->id);
     if (!$is_moderator) {
         cmsCore::error404();
     }
     if (!$counts) {
         return $template->render('empty');
     }
     $is_index = false;
     $ctypes_list = array_keys($counts);
     if (!$ctype_name) {
         $ctype_name = $ctypes_list[0];
         $is_index = true;
     }
     $content_controller = cmsCore::getController('content');
     $ctypes = $content_controller->model->filterIn('name', $ctypes_list)->getContentTypesFiltered();
     $ctypes = array_collection_to_list($ctypes, 'name', 'title');
     $ctype = $content_controller->model->getContentTypeByName($ctype_name);
     $content_controller->model->filterByModeratorTask($user->id, $ctype_name);
     $page_url = $is_index ? href_to($this->name) : href_to($this->name, $ctype_name);
     $content_controller->model->disableApprovedFilter();
     $list_html = $content_controller->renderItemsList($ctype, $page_url, true);
     return $template->render('index', array('is_index' => $is_index, 'counts' => $counts, 'ctype' => $ctype, 'ctypes' => $ctypes, 'ctype_name' => $ctype_name, 'list_html' => $list_html, 'user' => $user));
 }
开发者ID:pin-git,项目名称:icms2,代码行数:28,代码来源:index.php

示例2: init

 public function init()
 {
     return array(array('type' => 'fieldset', 'title' => LANG_ACTIVITY_OPT_TYPES, 'childs' => array(new fieldList('types', array('is_multiple' => true, 'generator' => function () {
         $types = cmsCore::getModel('activity')->getTypes();
         return array_collection_to_list($types, 'id', 'title');
     })))));
 }
开发者ID:roman-burachenko,项目名称:icms2,代码行数:7,代码来源:form_options.php

示例3: init

 public function init()
 {
     return array(array('type' => 'fieldset', 'title' => LANG_ACTIVITY_OPT_TYPES, 'childs' => array(new fieldList('types', array('is_multiple' => true, 'generator' => function () {
         $types = cmsCore::getModel('activity')->getTypes();
         return array_collection_to_list($types, 'id', 'title');
     })))), array('type' => 'fieldset', 'title' => LANG_LIST_LIMIT, 'childs' => array(new fieldNumber('limit', array('default' => 15, 'rules' => array(array('required')))))));
 }
开发者ID:Val-Git,项目名称:icms2,代码行数:7,代码来源:form_options.php

示例4: run

 public function run($feed_id)
 {
     if (!$feed_id) {
         cmsCore::error404();
     }
     $rss_model = cmsCore::getModel('rss');
     $feed = $rss_model->getFeed($feed_id);
     $ctype_id = $feed['ctype_id'];
     $content_model = cmsCore::getModel('content');
     $fields = $content_model->getContentFields($feed['ctype_name']);
     $fields = array('' => '') + array_collection_to_list($fields, 'name', 'title');
     $form = $this->getForm('feed', array($fields));
     $is_submitted = $this->request->has('submit');
     if ($is_submitted) {
         $feed = $form->parse($this->request, $is_submitted);
         $errors = $form->validate($this, $feed);
         if (!$errors) {
             $rss_model->updateFeed($feed_id, $feed);
             $ctype = $content_model->getContentType($ctype_id);
             $ctype['options']['is_rss'] = $feed['is_enabled'];
             $content_model->updateContentType($ctype_id, array('options' => $ctype['options']));
             $this->redirectToAction();
         }
         if ($errors) {
             cmsUser::addSessionMessage(LANG_FORM_ERRORS, 'error');
         }
     }
     return cmsTemplate::getInstance()->render('backend/edit', array('feed' => $feed, 'form' => $form, 'errors' => isset($errors) ? $errors : false));
 }
开发者ID:asphix,项目名称:icms2,代码行数:29,代码来源:edit.php

示例5: init

 public function init($do)
 {
     return array('basic' => array('type' => 'fieldset', 'title' => '', 'childs' => array(new fieldList('vocabulary_id', array('title' => LANG_TAXONOMY_TERMS_VOCABULARY, 'generator' => function () {
         $model = cmsCore::getModel('taxonomy');
         $vocabularies = $model->getVocabularies();
         return array_collection_to_list($vocabularies, 'id', 'title');
     }, 'rules' => array(array('required')))), new fieldText('title', array('title' => LANG_TAXONOMY_TERMS_TITLES, 'hint' => LANG_TAXONOMY_TERMS_TITLES_HINT, 'rules' => array(array('required')))))));
 }
开发者ID:softsolution,项目名称:taxonomyic20,代码行数:8,代码来源:form_terms.php

示例6: init

 public function init()
 {
     return array(array('type' => 'fieldset', 'title' => LANG_SEARCH_IN_CTYPES, 'childs' => array(new fieldList('ctypes', array('is_multiple' => true, 'generator' => function () {
         $ctypes = cmsCore::getModel('content')->getContentTypes();
         $items = array_collection_to_list($ctypes, 'name', 'title');
         return $items;
     })))), array('type' => 'fieldset', 'title' => LANG_SEARCH_PERPAGE, 'childs' => array(new fieldNumber('perpage', array('default' => 15, 'rules' => array(array('required')))))));
 }
开发者ID:roman-burachenko,项目名称:icms2,代码行数:8,代码来源:form_options.php

示例7: init

 public function init($do)
 {
     $groups = cmsCore::getModel('users')->getGroups();
     return array('basic' => array('type' => 'fieldset', 'childs' => array(new fieldString('title', array('title' => LANG_USERS_MIG_TITLE, 'rules' => array(array('required'), array('max_length', 256)))), new fieldCheckbox('is_active', array('title' => LANG_USERS_MIG_IS_ACTIVE)))), array('type' => 'fieldset', 'childs' => array(new fieldList('is_keep_group', array('title' => LANG_USERS_MIG_ACTION, 'items' => array(0 => LANG_USERS_MIG_ACTION_CHANGE, 1 => LANG_USERS_MIG_ACTION_ADD))), new fieldList('group_from_id', array('title' => LANG_USERS_MIG_FROM, 'generator' => function () use($groups) {
         return array_collection_to_list($groups, 'id', 'title');
     })), new fieldList('group_to_id', array('title' => LANG_USERS_MIG_TO, 'generator' => function () use($groups) {
         return array_collection_to_list($groups, 'id', 'title');
     })))), array('type' => 'fieldset', 'childs' => array(new fieldCheckbox('is_passed', array('title' => LANG_USERS_MIG_COND_DATE)), new fieldList('passed_from', array('title' => LANG_USERS_MIG_PASSED_FROM, 'items' => array(0 => LANG_USERS_MIG_PASSED_REG, 1 => LANG_USERS_MIG_PASSED_MIG))), new fieldNumber('passed_days', array('title' => LANG_USERS_MIG_PASSED)))), array('type' => 'fieldset', 'childs' => array(new fieldCheckbox('is_rating', array('title' => LANG_USERS_MIG_COND_RATING)), new fieldNumber('rating', array('title' => LANG_USERS_MIG_RATING)))), array('type' => 'fieldset', 'childs' => array(new fieldCheckbox('is_karma', array('title' => LANG_USERS_MIG_COND_KARMA)), new fieldNumber('karma', array('title' => LANG_USERS_MIG_KARMA)))), array('type' => 'fieldset', 'childs' => array(new fieldCheckbox('is_notify', array('title' => LANG_USERS_MIG_NOTIFY)), new fieldHtml('notify_text', array('title' => LANG_USERS_MIG_NOTIFY_TEXT, 'options' => array('editor' => cmsConfig::get('default_editor')))))));
 }
开发者ID:roman-burachenko,项目名称:icms2,代码行数:9,代码来源:form_migration.php

示例8: init

 public function init($do)
 {
     return array('basic' => array('type' => 'fieldset', 'title' => '', 'childs' => array(new fieldString('title', array('title' => LANG_TAXONOMY_VOCABULARY_TITLE, 'rules' => array(array('max_length', 255), array('required')))), new fieldString('name', array('title' => LANG_TAXONOMY_VOCABULARY_NAME, 'hint' => LANG_TAXONOMY_VOCABULARY_NAME_HINT, 'rules' => array(array('max_length', 255), array('required'), array('sysname'), $do == 'add' ? array('unique', 'menu', 'name') : false))))), array('type' => 'fieldset', 'title' => LANG_TAXONOMY_VOCABULARY_IN_CTYPES, 'childs' => array(new fieldList('ctypes', array('is_multiple' => true, 'generator' => function () {
         $content_model = cmsCore::getModel('content');
         $ctypes = $content_model->getContentTypes();
         $items = array_collection_to_list($ctypes, 'name', 'title');
         return $items;
     })))));
 }
开发者ID:softsolution,项目名称:taxonomyic20,代码行数:9,代码来源:form_vocabulary.php

示例9: run

 public function run()
 {
     $ctypes = $this->model->getContentTypes();
     $sources = array_collection_to_list($ctypes, 'name', 'title');
     foreach ($sources as $name => $title) {
         $sources[$name] = LANG_CONTENT_CONTROLLER . ': ' . $title;
     }
     return array('name' => $this->name, 'sources' => $sources);
 }
开发者ID:asphix,项目名称:icms2,代码行数:9,代码来源:sitemap_sources.php

示例10: run

 public function run($data)
 {
     list($form, $feed) = $data;
     $fields = $this->model->getContentFields($feed['ctype_name']);
     $fields = array('' => '') + array_collection_to_list($fields, 'name', 'title');
     $form->addFieldset(LANG_RSS_FEED_MAPPING, 'mapping', array('childs' => array(new fieldList('mapping:title', array('title' => LANG_RSS_FEED_MAP_TITLE, 'items' => $fields)), new fieldList('mapping:description', array('title' => LANG_RSS_FEED_MAP_DESC, 'items' => $fields)), new fieldList('mapping:pubDate', array('title' => LANG_RSS_FEED_MAP_DATE, 'items' => $fields)), new fieldList('mapping:image', array('title' => LANG_RSS_FEED_MAP_IMAGE, 'items' => $fields)), new fieldList('mapping:image_size', array('title' => LANG_RSS_FEED_MAP_IMAGE_SIZE, 'generator' => function ($item) {
         return array('original' => LANG_PARSER_IMAGE_SIZE_ORIGINAL) + cmsCore::getModel('images')->getPresetsList();
     })))));
     return array($form, $feed);
 }
开发者ID:pin-git,项目名称:icms2,代码行数:10,代码来源:rss_content_controller_form.php

示例11: applyFilter

 public function applyFilter($model, $value)
 {
     $users_model = cmsCore::getModel('users');
     $users = $users_model->filterLike('nickname', "%{$value}%")->getUsers();
     if (!$users) {
         return $model->filterIsNull($this->name . '_id');
     } else {
         $users_ids = array_collection_to_list($users, 'id', 'id');
         return $model->filterIn($this->name . '_id', $users_ids);
     }
 }
开发者ID:asphix,项目名称:icms2,代码行数:11,代码来源:user.php

示例12: run

 public function run()
 {
     $ctypes = $this->model->getContentTypes();
     $sources = array_collection_to_list($ctypes, 'name', 'title');
     foreach ($sources as $name => $title) {
         $sources[$name] = $title;
     }
     // по каким полям поиск
     $match_fields = array();
     // какие поля получать
     $select_fields = array();
     // из каких таблиц выборка
     $table_names = array();
     // какие поля точно нужны
     $default_fields = array('id', 'slug', 'date_pub');
     foreach ($ctypes as $ctype) {
         $fields = $this->model->getContentFields($ctype['name']);
         $table_names[$ctype['name']] = $this->model->getContentTypeTableName($ctype['name']);
         $select_fields[$ctype['name']] = $default_fields;
         foreach ($fields as $field) {
             // индексы создаются только на поля типа caption, text, html
             // в настройках полей должно быть включено их участие в индексе
             $is_text = in_array($field['type'], array('caption', 'text', 'html')) && $field['handler']->getOption('in_fulltext_search');
             if ($is_text && !$field['is_private'] && (!$field['groups_read'] || $this->cms_user->isInGroups($field['groups_read']))) {
                 $match_fields[$ctype['name']][] = $field['name'];
                 $select_fields[$ctype['name']][] = $field['name'];
             }
             if ($field['type'] == 'image' && !$field['is_private'] && (!$field['groups_read'] || $this->cms_user->isInGroups($field['groups_read']))) {
                 $select_fields[$ctype['name']]['image'] = $field['name'];
             }
         }
         $filters[$ctype['name']] = array(array('condition' => '=', 'value' => 1, 'field' => 'is_pub'), array('condition' => '=', 'value' => 1, 'field' => 'is_approved'), array('condition' => 'IS', 'value' => NULL, 'field' => 'is_parent_hidden'));
         $_ctypes[$ctype['name']] = $ctype;
     }
     return array('name' => $this->name, 'sources' => $sources, 'table_names' => $table_names, 'match_fields' => $match_fields, 'select_fields' => $select_fields, 'filters' => $filters, 'item_callback' => function ($item, $model, $sources_name, $match_fields, $select_fields) use($_ctypes) {
         $fields = array();
         foreach ($match_fields as $match_field) {
             if ($match_field == 'title') {
                 continue;
             }
             $fields[$match_field] = $item[$match_field];
         }
         return array_merge($item, array('url' => href_to($sources_name, $item['slug'] . '.html'), 'ctype' => $_ctypes[$sources_name], 'title' => $item['title'], 'fields' => $fields, 'date_pub' => $item['date_pub'], 'image' => !empty($select_fields['image']) ? html_image($item[$select_fields['image']], 'small', strip_tags($item['title'])) : ''));
     });
 }
开发者ID:Val-Git,项目名称:icms2,代码行数:45,代码来源:fulltext_search.php

示例13: createCategories

 private function createCategories($content_model, $ctype, $data)
 {
     $list = explode("\n", $data['title']);
     $levels_ids = array();
     $cats_ids = array();
     $parent_props = $content_model->getContentPropsBinds($ctype['name'], $data['parent_id']);
     $parent_props = array_collection_to_list($parent_props, 'id', 'prop_id');
     $is_first = true;
     $remove_level_offset = 0;
     foreach ($list as $category_title) {
         $category_title = trim($category_title);
         if (!$category_title) {
             continue;
         }
         $level = mb_strlen(str_replace(' ', '', $category_title)) - mb_strlen(ltrim(str_replace(' ', '', $category_title), '- '));
         //			dump($level.': '.ltrim($category_title, '- '), false);
         if ($is_first && $level > 0) {
             $remove_level_offset = $level;
         }
         $level = $level - $remove_level_offset;
         $is_sub = $level > 0;
         $is_first = false;
         $category_title = ltrim($category_title, '- ');
         if (!$is_sub) {
             $levels_ids = array();
             $result = $content_model->addCategory($ctype['name'], array('parent_id' => $data['parent_id'], 'title' => $category_title));
             $levels_ids[0] = $result['id'];
             $cats_ids[] = $result['id'];
             continue;
         }
         $parent_id = $levels_ids[$level - 1];
         if (!$category_title) {
             $category_title = 'untitled';
         }
         $result = $content_model->addCategory($ctype['name'], array('parent_id' => $parent_id, 'title' => ltrim($category_title, '- ')));
         $levels_ids[$level] = $result['id'];
         $cats_ids[] = $result['id'];
     }
     //		die();
     if ($data['is_inherit_binds'] && $parent_props && $cats_ids) {
         foreach ($parent_props as $prop_id) {
             $content_model->bindContentProp($ctype['name'], $prop_id, $cats_ids);
         }
     }
 }
开发者ID:rookees,项目名称:icms2,代码行数:45,代码来源:content_cats_add.php

示例14: run

 public function run()
 {
     if (!$this->request->isAjax()) {
         cmsCore::error404();
     }
     if (!cmsUser::isAdmin()) {
         cmsCore::error404();
     }
     $ctype_id = $this->request->get('value', 0);
     if (!$ctype_id) {
         cmsCore::error404();
     }
     $datasets = $this->model->getContentDatasets($ctype_id);
     $list = array();
     if ($datasets) {
         $list = array('0' => '') + array_collection_to_list($datasets, 'id', 'title');
     }
     cmsTemplate::getInstance()->renderJSON($list);
 }
开发者ID:Val-Git,项目名称:icms2,代码行数:19,代码来源:widget_datasets_ajax.php

示例15: init

 public function init($options = false)
 {
     $cats_list = array();
     $datasets_list = array('0' => '');
     $fields_list = array('' => '');
     if (!empty($options['ctype_id'])) {
         $content_model = cmsCore::getModel('content');
         $ctype = $content_model->getContentType($options['ctype_id']);
         $cats = $content_model->getCategoriesTree($ctype['name']);
         if ($cats) {
             foreach ($cats as $cat) {
                 if ($cat['ns_level'] > 1) {
                     $cat['title'] = str_repeat('-', $cat['ns_level']) . ' ' . $cat['title'];
                 }
                 $cats_list[$cat['id']] = $cat['title'];
             }
         }
         $datasets = $content_model->getContentDatasets($options['ctype_id']);
         if ($datasets) {
             $datasets_list = array(0 => '') + array_collection_to_list($datasets, 'id', 'title');
         }
         $fields = $content_model->getContentFields($ctype['name']);
         if ($fields) {
             $fields_list = array('' => '') + array_collection_to_list($fields, 'name', 'title');
         }
     }
     return array(array('type' => 'fieldset', 'title' => LANG_OPTIONS, 'childs' => array(new fieldList('options:ctype_id', array('title' => LANG_CONTENT_TYPE, 'generator' => function ($item) {
         $model = cmsCore::getModel('content');
         $tree = $model->getContentTypes();
         $items = array();
         if ($tree) {
             foreach ($tree as $item) {
                 $items[$item['id']] = $item['title'];
             }
         }
         return $items;
     })), new fieldList('options:category_id', array('title' => LANG_CATEGORY, 'parent' => array('list' => 'options:ctype_id', 'url' => href_to('content', 'widget_cats_ajax')), 'items' => $cats_list)), new fieldList('options:dataset', array('title' => LANG_WD_CONTENT_SLIDER_DATASET, 'parent' => array('list' => 'options:ctype_id', 'url' => href_to('content', 'widget_datasets_ajax')), 'items' => $datasets_list)), new fieldList('options:image_field', array('title' => LANG_WD_CONTENT_SLIDER_IMAGE, 'parent' => array('list' => 'options:ctype_id', 'url' => href_to('content', 'widget_fields_ajax')), 'items' => $fields_list)), new fieldList('options:big_image_field', array('title' => LANG_WD_CONTENT_SLIDER_BIG_IMAGE, 'hint' => LANG_WD_CONTENT_SLIDER_BIG_IMAGE_HINT, 'parent' => array('list' => 'options:ctype_id', 'url' => href_to('content', 'widget_fields_ajax')), 'items' => $fields_list)), new fieldList('options:big_image_preset', array('title' => LANG_WD_CONTENT_SLIDER_BIG_IMAGE_PRESET, 'generator' => function ($item) {
         return cmsCore::getModel('images')->getPresetsList() + array('original' => LANG_PARSER_IMAGE_SIZE_ORIGINAL);
     })), new fieldList('options:teaser_field', array('title' => LANG_WD_CONTENT_SLIDER_TEASER, 'parent' => array('list' => 'options:ctype_id', 'url' => href_to('content', 'widget_fields_ajax')), 'items' => $fields_list)), new fieldNumber('options:delay', array('title' => LANG_WD_CONTENT_SLIDER_DELAY, 'hint' => LANG_WD_CONTENT_SLIDER_DELAY_HINT, 'default' => 5, 'units' => LANG_SECOND10)), new fieldNumber('options:limit', array('title' => LANG_LIST_LIMIT, 'default' => 4, 'rules' => array(array('required')))))));
 }
开发者ID:selimoves,项目名称:icms2,代码行数:40,代码来源:options.form.php


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