Skip to content
Open
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
3 changes: 2 additions & 1 deletion src/components/com_cluster/administrator/controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/

defined('_JEXEC') or die;
use Joomla\CMS\Filter\InputFilter;

use Joomla\CMS\Factory;
use Joomla\CMS\MVC\Controller\BaseController;
Expand All @@ -26,7 +27,7 @@ class ClusterController extends BaseController
* Method to display a view.
*
* @param boolean $cachable If true, the view output will be cached
* @param mixed $urlparams An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
* @param mixed $urlparams An array of safe url parameters and their variable types, for valid values see {@link InputFilter::clean()}.
*
* @return JController This object to support chaining.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ClusterControllerClusters extends AdminController
*
* @since 1.0.0
*/
public function getModel($name = 'Cluster', $prefix = 'ClusterModel')
public function getModel($name = 'Cluster', $prefix = 'ClusterModel', $config = [])
{
return parent::getModel($name, $prefix, array('ignore_request' => true));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ClusterControllerClusterUsers extends AdminController
*
* @since 1.0.0
*/
public function getModel($name = 'ClusterUser', $prefix = 'ClusterModel')
public function getModel($name = 'ClusterUser', $prefix = 'ClusterModel', $config = [])
{
return parent::getModel($name, $prefix, array('ignore_request' => true));
}
Expand Down
13 changes: 8 additions & 5 deletions src/components/com_cluster/administrator/helpers/cluster.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
*/

defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Filesystem\Path;

use Joomla\CMS\Factory;

Expand All @@ -33,13 +36,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 All @@ -54,7 +57,7 @@ public static function addSubmenu($vName = '')
// Eg com_jgive
$component = $fullClient[0];
$eName = str_replace('com_', '', $component);
$file = JPath::clean(JPATH_ADMINISTRATOR . '/components/' . $component . '/helpers/' . $eName . '.php');
$file = Path::clean(JPATH_ADMINISTRATOR . '/components/' . $component . '/helpers/' . $eName . '.php');

if (file_exists($file))
{
Expand All @@ -72,9 +75,9 @@ public static function addSubmenu($vName = '')
// Loading language file from the administrator/language directory then
// Loading language file from the administrator/components/*extension*/language directory
$lang->load($component, JPATH_BASE, null, false, false)
|| $lang->load($component, JPath::clean(JPATH_ADMINISTRATOR . '/components/' . $component), null, false, false)
|| $lang->load($component, Path::clean(JPATH_ADMINISTRATOR . '/components/' . $component), null, false, false)
|| $lang->load($component, JPATH_BASE, $lang->getDefault(), false, false)
|| $lang->load($component, JPath::clean(JPATH_ADMINISTRATOR . '/components/' . $component), $lang->getDefault(), false, false);
|| $lang->load($component, Path::clean(JPATH_ADMINISTRATOR . '/components/' . $component), $lang->getDefault(), false, false);

call_user_func(array($cName, 'addSubmenu'), $vName);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/

defined('_JEXEC') or die('Unauthorized Access');
use Joomla\CMS\Language\Text;

use Joomla\CMS\Factory;
use Joomla\CMS\Object\CMSObject;
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
3 changes: 2 additions & 1 deletion src/components/com_cluster/administrator/models/clusters.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\Data\DataObject;

use Joomla\CMS\MVC\Model\ListModel;

Expand Down Expand Up @@ -47,7 +48,7 @@ public function __construct($config = array())
/**
* Build an SQL query to load the list data.
*
* @return JDatabaseQuery
* @return DataObjectbaseQuery
*
* @since 1.0.0
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/

defined('_JEXEC') or die;
use Joomla\CMS\Form\Form;

use Joomla\CMS\Factory;
use Joomla\CMS\MVC\Model\AdminModel;
Expand All @@ -27,7 +28,7 @@ class ClusterModelClusterUser extends AdminModel
* @param array $data Data for the form.
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
*
* @return JForm|boolean A JForm object on success, false on failure
* @return Form|boolean A Form object on success, false on failure
*
* @since 1.0.0
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\Data\DataObject;

use Joomla\CMS\Factory;
use Joomla\CMS\MVC\Model\ListModel;
Expand Down Expand Up @@ -46,7 +47,7 @@ public function __construct($config = array())
/**
* Build an SQL query to load the list data.
*
* @return JDatabaseQuery
* @return DataObjectbaseQuery
*
* @since 1.0.0
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
*/

defined('_JEXEC') or die;
use Joomla\CMS\Form\Form;
use Joomla\CMS\Object\CMSObject;
use Joomla\CMS\Helper\ContentHelper;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Language\Text;

use Joomla\CMS\Factory;
use Joomla\CMS\MVC\View\HtmlView;
Expand All @@ -20,9 +26,9 @@
class ClusterViewCluster extends HtmlView
{
/**
* The JForm object
* The Form object
*
* @var JForm
* @var Form
*/
protected $form;

Expand Down Expand Up @@ -50,7 +56,7 @@ class ClusterViewCluster extends HtmlView
/**
* The actions the user is authorised to perform
*
* @var JObject
* @var CMSObject
*/
protected $canDo;

Expand All @@ -70,7 +76,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 +116,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 +149,7 @@ protected function addToolbar()
$this->sidebar = JHtmlSidebar::render();
}

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

/**
Expand All @@ -159,7 +165,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 @@ -9,10 +9,16 @@

// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Pagination\Pagination;
use Joomla\CMS\Form\Form;
use Joomla\CMS\Object\CMSObject;
use Joomla\CMS\Helper\ContentHelper;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\ToolbarHelper;

use Joomla\CMS\Factory;
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Object\CMSObject;

/**
* Clusters view
Expand All @@ -31,7 +37,7 @@ class ClusterViewClusters extends HtmlView
/**
* The pagination object
*
* @var JPagination
* @var Pagination
*/
protected $pagination;

Expand All @@ -45,14 +51,14 @@ class ClusterViewClusters extends HtmlView
/**
* Form object for search filters
*
* @var JForm
* @var Form
*/
public $filterForm;

/**
* Logged in User
*
* @var JObject
* @var CMSObject
*/
public $user;

Expand Down Expand Up @@ -93,7 +99,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 +117,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 +160,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'),
);
}
}
Loading