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


PHP CategoryModel::getAll方法代码示例

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


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

示例1: indexAction

 public function indexAction()
 {
     $View = new View('category/list');
     $View->assign('_title_', _('Categories'));
     $categories = CategoryModel::getAll();
     $View->assign('categories', $categories);
     $View->display();
 }
开发者ID:richistron,项目名称:TianguisCabal,代码行数:8,代码来源:CategoryController.php

示例2: manageCategories

 /**
  * Enabling and disabling categories from list.
  *
  * @since 2.0.0
  * @access public
  */
 public function manageCategories()
 {
     // Check permission
     $this->permission(['Garden.Community.Manage', 'Garden.Settings.Manage'], false);
     $this->setHighlightRoute('vanilla/settings/categories');
     $this->addJsFile('manage-categories.js');
     $this->addJsFile('jquery.alphanumeric.js');
     // This now works on latest jQuery version 1.10.2
     //
     // Jan29, 2014, upgraded jQuery UI to 1.10.3 from 1.8.11
     $this->addJsFile('nestedSortable/jquery-ui.min.js');
     // Newer nestedSortable, but does not work.
     //$this->addJsFile('js/library/nestedSortable/jquery.mjs.nestedSortable.js');
     // old jquery-ui
     //$this->addJsFile('js/library/nestedSortable.1.3.4/jquery-ui-1.8.11.custom.min.js');
     $this->addJsFile('nestedSortable.1.3.4/jquery.ui.nestedSortable.js');
     $this->title(t('Categories'));
     // Get category data
     $CategoryData = $this->CategoryModel->getAll('TreeLeft');
     // Set CanDelete per-category so we can override later if we want.
     $canDelete = checkPermission(['Garden.Community.Manage', 'Garden.Settings.Manage']);
     array_walk($CategoryData->result(), function (&$value) use($canDelete) {
         setvalr('CanDelete', $value, $canDelete);
     });
     $this->setData('CategoryData', $CategoryData, true);
     // Setup & save forms
     $Validation = new Gdn_Validation();
     $ConfigurationModel = new Gdn_ConfigurationModel($Validation);
     $ConfigurationModel->setField(array('Vanilla.Categories.MaxDisplayDepth', 'Vanilla.Categories.DoHeadings', 'Vanilla.Categories.HideModule'));
     // Set the model on the form.
     $this->Form->setModel($ConfigurationModel);
     // Define MaxDepthOptions
     $DepthData = array();
     $DepthData['2'] = sprintf(t('more than %s deep'), plural(1, '%s level', '%s levels'));
     $DepthData['3'] = sprintf(t('more than %s deep'), plural(2, '%s level', '%s levels'));
     $DepthData['4'] = sprintf(t('more than %s deep'), plural(3, '%s level', '%s levels'));
     $DepthData['0'] = t('never');
     $this->setData('MaxDepthData', $DepthData);
     // If seeing the form for the first time...
     if ($this->Form->authenticatedPostBack() === false) {
         // Apply the config settings to the form.
         $this->Form->setData($ConfigurationModel->Data);
     } else {
         if ($this->Form->save() !== false) {
             CategoryModel::clearCache();
             $this->informMessage(t("Your settings have been saved."));
         }
     }
     // Render default view
     $this->render();
 }
开发者ID:vanilla,项目名称:vanilla,代码行数:57,代码来源:class.vanillasettingscontroller.php


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