本文整理汇总了PHP中K2View::display方法的典型用法代码示例。如果您正苦于以下问题:PHP K2View::display方法的具体用法?PHP K2View::display怎么用?PHP K2View::display使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类K2View
的用法示例。
在下文中一共展示了K2View::display方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
public function display($tpl = null)
{
// Get application
$application = JFactory::getApplication();
// Get input
$task = $application->input->get('task', '', 'cmd');
$this->offset = $application->input->get('limitstart', 0, 'int');
$this->limit = $application->input->get('limit', 10, 'int');
// Trigger the corresponding method
if (method_exists($this, $task)) {
call_user_func(array($this, $task));
} else {
throw new Exception(JText::_('K2_NOT_FOUND'), 404);
}
// Generate the view params depedning on the task prefix. This let's us have one common layout file for listing items
$this->generateItemlistParams($task);
// Load the comments counters in a single query for all items
if ($this->params->get('comments')) {
K2Items::countComments($this->items);
}
// Plugins
foreach ($this->items as $item) {
$item->events = $item->getEvents('com_k2.itemlist.' . $task, $this->params, $this->offset);
}
// Pagination
jimport('joomla.html.pagination');
$this->pagination = new JPagination($this->total, $this->offset, $this->limit);
// Display
parent::display($tpl);
}
示例2: display
function display($tpl = null)
{
$mainframe = JFactory::getApplication();
$user = JFactory::getUser();
$document = JFactory::getDocument();
$document->addStyleSheet('//ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/smoothness/jquery-ui.css');
$document->addStyleSheet(JURI::root(true) . '/media/k2/assets/css/theme.css?v=2.6.8');
$document->addStyleSheet(JURI::root(true) . '/media/k2/assets/css/elfinder.min.css?v=2.6.8');
$type = JRequest::getCmd('type');
$fieldID = JRequest::getCmd('fieldID');
if ($type == 'video') {
$mimes = "'video','audio'";
} elseif ($type == 'image') {
$mimes = "'image'";
} else {
$mimes = '';
}
$this->assignRef('mimes', $mimes);
$this->assignRef('type', $type);
$this->assignRef('fieldID', $fieldID);
if ($mainframe->isAdmin()) {
$toolbar = JToolBar::getInstance('toolbar');
if (K2_JVERSION != '15') {
JToolBarHelper::preferences('com_k2', 550, 875, 'K2_PARAMETERS');
} else {
$toolbar->appendButton('Popup', 'config', 'K2_PARAMETERS', 'index.php?option=com_k2&view=settings');
}
JToolBarHelper::title(JText::_('K2_MEDIA_MANAGER'), 'k2.png');
$this->loadHelper('html');
K2HelperHTML::subMenu();
}
parent::display($tpl);
}
示例3: display
function display($tpl = null)
{
$mainframe = JFactory::getApplication();
$user = JFactory::getUser();
$option = JRequest::getCmd('option');
$view = JRequest::getCmd('view');
$limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
$limitstart = $mainframe->getUserStateFromRequest($option . $view . '.limitstart', 'limitstart', 0, 'int');
$filter_order = $mainframe->getUserStateFromRequest($option . $view . 'filter_order', 'filter_order', '', 'cmd');
$filter_order_Dir = $mainframe->getUserStateFromRequest($option . $view . 'filter_order_Dir', 'filter_order_Dir', '', 'word');
$model = $this->getModel();
$total = $model->getTotalGroups();
if ($limitstart > $total - $limit) {
$limitstart = max(0, (int) (ceil($total / $limit) - 1) * $limit);
JRequest::setVar('limitstart', $limitstart);
}
$extraFieldGroups = $model->getGroups();
$this->assignRef('rows', $extraFieldGroups);
jimport('joomla.html.pagination');
$pageNav = new JPagination($total, $limitstart, $limit);
$this->assignRef('page', $pageNav);
JToolBarHelper::title(JText::_('K2_EXTRA_FIELD_GROUPS'), 'k2.png');
JToolBarHelper::deleteList('', 'remove', 'K2_DELETE');
JToolBarHelper::editList();
JToolBarHelper::addNew();
if (K2_JVERSION != '15') {
JToolBarHelper::preferences('com_k2', 550, 875, 'K2_PARAMETERS');
} else {
$toolbar = JToolBar::getInstance('toolbar');
$toolbar->appendButton('Popup', 'config', 'Parameters', 'index.php?option=com_k2&view=settings');
}
$this->loadHelper('html');
K2HelperHTML::subMenu();
parent::display($tpl);
}
示例4: report
function report($tpl = null)
{
JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . DS . 'tables');
$row =& JTable::getInstance('K2Comment', 'Table');
$row->load(JRequest::getInt('commentID'));
if (!$row->published) {
JError::raiseError(404, JText::_('K2_NOT_FOUND'));
}
$this->assignRef('row', $row);
$user = JFactory::getUser();
$this->assignRef('user', $user);
$params =& K2HelperUtilities::getParams('com_k2');
if (!$params->get('comments') || !$params->get('commentsReporting') || $params->get('commentsReporting') == '2' && $user->guest) {
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
}
$this->assignRef('params', $params);
if ($params->get('recaptcha') && $user->guest) {
$document = JFactory::getDocument();
$document->addScript('http://api.recaptcha.net/js/recaptcha_ajax.js');
$js = '
function showRecaptcha(){
Recaptcha.create("' . $params->get('recaptcha_public_key') . '", "recaptcha", {
theme: "' . $params->get('recaptcha_theme', 'clean') . '"
});
}
$K2(window).load(function() {
showRecaptcha();
});
';
$document->addScriptDeclaration($js);
}
parent::display($tpl);
}
示例5: display
function display($tpl = null)
{
JRequest::setVar('hidemainmenu', 1);
$model = $this->getModel();
$extraField = $model->getData();
if (!$extraField->id) {
$extraField->published = 1;
}
$this->assignRef('row', $extraField);
$lists = array();
$lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $extraField->published);
$groups[] = JHTML::_('select.option', 0, JText::_('K2_CREATE_NEW_GROUP'));
$extraFieldModel = K2Model::getInstance('ExtraFields', 'K2Model');
$uniqueGroups = $extraFieldModel->getGroups(true);
foreach ($uniqueGroups as $group) {
$groups[] = JHTML::_('select.option', $group->id, $group->name);
}
$lists['group'] = JHTML::_('select.genericlist', $groups, 'groups', '', 'value', 'text', $extraField->group);
$typeOptions[] = JHTML::_('select.option', 0, JText::_('K2_SELECT_TYPE'));
$typeOptions[] = JHTML::_('select.option', 'textfield', JText::_('K2_TEXT_FIELD'));
$typeOptions[] = JHTML::_('select.option', 'textarea', JText::_('K2_TEXTAREA'));
$typeOptions[] = JHTML::_('select.option', 'select', JText::_('K2_DROPDOWN_SELECTION'));
$typeOptions[] = JHTML::_('select.option', 'multipleSelect', JText::_('K2_MULTISELECT_LIST'));
$typeOptions[] = JHTML::_('select.option', 'radio', JText::_('K2_RADIO_BUTTONS'));
$typeOptions[] = JHTML::_('select.option', 'link', JText::_('K2_LINK'));
$typeOptions[] = JHTML::_('select.option', 'csv', JText::_('K2_CSV_DATA'));
$typeOptions[] = JHTML::_('select.option', 'labels', JText::_('K2_SEARCHABLE_LABELS'));
$typeOptions[] = JHTML::_('select.option', 'date', JText::_('K2_DATE'));
$lists['type'] = JHTML::_('select.genericlist', $typeOptions, 'type', '', 'value', 'text', $extraField->type);
$this->assignRef('lists', $lists);
JRequest::getInt('cid') ? $title = JText::_('K2_EDIT_EXTRA_FIELD') : ($title = JText::_('K2_ADD_EXTRA_FIELD'));
JToolBarHelper::title($title, 'k2.png');
JToolBarHelper::save();
JToolBarHelper::apply();
JToolBarHelper::cancel();
JHTML::_('behavior.calendar');
$document = JFactory::getDocument();
$document->addScriptDeclaration('
var K2Language = [
"' . JText::_('K2_REMOVE', true) . '",
"' . JText::_('K2_OPTIONAL', true) . '",
"' . JText::_('K2_COMMA_SEPARATED_VALUES', true) . '",
"' . JText::_('K2_USE_EDITOR', true) . '",
"' . JText::_('K2_ALL_SETTINGS_ABOVE_ARE_OPTIONAL', true) . '",
"' . JText::_('K2_ADD_AN_OPTION', true) . '",
"' . JText::_('K2_LINK_TEXT', true) . '",
"' . JText::_('K2_URL', true) . '",
"' . JText::_('K2_OPEN_IN', true) . '",
"' . JText::_('K2_SAME_WINDOW', true) . '",
"' . JText::_('K2_NEW_WINDOW', true) . '",
"' . JText::_('K2_CLASSIC_JAVASCRIPT_POPUP', true) . '",
"' . JText::_('K2_LIGHTBOX_POPUP', true) . '",
"' . JText::_('K2_RESET_VALUE', true) . '",
"' . JText::_('K2_CALENDAR', true) . '",
"' . JText::_('K2_PLEASE_SELECT_A_FIELD_TYPE_FROM_THE_LIST_ABOVE', true) . '",
];');
parent::display($tpl);
}
示例6: display
function display($tpl = null)
{
$mainframe = JFactory::getApplication();
$user = JFactory::getUser();
$option = JRequest::getCmd('option');
$view = JRequest::getCmd('view');
$limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
$limitstart = $mainframe->getUserStateFromRequest($option . $view . '.limitstart', 'limitstart', 0, 'int');
$filter_order = $mainframe->getUserStateFromRequest($option . $view . 'filter_order', 'filter_order', 'id', 'cmd');
$filter_order_Dir = $mainframe->getUserStateFromRequest($option . $view . 'filter_order_Dir', 'filter_order_Dir', 'DESC', 'word');
$filter_state = $mainframe->getUserStateFromRequest($option . $view . 'filter_state', 'filter_state', -1, 'int');
$search = $mainframe->getUserStateFromRequest($option . $view . 'search', 'search', '', 'string');
$search = JString::strtolower($search);
$model = $this->getModel();
$total = $model->getTotal();
$task = JRequest::getCmd('task');
if ($limitstart > $total - $limit) {
$limitstart = max(0, (int) (ceil($total / $limit) - 1) * $limit);
JRequest::setVar('limitstart', $limitstart);
}
$tags = $model->getData();
foreach ($tags as $key => $tag) {
$tag->numOfItems = $model->countTagItems($tag->id);
$tag->status = K2_JVERSION == '15' ? JHTML::_('grid.published', $tag, $key) : JHtml::_('jgrid.published', $tag->published, $key, '', $task != 'element');
}
$this->assignRef('rows', $tags);
jimport('joomla.html.pagination');
$pageNav = new JPagination($total, $limitstart, $limit);
$this->assignRef('page', $pageNav);
$lists = array();
$lists['search'] = $search;
$lists['order_Dir'] = $filter_order_Dir;
$lists['order'] = $filter_order;
$filter_state_options[] = JHTML::_('select.option', -1, JText::_('K2_SELECT_STATE'));
$filter_state_options[] = JHTML::_('select.option', 1, JText::_('K2_PUBLISHED'));
$filter_state_options[] = JHTML::_('select.option', 0, JText::_('K2_UNPUBLISHED'));
$lists['state'] = JHTML::_('select.genericlist', $filter_state_options, 'filter_state', '', 'value', 'text', $filter_state);
$this->assignRef('lists', $lists);
JToolBarHelper::title(JText::_('K2_TAGS'), 'k2.png');
JToolBarHelper::publishList();
JToolBarHelper::unpublishList();
JToolBarHelper::deleteList('', 'remove', 'K2_DELETE');
JToolBarHelper::editList();
JToolBarHelper::addNew();
if (K2_JVERSION != '15') {
JToolBarHelper::preferences('com_k2', 550, 875, 'K2_PARAMETERS');
} else {
$toolbar = JToolBar::getInstance('toolbar');
$toolbar->appendButton('Popup', 'config', 'Parameters', 'index.php?option=com_k2&view=settings');
}
$this->loadHelper('html');
K2HelperHTML::subMenu();
parent::display($tpl);
}
示例7: display
function display($tpl = null)
{
JRequest::setVar('hidemainmenu', 1);
$model = $this->getModel();
$extraFieldsGroup = $model->getExtraFieldsGroup();
JFilterOutput::objectHTMLSafe($extraFieldsGroup);
$this->assignRef('row', $extraFieldsGroup);
JRequest::getInt('cid') ? $title = JText::_('K2_EDIT_EXTRA_FIELD_GROUP') : ($title = JText::_('K2_ADD_EXTRA_FIELD_GROUP'));
JToolBarHelper::title($title, 'k2.png');
JToolBarHelper::save();
JToolBarHelper::apply();
JToolBarHelper::cancel();
parent::display($tpl);
}
示例8: display
public function display($tpl = null)
{
// Get application
$application = JFactory::getApplication();
// Get input
$task = $application->input->get('task', '', 'cmd');
$this->offset = $application->input->get('limitstart', 0, 'int');
$this->limit = $application->input->get('limit', 10, 'int');
// Trigger the corresponding method
if (method_exists($this, $task)) {
call_user_func(array($this, $task));
} else {
throw new Exception(JText::_('K2_NOT_FOUND'), 404);
}
// Generate the view params depedning on the task prefix. This let's us have one common layout file for listing items
$this->generateItemlistParams($task);
// Load the comments counters in a single query for all items
if ($this->params->get('comments')) {
K2Items::countComments($this->items);
}
// Plugins
foreach ($this->items as $item) {
$item->events = $item->getEvents('com_k2.itemlist.' . $task, $this->params, $this->offset);
}
// Add feed link
$this->feedLink = JRoute::_('&format=feed&limitstart=');
// Add feed links to head
if ($this->feedLinkToHead) {
$attributes = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0');
$this->document->addHeadLink(JRoute::_('&format=feed&limitstart=&type=rss'), 'alternate', 'rel', $attributes);
$attributes = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0');
$this->document->addHeadLink(JRoute::_('&format=feed&limitstart=&type=atom'), 'alternate', 'rel', $attributes);
}
// Pagination
jimport('joomla.html.pagination');
$this->pagination = new JPagination($this->total, $this->offset, $this->limit);
// Display
try {
parent::display($tpl);
} catch (Exception $e) {
if ($this->_template === false) {
$this->setLayout('itemlist');
}
parent::display($tpl);
}
}
示例9: display
function display($tpl = null)
{
JHTML::_('behavior.tooltip');
JRequest::setVar('hidemainmenu', 1);
$model = $this->getModel();
$userGroup = $model->getData();
if (K2_JVERSION == '15') {
JFilterOutput::objectHTMLSafe($userGroup);
} else {
JFilterOutput::objectHTMLSafe($userGroup, ENT_QUOTES, 'permissions');
}
$this->assignRef('row', $userGroup);
if (K2_JVERSION == '15') {
$form = new JParameter('', JPATH_COMPONENT . DS . 'models' . DS . 'usergroup.xml');
$form->loadINI($userGroup->permissions);
$appliedCategories = $form->get('categories');
$inheritance = $form->get('inheritance');
} else {
jimport('joomla.form.form');
$form = JForm::getInstance('permissions', JPATH_COMPONENT_ADMINISTRATOR . DS . 'models' . DS . 'usergroup.xml');
$values = array('params' => json_decode($userGroup->permissions));
$form->bind($values);
$inheritance = isset($values['params']->inheritance) ? $values['params']->inheritance : 0;
$appliedCategories = isset($values['params']->categories) ? $values['params']->categories : '';
}
$this->assignRef('form', $form);
$this->assignRef('categories', $appliedCategories);
$lists = array();
require_once JPATH_ADMINISTRATOR . '/components/com_k2/models/categories.php';
$categoriesModel = K2Model::getInstance('Categories', 'K2Model');
$categories = $categoriesModel->categoriesTree(NULL, true);
$categories_options = @array_merge($categories_option, $categories);
$lists['categories'] = JHTML::_('select.genericlist', $categories, 'params[categories][]', 'multiple="multiple" size="15"', 'value', 'text', $appliedCategories);
$lists['inheritance'] = JHTML::_('select.booleanlist', 'params[inheritance]', NULL, $inheritance);
$this->assignRef('lists', $lists);
JRequest::getInt('cid') ? $title = JText::_('K2_EDIT_USER_GROUP') : ($title = JText::_('K2_ADD_USER_GROUP'));
JToolBarHelper::title($title, 'k2.png');
JToolBarHelper::save();
JToolBarHelper::apply();
JToolBarHelper::cancel();
parent::display($tpl);
}
示例10: display
function display($tpl = null)
{
$mainframe = JFactory::getApplication();
$params = K2HelperUtilities::getParams('com_k2');
$model = $this->getModel('itemlist');
$limitstart = JRequest::getInt('limitstart');
$view = JRequest::getWord('view');
$task = JRequest::getWord('task');
//Add link
if (K2HelperPermissions::canAddItem()) {
$addLink = JRoute::_('index.php?option=com_k2&view=item&task=add&tmpl=component');
}
$this->assignRef('addLink', $addLink);
//Get data depending on task
switch ($task) {
case 'category':
//Get category
$id = JRequest::getInt('id');
JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . DS . 'tables');
$category = JTable::getInstance('K2Category', 'Table');
$category->load($id);
// State Check
if (!$category->published || $category->trash) {
JError::raiseError(404, JText::_('K2_CATEGORY_NOT_FOUND'));
}
//Access check
$user = JFactory::getUser();
if (K2_JVERSION != '15') {
if (!in_array($category->access, $user->getAuthorisedViewLevels())) {
if ($user->guest) {
$uri = JFactory::getURI();
$url = 'index.php?option=com_user&view=login&return=' . base64_encode($uri->toString());
$mainframe->redirect(JRoute::_($url, false), JText::_('K2_YOU_NEED_TO_LOGIN_FIRST'));
} else {
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
return;
}
}
$languageFilter = $mainframe->getLanguageFilter();
$languageTag = JFactory::getLanguage()->getTag();
if ($languageFilter && $category->language != $languageTag && $category->language != '*') {
return;
}
} else {
if ($category->access > $user->get('aid', 0)) {
if ($user->guest) {
$uri = JFactory::getURI();
$url = 'index.php?option=com_user&view=login&return=' . base64_encode($uri->toString());
$mainframe->redirect(JRoute::_($url, false), JText::_('K2_YOU_NEED_TO_LOGIN_FIRST'));
} else {
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
return;
}
}
}
// Hide the add new item link if user cannot post in the specific category
if (!K2HelperPermissions::canAddItem($id)) {
unset($this->addLink);
}
//Merge params
$cparams = class_exists('JParameter') ? new JParameter($category->params) : new JRegistry($category->params);
if ($cparams->get('inheritFrom')) {
$masterCategory = JTable::getInstance('K2Category', 'Table');
$masterCategory->load($cparams->get('inheritFrom'));
$cparams = class_exists('JParameter') ? new JParameter($masterCategory->params) : new JRegistry($masterCategory->params);
}
$params->merge($cparams);
//Category link
$category->link = urldecode(JRoute::_(K2HelperRoute::getCategoryRoute($category->id . ':' . urlencode($category->alias))));
//Category image
$category->image = K2HelperUtilities::getCategoryImage($category->image, $params);
//Category plugins
$dispatcher = JDispatcher::getInstance();
JPluginHelper::importPlugin('content');
$category->text = $category->description;
if (K2_JVERSION != '15') {
$dispatcher->trigger('onContentPrepare', array('com_k2.category', &$category, &$params, $limitstart));
} else {
$dispatcher->trigger('onPrepareContent', array(&$category, &$params, $limitstart));
}
$category->description = $category->text;
//Category K2 plugins
$category->event->K2CategoryDisplay = '';
JPluginHelper::importPlugin('k2');
$results = $dispatcher->trigger('onK2CategoryDisplay', array(&$category, &$params, $limitstart));
$category->event->K2CategoryDisplay = trim(implode("\n", $results));
$category->text = $category->description;
$dispatcher->trigger('onK2PrepareContent', array(&$category, &$params, $limitstart));
$category->description = $category->text;
$this->assignRef('category', $category);
$this->assignRef('user', $user);
//Category children
$ordering = $params->get('subCatOrdering');
$children = $model->getCategoryFirstChildren($id, $ordering);
if (count($children)) {
foreach ($children as $child) {
if ($params->get('subCatTitleItemCounter')) {
$child->numOfItems = $model->countCategoryItems($child->id);
}
$child->image = K2HelperUtilities::getCategoryImage($child->image, $params);
//.........这里部分代码省略.........
示例11: display
function display($tpl = null)
{
$mainframe = JFactory::getApplication();
$params = K2HelperUtilities::getParams('com_k2');
$document = JFactory::getDocument();
$user = JFactory::getUser();
$cache = JFactory::getCache('com_k2_extended');
$limit = $params->get('latestItemsLimit');
$limitstart = JRequest::getInt('limitstart');
$model = $this->getModel('itemlist');
$itemModel = $this->getModel('item');
$theme = $params->get('theme');
if ($params->get('source')) {
$categoryIDs = $params->get('categoryIDs');
if (is_string($categoryIDs) && !empty($categoryIDs)) {
$categoryIDs = array();
$categoryIDs[] = $params->get('categoryIDs');
}
$categories = array();
JTable::addIncludePath(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_k2' . DS . 'tables');
if (is_array($categoryIDs)) {
foreach ($categoryIDs as $categoryID) {
$category = JTable::getInstance('K2Category', 'Table');
$category->load($categoryID);
$category->event = new stdClass();
$languageCheck = true;
if (K2_JVERSION != '15') {
$accessCheck = in_array($category->access, $user->getAuthorisedViewLevels());
if ($mainframe->getLanguageFilter()) {
$languageTag = JFactory::getLanguage()->getTag();
$languageCheck = in_array($category->language, array($languageTag, '*'));
}
} else {
$accessCheck = $category->access <= $user->get('aid', 0);
}
if ($category->published && $accessCheck && $languageCheck) {
//Merge params
$cparams = class_exists('JParameter') ? new JParameter($category->params) : new JRegistry($category->params);
if ($cparams->get('inheritFrom')) {
$masterCategory = JTable::getInstance('K2Category', 'Table');
$masterCategory->load($cparams->get('inheritFrom'));
$cparams = class_exists('JParameter') ? new JParameter($masterCategory->params) : new JRegistry($masterCategory->params);
}
$params->merge($cparams);
//Category image
$category->image = K2HelperUtilities::getCategoryImage($category->image, $params);
//Category plugins
$dispatcher = JDispatcher::getInstance();
JPluginHelper::importPlugin('content');
$category->text = $category->description;
if (K2_JVERSION != '15') {
$dispatcher->trigger('onContentPrepare', array('com_k2.category', &$category, &$params, $limitstart));
} else {
$dispatcher->trigger('onPrepareContent', array(&$category, &$params, $limitstart));
}
$category->description = $category->text;
//Category K2 plugins
$category->event->K2CategoryDisplay = '';
JPluginHelper::importPlugin('k2');
$results = $dispatcher->trigger('onK2CategoryDisplay', array(&$category, &$params, $limitstart));
$category->event->K2CategoryDisplay = trim(implode("\n", $results));
$category->text = $category->description;
$dispatcher->trigger('onK2PrepareContent', array(&$category, &$params, $limitstart));
$category->description = $category->text;
//Category link
$link = urldecode(K2HelperRoute::getCategoryRoute($category->id . ':' . urlencode($category->alias)));
$category->link = JRoute::_($link);
$category->feed = JRoute::_($link . '&format=feed');
JRequest::setVar('view', 'itemlist');
JRequest::setVar('task', 'category');
JRequest::setVar('id', $category->id);
JRequest::setVar('featured', 1);
JRequest::setVar('limit', $limit);
JRequest::setVar('clearFlag', true);
$category->name = htmlspecialchars($category->name, ENT_QUOTES);
if ($limit) {
$category->items = $model->getData('rdate');
JRequest::setVar('view', 'latest');
JRequest::setVar('task', '');
for ($i = 0; $i < sizeof($category->items); $i++) {
$hits = $category->items[$i]->hits;
$category->items[$i]->hits = 0;
$category->items[$i] = $cache->call(array($itemModel, 'prepareItem'), $category->items[$i], 'latest', '');
$category->items[$i]->hits = $hits;
$category->items[$i] = $itemModel->execPlugins($category->items[$i], 'latest', '');
//Trigger comments counter event
$dispatcher = JDispatcher::getInstance();
JPluginHelper::importPlugin('k2');
$results = $dispatcher->trigger('onK2CommentsCounter', array(&$category->items[$i], &$params, $limitstart));
$category->items[$i]->event->K2CommentsCounter = trim(implode("\n", $results));
}
} else {
$category->items = array();
}
$categories[] = $category;
}
}
}
$source = 'categories';
$this->assignRef('blocks', $categories);
//.........这里部分代码省略.........
示例12: display
function display($tpl = null)
{
$mainframe = JFactory::getApplication();
$user = JFactory::getUser();
$document = JFactory::getDocument();
$params = K2HelperUtilities::getParams('com_k2');
$limitstart = JRequest::getInt('limitstart', 0);
$view = JRequest::getWord('view');
$task = JRequest::getWord('task');
$db = JFactory::getDBO();
$jnow = JFactory::getDate();
$now = K2_JVERSION == '15' ? $jnow->toMySQL() : $jnow->toSql();
$nullDate = $db->getNullDate();
$this->setLayout('item');
// Add link
if (K2HelperPermissions::canAddItem()) {
$addLink = JRoute::_('index.php?option=com_k2&view=item&task=add&tmpl=component');
}
$this->assignRef('addLink', $addLink);
// Get item
$model = $this->getModel();
$item = $model->getData();
$item->event = new stdClass();
// Does the item exists?
if (!is_object($item) || !$item->id) {
JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND'));
}
// Prepare item
$item = $model->prepareItem($item, $view, $task);
// Plugins
$item = $model->execPlugins($item, $view, $task);
// User K2 plugins
$item->event->K2UserDisplay = '';
if (isset($item->author) && is_object($item->author->profile) && isset($item->author->profile->id)) {
$dispatcher = JDispatcher::getInstance();
JPluginHelper::importPlugin('k2');
$results = $dispatcher->trigger('onK2UserDisplay', array(&$item->author->profile, &$params, $limitstart));
$item->event->K2UserDisplay = trim(implode("\n", $results));
$item->author->profile->url = htmlspecialchars($item->author->profile->url, ENT_QUOTES, 'UTF-8');
}
// Access check
if ($this->getLayout() == 'form') {
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
}
if (K2_JVERSION != '15') {
if (!in_array($item->access, $user->getAuthorisedViewLevels()) || !in_array($item->category->access, $user->getAuthorisedViewLevels())) {
if ($user->guest) {
$uri = JFactory::getURI();
$url = 'index.php?option=com_users&view=login&return=' . base64_encode($uri->toString());
$mainframe->enqueueMessage(JText::_('K2_YOU_NEED_TO_LOGIN_FIRST'), 'notice');
$mainframe->redirect(JRoute::_($url, false));
} else {
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
return;
}
}
} else {
if ($item->access > $user->get('aid', 0) || $item->category->access > $user->get('aid', 0)) {
if ($user->guest) {
$uri = JFactory::getURI();
$url = 'index.php?option=com_user&view=login&return=' . base64_encode($uri->toString());
$mainframe->enqueueMessage(JText::_('K2_YOU_NEED_TO_LOGIN_FIRST'), 'notice');
$mainframe->redirect(JRoute::_($url, false));
} else {
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
return;
}
}
}
// Published check
if (!$item->published || $item->trash) {
JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND'));
}
if ($item->publish_up != $nullDate && $item->publish_up > $now) {
JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND'));
}
if ($item->publish_down != $nullDate && $item->publish_down < $now) {
JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND'));
}
if (!$item->category->published || $item->category->trash) {
JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND'));
}
// Increase hits counter
$model->hit($item->id);
// Set default image
K2HelperUtilities::setDefaultImage($item, $view);
// Comments
$item->event->K2CommentsCounter = '';
$item->event->K2CommentsBlock = '';
if ($item->params->get('itemComments')) {
// Trigger comments events
$dispatcher = JDispatcher::getInstance();
JPluginHelper::importPlugin('k2');
$results = $dispatcher->trigger('onK2CommentsCounter', array(&$item, &$params, $limitstart));
$item->event->K2CommentsCounter = trim(implode("\n", $results));
$results = $dispatcher->trigger('onK2CommentsBlock', array(&$item, &$params, $limitstart));
$item->event->K2CommentsBlock = trim(implode("\n", $results));
// Load K2 native comments system only if there are no plugins overriding it
if (empty($item->event->K2CommentsCounter) && empty($item->event->K2CommentsBlock)) {
$limit = $params->get('commentsLimit');
//.........这里部分代码省略.........
示例13: move
function move()
{
$mainframe = JFactory::getApplication();
JTable::addIncludePath(JPATH_COMPONENT . DS . 'tables');
$cid = JRequest::getVar('cid');
foreach ($cid as $id) {
$row =& JTable::getInstance('K2Category', 'Table');
$row->load($id);
$rows[] = $row;
}
$categoriesModel = K2Model::getInstance('Categories', 'K2Model');
$categories_option[] = JHTML::_('select.option', 0, JText::_('K2_NONE_ONSELECTLISTS'));
$categories = $categoriesModel->categoriesTree(NULL, true, false);
$categories_options = @array_merge($categories_option, $categories);
foreach ($categories_options as $option) {
if (in_array($option->value, $cid)) {
$option->disable = true;
}
}
$lists['categories'] = JHTML::_('select.genericlist', $categories_options, 'category', 'class="inputbox" size="8"', 'value', 'text');
$this->assignRef('rows', $rows);
$this->assignRef('lists', $lists);
JToolBarHelper::title(JText::_('K2_MOVE_CATEGORIES'), 'k2.png');
JToolBarHelper::custom('saveMove', 'save.png', 'save_f2.png', 'K2_SAVE', false);
JToolBarHelper::cancel();
parent::display();
}
示例14: move
function move()
{
$mainframe = JFactory::getApplication();
JTable::addIncludePath(JPATH_COMPONENT . DS . 'tables');
$cid = JRequest::getVar('cid');
JArrayHelper::toInteger($cid);
foreach ($cid as $id) {
$row = JFactory::getUser($id);
$rows[] = $row;
}
$this->assignRef('rows', $rows);
$model = $this->getModel('users');
$lists = array();
$userGroups = $model->getUserGroups();
$groups[] = JHTML::_('select.option', '', JText::_('K2_DO_NOT_CHANGE'));
foreach ($userGroups as $userGroup) {
$groups[] = JHTML::_('select.option', $userGroup->value, JText::_($userGroup->text));
}
$fieldName = 'group';
$attributes = 'size="10"';
if (K2_JVERSION != '15') {
$attributes .= 'multiple="multiple"';
$fieldName .= '[]';
}
$lists['group'] = JHTML::_('select.genericlist', $groups, $fieldName, $attributes, 'value', 'text', '');
$K2userGroups = $model->getUserGroups('k2');
$K2groups[] = JHTML::_('select.option', '0', JText::_('K2_DO_NOT_CHANGE'));
foreach ($K2userGroups as $K2userGroup) {
$K2groups[] = JHTML::_('select.option', $K2userGroup->id, $K2userGroup->name);
}
$lists['k2group'] = JHTML::_('select.genericlist', $K2groups, 'k2group', 'size="10"', 'value', 'text', 0);
$this->assignRef('lists', $lists);
JToolBarHelper::title(JText::_('K2_MOVE_USERS'), 'k2.png');
JToolBarHelper::custom('saveMove', 'save.png', 'save_f2.png', 'K2_SAVE', false);
JToolBarHelper::cancel();
parent::display();
}
示例15: display
function display($tpl = null)
{
$mainframe = JFactory::getApplication();
$user = JFactory::getUser();
$document = JFactory::getDocument();
$params = K2HelperUtilities::getParams('com_k2');
$limitstart = JRequest::getInt('limitstart', 0);
$view = JRequest::getWord('view');
$task = JRequest::getWord('task');
$db = JFactory::getDBO();
$jnow = JFactory::getDate();
$now = K2_JVERSION == '15' ? $jnow->toMySQL() : $jnow->toSql();
$nullDate = $db->getNullDate();
$this->setLayout('item');
// Add link
if (K2HelperPermissions::canAddItem()) {
$addLink = JRoute::_('index.php?option=com_k2&view=item&task=add&tmpl=component');
}
$this->assignRef('addLink', $addLink);
// Get item
$model = $this->getModel();
$item = $model->getData();
// Does the item exists?
if (!is_object($item) || !$item->id) {
JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND'));
}
// Prepare item
$item = $model->prepareItem($item, $view, $task);
// Plugins
$item = $model->execPlugins($item, $view, $task);
// User K2 plugins
$item->event->K2UserDisplay = '';
if (isset($item->author) && is_object($item->author->profile) && isset($item->author->profile->id)) {
$dispatcher = JDispatcher::getInstance();
JPluginHelper::importPlugin('k2');
$results = $dispatcher->trigger('onK2UserDisplay', array(&$item->author->profile, &$params, $limitstart));
$item->event->K2UserDisplay = trim(implode("\n", $results));
$item->author->profile->url = htmlspecialchars($item->author->profile->url, ENT_QUOTES, 'UTF-8');
}
// Access check
if ($this->getLayout() == 'form') {
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
}
if (K2_JVERSION != '15') {
if (!in_array($item->access, $user->getAuthorisedViewLevels()) || !in_array($item->category->access, $user->getAuthorisedViewLevels())) {
if ($user->guest) {
$uri = JFactory::getURI();
$url = 'index.php?option=com_users&view=login&return=' . base64_encode($uri->toString());
$mainframe->enqueueMessage(JText::_('K2_YOU_NEED_TO_LOGIN_FIRST'), 'notice');
$mainframe->redirect(JRoute::_($url, false));
} else {
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
return;
}
}
} else {
if ($item->access > $user->get('aid', 0) || $item->category->access > $user->get('aid', 0)) {
if ($user->guest) {
$uri = JFactory::getURI();
$url = 'index.php?option=com_user&view=login&return=' . base64_encode($uri->toString());
$mainframe->enqueueMessage(JText::_('K2_YOU_NEED_TO_LOGIN_FIRST'), 'notice');
$mainframe->redirect(JRoute::_($url, false));
} else {
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
return;
}
}
}
// Published check
if (!$item->published || $item->trash) {
JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND'));
}
if ($item->publish_up != $nullDate && $item->publish_up > $now) {
JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND'));
}
if ($item->publish_down != $nullDate && $item->publish_down < $now) {
JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND'));
}
if (!$item->category->published || $item->category->trash) {
JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND'));
}
// Increase hits counter
$model->hit($item->id);
// Set default image
K2HelperUtilities::setDefaultImage($item, $view);
// Pass the old parameter to the view in order to avoid layout changes
if ($params->get('antispam') == 'recaptcha' || $params->get('antispam') == 'both') {
$params->set('recaptcha', true);
$item->params->set('recaptcha', true);
} else {
$params->set('recaptcha', false);
$item->params->set('recaptcha', false);
}
// Comments
$item->event->K2CommentsCounter = '';
$item->event->K2CommentsBlock = '';
if ($item->params->get('itemComments')) {
// Trigger comments events
$dispatcher = JDispatcher::getInstance();
JPluginHelper::importPlugin('k2');
//.........这里部分代码省略.........