From a2016e77eda63be63f1567df7f68861d32edc6f0 Mon Sep 17 00:00:00 2001 From: kamalakanta Date: Mon, 5 Jun 2023 09:43:34 +0530 Subject: [PATCH] Task #199141 chore : Com cluster compatible with joomla4 --- .../com_cluster/administrator/controller.php | 3 +- .../administrator/controllers/clusters.php | 2 +- .../controllers/clusterusers.php | 2 +- .../administrator/helpers/cluster.php | 13 +++-- .../administrator/libraries/cluster.php | 5 +- .../administrator/models/clusters.php | 3 +- .../administrator/models/clusteruser.php | 3 +- .../administrator/models/clusterusers.php | 3 +- .../administrator/views/cluster/view.html.php | 32 +++++++----- .../views/clusters/view.html.php | 50 +++++++++++-------- .../views/clusteruser/view.html.php | 32 +++++++----- .../views/clusterusers/view.html.php | 49 ++++++++++-------- src/components/com_cluster/site/cluster.php | 6 ++- .../com_cluster/site/controller.php | 11 ++-- src/components/com_cluster/site/router.php | 3 +- .../site/views/cluster/view.html.php | 5 +- .../site/views/clusters/view.html.php | 26 ++++++---- 17 files changed, 146 insertions(+), 102 deletions(-) diff --git a/src/components/com_cluster/administrator/controller.php b/src/components/com_cluster/administrator/controller.php index fd74708..a4f0a66 100644 --- a/src/components/com_cluster/administrator/controller.php +++ b/src/components/com_cluster/administrator/controller.php @@ -8,6 +8,7 @@ */ defined('_JEXEC') or die; +use Joomla\CMS\Filter\InputFilter; use Joomla\CMS\Factory; use Joomla\CMS\MVC\Controller\BaseController; @@ -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. * diff --git a/src/components/com_cluster/administrator/controllers/clusters.php b/src/components/com_cluster/administrator/controllers/clusters.php index 804831f..8d8425c 100644 --- a/src/components/com_cluster/administrator/controllers/clusters.php +++ b/src/components/com_cluster/administrator/controllers/clusters.php @@ -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)); } diff --git a/src/components/com_cluster/administrator/controllers/clusterusers.php b/src/components/com_cluster/administrator/controllers/clusterusers.php index ed8b479..5887f3f 100644 --- a/src/components/com_cluster/administrator/controllers/clusterusers.php +++ b/src/components/com_cluster/administrator/controllers/clusterusers.php @@ -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)); } diff --git a/src/components/com_cluster/administrator/helpers/cluster.php b/src/components/com_cluster/administrator/helpers/cluster.php index ef1f44a..7cf6f43 100644 --- a/src/components/com_cluster/administrator/helpers/cluster.php +++ b/src/components/com_cluster/administrator/helpers/cluster.php @@ -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; @@ -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' ); @@ -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)) { @@ -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); } diff --git a/src/components/com_cluster/administrator/libraries/cluster.php b/src/components/com_cluster/administrator/libraries/cluster.php index e2877c3..adfa968 100644 --- a/src/components/com_cluster/administrator/libraries/cluster.php +++ b/src/components/com_cluster/administrator/libraries/cluster.php @@ -8,6 +8,7 @@ */ defined('_JEXEC') or die('Unauthorized Access'); +use Joomla\CMS\Language\Text; use Joomla\CMS\Factory; use Joomla\CMS\Object\CMSObject; @@ -192,7 +193,7 @@ public function bind(&$array) { if (empty($array)) { - $this->setError(JText::_('COM_CLUSTER_EMPTY_DATA')); + $this->setError(Text::_('COM_CLUSTER_EMPTY_DATA')); return false; } @@ -200,7 +201,7 @@ public function bind(&$array) // Bind the array if (!$this->setProperties($array)) { - $this->setError(\JText::_('COM_CLUSTER_BINDING_ERROR')); + $this->setError(\Text::_('COM_CLUSTER_BINDING_ERROR')); return false; } diff --git a/src/components/com_cluster/administrator/models/clusters.php b/src/components/com_cluster/administrator/models/clusters.php index 803e2af..f46023d 100644 --- a/src/components/com_cluster/administrator/models/clusters.php +++ b/src/components/com_cluster/administrator/models/clusters.php @@ -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; @@ -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 */ diff --git a/src/components/com_cluster/administrator/models/clusteruser.php b/src/components/com_cluster/administrator/models/clusteruser.php index 15b46de..c743f35 100644 --- a/src/components/com_cluster/administrator/models/clusteruser.php +++ b/src/components/com_cluster/administrator/models/clusteruser.php @@ -8,6 +8,7 @@ */ defined('_JEXEC') or die; +use Joomla\CMS\Form\Form; use Joomla\CMS\Factory; use Joomla\CMS\MVC\Model\AdminModel; @@ -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 */ diff --git a/src/components/com_cluster/administrator/models/clusterusers.php b/src/components/com_cluster/administrator/models/clusterusers.php index b024aa5..c0792b2 100644 --- a/src/components/com_cluster/administrator/models/clusterusers.php +++ b/src/components/com_cluster/administrator/models/clusterusers.php @@ -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; @@ -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 */ diff --git a/src/components/com_cluster/administrator/views/cluster/view.html.php b/src/components/com_cluster/administrator/views/cluster/view.html.php index fe0e642..3734405 100644 --- a/src/components/com_cluster/administrator/views/cluster/view.html.php +++ b/src/components/com_cluster/administrator/views/cluster/view.html.php @@ -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; @@ -20,9 +26,9 @@ class ClusterViewCluster extends HtmlView { /** - * The JForm object + * The Form object * - * @var JForm + * @var Form */ protected $form; @@ -50,7 +56,7 @@ class ClusterViewCluster extends HtmlView /** * The actions the user is authorised to perform * - * @var JObject + * @var CMSObject */ protected $canDo; @@ -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'))) @@ -110,15 +116,15 @@ 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 { @@ -126,13 +132,13 @@ protected function addToolbar() // 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(); @@ -143,7 +149,7 @@ protected function addToolbar() $this->sidebar = JHtmlSidebar::render(); } - JToolbarHelper::divider(); + ToolbarHelper::divider(); } /** @@ -159,7 +165,7 @@ protected function canSave($checkedOut, $itemEditable) { if (!$checkedOut && $itemEditable) { - JToolbarHelper::save('cluster.save'); + ToolbarHelper::save('cluster.save'); } } diff --git a/src/components/com_cluster/administrator/views/clusters/view.html.php b/src/components/com_cluster/administrator/views/clusters/view.html.php index d31496f..4bb3d41 100644 --- a/src/components/com_cluster/administrator/views/clusters/view.html.php +++ b/src/components/com_cluster/administrator/views/clusters/view.html.php @@ -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 @@ -31,7 +37,7 @@ class ClusterViewClusters extends HtmlView /** * The pagination object * - * @var JPagination + * @var Pagination */ protected $pagination; @@ -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; @@ -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(); @@ -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(); } } @@ -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'), ); } } diff --git a/src/components/com_cluster/administrator/views/clusteruser/view.html.php b/src/components/com_cluster/administrator/views/clusteruser/view.html.php index 374f84a..8b87dea 100644 --- a/src/components/com_cluster/administrator/views/clusteruser/view.html.php +++ b/src/components/com_cluster/administrator/views/clusteruser/view.html.php @@ -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; @@ -20,9 +26,9 @@ class ClusterViewClusterUser extends HtmlView { /** - * The JForm object + * The Form object * - * @var JForm + * @var Form */ protected $form; @@ -50,7 +56,7 @@ class ClusterViewClusterUser extends HtmlView /** * The actions the user is authorised to perform * - * @var JObject + * @var CMSObject */ protected $canDo; @@ -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', 'clusteruser', $this->item->id); + $this->canDo = ContentHelper::getActions('com_cluster', 'clusteruser', $this->item->id); // Check for errors. if (count($errors = $this->get('Errors'))) @@ -108,27 +114,27 @@ 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'); @@ -136,7 +142,7 @@ protected function addToolbar() $this->sidebar = JHtmlSidebar::render(); } - JToolbarHelper::divider(); + ToolbarHelper::divider(); } /** @@ -152,7 +158,7 @@ protected function canSave($checkedOut, $itemEditable) { if (!$checkedOut && $itemEditable) { - JToolbarHelper::save('clusteruser.save'); + ToolbarHelper::save('clusteruser.save'); } } diff --git a/src/components/com_cluster/administrator/views/clusterusers/view.html.php b/src/components/com_cluster/administrator/views/clusterusers/view.html.php index 7816666..adc5956 100644 --- a/src/components/com_cluster/administrator/views/clusterusers/view.html.php +++ b/src/components/com_cluster/administrator/views/clusterusers/view.html.php @@ -9,6 +9,13 @@ // 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; @@ -30,7 +37,7 @@ class ClusterViewClusterUsers extends HtmlView /** * The pagination object * - * @var JPagination + * @var Pagination */ protected $pagination; @@ -44,14 +51,14 @@ class ClusterViewClusterUsers extends HtmlView /** * Form object for search filters * - * @var JForm + * @var Form */ public $filterForm; /** * Logged in User * - * @var JObject + * @var CMSObject */ public $user; @@ -92,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('clusterusers'); $this->addToolbar(); @@ -110,37 +117,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(); } } @@ -152,11 +159,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'), ); } } diff --git a/src/components/com_cluster/site/cluster.php b/src/components/com_cluster/site/cluster.php index 2700e1e..9a55871 100644 --- a/src/components/com_cluster/site/cluster.php +++ b/src/components/com_cluster/site/cluster.php @@ -7,6 +7,8 @@ */ defined('_JEXEC') or die; +use Joomla\CMS\MVC\Controller\BaseController; +use Joomla\CMS\Factory; // Include dependancies jimport('joomla.application.component.controller'); @@ -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(); diff --git a/src/components/com_cluster/site/controller.php b/src/components/com_cluster/site/controller.php index d4735e3..fab237e 100644 --- a/src/components/com_cluster/site/controller.php +++ b/src/components/com_cluster/site/controller.php @@ -8,8 +8,11 @@ // No direct access defined('_JEXEC') or die; +use Joomla\CMS\MVC\Controller\BaseController; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Factory; + -jimport('joomla.application.component.controller'); JLoader::import('components.com_cluster.includes.cluster', JPATH_ADMINISTRATOR); /** @@ -17,13 +20,13 @@ * * @since 1.0.0 */ -class ClusterController extends JControllerLegacy +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. * @@ -31,7 +34,7 @@ class ClusterController extends JControllerLegacy */ public function display($cachable = false, $urlparams = false) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $view = $app->input->getCmd('view', 'clusters'); $app->input->set('view', $view); diff --git a/src/components/com_cluster/site/router.php b/src/components/com_cluster/site/router.php index 73f26b8..827c3ee 100644 --- a/src/components/com_cluster/site/router.php +++ b/src/components/com_cluster/site/router.php @@ -8,6 +8,7 @@ // No direct access defined('_JEXEC') or die; +use Joomla\CMS\Component\Router\RouterBase; JLoader::registerPrefix('Cluster', JPATH_SITE . '/components/com_cluster/'); @@ -16,7 +17,7 @@ * * @since 1.0.0 */ -class ClusterRouter extends JComponentRouterBase +class ClusterRouter extends RouterBase { /** * Build method for URLs diff --git a/src/components/com_cluster/site/views/cluster/view.html.php b/src/components/com_cluster/site/views/cluster/view.html.php index c170105..42403c6 100644 --- a/src/components/com_cluster/site/views/cluster/view.html.php +++ b/src/components/com_cluster/site/views/cluster/view.html.php @@ -8,15 +8,14 @@ // No direct access defined('_JEXEC') or die; - -jimport('joomla.application.component.view'); +use Joomla\CMS\MVC\View\HtmlView; /** * View to edit * * @since 1.0.0 */ -class ClusterViewCluster extends JViewLegacy +class ClusterViewCluster extends HtmlView { protected $item; diff --git a/src/components/com_cluster/site/views/clusters/view.html.php b/src/components/com_cluster/site/views/clusters/view.html.php index 89e3983..6cee327 100644 --- a/src/components/com_cluster/site/views/clusters/view.html.php +++ b/src/components/com_cluster/site/views/clusters/view.html.php @@ -8,13 +8,19 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\MVC\View\HtmlView; +use Joomla\CMS\Pagination\Pagination; +use Joomla\CMS\Form\Form; +use Joomla\CMS\Object\CMSObject; +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; /** * Clusters view * * @since 1.0.0 */ -class ClusterViewClusters extends JViewLegacy +class ClusterViewClusters extends HtmlView { /** * An array of items @@ -26,7 +32,7 @@ class ClusterViewClusters extends JViewLegacy /** * The pagination object * - * @var JPagination + * @var Pagination */ protected $pagination; @@ -40,14 +46,14 @@ class ClusterViewClusters extends JViewLegacy /** * Form object for search filters * - * @var JForm + * @var Form */ public $filterForm; /** * Logged in User * - * @var JObject + * @var CMSObject */ public $user; @@ -122,7 +128,7 @@ public function display($tpl = null) $this->activeFilters = $this->get('ActiveFilters'); // Get ACL actions - $this->user = JFactory::getUser(); + $this->user = Factory::getUser(); $this->canCreate = $this->user->authorise('core.content.create', 'com_cluster'); $this->canEdit = $this->user->authorise('core.content.edit', 'com_cluster'); @@ -142,11 +148,11 @@ public function display($tpl = null) 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'), ); } }