/** * Display the toolbar */ protected function _setToolbar() { $canDo = ContentHelper::getActions($this->state->get('filter.category_id')); JToolBarHelper::title(JText::_('Content_Featured_Title'), 'featured.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); JToolBarHelper::custom('featured.delete', 'remove.png', 'remove_f2.png', 'JToolbar_Remove', true); if ($this->state->get('filter.published') != -1) { JToolBarHelper::archiveList('articles.archive'); } } if ($canDo->get('core.admin')) { JToolBarHelper::divider(); JToolBarHelper::preferences('com_content'); } JToolBarHelper::divider(); JToolBarHelper::help('screen.content.featured'); }
/** * 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'); }
/** * 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'); }
/** * 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'); }
/** * 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); }
/** * 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'))); }
/** * Display the toolbar */ protected function _setToolbar() { JRequest::setVar('hidemainmenu', true); $user = JFactory::getUser(); $isNew = $this->item->id == 0; $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id')); $canDo = ContentHelper::getActions($this->state->get('filter.category_id'), $this->item->id); JToolBarHelper::title(JText::_('Content_Page_' . ($checkedOut ? 'View_Article' : ($isNew ? 'Add_Article' : 'Edit_Article'))), 'article-add.png'); // If not checked out, can save the item. if (!$checkedOut && $canDo->get('core.edit')) { JToolBarHelper::apply('article.apply', 'JToolbar_Apply'); JToolBarHelper::save('article.save', 'JToolbar_Save'); JToolBarHelper::custom('article.save2new', 'save-new.png', 'save-new_f2.png', 'JToolbar_Save_and_new', false); } // If an existing item, can save to a copy. if (!$isNew && $canDo->get('core.create')) { JToolBarHelper::custom('article.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JToolbar_Save_as_Copy', false); } if (empty($this->item->id)) { JToolBarHelper::cancel('article.cancel', 'JToolbar_Cancel'); } else { JToolBarHelper::cancel('article.cancel', 'JToolbar_Close'); } JToolBarHelper::divider(); JToolBarHelper::help('screen.content.article'); }
/** * 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'))); }
/** * Add the page title and toolbar. * * @since 1.6 */ protected function addToolbar() { JRequest::setVar('hidemainmenu', true); $user = JFactory::getUser(); $userId = $user->get('id'); $isNew = $this->item->id == 0; $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $userId); $canDo = ContentHelper::getActions($this->state->get('filter.category_id'), $this->item->id); JToolBarHelper::title(JText::_('COM_CONTENT_PAGE_' . ($checkedOut ? 'VIEW_ARTICLE' : ($isNew ? 'ADD_ARTICLE' : 'EDIT_ARTICLE'))), 'article-add.png'); // Built the actions for new and existing records. // For new records, check the create permission. if ($isNew && count($user->getAuthorisedCategories('com_content', 'core.create')) > 0) { JToolBarHelper::apply('article.apply'); JToolBarHelper::save('article.save'); JToolBarHelper::save2new('article.save2new'); JToolBarHelper::cancel('article.cancel'); } else { // Can't save the record if it's checked out. if (!$checkedOut) { // Since it's an existing record, check the edit permission, or fall back to edit own if the owner. if ($canDo->get('core.edit') || $canDo->get('core.edit.own') && $this->item->created_by == $userId) { JToolBarHelper::apply('article.apply'); JToolBarHelper::save('article.save'); // We can save this record, but check the create permission to see if we can return to make a new one. if ($canDo->get('core.create')) { JToolBarHelper::save2new('article.save2new'); } } } // If checked out, we can still save if ($canDo->get('core.create')) { JToolBarHelper::save2copy('article.save2copy'); } JToolBarHelper::cancel('article.cancel', 'JTOOLBAR_CLOSE'); } JToolBarHelper::divider(); JToolBarHelper::help('JHELP_CONTENT_ARTICLE_MANAGER_EDIT'); }
/** * Add the page title and toolbar. * * @since 1.6 */ protected function addToolbar() { $canDo = ContentHelper::getActions($this->state->get('filter.category_id')); $user = JFactory::getUser(); 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::divider(); 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::divider(); 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'); JToolBarHelper::divider(); } else { if ($canDo->get('core.edit.state')) { JToolBarHelper::trash('articles.trash'); JToolBarHelper::divider(); } } if ($canDo->get('core.admin')) { JToolBarHelper::preferences('com_content'); JToolBarHelper::divider(); } JToolBarHelper::help('JHELP_CONTENT_ARTICLE_MANAGER'); }