Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/components/com_cluster/administrator/helpers/cluster.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
defined('_JEXEC') or die('Restricted access');

use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;

/**
* Cluster helper.
Expand All @@ -33,13 +34,13 @@ public static function addSubmenu($vName = '')
if ($layout != "default")
{
JHtmlSidebar::addEntry(
JText::_('COM_CLUSTERS_VIEW_CLUSTERS'),
Text::_('COM_CLUSTERS_VIEW_CLUSTERS'),
'index.php?option=com_cluster&view=clusters',
$vName == 'clusters'
);

JHtmlSidebar::addEntry(
JText::_('COM_CLUSTERS_VIEW_CLUSTER_USERS'),
Text::_('COM_CLUSTERS_VIEW_CLUSTER_USERS'),
'index.php?option=com_cluster&view=clusterusers',
$vName == 'clusterusers'
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

use Joomla\CMS\Factory;
use Joomla\CMS\Object\CMSObject;
use Joomla\CMS\Language\Text;

/**
* Cluster class. Handles all application interaction with a Cluster
Expand Down Expand Up @@ -192,15 +193,15 @@ public function bind(&$array)
{
if (empty($array))
{
$this->setError(JText::_('COM_CLUSTER_EMPTY_DATA'));
$this->setError(Text::_('COM_CLUSTER_EMPTY_DATA'));

return false;
}

// Bind the array
if (!$this->setProperties($array))
{
$this->setError(\JText::_('COM_CLUSTER_BINDING_ERROR'));
$this->setError(Text::_('COM_CLUSTER_BINDING_ERROR'));

return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@

use Joomla\CMS\Factory;
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Helper\ContentHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\ToolbarHelper;

/**
* View to edit
Expand Down Expand Up @@ -70,7 +73,7 @@ public function display($tpl = null)
$this->form = $this->get('Form');
$this->input = Factory::getApplication()->input;

$this->canDo = JHelperContent::getActions('com_cluster', 'cluster', $this->item->id);
$this->canDo = ContentHelper::getActions('com_cluster', 'cluster', $this->item->id);

// Check for errors.
if (count($errors = $this->get('Errors')))
Expand Down Expand Up @@ -110,29 +113,29 @@ protected function addToolbar()
{
Factory::getApplication()->input->set('hidemainmenu', true);

JToolbarHelper::title(
JText::_('COM_CLUSTER_PAGE_' . ($checkedOut ? 'VIEW_CLUSTER' : ($isNew ? 'ADD_CLUSTER' : 'EDIT_CLUSTER'))),
ToolbarHelper::title(
Text::_('COM_CLUSTER_PAGE_' . ($checkedOut ? 'VIEW_CLUSTER' : ($isNew ? 'ADD_CLUSTER' : 'EDIT_CLUSTER'))),
'pencil-2 cluster-add'
);

if ($isNew)
{
JToolbarHelper::save('cluster.save');
JToolbarHelper::cancel('cluster.cancel');
ToolbarHelper::save('cluster.save');
ToolbarHelper::cancel('cluster.cancel');
}
else
{
$itemEditable = $this->isEditable($canDo, $userId);

// Can't save the record if it's checked out and editable
$this->canSave($checkedOut, $itemEditable);
JToolbarHelper::cancel('cluster.cancel', 'JTOOLBAR_CLOSE');
ToolbarHelper::cancel('cluster.cancel', 'JTOOLBAR_CLOSE');
}
}
else
{
JToolbarHelper::title(
JText::_('COM_CLUSTER_PAGE_VIEW_CLUSTER')
ToolbarHelper::title(
Text::_('COM_CLUSTER_PAGE_VIEW_CLUSTER')
);

$app = Factory::getApplication();
Expand All @@ -143,7 +146,7 @@ protected function addToolbar()
$this->sidebar = JHtmlSidebar::render();
}

JToolbarHelper::divider();
ToolbarHelper::divider();
}

/**
Expand All @@ -159,7 +162,7 @@ protected function canSave($checkedOut, $itemEditable)
{
if (!$checkedOut && $itemEditable)
{
JToolbarHelper::save('cluster.save');
ToolbarHelper::save('cluster.save');
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
use Joomla\CMS\Factory;
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Object\CMSObject;
use Joomla\CMS\Helper\ContentHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\ToolbarHelper;

/**
* Clusters view
Expand Down Expand Up @@ -93,7 +96,7 @@ public function display($tpl = null)
$this->filterForm = $this->get('FilterForm');
$this->activeFilters = $this->get('ActiveFilters');
$this->user = Factory::getUser();
$this->canDo = JHelperContent::getActions('com_cluster');
$this->canDo = ContentHelper::getActions('com_cluster');

ClusterHelper::addSubmenu('clusters');
$this->addToolbar();
Expand All @@ -111,38 +114,38 @@ public function display($tpl = null)
*/
protected function addToolbar()
{
JToolBarHelper::title(JText::_('COM_CLUSTERS_VIEW_CLUSTERS'), '');
ToolbarHelper::title(Text::_('COM_CLUSTERS_VIEW_CLUSTERS'), '');
$canDo = $this->canDo;

if ($canDo->get('core.create'))
{
JToolbarHelper::addNew('cluster.add');
ToolbarHelper::addNew('cluster.add');
}

if ($canDo->get('core.edit'))
{
JToolbarHelper::editList('cluster.edit');
ToolbarHelper::editList('cluster.edit');
}

if ($canDo->get('core.edit.state'))
{
JToolbarHelper::divider();
JToolbarHelper::publish('clusters.publish', 'JTOOLBAR_PUBLISH', true);
JToolbarHelper::unpublish('clusters.unpublish', 'JTOOLBAR_UNPUBLISH', true);
JToolBarHelper::archiveList('clusters.archive', 'JTOOLBAR_ARCHIVE');
JToolbarHelper::divider();
ToolbarHelper::divider();
ToolbarHelper::publish('clusters.publish', 'JTOOLBAR_PUBLISH', true);
ToolbarHelper::unpublish('clusters.unpublish', 'JTOOLBAR_UNPUBLISH', true);
ToolbarHelper::archiveList('clusters.archive', 'JTOOLBAR_ARCHIVE');
ToolbarHelper::divider();
}

if ($canDo->get('core.delete'))
{
JToolbarHelper::deleteList('JGLOBAL_CONFIRM_DELETE', 'clusters.delete', 'JTOOLBAR_DELETE');
JToolbarHelper::divider();
ToolbarHelper::deleteList('JGLOBAL_CONFIRM_DELETE', 'clusters.delete', 'JTOOLBAR_DELETE');
ToolbarHelper::divider();
}

if ($canDo->get('core.admin') || $canDo->get('core.options'))
{
JToolbarHelper::preferences('com_cluster');
JToolbarHelper::divider();
ToolbarHelper::preferences('com_cluster');
ToolbarHelper::divider();
}
}

Expand All @@ -154,11 +157,11 @@ protected function addToolbar()
protected function getSortFields()
{
return array(
'cl.id' => JText::_('JGRID_HEADING_ID'),
'cl.title' => JText::_('COM_CLUSTER_LIST_CLUSTERS_NAME'),
'cl.client' => JText::_('COM_CLUSTER_LIST_CLUSTERS_CLIENT'),
'cl.ordering' => JText::_('JGRID_HEADING_ORDERING'),
'cl.state' => JText::_('JSTATUS'),
'cl.id' => Text::_('JGRID_HEADING_ID'),
'cl.title' => Text::_('COM_CLUSTER_LIST_CLUSTERS_NAME'),
'cl.client' => Text::_('COM_CLUSTER_LIST_CLUSTERS_CLIENT'),
'cl.ordering' => Text::_('JGRID_HEADING_ORDERING'),
'cl.state' => Text::_('JSTATUS'),
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@

use Joomla\CMS\Factory;
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Helper\ContentHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\ToolbarHelper;

/**
* View to edit
Expand Down Expand Up @@ -70,7 +73,7 @@ public function display($tpl = null)
$this->form = $this->get('Form');
$this->input = Factory::getApplication()->input;

$this->canDo = JHelperContent::getActions('com_cluster', 'clusteruser', $this->item->id);
$this->canDo = ContentHelper::getActions('com_cluster', 'clusteruser', $this->item->id);

// Check for errors.
if (count($errors = $this->get('Errors')))
Expand Down Expand Up @@ -108,35 +111,35 @@ protected function addToolbar()
{
Factory::getApplication()->input->set('hidemainmenu', true);

JToolbarHelper::title(
JText::_('COM_CLUSTER_PAGE_' . ($checkedOut ? 'VIEW_USER' : ($isNew ? 'ADD_USER' : 'EDIT_USER'))),
ToolbarHelper::title(
Text::_('COM_CLUSTER_PAGE_' . ($checkedOut ? 'VIEW_USER' : ($isNew ? 'ADD_USER' : 'EDIT_USER'))),
'pencil-2 cluster-add'
);

if ($isNew)
{
JToolbarHelper::save('clusteruser.save');
JToolbarHelper::cancel('clusteruser.cancel');
ToolbarHelper::save('clusteruser.save');
ToolbarHelper::cancel('clusteruser.cancel');
}
else
{
$itemEditable = $this->isEditable($this->canDo, $user->id);
$this->canSave($checkedOut, $itemEditable);
JToolbarHelper::cancel('clusteruser.cancel', 'JTOOLBAR_CLOSE');
ToolbarHelper::cancel('clusteruser.cancel', 'JTOOLBAR_CLOSE');
}
}
else
{
JToolbarHelper::title(
JText::_('COM_CLUSTER_PAGE_VIEW_CLUSTER_USER')
ToolbarHelper::title(
Text::_('COM_CLUSTER_PAGE_VIEW_CLUSTER_USER')
);

ClusterHelper::addSubmenu('clusteruser');

$this->sidebar = JHtmlSidebar::render();
}

JToolbarHelper::divider();
ToolbarHelper::divider();
}

/**
Expand All @@ -152,7 +155,7 @@ protected function canSave($checkedOut, $itemEditable)
{
if (!$checkedOut && $itemEditable)
{
JToolbarHelper::save('clusteruser.save');
ToolbarHelper::save('clusteruser.save');
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@

use Joomla\CMS\Factory;
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Helper\ContentHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\ToolbarHelper;

/**
* Clusters view
Expand Down Expand Up @@ -92,7 +95,7 @@ public function display($tpl = null)
$this->filterForm = $this->get('FilterForm');
$this->activeFilters = $this->get('ActiveFilters');
$this->user = Factory::getUser();
$this->canDo = JHelperContent::getActions('com_cluster');
$this->canDo = ContentHelper::getActions('com_cluster');

ClusterHelper::addSubmenu('clusterusers');
$this->addToolbar();
Expand All @@ -110,37 +113,37 @@ public function display($tpl = null)
*/
protected function addToolbar()
{
JToolBarHelper::title(JText::_('COM_CLUSTERS_VIEW_CLUSTERS'), '');
ToolBarHelper::title(Text::_('COM_CLUSTERS_VIEW_CLUSTERS'), '');

if ($this->canDo->get('core.create'))
{
JToolbarHelper::addNew('clusteruser.add');
ToolBarHelper::addNew('clusteruser.add');
}

if ($this->canDo->get('core.edit'))
{
JToolbarHelper::editList('clusteruser.edit');
ToolBarHelper::editList('clusteruser.edit');
}

if ($this->canDo->get('core.edit.state'))
{
JToolbarHelper::divider();
JToolbarHelper::publish('clusteruser.publish', 'JTOOLBAR_PUBLISH', true);
JToolbarHelper::unpublish('clusteruser.unpublish', 'JTOOLBAR_UNPUBLISH', true);
JToolBarHelper::archiveList('clusteruser.archive', 'JTOOLBAR_ARCHIVE');
JToolbarHelper::divider();
ToolBarHelper::divider();
ToolBarHelper::publish('clusteruser.publish', 'JTOOLBAR_PUBLISH', true);
ToolBarHelper::unpublish('clusteruser.unpublish', 'JTOOLBAR_UNPUBLISH', true);
ToolBarHelper::archiveList('clusteruser.archive', 'JTOOLBAR_ARCHIVE');
ToolBarHelper::divider();
}

if ($this->canDo->get('core.delete'))
{
JToolbarHelper::deleteList('JGLOBAL_CONFIRM_DELETE', 'clusterusers.delete', 'JTOOLBAR_DELETE');
JToolbarHelper::divider();
ToolBarHelper::deleteList('JGLOBAL_CONFIRM_DELETE', 'clusterusers.delete', 'JTOOLBAR_DELETE');
ToolBarHelper::divider();
}

if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
{
JToolbarHelper::preferences('com_cluster');
JToolbarHelper::divider();
ToolBarHelper::preferences('com_cluster');
ToolBarHelper::divider();
}
}

Expand All @@ -152,11 +155,11 @@ protected function addToolbar()
protected function getSortFields()
{
return array(
'cl.id' => JText::_('JGRID_HEADING_ID'),
'cl.title' => JText::_('COM_CLUSTER_LIST_CLUSTERS_NAME'),
'cl.client' => JText::_('COM_CLUSTER_LIST_CLUSTERS_CLIENT'),
'cl.ordering' => JText::_('JGRID_HEADING_ORDERING'),
'cl.state' => JText::_('JSTATUS'),
'cl.id' => Text::_('JGRID_HEADING_ID'),
'cl.title' => Text::_('COM_CLUSTER_LIST_CLUSTERS_NAME'),
'cl.client' => Text::_('COM_CLUSTER_LIST_CLUSTERS_CLIENT'),
'cl.ordering' => Text::_('JGRID_HEADING_ORDERING'),
'cl.state' => Text::_('JSTATUS'),
);
}
}
6 changes: 4 additions & 2 deletions src/components/com_cluster/site/cluster.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
*/

defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\MVC\Controller\BaseController;

// Include dependancies
jimport('joomla.application.component.controller');
Expand All @@ -16,6 +18,6 @@


// Execute the task.
$controller = JControllerLegacy::getInstance('Cluster');
$controller->execute(JFactory::getApplication()->input->get('task'));
$controller = BaseController::getInstance('Cluster');
$controller->execute(Factory::getApplication()->input->get('task'));
$controller->redirect();
Loading