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


PHP Gdn_DataSet::DatasetType方法代码示例

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


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

示例1: __construct

 public function __construct($Sender = '', $ApplicationFolder = '')
 {
     $this->Data = FALSE;
     $NoFollowing = TRUE;
     if (C('Vanilla.Categories.Use') == TRUE) {
         // Load categories with respect to view permissions
         $Categories = CategoryModel::Categories();
         $Categories2 = $Categories;
         foreach ($Categories2 as $i => $Category) {
             if (!$Category['PermsDiscussionsView']) {
                 unset($Categories[$i]);
             } elseif (!$Category['Following']) {
                 $NoFollowing = FALSE;
             }
         }
         // delete view filter if no categories are hidden
         $Session = Gdn::Session();
         if ($NoFollowing && $Session->IsValid()) {
             $Session->SetPreference('ShowAllCategories', TRUE);
         }
         // set categories to data
         $Data = new Gdn_DataSet($Categories);
         $Data->DatasetType(DATASET_TYPE_ARRAY);
         $Data->DatasetType(DATASET_TYPE_OBJECT);
         $this->Data['Categories'] = $Data;
         // calculate additional needed data
         $this->Data['CategoryID'] = isset($Sender->CategoryID) ? $Sender->CategoryID : '';
         $this->Data['OnCategories'] = strtolower($Sender->ControllerName) == 'categoriescontroller' && !is_numeric($this->Data['CategoryID']);
         $this->Data['ShowAllCategoriesPref'] = $Session->GetPreference('ShowAllCategories');
         $this->Data['Url'] = Gdn::Request()->Path();
         if ($this->Data['Url'] == '') {
             $this->Data['Url'] = '/';
         }
         $this->Data['ShowAllCategoriesUrl'] = Gdn::Request()->Url('categories/settoggle?ShowAllCategories=true&Target=' . $this->Data['Url']);
         $this->Data['ShowFollowedCategoriesUrl'] = Gdn::Request()->Url('categories/settoggle?ShowAllCategories=false&Target=' . $this->Data['Url']);
         $this->Data['TKey'] = urlencode(Gdn::Session()->TransientKey());
         $this->Data['ValidSession'] = $Session->UserID > 0 && $Session->ValidateTransientKey($this->Data['TKey']);
         $this->Data['MaxDepth'] = C('Vanilla.Categories.MaxDisplayDepth');
         $this->Data['DoHeadings'] = C('Vanilla.Categories.DoHeadings');
     }
     parent::__construct($Sender, $ApplicationFolder);
 }
开发者ID:Nordic-T,项目名称:vanilla-plugins,代码行数:42,代码来源:class.categoriesmoduleplusmodule.php

示例2: __construct

 public function __construct($Sender = '')
 {
     // Load categories
     $this->Data = FALSE;
     if (C('Vanilla.Categories.Use') == TRUE && !C('Vanilla.Categories.HideModule')) {
         $Categories = CategoryModel::Categories();
         $Categories2 = $Categories;
         // Filter out the categories we aren't watching.
         foreach ($Categories2 as $i => $Category) {
             if (!$Category['PermsDiscussionsView'] || !$Category['Following']) {
                 unset($Categories[$i]);
             }
         }
         $Data = new Gdn_DataSet($Categories);
         $Data->DatasetType(DATASET_TYPE_ARRAY);
         $Data->DatasetType(DATASET_TYPE_OBJECT);
         $this->Data = $Data;
     }
     parent::__construct($Sender);
 }
开发者ID:elpum,项目名称:TgaForumBundle,代码行数:20,代码来源:class.categoriesmodule.php

示例3: getData

 /**
  * Get the data for this module.
  */
 protected function getData()
 {
     // Allow plugins to set different data.
     $this->fireEvent('GetData');
     if ($this->Data) {
         return;
     }
     $Categories = CategoryModel::categories();
     $Categories2 = $Categories;
     // Filter out the categories we aren't watching.
     foreach ($Categories2 as $i => $Category) {
         if (!$Category['PermsDiscussionsView'] || !$Category['Following']) {
             unset($Categories[$i]);
         }
     }
     $Data = new Gdn_DataSet($Categories);
     $Data->DatasetType(DATASET_TYPE_ARRAY);
     $Data->DatasetType(DATASET_TYPE_OBJECT);
     $this->Data = $Data;
 }
开发者ID:sitexa,项目名称:vanilla,代码行数:23,代码来源:class.categoriesmodule.php

示例4: __get

 public function __get($Name)
 {
     switch ($Name) {
         case 'CommentData':
             Deprecated('ActivityController->CommentData', "ActivityController->Data('Activities')");
             $Result = new Gdn_DataSet(array(), DATASET_TYPE_OBJECT);
             return $Result;
         case 'ActivityData':
             Deprecated('ActivityController->ActivityData', "ActivityController->Data('Activities')");
             $Result = new Gdn_DataSet($this->Data('Activities'), DATASET_TYPE_ARRAY);
             $Result->DatasetType(DATASET_TYPE_OBJECT);
             return $Result;
     }
 }
开发者ID:statico,项目名称:openshift-origin-vanillaforums,代码行数:14,代码来源:class.activitycontroller.php

示例5: GetFiltered

 /**
  * Get a list of categories, considering several filters
  * 
  * @param array $RestrictIDs Optional list of category ids to mask the dataset
  * @param string $Permissions Optional permission to require. Defaults to Vanilla.Discussions.View.
  * @param array $ExcludeWhere Exclude categories with any of these flags
  * @return \Gdn_DataSet
  */
 public function GetFiltered($RestrictIDs = FALSE, $Permissions = FALSE, $ExcludeWhere = FALSE)
 {
     // Get the current category list
     $Categories = self::Categories();
     // Filter out the categories we aren't supposed to view.
     if ($RestrictIDs && !is_array($RestrictIDs)) {
         $RestrictIDs = array($RestrictIDs);
     } elseif ($this->Watching) {
         $RestrictIDs = self::CategoryWatch();
     }
     switch ($Permissions) {
         case 'Vanilla.Discussions.Add':
             $Permissions = 'PermsDiscussionsAdd';
             break;
         case 'Vanilla.Disussions.Edit':
             $Permissions = 'PermsDiscussionsEdit';
             break;
         default:
             $Permissions = 'PermsDiscussionsView';
             break;
     }
     $IDs = array_keys($Categories);
     foreach ($IDs as $ID) {
         // Exclude the root category
         if ($ID < 0) {
             unset($Categories[$ID]);
         } elseif (!$Categories[$ID][$Permissions]) {
             unset($Categories[$ID]);
         } elseif (is_array($ExcludeWhere)) {
             foreach ($ExcludeWhere as $Filter => $FilterValue) {
                 if (GetValue($Filter, $Categories[$ID], FALSE) == $FilterValue) {
                     unset($Categories[$ID]);
                 }
             }
         } elseif (is_array($RestrictIDs) && !in_array($ID, $RestrictIDs)) {
             unset($Categories[$ID]);
         }
     }
     Gdn::UserModel()->JoinUsers($Categories, array('LastUserID'));
     $Result = new Gdn_DataSet($Categories, DATASET_TYPE_ARRAY);
     $Result->DatasetType(DATASET_TYPE_OBJECT);
     return $Result;
 }
开发者ID:robhazkes,项目名称:Garden,代码行数:51,代码来源:class.categorymodel.php

示例6: GetFullCache

 public function GetFullCache($CategoryID = FALSE, $Permissions = FALSE)
 {
     $Categories = self::Categories();
     $Joined = self::JoinRecentPosts($Categories);
     if ($Joined) {
         Gdn::Cache()->Store(self::CACHE_KEY, $Categories);
     }
     // Filter our the categories we aren't supposed to view.
     if ($CategoryID && !is_array($CategoryID)) {
         $CategoryID = array($CategoryID);
     } elseif ($this->Watching) {
         $CategoryID = self::CategoryWatch();
     }
     switch ($Permissions) {
         case 'Vanilla.Discussions.Add':
             $Permissions = 'PermsDiscussionsAdd';
             break;
         case 'Vanilla.Disussions.Edit':
             $Permissions = 'PermsDiscussionsEdit';
             break;
         default:
             $Permissions = 'PermsDiscussionsView';
             break;
     }
     $IDs = array_keys($Categories);
     foreach ($IDs as $ID) {
         if ($ID < 0) {
             unset($Categories[$ID]);
         } elseif (!$Categories[$ID][$Permissions]) {
             unset($Categories[$ID]);
         } elseif (is_array($CategoryID) && !in_array($ID, $CategoryID)) {
             unset($Categories[$ID]);
         }
     }
     Gdn::UserModel()->JoinUsers($Categories, array('LastUserID'));
     $Result = new Gdn_DataSet($Categories, DATASET_TYPE_ARRAY);
     $Result->DatasetType(DATASET_TYPE_OBJECT);
     return $Result;
 }
开发者ID:Raz0r,项目名称:Garden,代码行数:39,代码来源:class.categorymodel.php


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