本文整理汇总了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);
}
示例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);
}
示例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;
}
示例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;
}
}
示例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;
}
示例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;
}