本文整理汇总了PHP中K2View类的典型用法代码示例。如果您正苦于以下问题:PHP K2View类的具体用法?PHP K2View怎么用?PHP K2View使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了K2View类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: 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);
}
开发者ID:GitIPFire,项目名称:Homeworks,代码行数:33,代码来源:view.html.php
示例2: 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);
}
开发者ID:Naldo100,项目名称:k2-v3-dev-build,代码行数:30,代码来源:view.raw.php
示例3: 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);
}
开发者ID:educakanchay,项目名称:educa,代码行数:33,代码来源:view.html.php
示例4: 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);
}
开发者ID:grchis,项目名称:Site-Auto,代码行数:35,代码来源:view.html.php
示例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);
}
开发者ID:GitIPFire,项目名称:Homeworks,代码行数:58,代码来源:view.html.php
示例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);
}
开发者ID:Gskflute,项目名称:joomla25,代码行数:54,代码来源:view.html.php
示例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);
}
开发者ID:Roma48,项目名称:abazherka_old,代码行数:14,代码来源:view.html.php
示例8: edit
/**
* Builds the response variables needed for rendering a form.
* Usually there will be no need to override this function.
*
* @param integer $id The id of the resource to load.
*
* @return void
*/
public function edit($id = null)
{
// Set title
$this->setTitle($id ? 'K2_EDIT_EXTRA_FIELD' : 'K2_ADD_EXTRA_FIELD');
// Set row
$this->setRow($id);
// Set form
$this->setForm();
// Set menu
$this->setMenu('edit');
// Set Actions
$this->setFormActions();
// Render
parent::render();
}
开发者ID:sofian86,项目名称:k2-v3-dev-build,代码行数:23,代码来源:view.json.php
示例9: edit
/**
* Builds the response variables needed for rendering a form.
* Usually there will be no need to override this function.
*
* @param integer $id The id of the resource to load.
*
* @return void
*/
public function edit($id = null)
{
// Set title
$this->setTitle('K2_EDIT_USER');
// Set row
$this->setRow($id);
// Set form
$this->setForm();
// Set menu
$this->setMenu('edit');
// Set Actions
$this->setFormActions();
// Render
parent::render();
}
开发者ID:Naldo100,项目名称:k2-v3-dev-build,代码行数:23,代码来源:view.json.php
示例10: 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);
}
}
开发者ID:Naldo100,项目名称:k2-v3-dev-build,代码行数:46,代码来源:view.html.php
示例11: 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);
}
开发者ID:emavro,项目名称:k2,代码行数:42,代码来源:view.html.php
示例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();
// 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');
//.........这里部分代码省略.........
开发者ID:emavro,项目名称:k2,代码行数:101,代码来源:view.html.php
示例13: 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');
$db = JFactory::getDBO();
// 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);
$category->event = new stdClass();
// 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_users&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);
// Get the meta information before merging params since we do not want them to be inherited
$category->metaDescription = $cparams->get('catMetaDesc');
$category->metaKeywords = $cparams->get('catMetaKey');
$category->metaRobots = $cparams->get('catMetaRobots');
$category->metaAuthor = $cparams->get('catMetaAuthor');
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');
//.........这里部分代码省略.........
开发者ID:GitIPFire,项目名称:Homeworks,代码行数:101,代码来源:view.html.php
示例14: 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');
//.........这里部分代码省略.........
开发者ID:emavro,项目名称:k2,代码行数:101,代码来源:view.raw.php
示例15: 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();
}
开发者ID:emavro,项目名称:k2,代码行数:37,代码来源:view.html.php
示例16: move
function move()
{
$mainframe = JFactory::getApplication();
JTable::addIncludePath(JPATH_COMPONENT . DS . 'tables');
$cid = JRequest::getVar('cid');
foreach ($cid as $id) {
$row = JTable::getInstance('K2Item', 'Table');
$row->load($id);
$rows[] = $row;
}
$categoriesModel = K2Model::getInstance('Categories', 'K2Model');
$categories = $categoriesModel->categoriesTree(null, true, false);
$lists['categories'] = JHTML::_('select.genericlist', $categories, 'category', 'class="inputbox" size="8"', 'value', 'text');
$this->assignRef('rows', $rows);
$this->assignRef('lists', $lists);
JToolBarHelper::title(JText::_('K2_MOVE_ITEMS'), 'k2.png');
JToolBarHelper::custom('saveMove', 'save.png', 'save_f2.png', 'K2_SAVE', false);
JToolBarHelper::cancel();
parent::display();
}
开发者ID:Roma48,项目名称:abazherka_old,代码行数:20,代码来源:view.html.php
示例17: display
function display($tpl = null)
{
$mainframe = JFactory::getApplication();
$db = JFactory::getDBO();
$view = JRequest::getCmd('view');
jimport('joomla.filesystem.file');
jimport('joomla.html.pane');
JHTML::_('behavior.keepalive');
JHTML::_('behavior.modal');
JRequest::setVar('hidemainmenu', 1);
$document = JFactory::getDocument();
$document->addScript(JURI::root(true) . '/media/k2/assets/js/nicEdit.js?v=2.6.8');
//var K2SitePath = '".JURI::root(true)."/';
$js = "\n\t\t\t\t\tvar K2BasePath = '" . JURI::base(true) . "/';\n\t\t\t\t\tvar K2Language = [\n\t\t\t\t\t\t'" . JText::_('K2_REMOVE', true) . "',\n\t\t\t\t\t\t'" . JText::_('K2_LINK_TITLE_OPTIONAL', true) . "',\n\t\t\t\t\t\t'" . JText::_('K2_LINK_TITLE_ATTRIBUTE_OPTIONAL', true) . "',\n\t\t\t\t\t\t'" . JText::_('K2_ARE_YOU_SURE', true) . "',\n\t\t\t\t\t\t'" . JText::_('K2_YOU_ARE_NOT_ALLOWED_TO_POST_TO_THIS_CATEGORY', true) . "',\n\t\t\t\t\t\t'" . JText::_('K2_OR_SELECT_A_FILE_ON_THE_SERVER', true) . "'\n\t\t\t\t\t]\n\t\t\t\t";
$document->addScriptDeclaration($js);
K2Model::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . DS . 'models');
$model = K2Model::getInstance('Item', 'K2Model', array('table_path' => JPATH_COMPONENT_ADMINISTRATOR . DS . 'tables'));
$item = $model->getData();
JFilterOutput::objectHTMLSafe($item, ENT_QUOTES, array('video', 'params', 'plugins'));
$user = JFactory::getUser();
// Permissions check on frontend
if ($mainframe->isSite()) {
JLoader::register('K2HelperPermissions', JPATH_COMPONENT . DS . 'helpers' . DS . 'permissions.php');
$task = JRequest::getCmd('task');
if ($task == 'edit' && !K2HelperPermissions::canEditItem($item->created_by, $item->catid)) {
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
}
if ($task == 'add' && !K2HelperPermissions::canAddItem()) {
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
}
// Get permissions
$K2Permissions = K2Permissions::getInstance();
$this->assignRef('permissions', $K2Permissions->permissions);
// Build permissions message
$permissionsLabels = array();
if ($this->permissions->get('add')) {
$permissionsLabels[] = JText::_('K2_ADD_ITEMS');
}
if ($this->permissions->get('editOwn')) {
$permissionsLabels[] = JText::_('K2_EDIT_OWN_ITEMS');
}
if ($this->permissions->get('editAll')) {
$permissionsLabels[] = JText::_('K2_EDIT_ANY_ITEM');
}
if ($this->permissions->get('publish')) {
$permissionsLabels[] = JText::_('K2_PUBLISH_ITEMS');
}
if ($this->permissions->get('editPublished')) {
$permissionsLabels[] = JText::_('K2_ALLOW_EDITING_OF_ALREADY_PUBLISHED_ITEMS');
}
$permissionsMessage = JText::_('K2_YOU_ARE_ALLOWED_TO') . ' ' . implode(', ', $permissionsLabels);
$this->assignRef('permissionsMessage', $permissionsMessage);
}
if ($item->isCheckedOut($user->get('id'), $item->checked_out)) {
$message = JText::_('K2_THE_ITEM') . ': ' . $item->title . ' ' . JText::_('K2_IS_CURRENTLY_BEING_EDITED_BY_ANOTHER_ADMINISTRATOR');
$url = $mainframe->isSite() ? 'index.php?option=com_k2&view=item&id=' . $item->id . '&tmpl=component' : 'index.php?option=com_k2';
$mainframe->enqueueMessage($message);
$mainframe->redirect($url);
}
if ($item->id) {
$item->checkout($user->get('id'));
} else {
$item->published = 1;
$item->publish_down = $db->getNullDate();
$item->modified = $db->getNullDate();
$date = JFactory::getDate();
$now = K2_JVERSION == '15' ? $date->toMySQL() : $date->toSql();
$item->created = $now;
$item-&
|
请发表评论