本文整理汇总了PHP中K2HelperPermissions::canAddToAll方法的典型用法代码示例。如果您正苦于以下问题:PHP K2HelperPermissions::canAddToAll方法的具体用法?PHP K2HelperPermissions::canAddToAll怎么用?PHP K2HelperPermissions::canAddToAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类K2HelperPermissions
的用法示例。
在下文中一共展示了K2HelperPermissions::canAddToAll方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
//.........这里部分代码省略.........
$item->video = str_replace($matches[1], JURI::root() . $matches[1], $item->video);
}
}
$item->text = $item->video;
if (K2_JVERSION == '15') {
$dispatcher->trigger('onPrepareContent', array(&$item, &$params, null));
} else {
$dispatcher->trigger('onContentPrepare', array('com_k2.' . $view, &$item, &$params, null));
}
$item->video = $item->text;
} else {
// no nothing
}
if (isset($item->created_by)) {
$author = JUser::getInstance($item->created_by);
$item->author = $author->name;
} else {
$item->author = $user->name;
}
if (isset($item->modified_by)) {
$moderator = JUser::getInstance($item->modified_by);
$item->moderator = $moderator->name;
}
if ($item->id) {
$active = $item->created_by;
} else {
$active = $user->id;
}
$lists['authors'] = JHTML::_('list.users', 'created_by', $active, false);
$categories_option[] = JHTML::_('select.option', 0, JText::_('K2_SELECT_CATEGORY'));
$categories = $categoriesModel->categoriesTree(NUll, true, false);
if ($mainframe->isSite()) {
JLoader::register('K2HelperPermissions', JPATH_SITE . DS . 'components' . DS . 'com_k2' . DS . 'helpers' . DS . 'permissions.php');
if (($task == 'add' || $task == 'edit') && !K2HelperPermissions::canAddToAll()) {
for ($i = 0; $i < sizeof($categories); $i++) {
if (!K2HelperPermissions::canAddItem($categories[$i]->value) && $task == 'add') {
$categories[$i]->disable = true;
}
if (!K2HelperPermissions::canEditItem($item->created_by, $categories[$i]->value) && $task == 'edit') {
$categories[$i]->disable = true;
}
}
}
}
$categories_options = @array_merge($categories_option, $categories);
$lists['categories'] = JHTML::_('select.genericlist', $categories_options, 'catid', '', 'value', 'text', $item->catid);
JTable::addIncludePath(JPATH_COMPONENT . DS . 'tables');
$category = JTable::getInstance('K2Category', 'Table');
$category->load($item->catid);
$extraFieldModel = K2Model::getInstance('ExtraField', 'K2Model');
if ($category->id) {
$extraFields = $extraFieldModel->getExtraFieldsByGroup($category->extraFieldsGroup);
} else {
$extraFields = NULL;
}
for ($i = 0; $i < sizeof($extraFields); $i++) {
$extraFields[$i]->element = $extraFieldModel->renderExtraField($extraFields[$i], $item->id);
}
if ($item->id) {
$item->attachments = $model->getAttachments($item->id);
$rating = $model->getRating();
if (is_null($rating)) {
$item->ratingSum = 0;
$item->ratingCount = 0;
} else {
$item->ratingSum = (int) $rating->rating_sum;