- md5
- bde6ad58b8ebdad0d9c9ccda14467dec
- sha1
- 3a75fa3a8dae0e4ce13d2340a241335b2e785c4d
- sha256
- e392e31e2ebe57ced949eebd216dac48c8ba5e47ebb2fcd5a70a56593c78e9f5
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
<?php
/**
* @package Joomla.Administrator
* @subpackage com_workflow
*
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Component\Workflow\Administrator\View\Workflows;
defined('_JEXEC') or die;
use Joomla\CMS\Helper\ContentHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\Component\Workflow\Administrator\Helper\WorkflowHelper;
/**
* Workflows view class for the Workflow package.
*
* @since 4.0.0
*/
class HtmlView extends BaseHtmlView
{
/**
* An array of workflows
*
* @var array
* @since 4.0.0
*/
protected $workflows;
/**
* The model state
*
* @var object
* @since 4.0.0
*/
protected $state;
/**
* The pagination object
*
* @var \JPagination
* @since 4.0.0
*/
protected $pagination;
/**
* The HTML for displaying sidebar
*
* @var string
* @since 4.0.0
*/
protected $sidebar;
/**
* Form object for search filters
*
* @var \JForm
* @since 4.0.0
*/
public $filterForm;
/**
* The active search filters
*
* @var array
* @since 4.0.0
*/
public $activeFilters;
/**
* The name of current extension
*
* @var string
* @since 4.0.0
*/
protected $extension;
/**
* Display the view
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise an Error object.
*
* @since 4.0.0
*/
public function display($tpl = null)
{
$this->state = $this->get('State');
$this->workflows = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->filterForm = $this->get('FilterForm');
$this->activeFilters = $this->get('ActiveFilters');
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new \JViewGenericdataexception(implode("\n", $errors), 500);
}
$this->extension = $this->state->get('filter.extension');
WorkflowHelper::addSubmenu($this->state->get('filter.extension'));
$this->sidebar = \JHtmlSidebar::render();
$this->addToolbar();
return parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
*
* @since 4.0.0
*/
protected function addToolbar()
{
$canDo = ContentHelper::getActions($this->extension);
ToolbarHelper::title(Text::_('COM_WORKFLOW_WORKFLOWS_LIST'), 'address contact');
if ($canDo->get('core.create'))
{
ToolbarHelper::addNew('workflow.add');
}
if ($canDo->get('core.edit.state'))
{
ToolbarHelper::publishList('workflows.publish');
ToolbarHelper::unpublishList('workflows.unpublish');
ToolbarHelper::makeDefault('workflows.setDefault', 'COM_WORKFLOW_TOOLBAR_DEFAULT');
}
if ($canDo->get('core.admin'))
{
ToolbarHelper::checkin('workflows.checkin', 'JTOOLBAR_CHECKIN', true);
}
if ($this->state->get('filter.published') === '-2' && $canDo->get('core.delete'))
{
ToolbarHelper::deleteList(Text::_('COM_WORKFLOW_ARE_YOU_SURE'), 'workflows.delete');
}
elseif ($canDo->get('core.edit.state'))
{
ToolbarHelper::trash('workflows.trash');
}
if ($canDo->get('core.admin') || $canDo->get('core.options'))
{
ToolbarHelper::preferences($this->extension);
}
ToolbarHelper::help('JHELP_WORKFLOWS_LIST');
}
/**
* Returns an array of fields the table can be sorted by
*
* @return array Array containing the field name to sort by as the key and display text as value
*
* @since 4.0.0
*/
protected function getSortFields()
{
return array(
'a.published' => Text::_('JSTATUS'),
'a.title' => Text::_('JGLOBAL_TITLE'),
'a.id' => Text::_('JGRID_HEADING_ID'),
);
}
}
The same content is in 2 releases, Joomla 4.0.0-alpha5 to 4.0.0-alpha6. See them all, or every version of this file.