本文整理汇总了PHP中ContentHelper::getActions方法的典型用法代码示例。如果您正苦于以下问题:PHP ContentHelper::getActions方法的具体用法?PHP ContentHelper::getActions怎么用?PHP ContentHelper::getActions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContentHelper
的用法示例。
在下文中一共展示了ContentHelper::getActions方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _setToolbar
/**
* 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');
}
示例2: 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');
}
示例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
*/
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);
}
示例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'));
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')));
}
示例6: 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')));
}
示例7: addToolbar
/**
* 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');
}