本文整理汇总了PHP中ContentHelper类的典型用法代码示例。如果您正苦于以下问题:PHP ContentHelper类的具体用法?PHP ContentHelper怎么用?PHP ContentHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ContentHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _setToolbar
/**
* Display the toolbar
*/
protected function _setToolbar()
{
$state = $this->get('State');
$canDo = ContentHelper::getActions($state->get('filter.category_id'));
JToolBarHelper::title(JText::_('Content_Articles_Title'), 'article.png');
if ($canDo->get('core.create')) {
JToolBarHelper::custom('article.add', 'new.png', 'new_f2.png', 'New', false);
}
if ($canDo->get('core.edit')) {
JToolBarHelper::custom('article.edit', 'edit.png', 'edit_f2.png', 'Edit', true);
}
JToolBarHelper::divider();
if ($canDo->get('core.edit.state')) {
JToolBarHelper::custom('articles.publish', 'publish.png', 'publish_f2.png', 'Publish', true);
JToolBarHelper::custom('articles.unpublish', 'unpublish.png', 'unpublish_f2.png', 'Unpublish', true);
if ($state->get('filter.published') != -1) {
JToolBarHelper::divider();
JToolBarHelper::archiveList('articles.archive');
}
}
if ($state->get('filter.published') == -2 && $canDo->get('core.delete')) {
JToolBarHelper::deleteList('', 'articles.delete');
} else {
if ($canDo->get('core.edit.state')) {
JToolBarHelper::trash('articles.trash');
}
}
if ($canDo->get('core.admin')) {
JToolBarHelper::divider();
JToolBarHelper::preferences('com_content');
}
JToolBarHelper::divider();
JToolBarHelper::help('screen.content.articles');
}
示例2: display
/**
* Display the view
*/
public function display($tpl = null)
{
// Include the component HTML helpers.
JSNFactory::import('components.com_content.helpers.content');
JSNFactory::import('components.com_content.helpers.html.contentadministrator');
$JSNMedia = JSNFactory::getMedia();
$JSNMedia->addStyleSheet(JSN_POWERADMIN_STYLE_URI . 'content.css');
JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.content.js');
if ($this->getLayout() == 'pagebreak') {
// TODO: This is really dogy - should change this one day.
$eName = JRequest::getVar('e_name');
$eName = preg_replace('#[^A-Z0-9\\-\\_\\[\\]]#i', '', $eName);
$document = JFactory::getDocument();
$document->setTitle(JText::_('COM_CONTENT_PAGEBREAK_DOC_TITLE'));
$this->assignRef('eName', $eName);
parent::display($tpl);
return;
}
// Initialiase variables.
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->state = $this->get('State');
$this->canDo = ContentHelper::getActions($this->state->get('filter.category_id'));
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode("\n", $errors));
return false;
}
$language = JFactory::getLanguage();
$language->load('com_content');
parent::display($tpl);
}
示例3: addToolbar
/**
* Add the page title and toolbar.
*
* @since 1.6
*/
protected function addToolbar()
{
$state = $this->get('State');
$canDo = ContentHelper::getActions($this->state->get('filter.category_id'));
JToolBarHelper::title(JText::_('COM_CONTENT_FEATURED_TITLE'), 'featured.png');
if ($canDo->get('core.create')) {
JToolBarHelper::custom('article.add', 'new.png', 'new_f2.png', 'JTOOLBAR_NEW', false);
}
if ($canDo->get('core.edit')) {
JToolBarHelper::custom('article.edit', 'edit.png', 'edit_f2.png', 'JTOOLBAR_EDIT', true);
}
if ($canDo->get('core.edit.state')) {
JToolBarHelper::divider();
JToolBarHelper::custom('articles.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true);
JToolBarHelper::custom('articles.unpublish', 'unpublish.png', 'unpublish_f2.png', 'JTOOLBAR_UNPUBLISH', true);
JToolBarHelper::divider();
JToolBarHelper::archiveList('articles.archive', 'JTOOLBAR_ARCHIVE');
JToolBarHelper::custom('articles.checkin', 'checkin.png', 'checkin_f2.png', 'JTOOLBAR_CHECKIN', true);
JToolBarHelper::custom('featured.delete', 'remove.png', 'remove_f2.png', 'JTOOLBAR_REMOVE', true);
}
if ($state->get('filter.published') == -2 && $canDo->get('core.delete')) {
JToolBarHelper::deleteList('', 'articles.delete', 'JTOOLBAR_EMPTY_TRASH');
JToolBarHelper::divider();
} else {
if ($canDo->get('core.edit.state')) {
JToolBarHelper::divider();
JToolBarHelper::trash('articles.trash', 'JTOOLBAR_TRASH');
}
}
if ($canDo->get('core.admin')) {
JToolBarHelper::preferences('com_content');
JToolBarHelper::divider();
}
JToolBarHelper::help('JHELP_CONTENT_FEATURED_ARTICLES');
}
示例4: display
/**
* Display the view
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
*/
public function display($tpl = null)
{
ContentHelper::addSubmenu('featured');
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->authors = $this->get('Authors');
$this->filterForm = $this->get('FilterForm');
$this->activeFilters = $this->get('ActiveFilters');
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode("\n", $errors));
return false;
}
// Levels filter.
$options = array();
$options[] = JHtml::_('select.option', '1', JText::_('J1'));
$options[] = JHtml::_('select.option', '2', JText::_('J2'));
$options[] = JHtml::_('select.option', '3', JText::_('J3'));
$options[] = JHtml::_('select.option', '4', JText::_('J4'));
$options[] = JHtml::_('select.option', '5', JText::_('J5'));
$options[] = JHtml::_('select.option', '6', JText::_('J6'));
$options[] = JHtml::_('select.option', '7', JText::_('J7'));
$options[] = JHtml::_('select.option', '8', JText::_('J8'));
$options[] = JHtml::_('select.option', '9', JText::_('J9'));
$options[] = JHtml::_('select.option', '10', JText::_('J10'));
$this->f_levels = $options;
$this->addToolbar();
$this->sidebar = JHtmlSidebar::render();
parent::display($tpl);
}
示例5: addToolbar
/**
* Add the page title and toolbar.
*
* @since 1.6
*/
protected function addToolbar()
{
$state = $this->get('State');
$canDo = ContentHelper::getActions($this->state->get('filter.category_id'));
Toolbar::title(Lang::txt('COM_CONTENT_FEATURED_TITLE'), 'featured.png');
if ($canDo->get('core.create')) {
Toolbar::addNew('article.add');
}
if ($canDo->get('core.edit')) {
Toolbar::editList('article.edit');
}
if ($canDo->get('core.edit.state')) {
Toolbar::divider();
Toolbar::publish('articles.publish', 'JTOOLBAR_PUBLISH', true);
Toolbar::unpublish('articles.unpublish', 'JTOOLBAR_UNPUBLISH', true);
Toolbar::divider();
Toolbar::archiveList('articles.archive');
Toolbar::checkin('articles.checkin');
Toolbar::custom('featured.delete', 'remove.png', 'remove_f2.png', 'JTOOLBAR_REMOVE', true);
}
if ($state->get('filter.published') == -2 && $canDo->get('core.delete')) {
Toolbar::deleteList('', 'articles.delete', 'JTOOLBAR_EMPTY_TRASH');
Toolbar::divider();
} elseif ($canDo->get('core.edit.state')) {
Toolbar::divider();
Toolbar::trash('articles.trash');
}
if ($canDo->get('core.admin')) {
Toolbar::preferences('com_content');
Toolbar::divider();
}
Toolbar::help('featured');
}
示例6: doBuild
protected function doBuild(PageContext $ctxt, PageBuilderContext $builderCtxt, RequestArrayAdapter $requestParams, ArrayAdapter $buildParams)
{
//1. ЗАГОЛОВОК
$builderCtxt->setTitle($this->basicPage->getTitle());
//2. JAVASCRIPT
$jsParams['postId'] = $ctxt->getPostId();
$jsParams['rubricId'] = $ctxt->getRubricId();
$jsParams['postType'] = $ctxt->getPostType();
$jsParams['isPostsListPage'] = $ctxt->isPostsListPage();
$jsParams['isRubricPage'] = $ctxt->isRubricPage();
$jsParams['isPostPage'] = $ctxt->isPostPage();
//Разборы, пройденные пользователем
$passed = TrainManager::inst()->getUserPassedLessons();
$jsParams['passedLessons'] = empty($passed) ? null : $passed;
//Структура проекта
$jsParams['structure'] = NavigationManager::inst()->getStructure();
$builderCtxt->setJsParams($jsParams);
//Параметры, зависимые от страницы
$builderCtxt->setJsParams($this->basicPage->getJsParams());
//3. SMARTY RESOURCES
$builderCtxt->setSmartyParams4Resources($this->basicPage->getSmartyParams4Resources());
//4. GET SMARTY PARAMS FOR TPL
$smartyParams['host'] = ServerArrayAdapter::HTTP_HOST();
$smartyParams['content'] = BasicPagesManager::inst()->getResourcesLinks($this->basicPage->getIdent(), ContentHelper::getContent($this->basicPage));
return $smartyParams;
}
示例7: addToolbar
/**
* Add the page title and toolbar.
*
* @since 1.6
*/
protected function addToolbar()
{
$state = $this->get('State');
$canDo = ContentHelper::getActions($this->state->get('filter.category_id'));
JToolbarHelper::title(JText::_('COM_CONTENT_FEATURED_TITLE'), 'featured.png');
if ($canDo->get('core.create')) {
JToolbarHelper::addNew('article.add');
}
if ($canDo->get('core.edit')) {
JToolbarHelper::editList('article.edit');
}
if ($canDo->get('core.edit.state')) {
JToolbarHelper::publish('articles.publish', 'JTOOLBAR_PUBLISH', true);
JToolbarHelper::unpublish('articles.unpublish', 'JTOOLBAR_UNPUBLISH', true);
JToolbarHelper::custom('featured.delete', 'remove.png', 'remove_f2.png', 'JTOOLBAR_REMOVE', true);
JToolbarHelper::archiveList('articles.archive');
JToolbarHelper::checkin('articles.checkin');
}
if ($state->get('filter.published') == -2 && $canDo->get('core.delete')) {
JToolbarHelper::deleteList('', 'articles.delete', 'JTOOLBAR_EMPTY_TRASH');
} elseif ($canDo->get('core.edit.state')) {
JToolbarHelper::trash('articles.trash');
}
if ($canDo->get('core.admin')) {
JToolbarHelper::preferences('com_content');
}
JToolbarHelper::help('JHELP_CONTENT_FEATURED_ARTICLES');
JHtmlSidebar::setAction('index.php?option=com_content&view=featured');
JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_published', JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true));
JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_CATEGORY'), 'filter_category_id', JHtml::_('select.options', JHtml::_('category.options', 'com_content'), 'value', 'text', $this->state->get('filter.category_id')));
JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_MAX_LEVELS'), 'filter_level', JHtml::_('select.options', $this->f_levels, 'value', 'text', $this->state->get('filter.level')));
JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_ACCESS'), 'filter_access', JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')));
JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_AUTHOR'), 'filter_author_id', JHtml::_('select.options', $this->authors, 'value', 'text', $this->state->get('filter.author_id')));
JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_LANGUAGE'), 'filter_language', JHtml::_('select.options', JHtml::_('contentlanguage.existing', true, true), 'value', 'text', $this->state->get('filter.language')));
}
示例8: doBuild
protected function doBuild(\PageContext $ctxt, \PageBuilderContext $builderCtxt, \RequestArrayAdapter $requestParams, \ArrayAdapter $buildParams)
{
//1. ЗАГОЛОВОК
$builderCtxt->setTitle($this->authed ? 'Админка | ' . $this->adminPage->title() : 'xxx');
//2. JAVASCRIPT
$builderCtxt->setJsParams($this->authed ? $this->adminPage->getJsParams() : null);
//3. SMARTY RESOURCES
if ($this->authed) {
$builderCtxt->setSmartyParams4Resources($this->adminPage->getSmartyParams4Resources());
$builderCtxt->setSmartyParam4Resources('IDENT', $this->adminPage->getPageIdent());
$builderCtxt->setSmartyParam4Resources('TIMELINE_ENABE', true);
}
$smartyParams['authed'] = $this->authed;
if (!$this->authed) {
return $smartyParams;
}
//Запустим неограниченный по времени режим - мало ли, что мы там будем делать:)
PsUtil::startUnlimitedMode();
//Получаем содержимое админской страницы
$content = ContentHelper::getContent($this->adminPage);
//Добавляем к ней ресурсы
$content = APagesResources::inst()->getResourcesLinks($this->adminPage->getPageIdent(), $content);
$smartyParams['page'] = $this->adminPage;
$smartyParams['content'] = $content;
$smartyParams['pagesLayout'] = AdminPagesManager::getInstance()->getLayout();
return $smartyParams;
}
示例9: association
/**
* @param int $articleid The article item id
*/
public static function association($articleid)
{
// Get the associations
$associations = ContentHelper::getAssociations($articleid);
foreach ($associations as $tag => $associated) {
$associations[$tag] = (int) $associated->id;
}
// Get the associated menu items
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('c.*');
$query->from('#__content as c');
$query->select('cat.title as category_title');
$query->leftJoin('#__categories as cat ON cat.id=c.catid');
$query->where('c.id IN (' . implode(',', array_values($associations)) . ')');
$query->leftJoin('#__languages as l ON c.language=l.lang_code');
$query->select('l.image');
$query->select('l.title as language_title');
$db->setQuery($query);
$items = $db->loadObjectList('id');
// Check for a database error.
if ($error = $db->getErrorMsg()) {
JError::raiseWarning(500, $error);
return false;
}
// Construct html
$text = array();
foreach ($associations as $tag => $associated) {
if ($associated != $articleid) {
$text[] = JText::sprintf('COM_CONTENT_TIP_ASSOCIATED_LANGUAGE', JHtml::_('image', 'mod_languages/' . $items[$associated]->image . '.gif', $items[$associated]->language_title, array('title' => $items[$associated]->language_title), true), $items[$associated]->title, $items[$associated]->category_title);
}
}
return JHtml::_('tooltip', implode('<br />', $text), JText::_('COM_CONTENT_TIP_ASSOCIATION'), 'admin/icon-16-links.png');
}
示例10: preparePartnerSlides
protected function preparePartnerSlides()
{
$slides = array();
$data = Yii::app()->db->createCommand(sprintf('SELECT p.title, ph.filename, ph.title photo_title, ph.description photo_description
FROM partners p
LEFT JOIN gallery g ON g.`gallery_id` = p.gallery_id
LEFT JOIN photo ph ON ph.gallery_id = g.gallery_id
WHERE p.is_active = 1 AND p.partner_id <> %d AND (ph.is_top <> 1 OR ph.is_top IS NULL)
ORDER BY ph.sort_order DESC', Yii::app()->params['partner_id']))->queryAll();
foreach ($data as $slide) {
$slides[] = array('url' => ImageHelper::imageUrl('', $slide['filename']), 'content' => sprintf('<img src=\'%s\' alt\'%s\' title=\'%s\'></img>', ImageHelper::imageUrl('partner_footer_frontend', $slide['filename']), ContentHelper::prepareStr($slide['title']), ContentHelper::prepareStr($slide['title'])));
}
return $slides;
}
示例11: display
/**
* Display the view
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
*/
public function display($tpl = null)
{
if ($this->getLayout() !== 'modal') {
ContentHelper::addSubmenu('articles');
}
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->authors = $this->get('Authors');
$this->filterForm = $this->get('FilterForm');
$this->activeFilters = $this->get('ActiveFilters');
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode("\n", $errors));
return false;
}
// Levels filter.
$options = array();
$options[] = JHtml::_('select.option', '1', JText::_('J1'));
$options[] = JHtml::_('select.option', '2', JText::_('J2'));
$options[] = JHtml::_('select.option', '3', JText::_('J3'));
$options[] = JHtml::_('select.option', '4', JText::_('J4'));
$options[] = JHtml::_('select.option', '5', JText::_('J5'));
$options[] = JHtml::_('select.option', '6', JText::_('J6'));
$options[] = JHtml::_('select.option', '7', JText::_('J7'));
$options[] = JHtml::_('select.option', '8', JText::_('J8'));
$options[] = JHtml::_('select.option', '9', JText::_('J9'));
$options[] = JHtml::_('select.option', '10', JText::_('J10'));
$this->f_levels = $options;
// We don't need toolbar in the modal window.
if ($this->getLayout() !== 'modal') {
$this->addToolbar();
$this->sidebar = JHtmlSidebar::render();
} else {
// In article associations modal we need to remove language filter if forcing a language.
// We also need to change the category filter to show show categories with All or the forced language.
if ($forcedLanguage = JFactory::getApplication()->input->get('forcedLanguage', '', 'CMD')) {
// If the language is forced we can't allow to select the language, so transform the language selector filter into an hidden field.
$languageXml = new SimpleXMLElement('<field name="language" type="hidden" default="' . $forcedLanguage . '" />');
$this->filterForm->setField($languageXml, 'filter', true);
// Also, unset the active language filter so the search tools is not open by default with this filter.
unset($this->activeFilters['language']);
// One last changes needed is to change the category filter to just show categories with All language or with the forced language.
$this->filterForm->setFieldAttribute('category_id', 'language', '*,' . $forcedLanguage, 'filter');
}
}
parent::display($tpl);
}
示例12: prepareSlides
protected function prepareSlides()
{
$slides = array();
$data = Yii::app()->db->createCommand('SELECT gp.*, p.title post_title, ph.filename, ph.title photo_title, ph.description photo_description, u.firstname, u.lastname
FROM galleryposts gp
LEFT JOIN users u ON u.user_id = gp.user_id
LEFT JOIN posting p ON p.post_id = gp.post_id
LEFT JOIN gallery g ON g.`gallery_id` = p.gallery_id
LEFT JOIN photo ph ON ph.gallery_id = g.gallery_id
WHERE gp.is_top = 1 AND gp.publication_date <= NOW()
ORDER BY ph.sort_order DESC')->queryAll();
foreach ($data as $slide) {
$slides[] = array('url' => ImageHelper::imageUrl('main_page_slider', $slide['filename']), 'content' => sprintf('<a href=\'%s\'><img src=\'%s\' alt=\'%s\' title=\'%s\'></img></a>', Yii::app()->createAbsoluteUrl('portfolio/default/view', array('id' => $slide['post_id'])), ImageHelper::imageUrl('main_page_slider', $slide['filename']), ContentHelper::prepareStr($slide['photo_description']), ContentHelper::prepareStr($slide['photo_description'])));
}
return $slides;
}
示例13: addToolbar
/**
* Add the page title and toolbar.
*
* @since 1.6
*/
protected function addToolbar()
{
$canDo = ContentHelper::getActions($this->state->get('filter.category_id'));
$user = JFactory::getUser();
// Get the toolbar object instance
$bar = JToolBar::getInstance('toolbar');
JToolbarHelper::title(JText::_('COM_CONTENT_ARTICLES_TITLE'), 'article.png');
if ($canDo->get('core.create') || count($user->getAuthorisedCategories('com_content', 'core.create')) > 0) {
JToolbarHelper::addNew('article.add');
}
if ($canDo->get('core.edit') || $canDo->get('core.edit.own')) {
JToolbarHelper::editList('article.edit');
}
if ($canDo->get('core.edit.state')) {
JToolbarHelper::publish('articles.publish', 'JTOOLBAR_PUBLISH', true);
JToolbarHelper::unpublish('articles.unpublish', 'JTOOLBAR_UNPUBLISH', true);
JToolbarHelper::custom('articles.featured', 'featured.png', 'featured_f2.png', 'JFEATURED', true);
JToolbarHelper::archiveList('articles.archive');
JToolbarHelper::checkin('articles.checkin');
}
if ($this->state->get('filter.published') == -2 && $canDo->get('core.delete')) {
JToolbarHelper::deleteList('', 'articles.delete', 'JTOOLBAR_EMPTY_TRASH');
} elseif ($canDo->get('core.edit.state')) {
JToolbarHelper::trash('articles.trash');
}
// Add a batch button
if ($user->authorise('core.create', 'com_content') && $user->authorise('core.edit', 'com_content') && $user->authorise('core.edit.state', 'com_content')) {
JHtml::_('bootstrap.modal', 'collapseModal');
$title = JText::_('JTOOLBAR_BATCH');
// Instantiate a new JLayoutFile instance and render the batch button
$layout = new JLayoutFile('joomla.toolbar.batch');
$dhtml = $layout->render(array('title' => $title));
$bar->appendButton('Custom', $dhtml, 'batch');
}
if ($canDo->get('core.admin')) {
JToolbarHelper::preferences('com_content');
}
JToolbarHelper::help('JHELP_CONTENT_ARTICLE_MANAGER');
JHtmlSidebar::setAction('index.php?option=com_content&view=articles');
JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_published', JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true));
JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_CATEGORY'), 'filter_category_id', JHtml::_('select.options', JHtml::_('category.options', 'com_content'), 'value', 'text', $this->state->get('filter.category_id')));
JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_MAX_LEVELS'), 'filter_level', JHtml::_('select.options', $this->f_levels, 'value', 'text', $this->state->get('filter.level')));
JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_ACCESS'), 'filter_access', JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')));
JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_AUTHOR'), 'filter_author_id', JHtml::_('select.options', $this->authors, 'value', 'text', $this->state->get('filter.author_id')));
JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_LANGUAGE'), 'filter_language', JHtml::_('select.options', JHtml::_('contentlanguage.existing', true, true), 'value', 'text', $this->state->get('filter.language')));
JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_TAG'), 'filter_tag', JHtml::_('select.options', JHtml::_('tag.options', true, true), 'value', 'text', $this->state->get('filter.tag')));
}
示例14: display
/**
* Method to display a view.
*
* @param boolean If true, the view output will be cached
* @param array An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
*
* @return JController This object to support chaining.
* @since 1.5
*/
public function display($cachable = false, $urlparams = false)
{
// Load the submenu.
ContentHelper::addSubmenu(JRequest::getCmd('view', 'articles'));
$view = JRequest::getCmd('view', 'articles');
$layout = JRequest::getCmd('layout', 'articles');
$id = JRequest::getInt('id');
// Check for edit form.
if ($view == 'article' && $layout == 'edit' && !$this->checkEditId('com_content.edit.article', $id)) {
// Somehow the person just went to the form - we don't allow that.
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
$this->setMessage($this->getError(), 'error');
$this->setRedirect(JRoute::_('index.php?option=com_content&view=articles', false));
return false;
}
parent::display();
return $this;
}
示例15: getAssociations
/**
* Method to get the associations for a given item
*
* @param integer $id Id of the item
* @param string $view Name of the view
*
* @return array Array of associations for the item
*
* @since 3.0
*/
public static function getAssociations($id = 0, $view = null)
{
jimport('helper.route', JPATH_COMPONENT_SITE);
$app = JFactory::getApplication();
$jinput = $app->input;
$view = is_null($view) ? $jinput->get('view') : $view;
$id = empty($id) ? $jinput->getInt('id') : $id;
if ($view == 'article') {
if ($id) {
$associations = ContentHelper::getAssociations($id);
$return = array();
foreach ($associations as $tag => $item) {
$return[$tag] = ContentHelperRoute::getArticleRoute($item->id, $item->catid, $item->language);
}
return $return;
}
}
if ($view == 'category' || $view == 'categories') {
return self::getCategoryAssociations($id, 'com_content');
}
return array();
}