From 5c59a7042efb0c915b378a60584b1662ca6c38ca Mon Sep 17 00:00:00 2001 From: kamalakanta Date: Thu, 11 May 2023 13:10:10 +0530 Subject: [PATCH 1/8] Task #198104 chore: comaptibleand code to joomla4 --- .../com_tjucm/administrator/controller.php | 11 ++- .../administrator/controllers/item.php | 77 ++++++++------- .../administrator/controllers/items.php | 35 +++---- .../administrator/controllers/type.php | 5 +- .../administrator/controllers/types.php | 42 +++++---- .../administrator/helpers/listhelper.php | 10 +- .../com_tjucm/administrator/helpers/tjucm.php | 13 ++- .../houseKeeping/1.1.0/ucmSubformData.php | 16 ++-- .../houseKeeping/1.2.3/updateClientName.php | 21 +++-- .../houseKeeping/1.2.4/updateAlias.php | 17 ++-- .../administrator/models/fields/createdby.php | 9 +- .../models/fields/custom_field.php | 5 +- .../models/fields/filemultiple.php | 4 +- .../models/fields/foreignkey.php | 14 +-- .../models/fields/modifiedby.php | 7 +- .../models/fields/timecreated.php | 13 ++- .../models/fields/timeupdated.php | 13 ++- .../administrator/models/fields/ucmtypes.php | 12 ++- .../com_tjucm/administrator/models/item.php | 36 ++++--- .../com_tjucm/administrator/models/items.php | 18 ++-- .../com_tjucm/administrator/models/type.php | 73 +++++++------- .../com_tjucm/administrator/models/types.php | 14 +-- .../com_tjucm/administrator/tables/item.php | 38 ++++---- .../com_tjucm/administrator/tables/type.php | 63 +++++++------ .../com_tjucm/administrator/tjucm.php | 13 +-- .../administrator/views/item/tmpl/edit.php | 57 ++++++----- .../views/item/tmpl/edit_extrafields.php | 13 ++- .../administrator/views/item/view.html.php | 32 ++++--- .../views/items/tmpl/default.php | 73 +++++++------- .../administrator/views/items/view.html.php | 53 ++++++----- .../administrator/views/type/tmpl/edit.php | 34 ++++--- .../administrator/views/type/view.html.php | 28 +++--- .../views/types/tmpl/default.php | 91 +++++++++--------- .../administrator/views/types/tmpl/import.php | 11 ++- .../administrator/views/types/view.html.php | 30 +++--- src/components/com_tjucm/site/controller.php | 11 ++- .../com_tjucm/site/controllers/item.php | 49 +++++----- .../site/controllers/itemform.json.php | 72 +++++++------- .../com_tjucm/site/controllers/itemform.php | 11 ++- .../com_tjucm/site/controllers/type.php | 16 ++-- .../com_tjucm/site/includes/access.php | 22 ++--- .../com_tjucm/site/includes/tjucm.php | 1 - .../com_tjucm/site/layouts/detail/fields.php | 16 ++-- .../com_tjucm/site/layouts/list/list.php | 14 +-- .../site/models/fields/createdby.php | 9 +- .../site/models/fields/filemultiple.php | 4 +- .../site/models/fields/foreignkey.php | 14 +-- .../site/models/fields/modifiedby.php | 7 +- .../com_tjucm/site/models/fields/submit.php | 11 ++- .../site/models/fields/timecreated.php | 13 ++- .../site/models/fields/timeupdated.php | 13 ++- src/components/com_tjucm/site/models/item.php | 41 ++++---- .../com_tjucm/site/models/itemform.php | 94 ++++++++++--------- .../com_tjucm/site/models/items.php | 51 +++++----- src/components/com_tjucm/site/router.php | 10 +- src/components/com_tjucm/site/tjucm.php | 16 ++-- .../site/views/item/tmpl/default.php | 25 +++-- .../com_tjucm/site/views/item/view.html.php | 41 ++++---- .../site/views/itemform/tmpl/default.php | 32 ++++--- .../itemform/tmpl/default_extrafields.php | 18 ++-- .../tmpl/default_extrafieldsaccordian.php | 12 ++- .../site/views/itemform/tmpl/default_grid.php | 18 ++-- .../site/views/itemform/view.html.php | 33 ++++--- .../site/views/items/tmpl/default.php | 73 +++++++------- .../site/views/items/tmpl/default_filter.php | 17 ++-- .../site/views/items/tmpl/default_filters.php | 45 +++++---- .../site/views/items/tmpl/importitems.php | 8 +- .../com_tjucm/site/views/items/view.html.php | 45 +++++---- 68 files changed, 1038 insertions(+), 825 deletions(-) diff --git a/src/components/com_tjucm/administrator/controller.php b/src/components/com_tjucm/administrator/controller.php index 1aea136c..c5510764 100644 --- a/src/components/com_tjucm/administrator/controller.php +++ b/src/components/com_tjucm/administrator/controller.php @@ -10,19 +10,22 @@ // No direct access defined('_JEXEC') or die; +use Joomla\CMS\MVC\Controller\BaseController; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Factory; /** * Class TjucmController * * @since 1.6 */ -class TjucmController extends JControllerLegacy +class TjucmController 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. * @@ -30,8 +33,8 @@ class TjucmController extends JControllerLegacy */ public function display($cachable = false, $urlparams = false) { - $view = JFactory::getApplication()->input->getCmd('view', 'types'); - JFactory::getApplication()->input->set('view', $view); + $view = Factory::getApplication()->input->getCmd('view', 'types'); + Factory::getApplication()->input->set('view', $view); parent::display($cachable, $urlparams); diff --git a/src/components/com_tjucm/administrator/controllers/item.php b/src/components/com_tjucm/administrator/controllers/item.php index 3e7675ca..707b6330 100644 --- a/src/components/com_tjucm/administrator/controllers/item.php +++ b/src/components/com_tjucm/administrator/controllers/item.php @@ -10,15 +10,20 @@ // No direct access defined('_JEXEC') or die; +use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\Factory; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Filesystem\File; -jimport('joomla.application.component.controllerform'); /** * Item controller class. * * @since 1.6 */ -class TjucmControllerItem extends JControllerForm +class TjucmControllerItem extends FormController { /** * Constructor @@ -29,11 +34,11 @@ public function __construct() { $this->view_list = 'items'; - $this->client = JFactory::getApplication()->input->get('client'); + $this->client = Factory::getApplication()->input->get('client'); if (empty($this->client)) { - $this->client = JFactory::getApplication()->input->get('jform', array(), 'array')['client']; + $this->client = Factory::getApplication()->input->get('jform', array(), 'array')['client']; } parent::__construct(); @@ -59,10 +64,10 @@ public function apply() */ public function edit($key = null, $urlVar = null) { - $input = JFactory::getApplication()->input; + $input = Factory::getApplication()->input; $cid = $input->post->get('cid', array(), 'array'); $recordId = (int) (count($cid) ? $cid[0] : $input->getInt('id')); - $link = JRoute::_('index.php?option=com_tjucm&view=item&layout=edit&id=' . $recordId . '&client=' . $this->client, false); + $link = Route::_('index.php?option=com_tjucm&view=item&layout=edit&id=' . $recordId . '&client=' . $this->client, false); $this->setRedirect($link); } @@ -82,11 +87,11 @@ public function add() if (!$this->allowAdd()) { // Set the internal error and also the redirect error. - $this->setError(JText::_('JLIB_APPLICATION_ERROR_CREATE_RECORD_NOT_PERMITTED')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_CREATE_RECORD_NOT_PERMITTED')); $this->setMessage($this->getError(), 'error'); $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . '&view=' . $this->view_list . '&client=' . $this->client . $this->getRedirectToListAppend(), false ) @@ -96,11 +101,11 @@ public function add() } // Clear the record edit information from the session. - JFactory::getApplication()->setUserState($context . '.data', null); + Factory::getApplication()->setUserState($context . '.data', null); // Redirect to the edit screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . '&view=' . $this->view_item . '&client=' . $this->client . $this->getRedirectToItemAppend(), false ) @@ -120,7 +125,7 @@ public function add() */ public function cancel($key = null) { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); $model = $this->getModel(); $table = $model->getTable(); @@ -141,11 +146,11 @@ public function cancel($key = null) if ($model->checkin($recordId) === false) { // Check-in failed, go back to the record and display a notice. - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_CHECKIN_FAILED', $model->getError())); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_CHECKIN_FAILED', $model->getError())); $this->setMessage($this->getError(), 'error'); $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . '&view=' . $this->view_item . '&client=' . $this->client . $this->getRedirectToItemAppend($recordId, $key), false ) @@ -158,10 +163,10 @@ public function cancel($key = null) // Clean the session data and redirect. $this->releaseEditId($context, $recordId); - JFactory::getApplication()->setUserState($context . '.data', null); + Factory::getApplication()->setUserState($context . '.data', null); $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . '&view=' . $this->view_list . '&client=' . $this->client . $this->getRedirectToListAppend(), false ) @@ -183,9 +188,9 @@ public function cancel($key = null) public function save($key = null, $urlVar = null) { // Check for request forgeries. - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); - $app = JFactory::getApplication(); - $lang = JFactory::getLanguage(); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); + $app = Factory::getApplication(); + $lang = Factory::getLanguage(); $model = $this->getModel(); // Set client value @@ -194,11 +199,11 @@ public function save($key = null, $urlVar = null) $table = $model->getTable(); // Get the user data. - $data = JFactory::getApplication()->input->get('jform', array(), 'array'); + $data = Factory::getApplication()->input->get('jform', array(), 'array'); $all_jform_data = $data; // Jform tweak - Get all posted data. - $post = JFactory::getApplication()->input->post; + $post = Factory::getApplication()->input->post; $checkin = property_exists($table, 'checked_out'); $context = "$this->option.edit.$this->context"; @@ -228,11 +233,11 @@ public function save($key = null, $urlVar = null) if ($checkin && $model->checkin($data[$key]) === false) { // Check-in failed. Go back to the item and display a notice. - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_CHECKIN_FAILED', $model->getError())); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_CHECKIN_FAILED', $model->getError())); $this->setMessage($this->getError(), 'error'); $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . '&view=' . $this->view_item . '&client=' . $this->client . $this->getRedirectToItemAppend($recordId, $urlVar), false ) @@ -250,11 +255,11 @@ public function save($key = null, $urlVar = null) // Access check. if (!$this->allowSave($data, $key)) { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_SAVE_NOT_PERMITTED')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_SAVE_NOT_PERMITTED')); $this->setMessage($this->getError(), 'error'); $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . '&view=' . $this->view_list . $this->getRedirectToListAppend(), false ) @@ -301,7 +306,7 @@ public function save($key = null, $urlVar = null) // Redirect back to the edit screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . '&view=' . $this->view_item . '&client=' . $this->client . $this->getRedirectToItemAppend($recordId, $urlVar), false ) @@ -321,7 +326,7 @@ public function save($key = null, $urlVar = null) $filePath = JPATH_ADMINISTRATOR . '/components/com_tjucm/models/forms/' . $client[1] . '_extra.xml'; - if (JFile::exists($filePath)) + if (File::exists($filePath)) { // Validate the posted data. $formExtra = $model->getFormExtra( @@ -384,7 +389,7 @@ public function save($key = null, $urlVar = null) // Redirect back to the edit screen. $id = (int) $app->getUserState('com_tjucm.edit.item.id'); - $this->setRedirect(JRoute::_('index.php?option=com_tjucm&view=itemform&layout=edit&client=' . $this->client . '&id=' . $id, false)); + $this->setRedirect(Route::_('index.php?option=com_tjucm&view=itemform&layout=edit&client=' . $this->client . '&id=' . $id, false)); return false; } @@ -402,11 +407,11 @@ public function save($key = null, $urlVar = null) $app->setUserState($context . '.data', $validData); // Redirect back to the edit screen. - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_SAVE_FAILED', $model->getError())); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_SAVE_FAILED', $model->getError())); $this->setMessage($this->getError(), 'error'); $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . '&view=' . $this->view_item . '&client=' . $this->client . $this->getRedirectToItemAppend($recordId, $urlVar), false ) @@ -422,11 +427,11 @@ public function save($key = null, $urlVar = null) $app->setUserState($context . '.data', $validData); // Check-in failed, so go back to the record and display a notice. - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_CHECKIN_FAILED', $model->getError())); + $this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_CHECKIN_FAILED', $model->getError())); $this->setMessage($this->getError(), 'error'); $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . '&view=' . $this->view_item . '&client=' . $this->client . $this->getRedirectToItemAppend($recordId, $urlVar), false ) @@ -436,9 +441,9 @@ public function save($key = null, $urlVar = null) } $langKey = $this->text_prefix . ($recordId == 0 && $app->isSite() ? '_SUBMIT' : '') . '_SAVE_SUCCESS'; - $prefix = JFactory::getLanguage()->hasKey($langKey) ? $this->text_prefix : 'JLIB_APPLICATION'; + $prefix = Factory::getLanguage()->hasKey($langKey) ? $this->text_prefix : 'JLIB_APPLICATION'; - $this->setMessage(JText::_($prefix . ($recordId == 0 && $app->isSite() ? '_SUBMIT' : '') . '_SAVE_SUCCESS')); + $this->setMessage(Text::_($prefix . ($recordId == 0 && $app->isSite() ? '_SUBMIT' : '') . '_SAVE_SUCCESS')); // Redirect the user and adjust session state based on the chosen task. switch ($task) @@ -452,7 +457,7 @@ public function save($key = null, $urlVar = null) // Redirect back to the edit screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . '&view=' . $this->view_item . '&client=' . $this->client . $this->getRedirectToItemAppend($recordId, $urlVar), false ) @@ -467,7 +472,7 @@ public function save($key = null, $urlVar = null) // Redirect back to the edit screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . '&view=' . $this->view_item . '&client=' . $this->client . $this->getRedirectToItemAppend(null, $urlVar), false ) @@ -482,7 +487,7 @@ public function save($key = null, $urlVar = null) // Redirect to the list screen. $this->setRedirect( - JRoute::_( + Route::_( 'index.php?option=' . $this->option . '&view=' . $this->view_list . '&client=' . $this->client . $this->getRedirectToListAppend(), false ) diff --git a/src/components/com_tjucm/administrator/controllers/items.php b/src/components/com_tjucm/administrator/controllers/items.php index 8b12f8eb..557e7aff 100644 --- a/src/components/com_tjucm/administrator/controllers/items.php +++ b/src/components/com_tjucm/administrator/controllers/items.php @@ -10,9 +10,12 @@ // No direct access. defined('_JEXEC') or die; - -jimport('joomla.application.component.controlleradmin'); - +use Joomla\CMS\MVC\Controller\AdminController; +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Log\Log; +use Joomla\CMS\Router\Route; use Joomla\Utilities\ArrayHelper; /** @@ -20,7 +23,7 @@ * * @since 1.6 */ -class TjucmControllerItems extends JControllerAdmin +class TjucmControllerItems extends AdminController { /** * Constructor @@ -31,11 +34,11 @@ public function __construct() { // $this->view_list = 'items'; - $this->client = JFactory::getApplication()->input->get('client'); + $this->client = Factory::getApplication()->input->get('client'); if (empty($this->client)) { - $this->client = JFactory::getApplication()->input->get('jform', array(), 'array')['client']; + $this->client = Factory::getApplication()->input->get('jform', array(), 'array')['client']; } parent::__construct(); @@ -49,7 +52,7 @@ public function __construct() public function duplicate() { // Check for request forgeries - Jsession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Jsession::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Get id(s) $pks = $this->input->post->get('cid', array(), 'array'); @@ -58,7 +61,7 @@ public function duplicate() { if (empty($pks)) { - throw new Exception(JText::_('COM_TJUCM_NO_ELEMENT_SELECTED')); + throw new Exception(Text::_('COM_TJUCM_NO_ELEMENT_SELECTED')); } ArrayHelper::toInteger($pks); @@ -68,7 +71,7 @@ public function duplicate() } catch (Exception $e) { - JFactory::getApplication()->enqueueMessage($e->getMessage(), 'warning'); + Factory::getApplication()->enqueueMessage($e->getMessage(), 'warning'); } $this->setRedirect('index.php?option=com_tjucm&view=items' . $this->client); @@ -102,7 +105,7 @@ public function getModel($name = 'item', $prefix = 'TjucmModel', $config = array public function saveOrderAjax() { // Get the input - $input = JFactory::getApplication()->input; + $input = Factory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); $order = $input->post->get('order', array(), 'array'); @@ -122,7 +125,7 @@ public function saveOrderAjax() } // Close the application - JFactory::getApplication()->close(); + Factory::getApplication()->close(); } /** @@ -135,14 +138,14 @@ public function saveOrderAjax() public function delete() { // Check for request forgeries - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Get items to remove from the request. - $cid = JFactory::getApplication()->input->get('cid', array(), 'array'); + $cid = Factory::getApplication()->input->get('cid', array(), 'array'); if (!is_array($cid) || count($cid) < 1) { - JLog::add(JText::_($this->text_prefix . '_NO_ITEM_SELECTED'), JLog::WARNING, 'jerror'); + Log::add(Text::_($this->text_prefix . '_NO_ITEM_SELECTED'), Log::WARNING, 'jerror'); } else { @@ -159,7 +162,7 @@ public function delete() // Remove the items. if ($model->delete($cid)) { - $this->setMessage(JText::plural($this->text_prefix . '_N_ITEMS_DELETED', count($cid))); + $this->setMessage(Text::plural($this->text_prefix . '_N_ITEMS_DELETED', count($cid))); } else { @@ -170,6 +173,6 @@ public function delete() $this->postDeleteHook($model, $cid); } - $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list . '&client=' . $this->client, false)); + $this->setRedirect(Route::_('index.php?option=' . $this->option . '&view=' . $this->view_list . '&client=' . $this->client, false)); } } diff --git a/src/components/com_tjucm/administrator/controllers/type.php b/src/components/com_tjucm/administrator/controllers/type.php index de7bcf2c..e00740ab 100644 --- a/src/components/com_tjucm/administrator/controllers/type.php +++ b/src/components/com_tjucm/administrator/controllers/type.php @@ -10,15 +10,14 @@ // No direct access defined('_JEXEC') or die; - -jimport('joomla.application.component.controllerform'); +use Joomla\CMS\MVC\Controller\FormController; /** * Type controller class. * * @since 1.6 */ -class TjucmControllerType extends JControllerForm +class TjucmControllerType extends FormController { /** * Constructor diff --git a/src/components/com_tjucm/administrator/controllers/types.php b/src/components/com_tjucm/administrator/controllers/types.php index dd832451..e795eec9 100644 --- a/src/components/com_tjucm/administrator/controllers/types.php +++ b/src/components/com_tjucm/administrator/controllers/types.php @@ -10,9 +10,11 @@ // No direct access. defined('_JEXEC') or die; - -jimport('joomla.application.component.controlleradmin'); - +use Joomla\CMS\MVC\Controller\AdminController; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; +use Joomla\CMS\HTML\HTMLHelper; +use Joomla\CMS\Uri\Uri; +use Joomla\CMS\Router\Route; use Joomla\Utilities\ArrayHelper; use Joomla\CMS\Factory; use Joomla\CMS\Session\Session; @@ -27,7 +29,7 @@ * * @since 1.6 */ -class TjucmControllerTypes extends JControllerAdmin +class TjucmControllerTypes extends AdminController { use TjControllerHouseKeeping; @@ -128,7 +130,7 @@ public function export() Session::checkToken('get') or jexit(Text::_('JINVALID_TOKEN')); JLoader::import('components.com_tjucm.tables.type', JPATH_ADMINISTRATOR); - JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tjfields/models'); + BaseDatabaseModel::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tjfields/models'); $app = Factory::getApplication(); $input = $app->input; $cids = $input->get('cid', array(), 'ARRAY'); @@ -141,7 +143,7 @@ public function export() $ucmTypeTable->load(array("id" => $cid)); $ucmTypeData = (object) $ucmTypeTable->getProperties(); - $tjFieldsGroupsModel = JModelLegacy::getInstance('Groups', 'TjfieldsModel', array('ignore_request' => true)); + $tjFieldsGroupsModel = BaseDatabaseModel::getInstance('Groups', 'TjfieldsModel', array('ignore_request' => true)); $tjFieldsGroupsModel->setState('list.ordering', 'a.ordering'); $tjFieldsGroupsModel->setState('list.direction', 'asc'); $tjFieldsGroupsModel->setState("filter.client", $ucmTypeData->unique_identifier); @@ -152,7 +154,7 @@ public function export() // Getting fields of fieldGroups foreach ($fieldGroups as $groupKey => $groupValue) { - $tjFieldsFieldsModel = JModelLegacy::getInstance('Fields', 'TjfieldsModel', array('ignore_request' => true)); + $tjFieldsFieldsModel = BaseDatabaseModel::getInstance('Fields', 'TjfieldsModel', array('ignore_request' => true)); $tjFieldsFieldsModel->setState("filter.group_id", $fieldGroups[$groupKey]->id); $tjFieldsFieldsModel->setState('list.ordering', 'a.ordering'); $tjFieldsFieldsModel->setState('list.direction', 'asc'); @@ -163,7 +165,7 @@ public function export() // Getting options of field foreach ($fields as $fieldKey => $fieldValue) { - $tjFieldsOptionsModel = JModelLegacy::getInstance('Options', 'TjfieldsModel', array('ignore_request' => true)); + $tjFieldsOptionsModel = BaseDatabaseModel::getInstance('Options', 'TjfieldsModel', array('ignore_request' => true)); $tjFieldsOptionsModel->setState("filter.field_id", $fields[$fieldKey]->id); // Variable to store Options of Field @@ -188,8 +190,8 @@ public function export() $jsonExportData = json_encode($exportData); header("Content-type: application/vnd.ms-excel"); - header("Content-disposition: json" . JHtml::date('now', 'Y-M-D-H-i-s', true) . ".json"); - header("Content-disposition: filename=" . 'ucmTypeData' . JHtml::date('now', 'Y-M-D-H-i-s', true) . ".json"); + header("Content-disposition: json" . HTMLHelper::date('now', 'Y-M-D-H-i-s', true) . ".json"); + header("Content-disposition: filename=" . 'ucmTypeData' . HTMLHelper::date('now', 'Y-M-D-H-i-s', true) . ".json"); ob_clean(); echo $jsonExportData; @@ -198,7 +200,7 @@ public function export() else { $app->enqueueMessage(Text::_('COM_TJUCM_SOMETHING_WENT_WRONG'), 'error'); - $link = JUri::base() . substr(JRoute::_('index.php?option=com_tjucm&view=types&layout=default', false), strlen(JUri::base(true)) + 1); + $link = Uri::base() . substr(Route::_('index.php?option=com_tjucm&view=types&layout=default', false), strlen(Uri::base(true)) + 1); $this->setRedirect($link); } } @@ -216,8 +218,8 @@ public function import() Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); JLoader::import('components.com_tjucm.tables.type', JPATH_ADMINISTRATOR); - JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tjfields/models'); - JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tjucm/models'); + BaseDatabaseModel::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tjfields/models'); + BaseDatabaseModel::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tjucm/models'); $app = Factory::getApplication(); $input = $app->input; @@ -229,7 +231,7 @@ public function import() if ($importFile['type'] != "application/json") { $app->enqueueMessage(Text::_('COM_TJUCM_TYPE_IMPORT_INVALID_FILE_UPLOAD_ERROR'), 'error'); - $app->redirect(JUri::root() . 'administrator/index.php?option=com_tjucm&view=types&layout=import&tmpl=component'); + $app->redirect(Uri::root() . 'administrator/index.php?option=com_tjucm&view=types&layout=import&tmpl=component'); } $uploadPath = $safefilename = Factory::getConfig()->get('tmp_path') . '/' . File::makeSafe($importFile['name']); @@ -238,7 +240,7 @@ public function import() if (!File::upload($importFile['tmp_name'], $uploadPath)) { $app->enqueueMessage(Text::_('COM_TJUCM_TYPE_IMPORT_FILE_UPLOAD_ERROR'), 'error'); - $app->redirect(JUri::root() . 'administrator/index.php?option=com_tjucm&view=types&layout=import&tmpl=component'); + $app->redirect(Uri::root() . 'administrator/index.php?option=com_tjucm&view=types&layout=import&tmpl=component'); } // Read the file @@ -248,7 +250,7 @@ public function import() if ($ucmTypesData === null) { $app->enqueueMessage(Text::_('COM_TJUCM_TYPE_IMPORT_INVALID_FILE_CONTENT_ERROR'), 'error'); - $app->redirect(JUri::root() . 'administrator/index.php?option=com_tjucm&view=types&layout=import&tmpl=component'); + $app->redirect(Uri::root() . 'administrator/index.php?option=com_tjucm&view=types&layout=import&tmpl=component'); } foreach ($ucmTypesData as $ucmTypeData) @@ -284,7 +286,7 @@ public function import() $ucmTypeData['created_date'] = Factory::getDate()->toSql(true); // Add record in ucm type table - $tjUcmTypeModel = JModelLegacy::getInstance('Type', 'TjucmModel', array('ignore_request' => true)); + $tjUcmTypeModel = BaseDatabaseModel::getInstance('Type', 'TjucmModel', array('ignore_request' => true)); $tjUcmTypeModel->save($ucmTypeData); $ucmTypeId = (int) $tjUcmTypeModel->getState($tjUcmTypeModel->getName() . '.id'); @@ -302,7 +304,7 @@ public function import() $fieldGroupData['asset_id'] = ''; $fieldGroupData['created_by'] = $user->id; - $tjFieldsGroupModel = JModelLegacy::getInstance('Group', 'TjfieldsModel', array('ignore_request' => true)); + $tjFieldsGroupModel = BaseDatabaseModel::getInstance('Group', 'TjfieldsModel', array('ignore_request' => true)); $tjFieldsGroupModel->save($fieldGroupData); $fieldGroupId = (int) $tjFieldsGroupModel->getState($tjFieldsGroupModel->getName() . '.id'); @@ -348,7 +350,7 @@ public function import() $input->post->set('client_type', end(explode(".", $ucmTypeData['unique_identifier']))); - $tjFieldsFieldModel = JModelLegacy::getInstance('Field', 'TjfieldsModel', array('ignore_request' => true)); + $tjFieldsFieldModel = BaseDatabaseModel::getInstance('Field', 'TjfieldsModel', array('ignore_request' => true)); $tjFieldsFieldModel->save($field); $fieldId = (int) $tjFieldsFieldModel->getState($tjFieldsFieldModel->getName() . '.id'); $input->post->set('client_type', ''); @@ -373,6 +375,6 @@ public function import() } $app->enqueueMessage(Text::_('COM_TJUCM_TYPE_IMPORT_SUCCESS_MSG'), 'success'); - $app->redirect(JUri::root() . 'administrator/index.php?option=com_tjucm&view=types&layout=import&tmpl=component'); + $app->redirect(Uri::root() . 'administrator/index.php?option=com_tjucm&view=types&layout=import&tmpl=component'); } } diff --git a/src/components/com_tjucm/administrator/helpers/listhelper.php b/src/components/com_tjucm/administrator/helpers/listhelper.php index 37c01dcb..c2b4bda0 100644 --- a/src/components/com_tjucm/administrator/helpers/listhelper.php +++ b/src/components/com_tjucm/administrator/helpers/listhelper.php @@ -10,13 +10,15 @@ // No direct access defined('_JEXEC') or die; +use Joomla\CMS\HTML\HTMLHelper; +use Joomla\CMS\Language\Text; /** * Tjucm Listhelper. * * @since 1.6 */ -abstract class JHtmlListhelper +abstract class HTMLHelperListhelper { /** * Function to toggle @@ -33,15 +35,15 @@ abstract class JHtmlListhelper public static function toggle($value = 0, $view = '', $field = '', $i = '') { $states = array( - 0 => array('icon-remove', JText::_('Toggle'), 'inactive btn-danger'), - 1 => array('icon-checkmark', JText::_('Toggle'), 'active btn-success'), + 0 => array('icon-remove', Text::_('Toggle'), 'inactive btn-danger'), + 1 => array('icon-checkmark', Text::_('Toggle'), 'active btn-success'), ); $state = \Joomla\Utilities\ArrayHelper::getValue($states, (int) $value, $states[0]); $text = ''; $html = '' . $text . ''; + . $view . '.toggle\',\'' . $field . '\')" title="' . Text::_($state[1]) . '">' . $text . ''; return $html; } diff --git a/src/components/com_tjucm/administrator/helpers/tjucm.php b/src/components/com_tjucm/administrator/helpers/tjucm.php index 645a9c34..aee0c7bf 100644 --- a/src/components/com_tjucm/administrator/helpers/tjucm.php +++ b/src/components/com_tjucm/administrator/helpers/tjucm.php @@ -10,13 +10,18 @@ // No direct access defined('_JEXEC') or die; +use Joomla\CMS\Helper\ContentHelper; +use Joomla\CMS\HTML\HTMLHelper; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Factory; +use Joomla\CMS\Object\CMSObject; /** * Tjucm helper. * * @since 1.6 */ -class TjucmHelper extends JHelperContent +class TjucmHelper extends ContentHelper { /** * Configure the Linkbar. @@ -28,7 +33,7 @@ class TjucmHelper extends JHelperContent public static function addSubmenu($vName = '') { JHtmlSidebar::addEntry( - JText::_('COM_TJUCM_TITLE_TYPES'), + Text::_('COM_TJUCM_TITLE_TYPES'), 'index.php?option=com_tjucm&view=types', $vName == 'types' ); @@ -47,7 +52,7 @@ public static function addSubmenu($vName = '') */ public static function getFiles($pk, $table, $field) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true); $query @@ -67,7 +72,7 @@ public static function getFiles($pk, $table, $field) * @param string $section The access section name. * @param integer $id The item ID. * - * @return JObject + * @return CMSObject * * @since 3.2 */ diff --git a/src/components/com_tjucm/administrator/houseKeeping/1.1.0/ucmSubformData.php b/src/components/com_tjucm/administrator/houseKeeping/1.1.0/ucmSubformData.php index 28a9cc9b..2cb0f035 100644 --- a/src/components/com_tjucm/administrator/houseKeeping/1.1.0/ucmSubformData.php +++ b/src/components/com_tjucm/administrator/houseKeeping/1.1.0/ucmSubformData.php @@ -10,10 +10,10 @@ // No direct access defined('_JEXEC') or die('Restricted access'); - -use Joomla\Registry\Registry; use Joomla\CMS\Factory; use Joomla\CMS\MVC\Model\BaseDatabaseModel; +use Joomla\CMS\Table\Table; +use Joomla\Registry\Registry; /** * Migration file for TJ-UCM @@ -172,7 +172,7 @@ public function migrate() */ public function saveUcmSubFormRecords(&$validData, $ucmSubFormDataSet, $ucmTypeId) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $subFormContentIds = array(); $isNew = empty($validData['id']) ? 1 : 0; @@ -189,8 +189,8 @@ public function saveUcmSubFormRecords(&$validData, $ucmSubFormDataSet, $ucmTypeI JLoader::import('components.com_tjfields.tables.fieldsvalue', JPATH_ADMINISTRATOR); JLoader::import('components.com_tjfields.tables.field', JPATH_ADMINISTRATOR); - JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tjucm/models'); - $tjUcmModelType = JModelLegacy::getInstance('Type', 'TjucmModel'); + BaseDatabaseModel::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tjucm/models'); + $tjUcmModelType = BaseDatabaseModel::getInstance('Type', 'TjucmModel'); $itemFormModel = BaseDatabaseModel::getInstance('ItemForm', 'TjucmModel', array('ignore_request' => true)); $itemFormModel->setState('ucmType.id', $ucmTypeId); @@ -223,11 +223,11 @@ public function saveUcmSubFormRecords(&$validData, $ucmSubFormDataSet, $ucmTypeI $ucmSubFormData[$ucmSubformContentIdFieldName] = $insertedId; // Get field id of contentid field - $fieldTable = JTable::getInstance('Field', 'TjfieldsTable', array('dbo', $db)); + $fieldTable = Table::getInstance('Field', 'TjfieldsTable', array('dbo', $db)); $fieldTable->load(array('name' => $ucmSubformContentIdFieldName)); // Add-Update the value of content id field in the fields value table - start - $fieldsValueTable = JTable::getInstance('Fieldsvalue', 'TjfieldsTable', array('dbo', $db)); + $fieldsValueTable = Table::getInstance('Fieldsvalue', 'TjfieldsTable', array('dbo', $db)); $fieldsValueTable->load(array('field_id' => $fieldTable->id, 'content_id' => $insertedId, 'client' => $validData['client'])); if (empty($fieldsValueTable->id)) @@ -237,7 +237,7 @@ public function saveUcmSubFormRecords(&$validData, $ucmSubFormDataSet, $ucmTypeI $fieldsValueTable->client = $validData['client']; } - $fieldsValueTable->user_id = JFactory::getUser()->id; + $fieldsValueTable->user_id = Factory::getUser()->id; $fieldsValueTable->store(); // Add-Update the value of content id field in the fields value table - end diff --git a/src/components/com_tjucm/administrator/houseKeeping/1.2.3/updateClientName.php b/src/components/com_tjucm/administrator/houseKeeping/1.2.3/updateClientName.php index 3cd32a52..5be86633 100644 --- a/src/components/com_tjucm/administrator/houseKeeping/1.2.3/updateClientName.php +++ b/src/components/com_tjucm/administrator/houseKeeping/1.2.3/updateClientName.php @@ -10,9 +10,10 @@ // No direct access defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Table\Table; +use Joomla\CMS\Factory; use Joomla\Registry\Registry; -use Joomla\CMS\Factory; use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\CMS\Filesystem\File; @@ -36,8 +37,8 @@ class TjHouseKeepingUpdateClientName extends TjModelHouseKeeping */ public function migrate() { - JTable::addIncludePath(JPATH_ROOT . '/administrator/components/com_tjucm/tables'); - JTable::addIncludePath(JPATH_ROOT . '/administrator/components/com_tjfields/tables'); + Table::addIncludePath(JPATH_ROOT . '/administrator/components/com_tjucm/tables'); + Table::addIncludePath(JPATH_ROOT . '/administrator/components/com_tjfields/tables'); JLoader::import('components.com_tjfields.helpers.tjfields', JPATH_ADMINISTRATOR); // TJ-Fields helper object @@ -49,14 +50,14 @@ public function migrate() try { // Get all the UCM types - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true); $query->select('*'); $query->from($db->qn('#__tj_ucm_types')); $db->setQuery($query); $ucmTypes = $db->loadObjectlist(); - $session = JFactory::getSession(); + $session = Factory::getSession(); $updatedTypes = (empty($session->get('updatedTypes'))) ? array() : $session->get('updatedTypes'); if (!empty($ucmTypes)) @@ -68,7 +69,7 @@ public function migrate() continue; } - $ucmTypeTable = JTable::getInstance('Type', 'TjucmTable', array('dbo', $db)); + $ucmTypeTable = Table::getInstance('Type', 'TjucmTable', array('dbo', $db)); $ucmTypeTable->load($ucmType->id); $updatedUniqueIdentifier = 'com_tjucm.' . preg_replace("/[^a-zA-Z0-9]/", "", str_replace('com_tjucm.', '', $ucmTypeTable->unique_identifier)); $ucmTypeParams = new Registry($ucmType->params); @@ -89,7 +90,7 @@ public function migrate() foreach ($fieldGroups as $fieldGroup) { - $tjfieldsGroupTable = JTable::getInstance('Group', 'TjfieldsTable', array('dbo', $db)); + $tjfieldsGroupTable = Table::getInstance('Group', 'TjfieldsTable', array('dbo', $db)); $tjfieldsGroupTable->load($fieldGroup->id); $tjfieldsGroupTable->client = $updatedUniqueIdentifier; @@ -106,7 +107,7 @@ public function migrate() foreach ($fields as $field) { - $tjfieldsFieldTable = JTable::getInstance('Field', 'TjfieldsTable', array('dbo', $db)); + $tjfieldsFieldTable = Table::getInstance('Field', 'TjfieldsTable', array('dbo', $db)); $tjfieldsFieldTable->load($field->id); $tjfieldsFieldTable->client = $updatedUniqueIdentifier; @@ -190,7 +191,7 @@ public function migrate() foreach ($ucmSubFormFields as $ucmSubFormField) { - $tjfieldsFieldTable = JTable::getInstance('Field', 'TjfieldsTable', array('dbo', $db)); + $tjfieldsFieldTable = Table::getInstance('Field', 'TjfieldsTable', array('dbo', $db)); $tjfieldsFieldTable->load($ucmSubFormField->id); $tjfieldsFieldTable->params = str_replace($oldFileName, $newFileName, $tjfieldsFieldTable->params); $tjfieldsFieldTable->store(); @@ -209,7 +210,7 @@ public function migrate() foreach ($formFields as $formField) { - $tjfieldsFieldTable = JTable::getInstance('Field', 'TjfieldsTable', array('dbo', $db)); + $tjfieldsFieldTable = Table::getInstance('Field', 'TjfieldsTable', array('dbo', $db)); $tjfieldsFieldTable->load($formField->id); $fieldParams = new Registry($tjfieldsFieldTable->params); diff --git a/src/components/com_tjucm/administrator/houseKeeping/1.2.4/updateAlias.php b/src/components/com_tjucm/administrator/houseKeeping/1.2.4/updateAlias.php index 95c61ddc..5318ad8e 100644 --- a/src/components/com_tjucm/administrator/houseKeeping/1.2.4/updateAlias.php +++ b/src/components/com_tjucm/administrator/houseKeeping/1.2.4/updateAlias.php @@ -10,6 +10,9 @@ // No direct access defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Table\Table; +use Joomla\CMS\Factory; +use Joomla\CMS\Filter\OutputFilter; /** * Migration file for TJ-UCM @@ -31,8 +34,8 @@ class TjHouseKeepingUpdateAlias extends TjModelHouseKeeping */ public function migrate() { - JTable::addIncludePath(JPATH_ROOT . '/administrator/components/com_tjucm/tables'); - JTable::addIncludePath(JPATH_ROOT . '/administrator/components/com_menus/tables'); + Table::addIncludePath(JPATH_ROOT . '/administrator/components/com_tjucm/tables'); + Table::addIncludePath(JPATH_ROOT . '/administrator/components/com_menus/tables'); JLoader::import('components.com_tjfields.helpers.tjfields', JPATH_ADMINISTRATOR); // TJ-Fields helper object @@ -43,7 +46,7 @@ public function migrate() try { // Get all the UCM types - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true); $query->select('*'); $query->from($db->qn('#__tj_ucm_types')); @@ -54,11 +57,11 @@ public function migrate() { foreach ($ucmTypes as $ucmType) { - $ucmTypeTable = JTable::getInstance('Type', 'TjucmTable', array('dbo', $db)); + $ucmTypeTable = Table::getInstance('Type', 'TjucmTable', array('dbo', $db)); $ucmTypeTable->load($ucmType->id); // Remove white spaces in alias of UCM types - $updatedAlias = JFilterOutput::stringURLSafe($ucmTypeTable->alias); + $updatedAlias = OutputFilter::stringURLSafe($ucmTypeTable->alias); $ucmTypeTable->alias = $updatedAlias; $ucmTypeTable->store(); } @@ -79,14 +82,14 @@ public function migrate() { foreach ($menuItems as $menuItem) { - $menuItemTable = JTable::getInstance('Menu', 'MenusTable', array('dbo', $db)); + $menuItemTable = Table::getInstance('Menu', 'MenusTable', array('dbo', $db)); $menuItemTable->load($menuItem->id); $oldparams = json_decode($menuItemTable->params); // Remove white spaces in alias of menus if (isset($oldparams->ucm_type)) { - $oldparams->ucm_type = JFilterOutput::stringURLSafe($oldparams->ucm_type); + $oldparams->ucm_type = OutputFilter::stringURLSafe($oldparams->ucm_type); } $menuItemTable->params = json_encode($oldparams); diff --git a/src/components/com_tjucm/administrator/models/fields/createdby.php b/src/components/com_tjucm/administrator/models/fields/createdby.php index 668a8ef6..94794329 100644 --- a/src/components/com_tjucm/administrator/models/fields/createdby.php +++ b/src/components/com_tjucm/administrator/models/fields/createdby.php @@ -9,15 +9,16 @@ */ defined('JPATH_BASE') or die; +use Joomla\CMS\Form\FormField; +use Joomla\CMS\Factory; -jimport('joomla.form.formfield'); /** * Supports an HTML select list of categories * * @since 1.6 */ -class JFormFieldCreatedby extends JFormField +class JFormFieldCreatedby extends FormField { /** * The form field type. @@ -44,11 +45,11 @@ protected function getInput() if ($user_id) { - $user = JFactory::getUser($user_id); + $user = Factory::getUser($user_id); } else { - $user = JFactory::getUser(); + $user = Factory::getUser(); $html[] = ''; } diff --git a/src/components/com_tjucm/administrator/models/fields/custom_field.php b/src/components/com_tjucm/administrator/models/fields/custom_field.php index 4fe718b6..09c4d261 100644 --- a/src/components/com_tjucm/administrator/models/fields/custom_field.php +++ b/src/components/com_tjucm/administrator/models/fields/custom_field.php @@ -9,16 +9,15 @@ */ defined('JPATH_BASE') or die; +use Joomla\CMS\Form\FormField; -jimport('joomla.html.html'); -jimport('joomla.form.formfield'); /** * Supports an HTML select list of categories * * @since 1.6 */ -class JFormFieldCustomField extends JFormField +class JFormFieldCustomField extends FormField { /** * The form field type. diff --git a/src/components/com_tjucm/administrator/models/fields/filemultiple.php b/src/components/com_tjucm/administrator/models/fields/filemultiple.php index 8a1222cc..c0b05983 100644 --- a/src/components/com_tjucm/administrator/models/fields/filemultiple.php +++ b/src/components/com_tjucm/administrator/models/fields/filemultiple.php @@ -9,15 +9,15 @@ */ defined('JPATH_BASE') or die; +use Joomla\CMS\Form\FormField; -jimport('joomla.form.formfield'); /** * Supports an HTML select list of categories * * @since 1.6 */ -class JFormFieldFileMultiple extends JFormField +class JFormFieldFileMultiple extends FormField { /** * The form field type. diff --git a/src/components/com_tjucm/administrator/models/fields/foreignkey.php b/src/components/com_tjucm/administrator/models/fields/foreignkey.php index 75b58764..dd724d14 100644 --- a/src/components/com_tjucm/administrator/models/fields/foreignkey.php +++ b/src/components/com_tjucm/administrator/models/fields/foreignkey.php @@ -9,15 +9,17 @@ */ defined('JPATH_BASE') or die; +use Joomla\CMS\Form\FormField; +use Joomla\CMS\Factory; +use Joomla\CMS\HTML\HTMLHelper; -jimport('joomla.form.formfield'); /** * Supports a value from an external table * * @since 1.6 */ -class JFormFieldForeignKey extends JFormField +class JFormFieldForeignKey extends FormField { /** * The form field type. @@ -65,7 +67,7 @@ protected function getInput() $fk_value = ''; // Load all the field options - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true); // Support for multiple fields on fk_values @@ -114,7 +116,7 @@ protected function getInput() // Iterate through all the results foreach ($results as $result) { - $options[] = JHtml::_('select.option', $result->{$this->key_field}, $result->{$this->value_field}); + $options[] = HTMLHelper::_('select.option', $result->{$this->key_field}, $result->{$this->value_field}); } $value = $this->value; @@ -137,10 +139,10 @@ protected function getInput() } else { - array_unshift($options, JHtml::_('select.option', '', '')); + array_unshift($options, HTMLHelper::_('select.option', '', '')); } - $html = JHtml::_('select.genericlist', $options, $this->name, $input_options, 'value', 'text', $value, $this->id); + $html = HTMLHelper::_('select.genericlist', $options, $this->name, $input_options, 'value', 'text', $value, $this->id); break; } diff --git a/src/components/com_tjucm/administrator/models/fields/modifiedby.php b/src/components/com_tjucm/administrator/models/fields/modifiedby.php index f721f7d1..3f30db8e 100644 --- a/src/components/com_tjucm/administrator/models/fields/modifiedby.php +++ b/src/components/com_tjucm/administrator/models/fields/modifiedby.php @@ -9,15 +9,16 @@ */ defined('JPATH_BASE') or die; +use Joomla\CMS\Form\FormField; +use Joomla\CMS\Factory; -jimport('joomla.form.formfield'); /** * Supports an HTML select list of categories * * @since 1.6 */ -class JFormFieldModifiedby extends JFormField +class JFormFieldModifiedby extends FormField { /** * The form field type. @@ -38,7 +39,7 @@ protected function getInput() { // Initialize variables. $html = array(); - $user = JFactory::getUser(); + $user = Factory::getUser(); $html[] = ''; if (!$this->hidden) diff --git a/src/components/com_tjucm/administrator/models/fields/timecreated.php b/src/components/com_tjucm/administrator/models/fields/timecreated.php index a113deda..80b28a94 100644 --- a/src/components/com_tjucm/administrator/models/fields/timecreated.php +++ b/src/components/com_tjucm/administrator/models/fields/timecreated.php @@ -9,15 +9,18 @@ */ defined('JPATH_BASE') or die; +use Joomla\CMS\Form\FormField; +use Joomla\CMS\Factory; +use Joomla\CMS\Date\Date; +use Joomla\CMS\Language\Text; -jimport('joomla.form.formfield'); /** * Supports an HTML select list of categories * * @since 1.6 */ -class JFormFieldTimecreated extends JFormField +class JFormFieldTimecreated extends FormField { /** * The form field type. @@ -43,7 +46,7 @@ protected function getInput() if (!strtotime($time_created)) { - $time_created = JFactory::getDate('now', JFactory::getConfig()->get('offset'))->toSql(true); + $time_created = Factory::getDate('now', Factory::getConfig()->get('offset'))->toSql(true); $html[] = ''; } @@ -51,8 +54,8 @@ protected function getInput() if ($hidden == null || !$hidden) { - $jdate = new JDate($time_created); - $pretty_date = $jdate->format(JText::_('DATE_FORMAT_LC2')); + $jdate = new Date($time_created); + $pretty_date = $jdate->format(Text::_('DATE_FORMAT_LC2')); $html[] = "
" . $pretty_date . "
"; } diff --git a/src/components/com_tjucm/administrator/models/fields/timeupdated.php b/src/components/com_tjucm/administrator/models/fields/timeupdated.php index e235de96..f5373a54 100644 --- a/src/components/com_tjucm/administrator/models/fields/timeupdated.php +++ b/src/components/com_tjucm/administrator/models/fields/timeupdated.php @@ -9,15 +9,18 @@ */ defined('JPATH_BASE') or die; +use Joomla\CMS\Form\FormField; +use Joomla\CMS\Date\Date; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Factory; -jimport('joomla.form.formfield'); /** * Supports an HTML select list of categories * * @since 1.6 */ -class JFormFieldTimeupdated extends JFormField +class JFormFieldTimeupdated extends FormField { /** * The form field type. @@ -50,13 +53,13 @@ protected function getInput() } else { - $jdate = new JDate($old_time_updated); - $pretty_date = $jdate->format(JText::_('DATE_FORMAT_LC2')); + $jdate = new Date($old_time_updated); + $pretty_date = $jdate->format(Text::_('DATE_FORMAT_LC2')); $html[] = "
" . $pretty_date . "
"; } } - $time_updated = JFactory::getDate('now', JFactory::getConfig()->get('offset'))->toSql(true); + $time_updated = Factory::getDate('now', Factory::getConfig()->get('offset'))->toSql(true); $html[] = ''; return implode($html); diff --git a/src/components/com_tjucm/administrator/models/fields/ucmtypes.php b/src/components/com_tjucm/administrator/models/fields/ucmtypes.php index 6793b2c6..dbe15536 100644 --- a/src/components/com_tjucm/administrator/models/fields/ucmtypes.php +++ b/src/components/com_tjucm/administrator/models/fields/ucmtypes.php @@ -10,6 +10,10 @@ // No direct access. defined('_JEXEC') or die(); +use Joomla\CMS\Form\FormHelper; +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper; JFormHelper::loadFieldClass('list'); @@ -20,7 +24,7 @@ * @subpackage com_quick2cart * @since 2.2 */ -class JFormFieldUcmTypes extends JFormFieldList +class JFormFieldUcmTypes extends FormFieldList { public $type = 'ucmtypes'; @@ -35,7 +39,7 @@ public function getOptions() { // Initialize variables. $options = array(); - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true); $query->select($db->quoteName(array("title", "alias"))); $query->from($db->quoteName('#__tj_ucm_types')); @@ -48,11 +52,11 @@ public function getOptions() $options = array(); - $options[] = JHtml::_('select.option', '', JText::_('COM_TJUCM_SELECT_UCM_TYPE_DESC')); + $options[] = HTMLHelper::_('select.option', '', Text::_('COM_TJUCM_SELECT_UCM_TYPE_DESC')); foreach ($ucmTypes as $ucmType) { - $options[] = JHtml::_('select.option', $ucmType->alias, $ucmType->title); + $options[] = HTMLHelper::_('select.option', $ucmType->alias, $ucmType->title); } return $options; diff --git a/src/components/com_tjucm/administrator/models/item.php b/src/components/com_tjucm/administrator/models/item.php index 9eb0466e..15f230d2 100644 --- a/src/components/com_tjucm/administrator/models/item.php +++ b/src/components/com_tjucm/administrator/models/item.php @@ -10,8 +10,14 @@ // No direct access. defined('_JEXEC') or die; +use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\Form\Form; +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Plugin\PluginHelper; +use Joomla\CMS\Filter\InputFilter; -jimport('joomla.application.component.modeladmin'); jimport('joomla.filesystem.file'); require_once JPATH_SITE . "/components/com_tjfields/filterFields.php"; @@ -20,7 +26,7 @@ * * @since 1.6 */ -class TjucmModelItem extends JModelAdmin +class TjucmModelItem extends AdminModel { /** * @var string The prefix to use with controller messages. @@ -74,13 +80,13 @@ public function getClient() * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ public function getTable($type = 'Item', $prefix = 'TjucmTable', $config = array()) { - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } /** @@ -89,14 +95,14 @@ public function getTable($type = 'Item', $prefix = 'TjucmTable', $config = array * @param array $data An optional array of data for the form to interogate. * @param boolean $loadData True if the form is to load its own data (default case), false if not. * - * @return JForm A JForm object on success, false on failure + * @return Form A Form object on success, false on failure * * @since 1.6 */ public function getForm($data = array(), $loadData = true) { // Initialise variables. - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Get the form. $form = $this->loadForm( @@ -124,7 +130,7 @@ public function getForm($data = array(), $loadData = true) protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_tjucm.edit.item.data', array()); + $data = Factory::getApplication()->getUserState('com_tjucm.edit.item.data', array()); if (empty($data)) { @@ -169,19 +175,19 @@ public function getItem($pk = null) */ public function duplicate(&$pks) { - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access checks. if (!$user->authorise('core.create', 'com_tjucm')) { - throw new Exception(JText::_('JERROR_CORE_CREATE_NOT_PERMITTED')); + throw new Exception(Text::_('JERROR_CORE_CREATE_NOT_PERMITTED')); } $dispatcher = JEventDispatcher::getInstance(); $context = $this->option . '.' . $this->name; // Include the plugins for the save events. - JPluginHelper::importPlugin($this->events_map['save']); + PluginHelper::importPlugin($this->events_map['save']); $table = $this->getTable(); @@ -235,7 +241,7 @@ public function duplicate(&$pks) /** * Prepare and sanitise the table prior to saving. * - * @param JTable $table Table Object + * @param Table $table Table Object * * @return void * @@ -250,7 +256,7 @@ protected function prepareTable($table) // Set ordering to the last item if not set if (@$table->ordering === '') { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $db->setQuery('SELECT MAX(ordering) FROM #__tj_ucm_data'); $max = $db->loadResult(); $table->ordering = $max + 1; @@ -271,11 +277,11 @@ protected function prepareTable($table) */ public function save($data, $extra_jform_data = '', $post = '') { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); JLoader::import('components.com_tjucm.tables.type', JPATH_ADMINISTRATOR); - $tjUcmTypeTable = JTable::getInstance('TjucmTableType', 'JTable', array('dbo', JFactory::getDbo())); + $tjUcmTypeTable = Table::getInstance('TjucmTableType', 'Table', array('dbo', Factory::getDbo())); $tjUcmTypeTable->load(array('unique_identifier' => $this->client)); $data['type_id'] = $tjUcmTypeTable->id; diff --git a/src/components/com_tjucm/administrator/models/items.php b/src/components/com_tjucm/administrator/models/items.php index fa04eeb9..ecc7eea9 100644 --- a/src/components/com_tjucm/administrator/models/items.php +++ b/src/components/com_tjucm/administrator/models/items.php @@ -9,15 +9,19 @@ */ defined('_JEXEC') or die; +use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Factory; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\Data\DataObject; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; -jimport('joomla.application.component.modellist'); /** * Methods supporting a list of Tjucm records. * * @since 1.6 */ -class TjucmModelItems extends JModelList +class TjucmModelItems extends ListModel { private $client = ''; /** @@ -65,7 +69,7 @@ public function __construct($config = array()) protected function populateState($ordering = null, $direction = null) { // Initialise variables. - $app = JFactory::getApplication('administrator'); + $app = Factory::getApplication('administrator'); // Load the filter state. $search = $app->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); @@ -75,7 +79,7 @@ protected function populateState($ordering = null, $direction = null) $this->setState('filter.state', $published); // Load the parameters. - $params = JComponentHelper::getParams('com_tjucm'); + $params = ComponentHelper::getParams('com_tjucm'); $this->setState('params', $params); // List state information. @@ -107,7 +111,7 @@ protected function getStoreId($id = '') /** * Build an SQL query to load the list data. * - * @return JDatabaseQuery + * @return DataObjectbaseQuery * * @since 1.6 */ @@ -238,7 +242,7 @@ public function getClient() public function getFields() { JLoader::import('components.com_tjfields.models.fields', JPATH_ADMINISTRATOR); - $items_model = JModelLegacy::getInstance('Fields', 'TjfieldsModel'); + $items_model = BaseDatabaseModel::getInstance('Fields', 'TjfieldsModel'); $items_model->setState('filter.showonlist', 1); if (!empty($this->client)) @@ -322,7 +326,7 @@ public function showListCheck($client) { if (!empty($client)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true); $query->select("count(" . $db->quoteName('id') . ")"); $query->from($db->quoteName('#__tjfields_fields')); diff --git a/src/components/com_tjucm/administrator/models/type.php b/src/components/com_tjucm/administrator/models/type.php index a737298d..7a9c5acc 100644 --- a/src/components/com_tjucm/administrator/models/type.php +++ b/src/components/com_tjucm/administrator/models/type.php @@ -10,17 +10,24 @@ // No direct access. defined('_JEXEC') or die; +use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Joomla\CMS\Form\Form; +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Plugin\PluginHelper; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Filter\OutputFilter; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; -jimport('joomla.application.component.modeladmin'); -use Joomla\CMS\MVC\Model\BaseDatabaseModel; /** * Tjucm model. * * @since 1.6 */ -class TjucmModelType extends JModelAdmin +class TjucmModelType extends AdminModel { /** * @var string The prefix to use with controller messages. @@ -63,13 +70,13 @@ public function __construct($config = array()) * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.6 */ public function getTable($type = 'Type', $prefix = 'TjucmTable', $config = array()) { - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } /** @@ -78,14 +85,14 @@ public function getTable($type = 'Type', $prefix = 'TjucmTable', $config = array * @param array $data An optional array of data for the form to interogate. * @param boolean $loadData True if the form is to load its own data (default case), false if not. * - * @return JForm A JForm object on success, false on failure + * @return Form A Form object on success, false on failure * * @since 1.6 */ public function getForm($data = array(), $loadData = true) { // Initialise variables. - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Get the form. $form = $this->loadForm( @@ -113,7 +120,7 @@ public function getForm($data = array(), $loadData = true) protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_tjucm.edit.type.data', array()); + $data = Factory::getApplication()->getUserState('com_tjucm.edit.type.data', array()); if (empty($data)) { @@ -164,19 +171,19 @@ public function getItem($pk = null) */ public function duplicate(&$pks) { - $user = JFactory::getUser(); + $user = Factory::getUser(); // Access checks. if (!$user->authorise('core.create', 'com_tjucm')) { - throw new Exception(JText::_('JERROR_CORE_CREATE_NOT_PERMITTED')); + throw new Exception(Text::_('JERROR_CORE_CREATE_NOT_PERMITTED')); } $dispatcher = JEventDispatcher::getInstance(); $context = $this->option . '.' . $this->name; // Include the plugins for the save events. - JPluginHelper::importPlugin($this->events_map['save']); + PluginHelper::importPlugin($this->events_map['save']); $table = $this->getTable(); @@ -218,7 +225,7 @@ public function duplicate(&$pks) /** * Prepare and sanitise the table prior to saving. * - * @param JTable $table Table Object + * @param Table $table Table Object * * @return void * @@ -233,7 +240,7 @@ protected function prepareTable($table) // Set ordering to the last item if not set if (@$table->ordering === '') { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $db->setQuery('SELECT MAX(ordering) FROM #__tj_ucm_types'); $max = $db->loadResult(); $table->ordering = $max + 1; @@ -252,8 +259,8 @@ protected function prepareTable($table) */ public function save($data) { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); // Alter the title for save as copy if ($input->get('task') == 'save2copy') @@ -283,20 +290,20 @@ public function save($data) { if ($data['alias'] == null) { - if (JFactory::getConfig()->get('unicodeslugs') == 1) + if (Factory::getConfig()->get('unicodeslugs') == 1) { - $data['alias'] = JFilterOutput::stringURLUnicodeSlug($data['title']); + $data['alias'] = OutputFilter::stringURLUnicodeSlug($data['title']); } else { - $data['alias'] = JFilterOutput::stringURLSafe($data['title']); + $data['alias'] = OutputFilter::stringURLSafe($data['title']); } $table = $this->getTable(); if ($table->load(array('alias' => $data['alias']))) { - $msg = JText::_('COM_TJUCM_SAVE_WARNING'); + $msg = Text::_('COM_TJUCM_SAVE_WARNING'); } list($title, $alias) = $this->generateNewAlias($data['alias'], $data['title']); @@ -304,14 +311,14 @@ public function save($data) if (isset($msg)) { - JFactory::getApplication()->enqueueMessage($msg, 'warning'); + Factory::getApplication()->enqueueMessage($msg, 'warning'); } } } // Remove white spaces from alias if any // $data['alias'] = str_replace(" ", "_", trim($data['alias'])); - $data['alias'] = JFilterOutput::stringURLSafe($data['alias']); + $data['alias'] = OutputFilter::stringURLSafe($data['alias']); if (!empty($data['id'])) { @@ -330,15 +337,15 @@ public function save($data) // If UCM type is a subform then need to add content_id as hidden field in the form - For flat subform storage JLoader::import('components.com_tjfields.tables.field', JPATH_ADMINISTRATOR); - $db = JFactory::getDbo(); - $tjfieldsFieldTable = JTable::getInstance('Field', 'TjfieldsTable', array('dbo', $db)); + $db = Factory::getDbo(); + $tjfieldsFieldTable = Table::getInstance('Field', 'TjfieldsTable', array('dbo', $db)); $tjfieldsFieldTable->load(array('name' => str_replace('.', '_', $data['unique_identifier']) . '_contentid')); if ($data['params']['is_subform'] == 1 && empty($tjfieldsFieldTable->id)) { - JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tjfields/models'); + BaseDatabaseModel::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tjfields/models'); $fieldGroup = array("name" => "hidden", "title" => "hidden", "client" => $data['unique_identifier'], "state" => 1); - $tjFieldsGroupModel = JModelLegacy::getInstance('Group', 'TjfieldsModel', array('ignore_request' => true)); + $tjFieldsGroupModel = BaseDatabaseModel::getInstance('Group', 'TjfieldsModel', array('ignore_request' => true)); $tjFieldsGroupModel->save($fieldGroup); $fieldGroupId = (int) $tjFieldsGroupModel->getState($tjFieldsGroupModel->getName() . '.id'); $field = array( @@ -348,7 +355,7 @@ public function save($data) "client" => $data['unique_identifier'], "state" => 1, "group_id" => $fieldGroupId, ); - $tjFieldsFieldModel = JModelLegacy::getInstance('Field', 'TjfieldsModel', array('ignore_request' => true)); + $tjFieldsFieldModel = BaseDatabaseModel::getInstance('Field', 'TjfieldsModel', array('ignore_request' => true)); $input->post->set('client_type', end(explode(".", $data['unique_identifier']))); $tjFieldsFieldModel->save($field); $input->post->set('client_type', ''); @@ -371,7 +378,7 @@ public function save($data) $id = (int) $this->getState($this->getName() . '.id'); $data['typeId'] = $id; $dispatcher = JDispatcher::getInstance(); - JPluginHelper::importPlugin('actionlog', 'tjucm'); + PluginHelper::importPlugin('actionlog', 'tjucm'); $isNew = ($data['id'] != 0) ? false : true; $dispatcher->trigger('tjUcmOnAfterTypeSave', array($data, $isNew)); @@ -393,7 +400,7 @@ public function save($data) public function getGroupCount($client) { JLoader::import('components.com_tjfields.models.groups', JPATH_ADMINISTRATOR); - $items_model = JModelLegacy::getInstance('Groups', 'TjfieldsModel'); + $items_model = BaseDatabaseModel::getInstance('Groups', 'TjfieldsModel'); $items_model->setState('filter.client', $client); return $items_model->getTotal(); @@ -411,7 +418,7 @@ public function getGroupCount($client) public function getCategoryCount($client) { JLoader::import('components.com_categories.models.categories', JPATH_ADMINISTRATOR); - $categoryModel = JModelLegacy::getInstance('Categories', 'CategoriesModel', array('ignore_request' => true)); + $categoryModel = BaseDatabaseModel::getInstance('Categories', 'CategoriesModel', array('ignore_request' => true)); $categoryModel->setState('filter.extension', $client); return $categoryModel->getTotal(); @@ -494,13 +501,13 @@ public function delete(&$pks) $table->load(array('id' => $pk)); // Get all field groups in the UCM type - $fieldGroupsModel = JModelLegacy::getInstance('Groups', 'TjfieldsModel', array('ignore_request' => true)); + $fieldGroupsModel = BaseDatabaseModel::getInstance('Groups', 'TjfieldsModel', array('ignore_request' => true)); $fieldGroupsModel->setState("filter.client", $table->unique_identifier); $fieldGroups = $fieldGroupsModel->getItems(); if (!empty($fieldGroups)) { - $tjFieldsGroupModel = JModelLegacy::getInstance('group', 'TjfieldsModel', array('ignore_request' => true)); + $tjFieldsGroupModel = BaseDatabaseModel::getInstance('group', 'TjfieldsModel', array('ignore_request' => true)); foreach ($fieldGroups as $fieldGroup) { @@ -515,14 +522,14 @@ public function delete(&$pks) } // Get all field records related to the UCM type - $itemsModel = JModelLegacy::getInstance('Items', 'TjucmModel', array('ignore_request' => true)); + $itemsModel = BaseDatabaseModel::getInstance('Items', 'TjucmModel', array('ignore_request' => true)); $itemsModel->setState("ucm.client", $table->unique_identifier); $items = $itemsModel->getItems(); // Delete records related to the UCM type if (!empty($items)) { - $itemFormModel = JModelLegacy::getInstance('ItemForm', 'TjucmModel', array('ignore_request' => true)); + $itemFormModel = BaseDatabaseModel::getInstance('ItemForm', 'TjucmModel', array('ignore_request' => true)); foreach ($items as $item) { diff --git a/src/components/com_tjucm/administrator/models/types.php b/src/components/com_tjucm/administrator/models/types.php index bf82a305..f9b95374 100644 --- a/src/components/com_tjucm/administrator/models/types.php +++ b/src/components/com_tjucm/administrator/models/types.php @@ -9,15 +9,17 @@ */ defined('_JEXEC') or die; - -jimport('joomla.application.component.modellist'); +use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Factory; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\Data\DataObject; /** * Methods supporting a list of Tjucm records. * * @since 1.6 */ -class TjucmModelTypes extends JModelList +class TjucmModelTypes extends ListModel { /** * Constructor. @@ -65,7 +67,7 @@ public function __construct($config = array()) protected function populateState($ordering = 'a.id', $direction = 'DESC') { // Initialise variables. - $app = JFactory::getApplication('administrator'); + $app = Factory::getApplication('administrator'); // Load the filter state. $search = $app->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); @@ -75,7 +77,7 @@ protected function populateState($ordering = 'a.id', $direction = 'DESC') $this->setState('filter.state', $published); // Load the parameters. - $params = JComponentHelper::getParams('com_tjucm'); + $params = ComponentHelper::getParams('com_tjucm'); $this->setState('params', $params); // List state information. @@ -107,7 +109,7 @@ protected function getStoreId($id = '') /** * Build an SQL query to load the list data. * - * @return JDatabaseQuery + * @return DataObjectbaseQuery * * @since 1.6 */ diff --git a/src/components/com_tjucm/administrator/tables/item.php b/src/components/com_tjucm/administrator/tables/item.php index ba04039c..9e8a6fae 100644 --- a/src/components/com_tjucm/administrator/tables/item.php +++ b/src/components/com_tjucm/administrator/tables/item.php @@ -10,6 +10,12 @@ // No direct access defined('_JEXEC') or die; +use Joomla\CMS\Table\Observer\ContentHistory; +use Joomla\CMS\Table\Observer\AbstractObserver; +use Joomla\CMS\Table\Table; +use Joomla\Data\DataObject; +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; use Joomla\Utilities\ArrayHelper; @@ -18,12 +24,12 @@ * * @since 1.6 */ -class TjucmTableitem extends JTable +class TjucmTableitem extends Table { /** * Constructor * - * @param JDatabase &$db A database connector object + * @param DataObjectbase &$db A database connector object */ public function __construct(&$db) { @@ -39,33 +45,33 @@ public function __construct(&$db) * * @return null|string null is operation was satisfactory, otherwise returns an error * - * @see JTable:bind + * @see Table:bind * @since 1.5 */ public function bind($data, $ignore = '') { if (empty($data['id'])) { - $data['created_by'] = JFactory::getUser()->id; - $data['created_date'] = JFactory::getDate()->toSql(); + $data['created_by'] = Factory::getUser()->id; + $data['created_date'] = Factory::getDate()->toSql(); } else { - $data['modified_by'] = JFactory::getUser()->id; - $data['modified_date'] = JFactory::getDate()->toSql(); + $data['modified_by'] = Factory::getUser()->id; + $data['modified_date'] = Factory::getDate()->toSql(); } return parent::bind($data, $ignore); } /** - * This function convert an array of JAccessRule objects into an rules array. + * This function convert an array of Rule objects into an rules array. * - * @param array $jaccessrules An array of JAccessRule objects. + * @param array $jaccessrules An array of Rule objects. * * @return array */ - private function JAccessRulestoArray($jaccessrules) + private function RulestoArray($jaccessrules) { $rules = array(); @@ -139,7 +145,7 @@ public function publish($pks = null, $state = 1, $userId = 0) // Nothing to set publishing state on, return false. else { - throw new Exception(500, JText::_('JLIB_DATABASE_ERROR_NO_ROWS_SELECTED')); + throw new Exception(500, Text::_('JLIB_DATABASE_ERROR_NO_ROWS_SELECTED')); } } @@ -189,7 +195,7 @@ public function publish($pks = null, $state = 1, $userId = 0) * * @return string The asset name * - * @see JTable::_getAssetName + * @see Table::_getAssetName */ protected function _getAssetName() { @@ -201,17 +207,17 @@ protected function _getAssetName() /** * Returns the parent asset's id. If you have a tree structure, retrieve the parent's id using the external key field * - * @param JTable $table Table name + * @param Table $table Table name * @param integer $id Id * - * @see JTable::_getAssetParentId + * @see Table::_getAssetParentId * * @return mixed The id on success, false on failure. */ - protected function _getAssetParentId(JTable $table = null, $id = null) + protected function _getAssetParentId(Table $table = null, $id = null) { // We will retrieve the parent-asset from the Asset-table - $assetParent = JTable::getInstance('Asset'); + $assetParent = Table::getInstance('Asset'); // Default: if no asset-parent can be found we take the global asset $assetParentId = $assetParent->getRootId(); diff --git a/src/components/com_tjucm/administrator/tables/type.php b/src/components/com_tjucm/administrator/tables/type.php index dfe31f4b..46a9a899 100644 --- a/src/components/com_tjucm/administrator/tables/type.php +++ b/src/components/com_tjucm/administrator/tables/type.php @@ -10,6 +10,15 @@ // No direct access defined('_JEXEC') or die; +use Joomla\CMS\Table\Observer\ContentHistory; +use Joomla\CMS\Table\Observer\AbstractObserver; +use Joomla\CMS\Table\Table; +use Joomla\CMS\Factory; +use Joomla\Data\DataObject; +use Joomla\CMS\Filter\OutputFilter; +use Joomla\Registry\Registry; +use Joomla\CMS\Access\Access; +use Joomla\CMS\Language\Text; use Joomla\Utilities\ArrayHelper; @@ -18,7 +27,7 @@ * * @since 1.6 */ -class TjucmTabletype extends JTable +class TjucmTabletype extends Table { /** * Check if a field is unique @@ -29,7 +38,7 @@ class TjucmTabletype extends JTable */ private function isUnique ($field) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true); $query @@ -47,7 +56,7 @@ private function isUnique ($field) /** * Constructor * - * @param JDatabase &$db A database connector object + * @param DataObjectbase &$db A database connector object */ public function __construct(&$db) { @@ -63,7 +72,7 @@ public function __construct(&$db) * * @return null|string null is operation was satisfactory, otherwise returns an error * - * @see JTable:bind + * @see Table:bind * @since 1.5 */ public function bind($array, $ignore = '') @@ -73,27 +82,27 @@ public function bind($array, $ignore = '') { if (empty($array['title'])) { - $array['alias'] = JFilterOutput::stringURLSafe(date('Y-m-d H:i:s')); + $array['alias'] = OutputFilter::stringURLSafe(date('Y-m-d H:i:s')); } else { - if (JFactory::getConfig()->get('unicodeslugs') == 1) + if (Factory::getConfig()->get('unicodeslugs') == 1) { - $array['alias'] = JFilterOutput::stringURLUnicodeSlug(trim($array['title'])); + $array['alias'] = OutputFilter::stringURLUnicodeSlug(trim($array['title'])); } else { - $array['alias'] = JFilterOutput::stringURLSafe(trim($array['title'])); + $array['alias'] = OutputFilter::stringURLSafe(trim($array['title'])); } } } - $input = JFactory::getApplication()->input; + $input = Factory::getApplication()->input; $task = $input->getString('task', ''); if ($array['id'] == 0) { - $array['created_by'] = JFactory::getUser()->id; + $array['created_by'] = Factory::getUser()->id; } if ($array['id'] == 0) @@ -103,10 +112,10 @@ public function bind($array, $ignore = '') if ($array['id'] == 0) { - $array['modified_by'] = JFactory::getUser()->id; + $array['modified_by'] = Factory::getUser()->id; } - $task = JFactory::getApplication()->input->get('task'); + $task = Factory::getApplication()->input->get('task'); if ($task == 'apply' || $task == 'save') @@ -116,25 +125,25 @@ public function bind($array, $ignore = '') if (isset($array['params']) && is_array($array['params'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['params']); $array['params'] = (string) $registry; } if (isset($array['metadata']) && is_array($array['metadata'])) { - $registry = new JRegistry; + $registry = new Registry; $registry->loadArray($array['metadata']); $array['metadata'] = (string) $registry; } - if (!JFactory::getUser()->authorise('core.admin', 'com_tjucm.type.' . $array['id'])) + if (!Factory::getUser()->authorise('core.admin', 'com_tjucm.type.' . $array['id'])) { - $actions = JAccess::getActionsFromFile( + $actions = Access::getActionsFromFile( JPATH_ADMINISTRATOR . '/components/com_tjucm/access.xml', "/access/section[@name='type']/" ); - $default_actions = JAccess::getAssetRules('com_tjucm.type.' . $array['id'])->getData(); + $default_actions = Access::getAssetRules('com_tjucm.type.' . $array['id'])->getData(); $array_jaccess = array(); foreach ($actions as $action) @@ -142,7 +151,7 @@ public function bind($array, $ignore = '') $array_jaccess[$action->name] = (!empty($default_actions[$action->name]))?$default_actions[$action->name]:''; } - $array['rules'] = $this->JAccessRulestoArray($array_jaccess); + $array['rules'] = $this->RulestoArray($array_jaccess); } // Bind the rules for ACL where supported. @@ -155,13 +164,13 @@ public function bind($array, $ignore = '') } /** - * This function convert an array of JAccessRule objects into an rules array. + * This function convert an array of Rule objects into an rules array. * - * @param array $jaccessrules An array of JAccessRule objects. + * @param array $jaccessrules An array of Rule objects. * * @return array */ - private function JAccessRulestoArray($jaccessrules) + private function RulestoArray($jaccessrules) { $rules = array(); @@ -241,7 +250,7 @@ public function publish($pks = null, $state = 1, $userId = 0) // Nothing to set publishing state on, return false. else { - throw new Exception(500, JText::_('JLIB_DATABASE_ERROR_NO_ROWS_SELECTED')); + throw new Exception(500, Text::_('JLIB_DATABASE_ERROR_NO_ROWS_SELECTED')); } } @@ -291,7 +300,7 @@ public function publish($pks = null, $state = 1, $userId = 0) * * @return string The asset name * - * @see JTable::_getAssetName + * @see Table::_getAssetName */ protected function _getAssetName() { @@ -303,17 +312,17 @@ protected function _getAssetName() /** * Returns the parent asset's id. If you have a tree structure, retrieve the parent's id using the external key field * - * @param JTable $table Table name + * @param Table $table Table name * @param integer $id Id * - * @see JTable::_getAssetParentId + * @see Table::_getAssetParentId * * @return mixed The id on success, false on failure. */ - protected function _getAssetParentId(JTable $table = null, $id = null) + protected function _getAssetParentId(Table $table = null, $id = null) { // We will retrieve the parent-asset from the Asset-table - $assetParent = JTable::getInstance('Asset'); + $assetParent = Table::getInstance('Asset'); // Default: if no asset-parent can be found we take the global asset $assetParentId = $assetParent->getRootId(); diff --git a/src/components/com_tjucm/administrator/tjucm.php b/src/components/com_tjucm/administrator/tjucm.php index fd288f3f..90a64814 100644 --- a/src/components/com_tjucm/administrator/tjucm.php +++ b/src/components/com_tjucm/administrator/tjucm.php @@ -10,15 +10,16 @@ // No direct access defined('_JEXEC') or die; +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\MVC\Controller\BaseController; // Access check. -if (!JFactory::getUser()->authorise('core.manage', 'com_tjucm')) +if (!Factory::getUser()->authorise('core.manage', 'com_tjucm')) { - throw new Exception(JText::_('JERROR_ALERTNOAUTHOR')); + throw new Exception(Text::_('JERROR_ALERTNOAUTHOR')); } -// Include dependancies -jimport('joomla.application.component.controller'); // Load backend helper $path = JPATH_ADMINISTRATOR . '/components/com_tjucm/helpers/tjucm.php'; @@ -31,6 +32,6 @@ JLoader::registerPrefix('Tjucm', JPATH_COMPONENT_ADMINISTRATOR); -$controller = JControllerLegacy::getInstance('Tjucm'); -$controller->execute(JFactory::getApplication()->input->get('task')); +$controller = BaseController::getInstance('Tjucm'); +$controller->execute(Factory::getApplication()->input->get('task')); $controller->redirect(); diff --git a/src/components/com_tjucm/administrator/views/item/tmpl/edit.php b/src/components/com_tjucm/administrator/views/item/tmpl/edit.php index 1cf14d63..2c6791cb 100644 --- a/src/components/com_tjucm/administrator/views/item/tmpl/edit.php +++ b/src/components/com_tjucm/administrator/views/item/tmpl/edit.php @@ -8,27 +8,32 @@ */ // No direct access defined('_JEXEC') or die; +use Joomla\CMS\HTML\HTMLHelper; +use Joomla\CMS\Factory; +use Joomla\CMS\Uri\Uri; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Router\Route; -JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); -JHtml::_('behavior.keepalive'); -JHtml::_('jquery.token'); +HTMLHelper::addIncludePath(JPATH_COMPONENT . '/helpers/html'); +HTMLHelper::_('bootstrap.tooltip'); +HTMLHelper::_('behavior.formvalidator'); +HTMLHelper::_('formbehavior.chosen', 'select'); +HTMLHelper::_('behavior.keepalive'); +HTMLHelper::_('jquery.token'); // Load admin language file -$lang = JFactory::getLanguage(); +$lang = Factory::getLanguage(); $lang->load('com_tjucm', JPATH_SITE); -$doc = JFactory::getDocument(); -$doc->addScript(JUri::root() . 'administrator/components/com_tjucm/assets/js/jquery.form.js'); -$doc->addScript(JUri::root() . 'administrator/components/com_tjucm/assets/js/itemform.js'); -$doc->addScript(JUri::root() . 'administrator/components/com_tjucm/assets/js/tjfield.js'); +$doc = Factory::getDocument(); +$doc->addScript(Uri::root() . 'administrator/components/com_tjucm/assets/js/jquery.form.js'); +$doc->addScript(Uri::root() . 'administrator/components/com_tjucm/assets/js/itemform.js'); +$doc->addScript(Uri::root() . 'administrator/components/com_tjucm/assets/js/tjfield.js'); -$jinput = JFactory::getApplication(); +$jinput = Factory::getApplication(); $baseUrl = $jinput->input->server->get('REQUEST_URI', '', 'STRING'); $calledFrom = (strpos($baseUrl, 'administrator')) ? 'backend' : 'frontend'; $layout = ($calledFrom == 'frontend') ? 'default' : 'edit'; -$client = JFactory::getApplication()->input->get('client'); +$client = Factory::getApplication()->input->get('client'); ?> -
+
form_extra): ?> - 'personal-information')); ?> - + 'personal-information')); ?> +
@@ -81,32 +86,32 @@ form_extra): ?> - + - +
- +
- - + + - " id="finalSave" onclick="finalsave('item-form');"> - " onclick="saveAsDraft('item-form');"> - " onclick="Joomla.submitbutton('itemform.cancel');"> + " id="finalSave" onclick="finalsave('item-form');"> + " onclick="saveAsDraft('item-form');"> + " onclick="Joomla.submitbutton('itemform.cancel');">
- +
diff --git a/src/components/com_tjucm/administrator/views/item/tmpl/edit_extrafields.php b/src/components/com_tjucm/administrator/views/item/tmpl/edit_extrafields.php index b45d4192..35bf6b45 100644 --- a/src/components/com_tjucm/administrator/views/item/tmpl/edit_extrafields.php +++ b/src/components/com_tjucm/administrator/views/item/tmpl/edit_extrafields.php @@ -9,12 +9,15 @@ // No direct access defined('_JEXEC') or die; +use Joomla\CMS\HTML\HTMLHelper; +use Joomla\CMS\Filter\OutputFilter; +use Joomla\CMS\Language\Text; ?> form_extra): //~ echo $this->form_extra->getFieldsets(0)->name; - echo JHtml::_('bootstrap.startTabSet', 'myTab', array('active' => 'personal-information')); + echo HTMLHelper::_('bootstrap.startTabSet', 'myTab', array('active' => 'personal-information')); endif; ?> @@ -24,8 +27,8 @@ getFieldsets() as $fieldName => $fieldset): ?> name)); - echo JHtml::_("bootstrap.addTab", "myTab", $tabName, $fieldset->name); + $tabName = OutputFilter::stringURLUnicodeSlug(trim($fieldset->name)); + echo HTMLHelper::_("bootstrap.addTab", "myTab", $tabName, $fieldset->name); ?> form_extra as $field1): ?> @@ -46,13 +49,13 @@
- +
diff --git a/src/components/com_tjucm/administrator/views/item/view.html.php b/src/components/com_tjucm/administrator/views/item/view.html.php index b6b01f4c..49864cf0 100644 --- a/src/components/com_tjucm/administrator/views/item/view.html.php +++ b/src/components/com_tjucm/administrator/views/item/view.html.php @@ -10,15 +10,17 @@ // No direct access defined('_JEXEC') or die; - -jimport('joomla.application.component.view'); +use Joomla\CMS\MVC\View\HtmlView; +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Toolbar\ToolbarHelper; /** * View to edit * * @since 1.6 */ -class TjucmViewItem extends JViewLegacy +class TjucmViewItem extends HtmlView { protected $state; @@ -43,8 +45,8 @@ public function display($tpl = null) // Get form for extra fields. - $this->client = JFactory::getApplication()->input->get('client'); - $id = JFactory::getApplication()->input->get('id'); + $this->client = Factory::getApplication()->input->get('client'); + $id = Factory::getApplication()->input->get('id'); $model = $this->getModel('item'); $view = explode('.', $this->client); @@ -80,9 +82,9 @@ public function display($tpl = null) */ protected function addToolbar() { - JFactory::getApplication()->input->set('hidemainmenu', true); + Factory::getApplication()->input->set('hidemainmenu', true); - $user = JFactory::getUser(); + $user = Factory::getUser(); $isNew = ($this->item->id == 0); if (isset($this->item->checked_out)) @@ -96,39 +98,39 @@ protected function addToolbar() $canDo = TjucmHelper::getActions(); - JToolBarHelper::title(JText::_('COM_TJUCM_TITLE_ITEM'), 'icon-pencil'); + ToolbarHelper::title(Text::_('COM_TJUCM_TITLE_ITEM'), 'icon-pencil'); // If not checked out, can save the item. if (!$checkedOut && ($canDo->get('core.edit') || ($canDo->get('core.create')))) { - JToolBarHelper::apply('item.apply', 'JTOOLBAR_APPLY'); - JToolBarHelper::save('item.save', 'JTOOLBAR_SAVE'); + ToolbarHelper::apply('item.apply', 'JTOOLBAR_APPLY'); + ToolbarHelper::save('item.save', 'JTOOLBAR_SAVE'); } if (!$checkedOut && ($canDo->get('core.create'))) { - JToolBarHelper::custom('item.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + ToolbarHelper::custom('item.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); } // If an existing item, can save to a copy. if (!$isNew && $canDo->get('core.create')) { - JToolBarHelper::custom('item.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); + ToolbarHelper::custom('item.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); } // Button for version control if ($this->state->params->get('save_history', 1) && $user->authorise('core.edit')) { - JToolbarHelper::versions('com_tjucm.item', $this->item->id); + ToolbarHelper::versions('com_tjucm.item', $this->item->id); } if (empty($this->item->id)) { - JToolBarHelper::cancel('item.cancel', 'JTOOLBAR_CANCEL'); + ToolbarHelper::cancel('item.cancel', 'JTOOLBAR_CANCEL'); } else { - JToolBarHelper::cancel('item.cancel', 'JTOOLBAR_CLOSE'); + ToolbarHelper::cancel('item.cancel', 'JTOOLBAR_CLOSE'); } } } diff --git a/src/components/com_tjucm/administrator/views/items/tmpl/default.php b/src/components/com_tjucm/administrator/views/items/tmpl/default.php index 3517d6bf..1c2bea39 100644 --- a/src/components/com_tjucm/administrator/views/items/tmpl/default.php +++ b/src/components/com_tjucm/administrator/views/items/tmpl/default.php @@ -9,30 +9,35 @@ // No direct access defined('_JEXEC') or die; +use Joomla\CMS\HTML\HTMLHelper; +use Joomla\CMS\Factory; +use Joomla\CMS\Uri\Uri; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Language\Text; -JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/'); -JHtml::_('bootstrap.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('formbehavior.chosen', 'select'); +HTMLHelper::addIncludePath(JPATH_COMPONENT . '/helpers/'); +HTMLHelper::_('bootstrap.tooltip'); +HTMLHelper::_('behavior.multiselect'); +HTMLHelper::_('formbehavior.chosen', 'select'); // Import CSS -$document = JFactory::getDocument(); -$document->addStyleSheet(JUri::root() . 'administrator/components/com_tjucm/assets/css/tjucm.css'); -$document->addStyleSheet(JUri::root() . 'media/com_tjucm/css/list.css'); +$document = Factory::getDocument(); +$document->addStyleSheet(Uri::root() . 'administrator/components/com_tjucm/assets/css/tjucm.css'); +$document->addStyleSheet(Uri::root() . 'media/com_tjucm/css/list.css'); -$user = JFactory::getUser(); +$user = Factory::getUser(); $userId = $user->get('id'); $listOrder = $this->state->get('list.ordering'); $listDirn = $this->state->get('list.direction'); $canOrder = $user->authorise('core.edit.state', 'com_tjucm'); $saveOrder = $listOrder == 'a.`ordering`'; -$client = JFactory::getApplication()->input->get('client'); +$client = Factory::getApplication()->input->get('client'); if ($saveOrder) { $saveOrderingUrl = 'index.php?option=com_tjucm&task=items.saveOrderAjax&tmpl=component'; - JHtml::_('sortablelist.sortable', 'itemList', 'adminForm', strtolower($listDirn), $saveOrderingUrl); + HTMLHelper::_('sortablelist.sortable', 'itemList', 'adminForm', strtolower($listDirn), $saveOrderingUrl); } $sortFields = $this->getSortFields(); @@ -98,7 +103,7 @@ } ?> -
+ sidebar)): ?>
sidebar; ?> @@ -111,44 +116,44 @@
- -
pagination->getLimitBox(); ?>
- +
@@ -164,22 +169,22 @@ items[0]->ordering)): ?> - ', 'a.`ordering`', $listDirn, $listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + ', 'a.`ordering`', $listDirn, $listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> - + items[0]->state)): ?> - + - + listcolumn)) @@ -204,7 +209,7 @@ items as $i => $item) : - $link = JRoute::_('index.php?option=com_tjucm&view=item&layout=edit&id=' . $item->id . '&client=' . $client, false); + $link = Route::_('index.php?option=com_tjucm&view=item&layout=edit&id=' . $item->id . '&client=' . $client, false); $ordering = ($listOrder == 'a.ordering'); $canCreate = $user->authorise('core.create', 'com_tjucm'); $canEdit = $user->authorise('core.edit', 'com_tjucm'); @@ -219,7 +224,7 @@ $disabledLabel = ''; if (!$saveOrder) : - $disabledLabel = JText::_('JORDERINGDISABLED'); + $disabledLabel = Text::_('JORDERINGDISABLED'); $disableClassName = 'inactive tip-top'; endif; ?> @@ -237,12 +242,12 @@ - id); ?> + id); ?> items[0]->state)): ?> - state, $i, 'items.', $canChange, 'cb'); ?> + state, $i, 'items.', $canChange, 'cb'); ?> @@ -271,14 +276,14 @@ else { ?> -
+
-
+
@@ -287,6 +292,6 @@ - +
diff --git a/src/components/com_tjucm/administrator/views/items/view.html.php b/src/components/com_tjucm/administrator/views/items/view.html.php index 89810a12..9c37af12 100644 --- a/src/components/com_tjucm/administrator/views/items/view.html.php +++ b/src/components/com_tjucm/administrator/views/items/view.html.php @@ -10,15 +10,20 @@ // No direct access defined('_JEXEC') or die; +use Joomla\CMS\MVC\View\HtmlView; +use Joomla\CMS\Factory; +use Joomla\CMS\HTML\HTMLHelper; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Toolbar\ToolbarHelper; + -jimport('joomla.application.component.view'); /** * View class for a list of Tjucm. * * @since 1.6 */ -class TjucmViewItems extends JViewLegacy +class TjucmViewItems extends HtmlView { protected $items; @@ -40,7 +45,7 @@ public function display($tpl = null) $this->state = $this->get('State'); $model_items = $this->getModel('items'); - $client = JFactory::getApplication()->input->get('client'); + $client = Factory::getApplication()->input->get('client'); // Set client value $model_items->setClient($client); @@ -78,7 +83,7 @@ protected function addToolbar() $state = $this->get('State'); $canDo = TjucmHelper::getActions(); - JToolBarHelper::title(JText::_('COM_TJUCM_TITLE_ITEMS'), 'list'); + ToolbarHelper::title(Text::_('COM_TJUCM_TITLE_ITEMS'), 'list'); // Check if the form exists before showing the add/edit buttons $formPath = JPATH_COMPONENT_ADMINISTRATOR . '/views/item'; @@ -87,13 +92,13 @@ protected function addToolbar() { if ($canDo->get('core.create')) { - JToolBarHelper::addNew('item.add', 'JTOOLBAR_NEW'); - JToolbarHelper::custom('items.duplicate', 'copy.png', 'copy_f2.png', 'JTOOLBAR_DUPLICATE', true); + ToolbarHelper::addNew('item.add', 'JTOOLBAR_NEW'); + ToolbarHelper::custom('items.duplicate', 'copy.png', 'copy_f2.png', 'JTOOLBAR_DUPLICATE', true); } /*if ($canDo->get('core.edit') && isset($this->items[0])) { - JToolBarHelper::editList('item.edit', 'JTOOLBAR_EDIT'); + ToolbarHelper::editList('item.edit', 'JTOOLBAR_EDIT'); }*/ } @@ -101,25 +106,25 @@ protected function addToolbar() { if (isset($this->items[0]->state)) { - JToolBarHelper::divider(); - JToolBarHelper::custom('items.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true); - JToolBarHelper::custom('items.unpublish', 'unpublish.png', 'unpublish_f2.png', 'JTOOLBAR_UNPUBLISH', true); + ToolbarHelper::divider(); + ToolbarHelper::custom('items.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true); + ToolbarHelper::custom('items.unpublish', 'unpublish.png', 'unpublish_f2.png', 'JTOOLBAR_UNPUBLISH', true); } elseif (isset($this->items[0])) { // If this component does not use state then show a direct delete button as we can not trash - JToolBarHelper::deleteList('', 'items.delete', 'JTOOLBAR_DELETE'); + ToolbarHelper::deleteList('', 'items.delete', 'JTOOLBAR_DELETE'); } if (isset($this->items[0]->state)) { - JToolBarHelper::divider(); - JToolBarHelper::archiveList('items.archive', 'JTOOLBAR_ARCHIVE'); + ToolbarHelper::divider(); + ToolbarHelper::archiveList('items.archive', 'JTOOLBAR_ARCHIVE'); } if (isset($this->items[0]->checked_out)) { - JToolBarHelper::custom('items.checkin', 'checkin.png', 'checkin_f2.png', 'JTOOLBAR_CHECKIN', true); + ToolbarHelper::custom('items.checkin', 'checkin.png', 'checkin_f2.png', 'JTOOLBAR_CHECKIN', true); } } @@ -128,19 +133,19 @@ protected function addToolbar() { if ($state->get('filter.state') == -2 && $canDo->get('core.delete')) { - JToolBarHelper::deleteList('', 'items.delete', 'JTOOLBAR_EMPTY_TRASH'); - JToolBarHelper::divider(); + ToolbarHelper::deleteList('', 'items.delete', 'JTOOLBAR_EMPTY_TRASH'); + ToolbarHelper::divider(); } elseif ($canDo->get('core.edit.state')) { - JToolBarHelper::trash('items.trash', 'JTOOLBAR_TRASH'); - JToolBarHelper::divider(); + ToolbarHelper::trash('items.trash', 'JTOOLBAR_TRASH'); + ToolbarHelper::divider(); } } if ($canDo->get('core.admin')) { - JToolBarHelper::preferences('com_tjucm'); + ToolbarHelper::preferences('com_tjucm'); } // Set sidebar action - New in 3.0 @@ -149,11 +154,11 @@ protected function addToolbar() $this->extra_sidebar = ''; JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), + Text::_('JOPTION_SELECT_PUBLISHED'), 'filter_published', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), "value", "text", $this->state->get('filter.state'), true) + HTMLHelper::_('select.options', HTMLHelper::_('jgrid.publishedOptions'), "value", "text", $this->state->get('filter.state'), true) ); } @@ -166,9 +171,9 @@ protected function addToolbar() protected function getSortFields() { return array( - 'a.`id`' => JText::_('JGRID_HEADING_ID'), - 'a.`ordering`' => JText::_('JGRID_HEADING_ORDERING'), - 'a.`state`' => JText::_('JSTATUS'), + 'a.`id`' => Text::_('JGRID_HEADING_ID'), + 'a.`ordering`' => Text::_('JGRID_HEADING_ORDERING'), + 'a.`state`' => Text::_('JSTATUS'), ); } } diff --git a/src/components/com_tjucm/administrator/views/type/tmpl/edit.php b/src/components/com_tjucm/administrator/views/type/tmpl/edit.php index c861509a..f6dd8e0e 100644 --- a/src/components/com_tjucm/administrator/views/type/tmpl/edit.php +++ b/src/components/com_tjucm/administrator/views/type/tmpl/edit.php @@ -8,12 +8,16 @@ */ // No direct access defined('_JEXEC') or die; +use Joomla\CMS\HTML\HTMLHelper; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Factory; -JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); -JHtml::_('behavior.keepalive'); +HTMLHelper::addIncludePath(JPATH_COMPONENT . '/helpers/html'); +HTMLHelper::_('bootstrap.tooltip'); +HTMLHelper::_('behavior.formvalidator'); +HTMLHelper::_('formbehavior.chosen', 'select'); +HTMLHelper::_('behavior.keepalive'); ?> -
+
- 'general')); ?> + 'general')); ?> - +
@@ -64,17 +68,17 @@
- + - authorise('core.admin', 'tjucm')) : ?> - + authorise('core.admin', 'tjucm')) : ?> + form->getInput('rules'); ?> - + - + - +
diff --git a/src/components/com_tjucm/administrator/views/type/view.html.php b/src/components/com_tjucm/administrator/views/type/view.html.php index 1fe5b9d6..0fba7960 100644 --- a/src/components/com_tjucm/administrator/views/type/view.html.php +++ b/src/components/com_tjucm/administrator/views/type/view.html.php @@ -10,15 +10,17 @@ // No direct access defined('_JEXEC') or die; - -jimport('joomla.application.component.view'); +use Joomla\CMS\MVC\View\HtmlView; +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Toolbar\ToolbarHelper; /** * View to edit * * @since 1.6 */ -class TjucmViewType extends JViewLegacy +class TjucmViewType extends HtmlView { protected $state; @@ -60,9 +62,9 @@ public function display($tpl = null) */ protected function addToolbar() { - JFactory::getApplication()->input->set('hidemainmenu', true); + Factory::getApplication()->input->set('hidemainmenu', true); - $user = JFactory::getUser(); + $user = Factory::getUser(); $isNew = ($this->item->id == 0); if (isset($this->item->checked_out)) @@ -76,31 +78,31 @@ protected function addToolbar() $canDo = TjucmHelper::getActions(); - $component_title = JText::_('COM_TJUCM_COMPONENT'); - JToolbarHelper::title( - $component_title . ": " . JText::_('COM_TJUCM_PAGE_' . ($checkedOut ? 'VIEW_TYPE' : ($isNew ? 'ADD_TYPE' : 'EDIT_TYPE'))), + $component_title = Text::_('COM_TJUCM_COMPONENT'); + ToolbarHelper::title( + $component_title . ": " . Text::_('COM_TJUCM_PAGE_' . ($checkedOut ? 'VIEW_TYPE' : ($isNew ? 'ADD_TYPE' : 'EDIT_TYPE'))), 'pencil-2 article-add' ); // If not checked out, can save the item. if (!$checkedOut && ($canDo->get('core.edit') || ($canDo->get('core.create')))) { - JToolBarHelper::apply('type.apply', 'JTOOLBAR_APPLY'); - JToolBarHelper::save('type.save', 'JTOOLBAR_SAVE'); + ToolbarHelper::apply('type.apply', 'JTOOLBAR_APPLY'); + ToolbarHelper::save('type.save', 'JTOOLBAR_SAVE'); } if (!$checkedOut && ($canDo->get('core.create'))) { - JToolBarHelper::custom('type.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + ToolbarHelper::custom('type.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); } if (empty($this->item->id)) { - JToolBarHelper::cancel('type.cancel', 'JTOOLBAR_CANCEL'); + ToolbarHelper::cancel('type.cancel', 'JTOOLBAR_CANCEL'); } else { - JToolBarHelper::cancel('type.cancel', 'JTOOLBAR_CLOSE'); + ToolbarHelper::cancel('type.cancel', 'JTOOLBAR_CLOSE'); } } } diff --git a/src/components/com_tjucm/administrator/views/types/tmpl/default.php b/src/components/com_tjucm/administrator/views/types/tmpl/default.php index 94b7824d..385eeade 100644 --- a/src/components/com_tjucm/administrator/views/types/tmpl/default.php +++ b/src/components/com_tjucm/administrator/views/types/tmpl/default.php @@ -9,28 +9,33 @@ // No direct access defined('_JEXEC') or die; +use Joomla\CMS\HTML\HTMLHelper; +use Joomla\CMS\Factory; +use Joomla\CMS\Uri\Uri; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Router\Route; use \Joomla\CMS\Layout\LayoutHelper; -JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/'); -JHtml::_('bootstrap.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('formbehavior.chosen', 'select'); +HTMLHelper::addIncludePath(JPATH_COMPONENT . '/helpers/'); +HTMLHelper::_('bootstrap.tooltip'); +HTMLHelper::_('behavior.multiselect'); +HTMLHelper::_('formbehavior.chosen', 'select'); -$user = JFactory::getUser(); +$user = Factory::getUser(); $listOrder = $this->state->get('list.ordering'); $listDirn = $this->state->get('list.direction'); $canOrder = $user->authorise('core.edit.state', 'com_tjucm'); $saveOrder = $listOrder == 'a.`ordering`'; -$document = JFactory::getDocument(); -$document->addScript(JUri::root() . 'administrator/components/com_tjucm/assets/js/tjucm.js'); -$document->addScript(JUri::root(true) . '/libraries/techjoomla/assets/js/houseKeeping.js'); +$document = Factory::getDocument(); +$document->addScript(Uri::root() . 'administrator/components/com_tjucm/assets/js/tjucm.js'); +$document->addScript(Uri::root(true) . '/libraries/techjoomla/assets/js/houseKeeping.js'); $document->addScriptDeclaration("var tjHouseKeepingView='types';"); if ($saveOrder) { $saveOrderingUrl = 'index.php?option=com_tjucm&task=types.saveOrderAjax&tmpl=component'; - JHtml::_('sortablelist.sortable', 'typeList', 'adminForm', strtolower($listDirn), $saveOrderingUrl); + HTMLHelper::_('sortablelist.sortable', 'typeList', 'adminForm', strtolower($listDirn), $saveOrderingUrl); } $sortFields = $this->getSortFields(); @@ -43,7 +48,7 @@ } else if (task == 'types.delete') { - if(confirm("")) + if(confirm("")) { Joomla.submitform(task); } @@ -109,7 +114,7 @@ -
+ sidebar)): ?>
sidebar; ?>
@@ -122,29 +127,29 @@
pagination->getLimitBox(); ?>
- +
@@ -158,33 +163,33 @@ items[0]->ordering)): ?> - ', 'a.`ordering`', $listDirn, $listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + ', 'a.`ordering`', $listDirn, $listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> - + items[0]->state)): ?> - + - + - + - + - + @@ -204,11 +209,11 @@ { foreach ($this->items as $i => $item) { - $category_url = JRoute::_('index.php?option=com_categories&extension=' . $item->unique_identifier); - $field_group_url = JRoute::_('index.php?option=com_tjfields&view=groups&client=' . $item->unique_identifier); - $fields_url = JRoute::_('index.php?option=com_tjfields&view=fields&client=' . $item->unique_identifier . '&extension=' . $item->unique_identifier); - $type_addnew_data_url = JRoute::_('index.php?option=com_tjucm&view=item&layout=edit&client=' . $item->unique_identifier); - $type_data_url = JRoute::_('index.php?option=com_tjucm&view=items&client=' . $item->unique_identifier); + $category_url = Route::_('index.php?option=com_categories&extension=' . $item->unique_identifier); + $field_group_url = Route::_('index.php?option=com_tjfields&view=groups&client=' . $item->unique_identifier); + $fields_url = Route::_('index.php?option=com_tjfields&view=fields&client=' . $item->unique_identifier . '&extension=' . $item->unique_identifier); + $type_addnew_data_url = Route::_('index.php?option=com_tjucm&view=item&layout=edit&client=' . $item->unique_identifier); + $type_data_url = Route::_('index.php?option=com_tjucm&view=items&client=' . $item->unique_identifier); $ordering = ($listOrder == 'a.ordering'); $canCreate = $user->authorise('core.create', 'com_tjucm'); @@ -225,7 +230,7 @@ $disabledLabel = ''; if (!$saveOrder) : - $disabledLabel = JText::_('JORDERINGDISABLED'); + $disabledLabel = Text::_('JORDERINGDISABLED'); $disableClassName = 'inactive tip-top'; endif; ?> @@ -241,12 +246,12 @@ - id); ?> + id); ?> items[0]->state)): ?> - state, $i, 'types.', $canChange, 'cb'); ?> + state, $i, 'types.', $canChange, 'cb'); ?> @@ -256,11 +261,11 @@ checked_out) && $item->checked_out && ($canEdit || $canChange)) : ?> - uEditor, $item->checked_out_time, 'types.', $canCheckin); ?> + uEditor, $item->checked_out_time, 'types.', $canCheckin); ?> - + escape($item->title); ?> @@ -273,11 +278,11 @@ - -  |  -  |  - + +  |  +  |  + -
+
@@ -296,7 +301,7 @@ - +
diff --git a/src/components/com_tjucm/administrator/views/types/tmpl/import.php b/src/components/com_tjucm/administrator/views/types/tmpl/import.php index 755adc67..3c35a2d7 100755 --- a/src/components/com_tjucm/administrator/views/types/tmpl/import.php +++ b/src/components/com_tjucm/administrator/views/types/tmpl/import.php @@ -9,6 +9,9 @@ // No direct access defined('_JEXEC') or die; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper; ?> -
+
-

+


- +
- +
diff --git a/src/components/com_tjucm/administrator/views/types/view.html.php b/src/components/com_tjucm/administrator/views/types/view.html.php index 8fcb032e..e168a801 100644 --- a/src/components/com_tjucm/administrator/views/types/view.html.php +++ b/src/components/com_tjucm/administrator/views/types/view.html.php @@ -10,16 +10,20 @@ // No direct access defined('_JEXEC') or die; +use Joomla\CMS\MVC\View\HtmlView; +use Joomla\CMS\HTML\HTMLHelper; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Toolbar\Toolbar; +use Joomla\CMS\Uri\Uri; -jimport('joomla.application.component.view'); -JHTML::_('behavior.modal'); +// JHTML::_('behavior.modal'); /** * View class for a list of Tjucm. * * @since 1.6 */ -class TjucmViewTypes extends JViewLegacy +class TjucmViewTypes extends HtmlView { protected $items; @@ -69,16 +73,16 @@ protected function addToolbar() { $state = $this->get('State'); $canDo = TjucmHelper::getActions(); - $component_title = JText::_('COM_TJUCM_COMPONENT'); - JToolBarHelper::title($component_title . " : " . JText::_('COM_TJUCM_TITLE_TYPES'), 'list'); + $component_title = Text::_('COM_TJUCM_COMPONENT'); + JToolBarHelper::title($component_title . " : " . Text::_('COM_TJUCM_TITLE_TYPES'), 'list'); // Check if the form exists before showing the add/edit buttons $formPath = JPATH_COMPONENT_ADMINISTRATOR . '/views/type'; - $toolbar = JToolbar::getInstance('toolbar'); + $toolbar = Toolbar::getInstance('toolbar'); $toolbar->appendButton( 'Custom', ''); + . Text::_('COM_TJUCM_FIX_DATABASE') . ''); if (file_exists($formPath)) { @@ -128,11 +132,11 @@ protected function addToolbar() JToolBarHelper::custom('types.export', 'download', '', 'COM_TJUCM_TYPE_EXPORT', false); // Add import button on UCM Types view - $link = "'" . JUri::root() . "administrator/index.php?option=com_tjucm&view=types&layout=import&tmpl=component" . "'"; + $link = "'" . Uri::root() . "administrator/index.php?option=com_tjucm&view=types&layout=import&tmpl=component" . "'"; $toolbar->appendButton( 'Custom', ' - ' . JText::_('COM_TJUCM_TYPE_IMPORT') . '' + ' . Text::_('COM_TJUCM_TYPE_IMPORT') . '' ); } @@ -150,10 +154,10 @@ protected function addToolbar() protected function getSortFields() { return array( - 'a.`id`' => JText::_('JGRID_HEADING_ID'), - 'a.`ordering`' => JText::_('JGRID_HEADING_ORDERING'), - 'a.`title`' => JText::_('COM_TJUCM_TYPES_TITLE'), - 'a.`state`' => JText::_('JSTATUS'), + 'a.`id`' => Text::_('JGRID_HEADING_ID'), + 'a.`ordering`' => Text::_('JGRID_HEADING_ORDERING'), + 'a.`title`' => Text::_('COM_TJUCM_TYPES_TITLE'), + 'a.`state`' => Text::_('JSTATUS'), ); } } diff --git a/src/components/com_tjucm/site/controller.php b/src/components/com_tjucm/site/controller.php index 5489300a..0a0ddc7e 100644 --- a/src/components/com_tjucm/site/controller.php +++ b/src/components/com_tjucm/site/controller.php @@ -10,21 +10,22 @@ // No direct access defined('_JEXEC') or die; - -jimport('joomla.application.component.controller'); +use Joomla\CMS\MVC\Controller\BaseController; +use Joomla\CMS\Filter\InputFilter; +use Joomla\CMS\Factory; /** * Class TjucmController * * @since 1.6 */ -class TjucmController extends JControllerLegacy +class TjucmController 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. * @@ -32,7 +33,7 @@ class TjucmController extends JControllerLegacy */ public function display($cachable = false, $urlparams = false) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $view = $app->input->getCmd('view', 'types'); $app->input->set('view', $view); diff --git a/src/components/com_tjucm/site/controllers/item.php b/src/components/com_tjucm/site/controllers/item.php index 29b0e21d..48d24b22 100644 --- a/src/components/com_tjucm/site/controllers/item.php +++ b/src/components/com_tjucm/site/controllers/item.php @@ -10,13 +10,20 @@ // No direct access defined('_JEXEC') or die; +use Joomla\CMS\MVC\Controller\BaseController; +use Joomla\CMS\Factory; +use Joomla\CMS\Table\Table; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Session\Session; /** * Item controller class. * * @since 1.6 */ -class TjucmControllerItem extends JControllerLegacy +class TjucmControllerItem extends BaseController { /** * Constructor @@ -25,10 +32,10 @@ class TjucmControllerItem extends JControllerLegacy */ public function __construct() { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); - $this->client = JFactory::getApplication()->input->get('client'); - $this->created_by = JFactory::getApplication()->input->get('created_by'); + $this->client = Factory::getApplication()->input->get('client'); + $this->created_by = Factory::getApplication()->input->get('created_by'); // If client is empty then get client from menu params if (empty($this->client)) @@ -46,7 +53,7 @@ public function __construct() if (!empty($this->ucm_type)) { JLoader::import('components.com_tjfields.tables.type', JPATH_ADMINISTRATOR); - $ucmTypeTable = JTable::getInstance('Type', 'TjucmTable', array('dbo', JFactory::getDbo())); + $ucmTypeTable = Table::getInstance('Type', 'TjucmTable', array('dbo', Factory::getDbo())); $ucmTypeTable->load(array('alias' => $this->ucm_type)); $this->client = $ucmTypeTable->unique_identifier; } @@ -54,8 +61,8 @@ public function __construct() } // Get UCM type id from uniquue identifier - JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tjucm/models'); - $tjUcmModelType = JModelLegacy::getInstance('Type', 'TjucmModel'); + BaseDatabaseModel::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tjucm/models'); + $tjUcmModelType = BaseDatabaseModel::getInstance('Type', 'TjucmModel'); $this->ucmTypeId = $tjUcmModelType->getTypeId($this->client); $this->appendUrl = ""; @@ -82,7 +89,7 @@ public function __construct() */ public function edit() { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Get the previous edit id (if any) and the current edit id. $previousId = (int) $app->getUserState('com_tjucm.edit.item.id'); @@ -111,7 +118,7 @@ public function edit() $link = 'index.php?option=com_tjucm&view=itemform&layout=default&client=' . $this->client . '&id=' . $editId; $itemId = $tjUcmFrontendHelper->getItemId($link); - $this->setRedirect(JRoute::_('index.php?option=com_tjucm&view=itemform&id=' . $editId . '&Itemid=' . $itemId, false)); + $this->setRedirect(Route::_('index.php?option=com_tjucm&view=itemform&id=' . $editId . '&Itemid=' . $itemId, false)); } /** @@ -125,10 +132,10 @@ public function edit() public function publish() { // Check for request forgeries. - (JSession::checkToken('get') or JSession::checkToken()) or jexit(JText::_('JINVALID_TOKEN')); + (Session::checkToken('get') or Session::checkToken()) or jexit(Text::_('JINVALID_TOKEN')); // Initialise variables. - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $id = $app->input->getInt('id'); $tjUcmFrontendHelper = new TjucmHelpersTjucm; @@ -149,7 +156,7 @@ public function publish() // Check for errors. if ($return === false) { - $this->setMessage(JText::sprintf('COM_TJUCM_SAVE_FAILED', $model->getError()), 'warning'); + $this->setMessage(Text::sprintf('COM_TJUCM_SAVE_FAILED', $model->getError()), 'warning'); } // Clear the profile id from the session. @@ -159,11 +166,11 @@ public function publish() $app->setUserState('com_tjucm.edit.item.data', null); // Redirect to the list screen. - $this->setMessage(JText::_('COM_TJUCM_ITEM_SAVED_SUCCESSFULLY')); + $this->setMessage(Text::_('COM_TJUCM_ITEM_SAVED_SUCCESSFULLY')); // If there isn't any menu item active, redirect to list view $itemId = $tjUcmFrontendHelper->getItemId('index.php?option=com_tjucm&view=items' . $this->client); - $this->setRedirect(JRoute::_('index.php?option=com_tjucm&view=items' . $this->appendUrl . '&Itemid=' . $itemId, false)); + $this->setRedirect(Route::_('index.php?option=com_tjucm&view=items' . $this->appendUrl . '&Itemid=' . $itemId, false)); // Call trigger on after publish/unpublish the record $dispatcher = JDispatcher::getInstance(); @@ -174,7 +181,7 @@ public function publish() // If there isn't any menu item active, redirect to list view $link = 'index.php?option=com_tjucm&view=items' . $this->appendUrl; $itemId = $tjUcmFrontendHelper->getItemId($link); - $this->setRedirect(JRoute::_($link . '&Itemid=' . $itemId, false), JText::_('COM_TJUCM_ITEM_SAVED_STATE_ERROR'), 'error'); + $this->setRedirect(Route::_($link . '&Itemid=' . $itemId, false), Text::_('COM_TJUCM_ITEM_SAVED_STATE_ERROR'), 'error'); } } @@ -188,10 +195,10 @@ public function publish() public function remove() { // Check for request forgeries. - (JSession::checkToken('get') or JSession::checkToken()) or jexit(JText::_('JINVALID_TOKEN')); + (Session::checkToken('get') or Session::checkToken()) or jexit(Text::_('JINVALID_TOKEN')); // Initialise variables. - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Get the user data. $id = $app->input->getInt('id', 0); @@ -209,7 +216,7 @@ public function remove() // Check for errors. if ($return === false) { - $this->setMessage(JText::sprintf("COM_TJUCM_DELETE_FAILED", $model->getError()), 'warning'); + $this->setMessage(Text::sprintf("COM_TJUCM_DELETE_FAILED", $model->getError()), 'warning'); } else { @@ -225,20 +232,20 @@ public function remove() // Flush the data from the session. $app->setUserState('com_tjucm.edit.item.data', null); - $this->setMessage(JText::_('COM_TJUCM_ITEM_DELETED_SUCCESSFULLY')); + $this->setMessage(Text::_('COM_TJUCM_ITEM_DELETED_SUCCESSFULLY')); } // If there isn't any menu item active, redirect to list view $link = 'index.php?option=com_tjucm&view=items' . $this->appendUrl; $itemId = $tjUcmFrontendHelper->getItemId($link); - $this->setRedirect(JRoute::_($link . '&Itemid=' . $itemId, false)); + $this->setRedirect(Route::_($link . '&Itemid=' . $itemId, false)); } else { // If there isn't any menu item active, redirect to list view $link = 'index.php?option=com_tjucm&view=items' . $this->appendUrl; $itemId = $tjUcmFrontendHelper->getItemId($link); - $this->setRedirect(JRoute::_($link . '&Itemid=' . $itemId, false), JText::_('COM_TJUCM_ITEM_SAVED_STATE_ERROR'), 'error'); + $this->setRedirect(Route::_($link . '&Itemid=' . $itemId, false), Text::_('COM_TJUCM_ITEM_SAVED_STATE_ERROR'), 'error'); } } } diff --git a/src/components/com_tjucm/site/controllers/itemform.json.php b/src/components/com_tjucm/site/controllers/itemform.json.php index e523cff3..c0a3dab7 100644 --- a/src/components/com_tjucm/site/controllers/itemform.json.php +++ b/src/components/com_tjucm/site/controllers/itemform.json.php @@ -10,16 +10,18 @@ // No direct access defined('_JEXEC') or die; +use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\Table\Table; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Response\JsonResponse; +use Joomla\CMS\Plugin\PluginHelper; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\CMS\Factory; use Joomla\CMS\User\User; use Joomla\CMS\Language\Text; -use Joomla\CMS\Session\Session; use Joomla\CMS\Router\Route; use Joomla\Registry\Registry; -use Joomla\CMS\MVC\Model\BaseDatabaseModel; -use Joomla\CMS\Plugin\PluginHelper; use Joomla\CMS\HTML\HTMLHelper; -use Joomla\CMS\Response\JsonResponse; use Joomla\CMS\Component\ComponentHelper; jimport('joomla.filesystem.file'); @@ -31,7 +33,7 @@ * * @since 1.6 */ -class TjucmControllerItemForm extends JControllerForm +class TjucmControllerItemForm extends FormController { // Use imported Trait in model use TjfieldsFilterField; @@ -56,7 +58,7 @@ public function __construct() if (!empty($this->client)) { JLoader::import('components.tables.type', JPATH_ADMINISTRATOR); - $tjUcmTypeTable = JTable::getInstance('Type', 'TjucmTable', array('dbo', Factory::getDbo())); + $tjUcmTypeTable = Table::getInstance('Type', 'TjucmTable', array('dbo', Factory::getDbo())); $tjUcmTypeTable->load(array('unique_identifier' => $this->client)); if (!empty($tjUcmTypeTable->id)) @@ -80,7 +82,7 @@ public function __construct() */ public function save($key = null, $urlVar = null) { - JSession::checkToken() or jexit(Text::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); $app = Factory::getApplication(); $post = $app->input->post; @@ -123,7 +125,7 @@ public function save($key = null, $urlVar = null) $isNew = (empty($data['id'])) ? 1 : 0; // Plugin trigger on before item save - JPluginHelper::importPlugin('actionlog'); + PluginHelper::importPlugin('actionlog'); $dispatcher = JDispatcher::getInstance(); $dispatcher->trigger('tjUcmOnBeforeSaveItem', array($data, $isNew)); @@ -132,7 +134,7 @@ public function save($key = null, $urlVar = null) $result['id'] = $model->getState($model->getName() . '.id'); // Plugin trigger on after item save - JPluginHelper::importPlugin('actionlog'); + PluginHelper::importPlugin('actionlog'); $dispatcher = JDispatcher::getInstance(); $dispatcher->trigger('tjUcmOnafterSaveItem', array($data, $isNew)); @@ -149,7 +151,7 @@ public function save($key = null, $urlVar = null) } catch (Exception $e) { - echo new JResponseJson($e); + echo new JsonResponse($e); $app->close(); } } @@ -163,7 +165,7 @@ public function save($key = null, $urlVar = null) */ public function saveFieldData() { - JSession::checkToken() or jexit(Text::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); $app = Factory::getApplication(); $post = $app->input->post; @@ -181,7 +183,7 @@ public function saveFieldData() if (empty($fieldData)) { $app->enqueueMessage(Text::_('COM_TJUCM_FORM_VALIDATATION_FAILED'), 'error'); - echo new JResponseJson(null); + echo new JsonResponse(null); $app->close(); } @@ -198,7 +200,7 @@ public function saveFieldData() $errors = $model->getErrors(); $this->processErrors($errors); - echo new JResponseJson(null); + echo new JsonResponse(null); $app->close(); } @@ -212,7 +214,7 @@ public function saveFieldData() $fieldData['created_by'] = $table->created_by; // Plugin trigger on before item date save - JPluginHelper::importPlugin('actionlog'); + PluginHelper::importPlugin('actionlog'); $dispatcher = JDispatcher::getInstance(); $dispatcher->trigger('tjUcmOnBeforeSaveItemData', array($recordId, $client, $data)); @@ -220,16 +222,16 @@ public function saveFieldData() $response = $model->saveFieldsData($fieldData); // Plugin trigger on after item data save - JPluginHelper::importPlugin('actionlog'); + PluginHelper::importPlugin('actionlog'); $dispatcher = JDispatcher::getInstance(); $dispatcher->trigger('tjUcmOnAfterSaveItemData', array($recordId, $client, $data)); - echo new JResponseJson($response); + echo new JsonResponse($response); $app->close(); } catch (Exception $e) { - echo new JResponseJson($e); + echo new JsonResponse($e); $app->close(); } } @@ -243,7 +245,7 @@ public function saveFieldData() */ public function saveFormData() { - JSession::checkToken() or jexit(Text::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); $app = Factory::getApplication(); $post = $app->input->post; @@ -259,7 +261,7 @@ public function saveFormData() if (empty($formData) || empty($client)) { $app->enqueueMessage(Text::_('COM_TJUCM_FORM_VALIDATATION_FAILED'), 'error'); - echo new JResponseJson(null); + echo new JsonResponse(null); $app->close(); } @@ -319,7 +321,7 @@ public function saveFormData() $errors = $model->getErrors(); $this->processErrors($errors); - echo new JResponseJson(null); + echo new JsonResponse(null); $app->close(); } @@ -333,7 +335,7 @@ public function saveFormData() $formData['created_by'] = $table->created_by; // Plugin trigger on before item date save - JPluginHelper::importPlugin('actionlog'); + PluginHelper::importPlugin('actionlog'); $dispatcher = JDispatcher::getInstance(); $dispatcher->trigger('tjUcmOnBeforeSaveItemData', array($recordId, $client, $data)); @@ -341,7 +343,7 @@ public function saveFormData() $response = $model->saveFieldsData($formData); // Plugin trigger on before item date save - JPluginHelper::importPlugin('actionlog'); + PluginHelper::importPlugin('actionlog'); $dispatcher = JDispatcher::getInstance(); $dispatcher->trigger('tjUcmOnAfterSaveItemData', array($recordId, $client, $data)); @@ -381,12 +383,12 @@ public function saveFormData() $msg = Text::_("COM_TJUCM_FORM_SAVE_FAILED_AUTHORIZATION_ERROR"); } - echo new JResponseJson($response, $msg); + echo new JsonResponse($response, $msg); $app->close(); } catch (Exception $e) { - echo new JResponseJson($e); + echo new JsonResponse($e); $app->close(); } } @@ -403,7 +405,7 @@ public function saveFormData() */ public function saveItemFieldData($key = null, $urlVar = null) { - JSession::checkToken() or jexit(Text::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); $post = Factory::getApplication()->input->post; $model = $this->getModel('itemform'); @@ -466,7 +468,7 @@ public function saveItemFieldData($key = null, $urlVar = null) } catch (Exception $e) { - echo new JResponseJson($e); + echo new JsonResponse($e); $app->close(); } } @@ -516,7 +518,7 @@ private function processErrors($errors) */ public function getRelatedFieldOptions() { - JSession::checkToken() or jexit(Text::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); $app = Factory::getApplication(); $post = $app->input->post; @@ -527,14 +529,14 @@ public function getRelatedFieldOptions() if (empty($client) || empty($contentId)) { - echo new JResponseJson(null); + echo new JsonResponse(null); $app->close(); } $app->input->set('id', $contentId); $updatedOptionsForRelatedField = $model->getUdatedRelatedFieldOptions($client, $contentId); - echo new JResponseJson($updatedOptionsForRelatedField); + echo new JsonResponse($updatedOptionsForRelatedField); $app->close(); } @@ -661,8 +663,8 @@ public function copyItem() $prefixTargetClient = str_replace(".", "_", $subFormClient); $subFieldName = $prefixTargetClient . '_' . $fieldName[1]; - JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tjfields/tables'); - $fieldTable = JTable::getInstance('field', 'TjfieldsTable'); + Table::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tjfields/tables'); + $fieldTable = Table::getInstance('field', 'TjfieldsTable'); $fieldTable->load(array('name' => $key)); @@ -709,8 +711,8 @@ public function copyItem() } elseif($fieldTable->type == 'file' || $fieldTable->type == 'image') { - JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tjfields/tables'); - $subDestionationFieldTable = JTable::getInstance('field', 'TjfieldsTable'); + Table::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tjfields/tables'); + $subDestionationFieldTable = Table::getInstance('field', 'TjfieldsTable'); $subDestionationFieldTable->load(array('name' => $subFieldName)); @@ -799,7 +801,7 @@ public function copyItem() } } - echo new JResponseJson($response, $msg); + echo new JsonResponse($response, $msg); $app->close(); } } @@ -833,7 +835,7 @@ public function getUpdatedRelatedFieldOptions() // Get object of TJ-Fields field model JLoader::import('components.com_tjfields.models.field', JPATH_ADMINISTRATOR); - $tjFieldsModelField = JModelLegacy::getInstance('Field', 'TjfieldsModel'); + $tjFieldsModelField = BaseDatabaseModel::getInstance('Field', 'TjfieldsModel'); $options = $tjFieldsModelField->getRelatedFieldOptions($fieldId); $relatedFieldOptions = array(); diff --git a/src/components/com_tjucm/site/controllers/itemform.php b/src/components/com_tjucm/site/controllers/itemform.php index f0817729..4cf5d46b 100644 --- a/src/components/com_tjucm/site/controllers/itemform.php +++ b/src/components/com_tjucm/site/controllers/itemform.php @@ -10,7 +10,10 @@ // No direct access defined('_JEXEC') or die; +use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\Table\Table; use Joomla\CMS\Factory; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\CMS\User\User; use Joomla\CMS\Language\Text; use Joomla\CMS\Session\Session; @@ -23,7 +26,7 @@ * * @since 1.6 */ -class TjucmControllerItemForm extends JControllerForm +class TjucmControllerItemForm extends FormController { /** * Constructor @@ -59,7 +62,7 @@ public function __construct() if (!empty($this->ucm_type)) { JLoader::import('components.com_tjfields.tables.type', JPATH_ADMINISTRATOR); - $ucmTypeTable = JTable::getInstance('Type', 'TjucmTable', array('dbo', JFactory::getDbo())); + $ucmTypeTable = Table::getInstance('Type', 'TjucmTable', array('dbo', Factory::getDbo())); $ucmTypeTable->load(array('alias' => $this->ucm_type)); $this->client = $ucmTypeTable->unique_identifier; } @@ -67,8 +70,8 @@ public function __construct() } // Get UCM type id from unique identifier - JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tjucm/models'); - $tjUcmModelType = JModelLegacy::getInstance('Type', 'TjucmModel'); + BaseDatabaseModel::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tjucm/models'); + $tjUcmModelType = BaseDatabaseModel::getInstance('Type', 'TjucmModel'); $this->ucmTypeId = $tjUcmModelType->getTypeId($this->client); $this->appendUrl = ""; diff --git a/src/components/com_tjucm/site/controllers/type.php b/src/components/com_tjucm/site/controllers/type.php index 8c711cc2..d2988bc2 100644 --- a/src/components/com_tjucm/site/controllers/type.php +++ b/src/components/com_tjucm/site/controllers/type.php @@ -10,6 +10,8 @@ // No direct access defined('_JEXEC') or die; +use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\Response\JsonResponse; use Joomla\CMS\Session\Session; use Joomla\CMS\Factory; @@ -23,7 +25,7 @@ * * @since __DEPLOY_VERSION__ */ -class TjucmControllerType extends JControllerForm +class TjucmControllerType extends FormController { /** * Constructor @@ -53,7 +55,7 @@ public function getCompatibleUcmTypes() if (empty($client)) { - echo new JResponseJson(null); + echo new JsonResponse(null); $app->close(); } @@ -88,7 +90,7 @@ public function getCompatibleUcmTypes() $validUcmType = false; } - echo new JResponseJson($validUcmType); + echo new JsonResponse($validUcmType); $app->close(); } @@ -118,7 +120,7 @@ public function getClusterFieldOptions() if (empty($client)) { - echo new JResponseJson(null); + echo new JsonResponse(null); $app->close(); } @@ -127,7 +129,7 @@ public function getClusterFieldOptions() if (empty($clusterExist)) { - echo new JResponseJson(null); + echo new JsonResponse(null); $app->close(); } @@ -137,7 +139,7 @@ public function getClusterFieldOptions() if (!$fieldTable->id) { - echo new JResponseJson(null); + echo new JsonResponse(null); $app->close(); } @@ -185,7 +187,7 @@ public function getClusterFieldOptions() } } - echo new JResponseJson($usersClusters); + echo new JsonResponse($usersClusters); $app->close(); } } diff --git a/src/components/com_tjucm/site/includes/access.php b/src/components/com_tjucm/site/includes/access.php index 822c4b94..47fc533b 100644 --- a/src/components/com_tjucm/site/includes/access.php +++ b/src/components/com_tjucm/site/includes/access.php @@ -9,12 +9,12 @@ */ defined('_JEXEC') or die(); - use Joomla\CMS\Factory; +use Joomla\CMS\Table\Table; + use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\MVC\Model\BaseDatabaseModel; -use Joomla\CMS\Table\Table; use Joomla\String\StringHelper; require_once JPATH_SITE . '/components/com_tjucm/includes/defines.php'; @@ -65,7 +65,7 @@ public static function canImport($ucmTypeId, $userId = 0) { JLoader::import("/components/com_subusers/includes/rbacl", JPATH_ADMINISTRATOR); - return RBACL::check($user->id, 'com_cluster', 'core.importitem.' . $ucmTypeId) && RBACL::check(JFactory::getUser()->id, 'com_cluster', 'core.createtitem.' . $ucmTypeId); + return RBACL::check($user->id, 'com_cluster', 'core.importitem.' . $ucmTypeId) && RBACL::check(Factory::getUser()->id, 'com_cluster', 'core.createtitem.' . $ucmTypeId); } } else @@ -79,7 +79,7 @@ public static function canView($ucmTypeId, $contentId, $userId = 0) $user = empty($userId) ? Factory::getUser() : Factory::getUser($userId); JLoader::import('components.com_tjucm.tables.item', JPATH_ADMINISTRATOR); - $itemTable = JTable::getInstance('Item', 'TjucmTable', array('dbo', JFactory::getDbo())); + $itemTable = Table::getInstance('Item', 'TjucmTable', array('dbo', Factory::getDbo())); $itemTable->load($contentId); if ($user->id == $itemTable->created_by) @@ -131,7 +131,7 @@ public static function canEdit($ucmTypeId, $contentId, $userId = 0) if ($subUserExist) { JLoader::import('components.com_tjucm.tables.item', JPATH_ADMINISTRATOR); - $itemTable = JTable::getInstance('Item', 'TjucmTable', array('dbo', JFactory::getDbo())); + $itemTable = Table::getInstance('Item', 'TjucmTable', array('dbo', Factory::getDbo())); $itemTable->load($contentId); return RBACL::check($user->id, 'com_cluster', 'core.edititem.' . $ucmTypeId, $itemTable->cluster_id); @@ -163,7 +163,7 @@ public static function canEditState($ucmTypeId, $contentId, $userId = 0) if ($subUserExist) { JLoader::import('components.com_tjucm.tables.item', JPATH_ADMINISTRATOR); - $itemTable = JTable::getInstance('Item', 'TjucmTable', array('dbo', JFactory::getDbo())); + $itemTable = Table::getInstance('Item', 'TjucmTable', array('dbo', Factory::getDbo())); $itemTable->load($contentId); return RBACL::check($user->id, 'com_cluster', 'core.edititemstate.' . $ucmTypeId, $itemTable->cluster_id); @@ -189,7 +189,7 @@ public static function canEditOwn($ucmTypeId, $contentId, $userId = 0) { JLoader::import("/components/com_subusers/includes/rbacl", JPATH_ADMINISTRATOR); JLoader::import('components.com_tjucm.tables.item', JPATH_ADMINISTRATOR); - $itemTable = JTable::getInstance('Item', 'TjucmTable', array('dbo', JFactory::getDbo())); + $itemTable = Table::getInstance('Item', 'TjucmTable', array('dbo', Factory::getDbo())); $itemTable->load($contentId); return RBACL::check($user->id, 'com_cluster', 'core.editownitem.' . $ucmTypeId, $itemTable->cluster_id); @@ -221,7 +221,7 @@ public static function canDelete($ucmTypeId, $contentId, $userId = 0) if ($subUserExist) { JLoader::import('components.com_tjucm.tables.item', JPATH_ADMINISTRATOR); - $itemTable = JTable::getInstance('Item', 'TjucmTable', array('dbo', JFactory::getDbo())); + $itemTable = Table::getInstance('Item', 'TjucmTable', array('dbo', Factory::getDbo())); $itemTable->load($contentId); return RBACL::check($user->id, 'com_cluster', 'core.deleteitem.' . $ucmTypeId, $itemTable->cluster_id); @@ -247,7 +247,7 @@ public static function canDeleteOwn($ucmTypeId, $contentId, $userId = 0) { JLoader::import("/components/com_subusers/includes/rbacl", JPATH_ADMINISTRATOR); JLoader::import('components.com_tjucm.tables.item', JPATH_ADMINISTRATOR); - $itemTable = JTable::getInstance('Item', 'TjucmTable', array('dbo', JFactory::getDbo())); + $itemTable = Table::getInstance('Item', 'TjucmTable', array('dbo', Factory::getDbo())); $itemTable->load($contentId); return RBACL::check($user->id, 'com_cluster', 'core.deleteownitem.' . $ucmTypeId, $itemTable->cluster_id); @@ -264,11 +264,11 @@ public static function hasCluster($ucmTypeId) if (ComponentHelper::getComponent('com_cluster', true)->enabled) { JLoader::import('components.com_tjucm.tables.type', JPATH_ADMINISTRATOR); - $typeTable = JTable::getInstance('Type', 'TjucmTable', array('dbo', JFactory::getDbo())); + $typeTable = Table::getInstance('Type', 'TjucmTable', array('dbo', Factory::getDbo())); $typeTable->load($ucmTypeId); JLoader::import('components.com_tjfields.tables.field', JPATH_ADMINISTRATOR); - $fieldTable = JTable::getInstance('Field', 'TjfieldsTable', array('dbo', JFactory::getDbo())); + $fieldTable = Table::getInstance('Field', 'TjfieldsTable', array('dbo', Factory::getDbo())); $fieldTable->load(array('client' => $typeTable->unique_identifier, 'type' => 'cluster', 'state' => 1)); if ($fieldTable->id) diff --git a/src/components/com_tjucm/site/includes/tjucm.php b/src/components/com_tjucm/site/includes/tjucm.php index 0671cbfb..f0152a2d 100644 --- a/src/components/com_tjucm/site/includes/tjucm.php +++ b/src/components/com_tjucm/site/includes/tjucm.php @@ -139,7 +139,6 @@ public static function loadClass($className) /** * Load the component configuration * - * @return Joomla\Registry\Registry A Registry object. */ public static function config() { diff --git a/src/components/com_tjucm/site/layouts/detail/fields.php b/src/components/com_tjucm/site/layouts/detail/fields.php index ec6b29cf..de1e88c9 100644 --- a/src/components/com_tjucm/site/layouts/detail/fields.php +++ b/src/components/com_tjucm/site/layouts/detail/fields.php @@ -9,14 +9,18 @@ // No direct access defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Table\Table; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; +use Joomla\CMS\Layout\FileLayout; if (!key_exists('formObject', $displayData) || !key_exists('xmlFormObject', $displayData)) { return; } -$app = JFactory::getApplication(); -$user = JFactory::getUser(); +$app = Factory::getApplication(); +$user = Factory::getUser(); // Layout for field types $fieldLayout = array(); @@ -51,7 +55,7 @@ // Get Field table JTable::addIncludePath(JPATH_ROOT . '/administrator/components/com_tjfields/tables'); -$tjFieldsFieldTable = JTable::getInstance('field', 'TjfieldsTable'); +$tjFieldsFieldTable = Table::getInstance('field', 'TjfieldsTable'); $fieldSets = $formObject->getFieldsets(); $count = 0; @@ -103,7 +107,7 @@ // Call to extra fields JLoader::import('components.com_tjucm.models.item', JPATH_SITE); - $tjucmItemModel = JModelLegacy::getInstance('Item', 'TjucmModel'); + $tjucmItemModel = BaseDatabaseModel::getInstance('Item', 'TjucmModel'); // Get Subform field data $formData = $TjfieldsHelper->getFieldData($field->getAttribute('name')); @@ -142,7 +146,7 @@ $ucmSubFormRecordData = $tjucmItemModel->getData($ucmSubFormData->$contentIdFieldname); // Call the JLayout recursively to render fields of ucmsubform - $layout = new JLayoutFile('fields', JPATH_ROOT . '/components/com_tjucm/layouts/detail'); + $layout = new FileLayout('fields', JPATH_ROOT . '/components/com_tjucm/layouts/detail'); echo $layout->render(array('xmlFormObject' => $ucmSubFormXmlFieldSets, 'formObject' => $ucmSubformFormObject, 'itemData' => $ucmSubFormRecordData, 'isSubForm' => 1)); echo "
"; } @@ -176,7 +180,7 @@ $field->setValue(''); } - $layout = new JLayoutFile($layoutToUse, JPATH_ROOT . '/components/com_tjfields/layouts/fields'); + $layout = new FileLayout($layoutToUse, JPATH_ROOT . '/components/com_tjfields/layouts/fields'); $output = $layout->render(array('fieldXml' => $xmlField, 'field' => $field)); // To align text, textarea, textareacounter, editor and tjlist fields properly diff --git a/src/components/com_tjucm/site/layouts/list/list.php b/src/components/com_tjucm/site/layouts/list/list.php index bfbaa54d..0bb600cf 100644 --- a/src/components/com_tjucm/site/layouts/list/list.php +++ b/src/components/com_tjucm/site/layouts/list/list.php @@ -9,9 +9,11 @@ // No direct access defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\MVC\Model\BaseDatabaseModel; +use Joomla\CMS\HTML\HTMLHelper; +use Joomla\CMS\Layout\FileLayout; use Joomla\CMS\Factory; -use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; use Joomla\CMS\Router\Route; use Joomla\CMS\Session\Session; @@ -46,7 +48,7 @@ // Load itemForm model JLoader::import('components.com_tjucm.models.itemform', JPATH_SITE); -$tjucmItemFormModel = JModelLegacy::getInstance('ItemForm', 'TjucmModel'); +$tjucmItemFormModel = BaseDatabaseModel::getInstance('ItemForm', 'TjucmModel'); // Get JLayout data $item = $displayData['itemsData']; @@ -105,7 +107,7 @@ - id); ?> + id); ?> getFieldData($field->getAttribute('name')); @@ -227,7 +229,7 @@ $ucmSubFormRecordData = $tjucmItemModel->getData($subFormData->$contentIdFieldname); // Call the JLayout recursively to render fields of ucmsubform - $layout = new JLayoutFile('fields', JPATH_ROOT . '/components/com_tjucm/layouts/detail'); + $layout = new FileLayout('fields', JPATH_ROOT . '/components/com_tjucm/layouts/detail'); echo $layout->render(array('xmlFormObject' => $ucmSubFormXmlFieldSets, 'formObject' => $ucmSubformFormObject, 'itemData' => $ucmSubFormRecordData, 'isSubForm' => 1)); if (count($ucmSubFormData) > $count) @@ -248,7 +250,7 @@ ucfirst($tjFieldsFieldTable->type), $fieldLayout ) ) ? $fieldLayout[ucfirst($tjFieldsFieldTable->type)] : 'field'; - $layout = new JLayoutFile($layoutToUse, JPATH_ROOT . '/components/com_tjfields/layouts/fields'); + $layout = new FileLayout($layoutToUse, JPATH_ROOT . '/components/com_tjfields/layouts/fields'); $output = $layout->render(array('fieldXml' => $fieldXml, 'field' => $field)); // To align text, textarea, textareacounter, editor and tjlist fields properly diff --git a/src/components/com_tjucm/site/models/fields/createdby.php b/src/components/com_tjucm/site/models/fields/createdby.php index 4704329e..26b1be8b 100644 --- a/src/components/com_tjucm/site/models/fields/createdby.php +++ b/src/components/com_tjucm/site/models/fields/createdby.php @@ -9,15 +9,16 @@ */ defined('JPATH_BASE') or die; +use Joomla\CMS\Form\FormField; +use Joomla\CMS\Factory; -jimport('joomla.form.formfield'); /** * Supports an HTML select list of categories * * @since 1.6 */ -class JFormFieldCreatedby extends JFormField +class JFormFieldCreatedby extends FormField { /** * The form field type. @@ -44,11 +45,11 @@ protected function getInput() if ($user_id) { - $user = JFactory::getUser($user_id); + $user = Factory::getUser($user_id); } else { - $user = JFactory::getUser(); + $user = Factory::getUser(); $html[] = ''; } diff --git a/src/components/com_tjucm/site/models/fields/filemultiple.php b/src/components/com_tjucm/site/models/fields/filemultiple.php index 0400591e..4a481f98 100644 --- a/src/components/com_tjucm/site/models/fields/filemultiple.php +++ b/src/components/com_tjucm/site/models/fields/filemultiple.php @@ -9,15 +9,15 @@ */ defined('JPATH_BASE') or die; +use Joomla\CMS\Form\FormField; -jimport('joomla.form.formfield'); /** * Supports an HTML select list of categories * * @since 1.6 */ -class JFormFieldFileMultiple extends JFormField +class JFormFieldFileMultiple extends FormField { /** * The form field type. diff --git a/src/components/com_tjucm/site/models/fields/foreignkey.php b/src/components/com_tjucm/site/models/fields/foreignkey.php index 8ea5a304..2a942c1e 100644 --- a/src/components/com_tjucm/site/models/fields/foreignkey.php +++ b/src/components/com_tjucm/site/models/fields/foreignkey.php @@ -9,15 +9,17 @@ */ defined('JPATH_BASE') or die; +use Joomla\CMS\Form\FormField; +use Joomla\CMS\Factory; +use Joomla\CMS\HTML\HTMLHelper; -jimport('joomla.form.formfield'); /** * Supports a value from an external table * * @since 1.6 */ -class JFormFieldForeignKey extends JFormField +class JFormFieldForeignKey extends FormField { /** * The form field type. @@ -65,7 +67,7 @@ protected function getInput() $fk_value = ''; // Load all the field options - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true); // Support for multiple fields on fk_values @@ -114,7 +116,7 @@ protected function getInput() // Iterate through all the results foreach ($results as $result) { - $options[] = JHtml::_('select.option', $result->{$this->key_field}, $result->{$this->value_field}); + $options[] = HTMLHelper::_('select.option', $result->{$this->key_field}, $result->{$this->value_field}); } $value = $this->value; @@ -137,10 +139,10 @@ protected function getInput() } else { - array_unshift($options, JHtml::_('select.option', '', '')); + array_unshift($options, HTMLHelper::_('select.option', '', '')); } - $html = JHtml::_('select.genericlist', $options, $this->name, $input_options, 'value', 'text', $value, $this->id); + $html = HTMLHelper::_('select.genericlist', $options, $this->name, $input_options, 'value', 'text', $value, $this->id); break; } diff --git a/src/components/com_tjucm/site/models/fields/modifiedby.php b/src/components/com_tjucm/site/models/fields/modifiedby.php index dc70031d..cce61f0f 100644 --- a/src/components/com_tjucm/site/models/fields/modifiedby.php +++ b/src/components/com_tjucm/site/models/fields/modifiedby.php @@ -9,15 +9,16 @@ */ defined('JPATH_BASE') or die; +use Joomla\CMS\Form\FormField; +use Joomla\CMS\Factory; -jimport('joomla.form.formfield'); /** * Supports an HTML select list of categories * * @since 1.6 */ -class JFormFieldModifiedby extends JFormField +class JFormFieldModifiedby extends FormField { /** * The form field type. @@ -38,7 +39,7 @@ protected function getInput() { // Initialize variables. $html = array(); - $user = JFactory::getUser(); + $user = Factory::getUser(); $html[] = ''; if (!$this->hidden) diff --git a/src/components/com_tjucm/site/models/fields/submit.php b/src/components/com_tjucm/site/models/fields/submit.php index 7ff31ddd..5d6764c8 100644 --- a/src/components/com_tjucm/site/models/fields/submit.php +++ b/src/components/com_tjucm/site/models/fields/submit.php @@ -10,15 +10,16 @@ // Check to ensure this file is included in Joomla! defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Form\FormField; +use Joomla\CMS\Language\Text; -jimport('joomla.form.formfield'); /** - * Class JFormFieldSubmit + * Class FormFieldSubmit * * @since 1.6 */ -class JFormFieldSubmit extends JFormField +class JFormFieldSubmit extends FormField { protected $type = 'submit'; @@ -38,9 +39,9 @@ public function getInput() return ''; } } diff --git a/src/components/com_tjucm/site/models/fields/timecreated.php b/src/components/com_tjucm/site/models/fields/timecreated.php index a241fd3e..7c86b8fe 100644 --- a/src/components/com_tjucm/site/models/fields/timecreated.php +++ b/src/components/com_tjucm/site/models/fields/timecreated.php @@ -9,15 +9,18 @@ */ defined('JPATH_BASE') or die; +use Joomla\CMS\Form\FormField; +use Joomla\CMS\Factory; +use Joomla\CMS\Date\Date; +use Joomla\CMS\Language\Text; -jimport('joomla.form.formfield'); /** * Supports an HTML select list of categories * * @since 1.6 */ -class JFormFieldTimecreated extends JFormField +class JFormFieldTimecreated extends FormField { /** * The form field type. @@ -43,7 +46,7 @@ protected function getInput() if (!strtotime($time_created)) { - $time_created = JFactory::getDate()->toSql(); + $time_created = Factory::getDate()->toSql(); $html[] = ''; } @@ -51,8 +54,8 @@ protected function getInput() if ($hidden == null || !$hidden) { - $jdate = new JDate($time_created); - $pretty_date = $jdate->format(JText::_('DATE_FORMAT_LC2')); + $jdate = new Date($time_created); + $pretty_date = $jdate->format(Text::_('DATE_FORMAT_LC2')); $html[] = "
" . $pretty_date . "
"; } diff --git a/src/components/com_tjucm/site/models/fields/timeupdated.php b/src/components/com_tjucm/site/models/fields/timeupdated.php index fd2e620e..52ed5471 100644 --- a/src/components/com_tjucm/site/models/fields/timeupdated.php +++ b/src/components/com_tjucm/site/models/fields/timeupdated.php @@ -9,15 +9,18 @@ */ defined('JPATH_BASE') or die; +use Joomla\CMS\Form\FormField; +use Joomla\CMS\Date\Date; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Factory; -jimport('joomla.form.formfield'); /** * Supports an HTML select list of categories * * @since 1.6 */ -class JFormFieldTimeupdated extends JFormField +class JFormFieldTimeupdated extends FormField { /** * The form field type. @@ -50,13 +53,13 @@ protected function getInput() } else { - $jdate = new JDate($old_time_updated); - $pretty_date = $jdate->format(JText::_('DATE_FORMAT_LC2')); + $jdate = new Date($old_time_updated); + $pretty_date = $jdate->format(Text::_('DATE_FORMAT_LC2')); $html[] = "
" . $pretty_date . "
"; } } - $time_updated = JFactory::getDate()->toSql(); + $time_updated = Factory::getDate()->toSql(); $html[] = ''; return implode($html); diff --git a/src/components/com_tjucm/site/models/item.php b/src/components/com_tjucm/site/models/item.php index 60ea055d..fd3b85d8 100644 --- a/src/components/com_tjucm/site/models/item.php +++ b/src/components/com_tjucm/site/models/item.php @@ -10,6 +10,12 @@ // No direct access. defined('_JEXEC') or die; +use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Factory; +use Joomla\CMS\Table\Table; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Object\CMSObject; jimport('joomla.application.component.modelitem'); jimport('joomla.event.dispatcher'); @@ -17,14 +23,13 @@ require_once JPATH_SITE . "/components/com_tjfields/filterFields.php"; use Joomla\Utilities\ArrayHelper; -use Joomla\CMS\MVC\Model\BaseDatabaseModel; /** * Tjucm model. * * @since 1.6 */ -class TjucmModelItem extends JModelAdmin +class TjucmModelItem extends AdminModel { private $client = ''; @@ -44,7 +49,7 @@ class TjucmModelItem extends JModelAdmin */ protected function populateState() { - $app = JFactory::getApplication('com_tjucm'); + $app = Factory::getApplication('com_tjucm'); // Load state from the request. $id = $app->input->getInt('id'); @@ -69,15 +74,15 @@ protected function populateState() if (!empty($ucm_type)) { JLoader::import('components.com_tjfields.tables.type', JPATH_ADMINISTRATOR); - $ucmTypeTable = JTable::getInstance('Type', 'TjucmTable', array('dbo', JFactory::getDbo())); + $ucmTypeTable = Table::getInstance('Type', 'TjucmTable', array('dbo', Factory::getDbo())); $ucmTypeTable->load(array('alias' => $ucm_type)); $ucmType = $ucmTypeTable->unique_identifier; } } } - JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tjucm/models'); - $tjUcmModelType = JModelLegacy::getInstance('Type', 'TjucmModel'); + BaseDatabaseModel::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tjucm/models'); + $tjUcmModelType = BaseDatabaseModel::getInstance('Type', 'TjucmModel'); $ucmId = $tjUcmModelType->getTypeId($ucmType); $this->setState('ucmType.id', $ucmId); @@ -123,12 +128,12 @@ public function getItem($pk = null) $item = $db->loadObject(); // Variable to store creator name and id - $created_by = JFactory::getUser($item->created_by); + $created_by = Factory::getUser($item->created_by); $created_by = array("id" => $created_by->id, "name" => $created_by->name); $item->created_by = $created_by; // Variable to store modifier name and id - $modified_by = JFactory::getUser($item->modified_by); + $modified_by = Factory::getUser($item->modified_by); $modified_by = array("id" => $modified_by->id, "name" => $modified_by->name); $item->modified_by = $modified_by; @@ -197,7 +202,7 @@ public function &getData($id = null) // Check for published state if filter set. if (((is_numeric($published)) || (is_numeric($archived))) && (($table->state != $published) && ($table->state != $archived))) { - return JError::raiseError(404, JText::_('COM_TJUCM_ITEM_DOESNT_EXIST')); + return JError::raiseError(404, Text::_('COM_TJUCM_ITEM_DOESNT_EXIST')); } } @@ -210,7 +215,7 @@ public function &getData($id = null) if (!empty($this->item->id)) { - if ($canView || ($this->item->created_by == JFactory::getUser()->id)) + if ($canView || ($this->item->created_by == Factory::getUser()->id)) { $this->item->params->set('access-view', true); } @@ -218,26 +223,26 @@ public function &getData($id = null) } else { - return JError::raiseError(404, JText::_('COM_TJUCM_ITEM_DOESNT_EXIST')); + return JError::raiseError(404, Text::_('COM_TJUCM_ITEM_DOESNT_EXIST')); } return $this->item; } /** - * Get an instance of JTable class + * Get an instance of Table class * - * @param string $type Name of the JTable class to get an instance of. + * @param string $type Name of the Table class to get an instance of. * @param string $prefix Prefix for the table class name. Optional. - * @param array $config Array of configuration values for the JTable object. Optional. + * @param array $config Array of configuration values for the Table object. Optional. * - * @return JTable|bool JTable if success, false on failure. + * @return Table|bool Table if success, false on failure. */ public function getTable($type = 'Item', $prefix = 'TjucmTable', $config = array()) { $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_tjucm/tables'); - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } /** @@ -293,7 +298,7 @@ public function publish(&$id, $state = 1) */ public function delete(&$id) { - $app = JFactory::getApplication('com_tjucm'); + $app = Factory::getApplication('com_tjucm'); $ucmTypeId = $this->getState('ucmType.id'); $canDelete = TjucmAccess::canDelete($ucmTypeId, $id); @@ -306,7 +311,7 @@ public function delete(&$id) } else { - throw new Exception(JText::_('JERROR_ALERTNOAUTHOR'), 403); + throw new Exception(Text::_('JERROR_ALERTNOAUTHOR'), 403); return false; } diff --git a/src/components/com_tjucm/site/models/itemform.php b/src/components/com_tjucm/site/models/itemform.php index e71f4405..b5425ecb 100644 --- a/src/components/com_tjucm/site/models/itemform.php +++ b/src/components/com_tjucm/site/models/itemform.php @@ -10,18 +10,24 @@ // No direct access. defined('_JEXEC') or die; +use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Factory; +use Joomla\CMS\Table\Table; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Object\CMSObject; +use Joomla\CMS\Form\Form; +use Joomla\CMS\Filesystem\File; +use Joomla\CMS\Plugin\PluginHelper; jimport('joomla.application.component.modelform'); jimport('joomla.event.dispatcher'); require_once JPATH_SITE . "/components/com_tjfields/filterFields.php"; -use Joomla\CMS\Table\Table; use Joomla\Utilities\ArrayHelper; -use Joomla\CMS\Factory; use Joomla\CMS\Component\ComponentHelper; use Joomla\Registry\Registry; -use Joomla\CMS\Language\Text; use TJQueue\Admin\TJQueueProduce; if (ComponentHelper::getComponent('com_tjqueue', true)->enabled) @@ -36,7 +42,7 @@ * * @since 1.0 */ -class TjucmModelItemForm extends JModelAdmin +class TjucmModelItemForm extends AdminModel { private $item = null; @@ -68,8 +74,8 @@ class TjucmModelItemForm extends JModelAdmin */ protected function populateState() { - $app = JFactory::getApplication('com_tjucm'); - $user = JFactory::getUser(); + $app = Factory::getApplication('com_tjucm'); + $user = Factory::getUser(); // Load state from the request. $id = $app->input->getInt('id'); @@ -97,15 +103,15 @@ protected function populateState() if (!empty($ucm_type)) { JLoader::import('components.com_tjfields.tables.type', JPATH_ADMINISTRATOR); - $ucmTypeTable = JTable::getInstance('Type', 'TjucmTable', array('dbo', JFactory::getDbo())); + $ucmTypeTable = Table::getInstance('Type', 'TjucmTable', array('dbo', Factory::getDbo())); $ucmTypeTable->load(array('alias' => $ucm_type)); $ucmType = $ucmTypeTable->unique_identifier; } } } - JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tjucm/models'); - $tjUcmModelType = JModelLegacy::getInstance('Type', 'TjucmModel'); + BaseDatabaseModel::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tjucm/models'); + $tjUcmModelType = BaseDatabaseModel::getInstance('Type', 'TjucmModel'); $ucmId = $tjUcmModelType->getTypeId($ucmType); $this->setState('ucmType.id', $ucmId); @@ -140,7 +146,7 @@ protected function populateState() */ public function &getData($id = null) { - $user = JFactory::getUser(); + $user = Factory::getUser(); $this->item = false; @@ -170,7 +176,7 @@ public function &getData($id = null) // Check for published state if filter set. if (((is_numeric($published)) || (is_numeric($archived))) && (($table->state != $published) && ($table->state != $archived))) { - return JError::raiseError(404, JText::_('COM_TJUCM_ITEM_DOESNT_EXIST')); + return JError::raiseError(404, Text::_('COM_TJUCM_ITEM_DOESNT_EXIST')); } } @@ -192,7 +198,7 @@ public function &getData($id = null) } else { - if ($this->item->created_by == JFactory::getUser()->id) + if ($this->item->created_by == Factory::getUser()->id) { if ($canEditOwn || $canEdit) { @@ -210,7 +216,7 @@ public function &getData($id = null) } else { - return JError::raiseError(404, JText::_('COM_TJUCM_ITEM_DOESNT_EXIST')); + return JError::raiseError(404, Text::_('COM_TJUCM_ITEM_DOESNT_EXIST')); } return $this->item; @@ -223,7 +229,7 @@ public function &getData($id = null) * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * - * @return JTable A database object + * @return Table A database object * * @since 1.0 */ @@ -231,7 +237,7 @@ public function getTable($type = 'Item', $prefix = 'TjucmTable', $config = array { $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_tjucm/tables'); - return JTable::getInstance($type, $prefix, $config); + return Table::getInstance($type, $prefix, $config); } /** @@ -252,7 +258,7 @@ public function setClient($client) * @param array $data An optional array of data for the form to interogate. * @param boolean $loadData True if the form is to load its own data (default case), false if not. * - * @return JForm A JForm object on success, false on failure + * @return Form A Form object on success, false on failure * * @since 1.0 */ @@ -280,7 +286,7 @@ public function getForm($data = array(), $loadData = true) * @param array $data An optional array of data for the form to interogate. * @param boolean $loadData True if the form is to load its own data (default case), false if not. * - * @return JForm A JForm object on success, false on failure + * @return Form A Form object on success, false on failure * * @since 1.2.2 */ @@ -336,7 +342,7 @@ public function getFieldForm($data = array(), $loadData = true) * @param array $data An optional array of data for the form to interogate. * @param boolean $loadData True if the form is to load its own data (default case), false if not. * - * @return JForm A JForm object on success, false on failure + * @return Form A Form object on success, false on failure * * @since 1.2.2 */ @@ -399,7 +405,7 @@ public function getTypeForm($data = array(), $loadData = true) * @param array $data An optional array of data for the form to interogate. * @param boolean $loadData True if the form is to load its own data (default case), false if not. * - * @return JForm A JForm object on success, false on failure + * @return Form A Form object on success, false on failure * * @since 1.2.2 */ @@ -456,9 +462,9 @@ public function getSectionForm($data = array(), $loadData = true) ); // Delete temp xml once its object is created - if (JFile::exists($newXmlFilePath)) + if (File::exists($newXmlFilePath)) { - JFile::delete($newXmlFilePath); + File::delete($newXmlFilePath); } if (empty($sectionForm)) @@ -479,7 +485,7 @@ public function getSectionForm($data = array(), $loadData = true) protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_tjucm.edit.item.data', array()); + $data = Factory::getApplication()->getUserState('com_tjucm.edit.item.data', array()); if (empty($data)) { @@ -510,7 +516,7 @@ public function save($data) // Guest users are not allowed to add the records if (empty($user->id)) { - $this->setError(JText::_('COM_TJUCM_FORM_SAVE_FAILED_AUTHORIZATION_ERROR')); + $this->setError(Text::_('COM_TJUCM_FORM_SAVE_FAILED_AUTHORIZATION_ERROR')); return false; } @@ -526,7 +532,7 @@ public function save($data) // Get instance of UCM type table JLoader::import('components.com_tjucm.tables.type', JPATH_ADMINISTRATOR); - $tjUcmTypeTable = JTable::getInstance('Type', 'TjucmTable', array('dbo', Factory::getDbo())); + $tjUcmTypeTable = Table::getInstance('Type', 'TjucmTable', array('dbo', Factory::getDbo())); // Check and assign valid client and type_id to the record if (!empty($data['type_id']) || !empty($data['client'])) @@ -544,7 +550,7 @@ public function save($data) } else { - $this->setError(JText::_('COM_TJUCM_FORM_SAVE_FAILED_CLIENT_REQUIRED')); + $this->setError(Text::_('COM_TJUCM_FORM_SAVE_FAILED_CLIENT_REQUIRED')); return false; } @@ -587,7 +593,7 @@ public function save($data) if (!$canAdd) { - $this->setError(JText::_('COM_TJUCM_FORM_SAVE_FAILED_AUTHORIZATION_ERROR')); + $this->setError(Text::_('COM_TJUCM_FORM_SAVE_FAILED_AUTHORIZATION_ERROR')); return false; } @@ -599,7 +605,7 @@ public function save($data) if (!$canAdd) { - $this->setError(JText::sprintf('COM_TJUCM_ALLOWED_COUNT_LIMIT', $allowedCount)); + $this->setError(Text::sprintf('COM_TJUCM_ALLOWED_COUNT_LIMIT', $allowedCount)); return false; } @@ -625,7 +631,7 @@ public function save($data) if (!$authorised) { - $this->setError(JText::_('COM_TJUCM_FORM_SAVE_FAILED_AUTHORIZATION_ERROR')); + $this->setError(Text::_('COM_TJUCM_FORM_SAVE_FAILED_AUTHORIZATION_ERROR')); return false; } @@ -657,7 +663,7 @@ public function saveFieldsData($fieldData) || array_key_exists($itemCategoryFieldName, $fieldData['fieldsvalue'])) { JLoader::import('components.com_tjucm.tables.item', JPATH_ADMINISTRATOR); - $ucmItemTable = JTable::getInstance('Item', 'TjucmTable', array('dbo', JFactory::getDbo())); + $ucmItemTable = Table::getInstance('Item', 'TjucmTable', array('dbo', Factory::getDbo())); $ucmItemTable->load(array('id' => $fieldData['content_id'])); if (!empty($fieldData['fieldsvalue'][$clusterFieldName])) @@ -668,7 +674,7 @@ public function saveFieldsData($fieldData) if (!empty($fieldData['fieldsvalue'][$ownerShipFieldName])) { JLoader::import('components.com_tjfields.tables.field', JPATH_ADMINISTRATOR); - $fieldTable = JTable::getInstance('Field', 'TjfieldsTable', array('dbo', JFactory::getDbo())); + $fieldTable = Table::getInstance('Field', 'TjfieldsTable', array('dbo', Factory::getDbo())); $fieldTable->load(array('name' => $ownerShipFieldName)); $fieldParams = new Registry($fieldTable->params); @@ -703,7 +709,7 @@ public function saveFieldsData($fieldData) public function delete(&$contentId) { $ucmTypeId = $this->getState('ucmType.id'); - $user = JFactory::getUser(); + $user = Factory::getUser(); $table = $this->getTable(); $table->load($contentId); $canDelete = TjucmAccess::canDelete($table->type_id, $contentId); @@ -713,7 +719,7 @@ public function delete(&$contentId) if ($canDeleteown) { - $deleteOwn = (JFactory::getUser()->id == $table->created_by ? true : false); + $deleteOwn = (Factory::getUser()->id == $table->created_by ? true : false); } if ($canDelete || $deleteOwn) @@ -728,7 +734,7 @@ public function delete(&$contentId) } // If there are child records then delete child records first - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true); $query->select('id'); $query->from($db->quoteName('#__tj_ucm_data')); @@ -743,7 +749,7 @@ public function delete(&$contentId) $table->load($subFormContentId); // Plugin trigger on before item delete - JPluginHelper::importPlugin('actionlog'); + PluginHelper::importPlugin('actionlog'); $dispatcher = JDispatcher::getInstance(); $dispatcher->trigger('tjUcmOnBeforeDeleteItem', array($subFormContentId, $table->client)); @@ -752,7 +758,7 @@ public function delete(&$contentId) $this->deleteExtraFieldsData($subFormContentId, $table->client); // Plugin trigger on after item delete - JPluginHelper::importPlugin('actionlog'); + PluginHelper::importPlugin('actionlog'); $dispatcher = JDispatcher::getInstance(); $dispatcher->trigger('tjUcmOnAfterDeleteItem', array($subFormContentId, $table->client)); } @@ -763,7 +769,7 @@ public function delete(&$contentId) $table->load($id); // Plugin trigger on before item delete - JPluginHelper::importPlugin('actionlog'); + PluginHelper::importPlugin('actionlog'); $dispatcher = JDispatcher::getInstance(); $dispatcher->trigger('tjUcmOnBeforeDeleteItem', array($id, $table->client)); @@ -772,7 +778,7 @@ public function delete(&$contentId) $this->deleteExtraFieldsData($id, $table->client); // Plugin trigger on after item delete - JPluginHelper::importPlugin('actionlog'); + PluginHelper::importPlugin('actionlog'); $dispatcher = JDispatcher::getInstance(); $dispatcher->trigger('tjUcmOnAfterDeleteItem', array($id, $table->client)); @@ -785,7 +791,7 @@ public function delete(&$contentId) } else { - throw new Exception(JText::_('COM_TJUCM_ITEM_SAVED_STATE_ERROR'), 403); + throw new Exception(Text::_('COM_TJUCM_ITEM_SAVED_STATE_ERROR'), 403); return false; } @@ -804,7 +810,7 @@ public function allowedToAddTypeData($userId, $client, $allowedCount) { if (!empty($userId) && !empty($client)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true); $query->select("count(" . $db->quoteName('id') . ")"); $query->from($db->quoteName('#__tj_ucm_data')); @@ -849,7 +855,7 @@ public function getUcmSubFormFieldDataJson($parentRecordId, $efd) $efd->value = $efd->value[0]; } - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true); $query->select('id'); $query->from($db->quoteName('#__tj_ucm_data')); @@ -961,11 +967,11 @@ public function getUdatedRelatedFieldOptions($client, $contentId) return false; } - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Get all the fields of the UCM type JLoader::import('components.com_tjfields.models.fields', JPATH_ADMINISTRATOR); - $tjFieldsModelFields = JModelLegacy::getInstance('Fields', 'TjfieldsModel', array('ignore_request' => true)); + $tjFieldsModelFields = BaseDatabaseModel::getInstance('Fields', 'TjfieldsModel', array('ignore_request' => true)); $tjFieldsModelFields->setState("filter.client", $client); $tjFieldsModelFields->setState("filter.state", 1); $fields = $tjFieldsModelFields->getItems(); @@ -977,7 +983,7 @@ public function getUdatedRelatedFieldOptions($client, $contentId) // Get object of TJ-Fields field model JLoader::import('components.com_tjfields.models.field', JPATH_ADMINISTRATOR); - $tjFieldsModelField = JModelLegacy::getInstance('Field', 'TjfieldsModel'); + $tjFieldsModelField = BaseDatabaseModel::getInstance('Field', 'TjfieldsModel'); $returnData = array(); @@ -1040,7 +1046,7 @@ public function getUdatedRelatedFieldOptions($client, $contentId) $sfFieldName = $field->name; // Get fields of the subform of the parent form - $tjFieldsModelFields = JModelLegacy::getInstance('Fields', 'TjfieldsModel', array('ignore_request' => true)); + $tjFieldsModelFields = BaseDatabaseModel::getInstance('Fields', 'TjfieldsModel', array('ignore_request' => true)); $tjFieldsModelFields->setState("filter.client", $ucmSubFormClient); $tjFieldsModelFields->setState("filter.state", 1); $ucmSubFormfields = $tjFieldsModelFields->getItems(); diff --git a/src/components/com_tjucm/site/models/items.php b/src/components/com_tjucm/site/models/items.php index 33366386..1d1a174c 100644 --- a/src/components/com_tjucm/site/models/items.php +++ b/src/components/com_tjucm/site/models/items.php @@ -9,19 +9,22 @@ */ defined('_JEXEC') or die; +use Joomla\CMS\MVC\Model\ListModel; +use Joomla\CMS\Factory; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; +use Joomla\CMS\Table\Table; +use Joomla\Data\DataObject; jimport('joomla.application.component.modellist'); use Joomla\CMS\Component\ComponentHelper; -use Joomla\CMS\MVC\Model\BaseDatabaseModel; -use Joomla\CMS\Table\Table; /** * Methods supporting a list of Tjucm records. * * @since 1.6 */ -class TjucmModelItems extends JModelList +class TjucmModelItems extends ListModel { /** * Constructor. @@ -68,20 +71,20 @@ public function __construct($config = array()) */ protected function populateState($ordering = "a.id", $direction = "DESC") { - $app = JFactory::getApplication(); - $user = JFactory::getUser(); - $db = JFactory::getDbo(); + $app = Factory::getApplication(); + $user = Factory::getUser(); + $db = Factory::getDbo(); - JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tjucm/models'); - $tjUcmModelType = JModelLegacy::getInstance('Type', 'TjucmModel'); + BaseDatabaseModel::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tjucm/models'); + $tjUcmModelType = BaseDatabaseModel::getInstance('Type', 'TjucmModel'); $typeId = $app->input->get('id', 0, "INT"); $ucmType = $app->input->get('client', '', "STRING"); if (empty($typeId) || empty($ucmType)) { - JTable::addIncludePath(JPATH_ROOT . '/administrator/components/com_tjucm/tables'); - $typeTable = JTable::getInstance('Type', 'TjucmTable', array('dbo', $db)); + Table::addIncludePath(JPATH_ROOT . '/administrator/components/com_tjucm/tables'); + $typeTable = Table::getInstance('Type', 'TjucmTable', array('dbo', $db)); if ($typeId && empty($ucmType)) { @@ -111,7 +114,7 @@ protected function populateState($ordering = "a.id", $direction = "DESC") if (!empty($ucmTypeAlias)) { JLoader::import('components.com_tjfields.tables.type', JPATH_ADMINISTRATOR); - $ucmTypeTable = JTable::getInstance('Type', 'TjucmTable', array('dbo', JFactory::getDbo())); + $ucmTypeTable = Table::getInstance('Type', 'TjucmTable', array('dbo', Factory::getDbo())); $ucmTypeTable->load(array('alias' => $ucmTypeAlias)); $ucmType = $ucmTypeTable->unique_identifier; $typeId = $ucmTypeTable->id; @@ -125,7 +128,7 @@ protected function populateState($ordering = "a.id", $direction = "DESC") // Set state for field filters JLoader::import('components.com_tjfields.models.fields', JPATH_ADMINISTRATOR); - $fieldsModel = JModelLegacy::getInstance('Fields', 'TjfieldsModel', array('ignore_request' => true)); + $fieldsModel = BaseDatabaseModel::getInstance('Fields', 'TjfieldsModel', array('ignore_request' => true)); $fieldsModel->setState('filter.client', $ucmType); $fieldsModel->setState('filter.filterable', 1); $fields = $fieldsModel->getItems(); @@ -174,8 +177,8 @@ protected function populateState($ordering = "a.id", $direction = "DESC") if (!empty($fromDate) || !empty($toDate)) { - $fromDate = empty($fromDate) ? JFactory::getDate('now -1 month')->toSql() : JFactory::getDate($fromDate)->toSql(); - $toDate = empty($toDate) ? JFactory::getDate('now')->toSql() : JFactory::getDate($toDate)->toSql(); + $fromDate = empty($fromDate) ? Factory::getDate('now -1 month')->toSql() : Factory::getDate($fromDate)->toSql(); + $toDate = empty($toDate) ? Factory::getDate('now')->toSql() : Factory::getDate($toDate)->toSql(); // If from date is less than to date then swipe the dates if ($fromDate > $toDate) @@ -196,7 +199,7 @@ protected function populateState($ordering = "a.id", $direction = "DESC") /** * Build an SQL query to load the list data. * - * @return JDatabaseQuery + * @return DataObjectbaseQuery * * @since 1.6 */ @@ -266,7 +269,7 @@ protected function getListQuery() if ($clusterExist) { JLoader::import('components.com_tjfields.tables.field', JPATH_ADMINISTRATOR); - $fieldTable = JTable::getInstance('Field', 'TjfieldsTable', array('dbo', $db)); + $fieldTable = Table::getInstance('Field', 'TjfieldsTable', array('dbo', $db)); $fieldTable->load(array('client' => $client, 'type' => 'cluster', 'state' => '1')); if ($fieldTable->id) @@ -386,7 +389,7 @@ public function getItems() if (!empty($contentIds) && !empty($client)) { // Get fields which can have multiple values - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true); $query->select($db->qn('id')); $query->from($db->qn('#__tjfields_fields')); @@ -398,7 +401,7 @@ public function getItems() if (!empty($fieldsList)) { // Get fields which can have multiple values - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true); $query->select($db->qn(array('content_id', 'field_id', 'value'))); $query->from($db->qn('#__tjfields_fields_value')); @@ -451,7 +454,7 @@ public function getItems() */ private function sortContent(&$query) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Add the list ordering clause. $orderCol = $this->state->get('list.ordering'); @@ -560,7 +563,7 @@ private function filterContent($client, &$query) // For filterable fields JLoader::import('components.com_tjfields.models.fields', JPATH_ADMINISTRATOR); - $fieldsModel = JModelLegacy::getInstance('Fields', 'TjfieldsModel', array('ignore_request' => true)); + $fieldsModel = BaseDatabaseModel::getInstance('Fields', 'TjfieldsModel', array('ignore_request' => true)); $fieldsModel->setState('filter.client', $client); $fieldsModel->setState('filter.filterable', 1); $fields = $fieldsModel->getItems(); @@ -614,7 +617,7 @@ public function getFields() { // Load fields model JLoader::import('components.com_tjfields.models.fields', JPATH_ADMINISTRATOR); - $fieldsModel = JModelLegacy::getInstance('Fields', 'TjfieldsModel', array('ignore_request' => true)); + $fieldsModel = BaseDatabaseModel::getInstance('Fields', 'TjfieldsModel', array('ignore_request' => true)); $fieldsModel->setState('filter.showonlist', 1); $fieldsModel->setState('filter.state', 1); $fieldsModel->setState('filter.showonlist', 1); @@ -660,7 +663,7 @@ private function getFieldsData($contentIds) return false; } - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true); $query->select('*'); $query->from($db->qn('#__tjfields_fields_value', 'fv')); @@ -683,7 +686,7 @@ public function showListCheck($client) { if (!empty($client)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true); $query->select("count(" . $db->qn('id') . ")"); $query->from($db->qn('#__tjfields_fields')); @@ -736,7 +739,7 @@ public function canCopyToSameUcmType($client) } JLoader::import('components.com_tjfields.tables.field', JPATH_ADMINISTRATOR); - $fieldTable = Table::getInstance('Field', 'TjfieldsTable', array('dbo', JFactory::getDbo())); + $fieldTable = Table::getInstance('Field', 'TjfieldsTable', array('dbo', Factory::getDbo())); $fieldTable->load(array('client' => $client, 'type' => 'cluster', 'state' => '1')); if (!$checkUcmCompatability && !$fieldTable->id) diff --git a/src/components/com_tjucm/site/router.php b/src/components/com_tjucm/site/router.php index f1fc2a97..2353612c 100644 --- a/src/components/com_tjucm/site/router.php +++ b/src/components/com_tjucm/site/router.php @@ -10,6 +10,8 @@ // No direct access. defined('_JEXEC') or die; +use Joomla\CMS\Component\Router\RouterBase; +use Joomla\CMS\Factory; use Joomla\CMS\Table\Table; @@ -23,7 +25,7 @@ * * @since _DEPLOY_VERSION_ */ -class TjUcmRouter extends JComponentRouterBase +class TjUcmRouter extends RouterBase { private $views = array('itemform', 'items', 'item'); @@ -43,9 +45,9 @@ public function build(&$query) $segments = array(); // Get a menu item based on Itemid or currently active - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $menu = $app->getMenu(); - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // We need a menu item. Either the one specified in the query, or the current active one if none specified if (empty($query['Itemid'])) @@ -131,7 +133,7 @@ public function parse(&$segments) { $item = $this->menu->getActive(); $vars = array(); - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Count route segments $count = count($segments); diff --git a/src/components/com_tjucm/site/tjucm.php b/src/components/com_tjucm/site/tjucm.php index 118757ed..af3e6abd 100644 --- a/src/components/com_tjucm/site/tjucm.php +++ b/src/components/com_tjucm/site/tjucm.php @@ -9,15 +9,15 @@ */ defined('_JEXEC') or die; - -// Include dependancies -jimport('joomla.application.component.controller'); +use Joomla\CMS\Factory; +use Joomla\CMS\Uri\Uri; +use Joomla\CMS\MVC\Controller\BaseController; JLoader::registerPrefix('Tjucm', JPATH_COMPONENT); JLoader::register('TjucmController', JPATH_COMPONENT . '/controller.php'); // Load tj-fields language files -$lang = JFactory::getLanguage(); +$lang = Factory::getLanguage(); $lang->load('com_tjfields', JPATH_ADMINISTRATOR); $lang->load('com_tjfields', JPATH_SITE); @@ -25,8 +25,8 @@ $path = JPATH_ADMINISTRATOR . '/components/com_tjucm/helpers/tjucm.php'; // Load joomla icon media file -$doc = JFactory::getDocument(); -$doc->addStyleSheet(JUri::root() . '/media/jui/css/icomoon.css'); +$doc = Factory::getDocument(); +$doc->addStyleSheet(Uri::root() . '/media/jui/css/icomoon.css'); if (!class_exists('TjucmHelper')) { @@ -44,7 +44,7 @@ TJUCM::init(); // Execute the task. -$controller = JControllerLegacy::getInstance('Tjucm'); +$controller = BaseController::getInstance('Tjucm'); -$controller->execute(JFactory::getApplication()->input->getCmd('task')); +$controller->execute(Factory::getApplication()->input->getCmd('task')); $controller->redirect(); diff --git a/src/components/com_tjucm/site/views/item/tmpl/default.php b/src/components/com_tjucm/site/views/item/tmpl/default.php index a1e30e63..db87e20b 100644 --- a/src/components/com_tjucm/site/views/item/tmpl/default.php +++ b/src/components/com_tjucm/site/views/item/tmpl/default.php @@ -8,11 +8,16 @@ // No direct access defined('_JEXEC') or die; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Factory; +use Joomla\CMS\Layout\FileLayout; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; /*To load language constant of js file*/ JText::script('COM_TJUCM_DELETE_MESSAGE'); -$user = JFactory::getUser(); +$user = Factory::getUser(); $tjUcmFrontendHelper = new TjucmHelpersTjucm; if ($this->form_extra) @@ -38,14 +43,14 @@ } // Call the JLayout to render the fields in the details view - $layout = new JLayoutFile('detail.fields', JPATH_ROOT . '/components/com_tjucm'); + $layout = new FileLayout('detail.fields', JPATH_ROOT . '/components/com_tjucm'); echo $layout->render(array('xmlFormObject' => $xmlFieldSets, 'formObject' => $this->form_extra, 'itemData' => $this->item)); } else { ?>
- +
ucmTypeId, $this->item->id)) || (TjucmAccess::canEditOwn($this->ucmTypeId, $this->item->id) && JFactory::getUser()->id == $this->item->created_by)) + if ((TjucmAccess::canEdit($this->ucmTypeId, $this->item->id)) || (TjucmAccess::canEditOwn($this->ucmTypeId, $this->item->id) && Factory::getUser()->id == $this->item->created_by)) { - $redirectURL = JRoute::_('index.php?option=com_tjucm&task=item.edit&id=' . $this->item->id . '&client=' . $this->client, false); + $redirectURL = Route::_('index.php?option=com_tjucm&task=item.edit&id=' . $this->item->id . '&client=' . $this->client, false); ?> - + ucmTypeId, $this->item->id)) { - $deleteOwn = (JFactory::getUser()->id == $this->item->created_by ? true : false); + $deleteOwn = (Factory::getUser()->id == $this->item->created_by ? true : false); } if (TjucmAccess::canDelete($this->ucmTypeId, $this->item->id) || $deleteOwn) { - $redirectURL = JRoute::_('index.php?option=com_tjucm&task=itemform.remove&id=' . $this->item->id . '&client=' . $this->client . "&" . JSession::getFormToken() . '=1', false); + $redirectURL = Route::_('index.php?option=com_tjucm&task=itemform.remove&id=' . $this->item->id . '&client=' . $this->client . "&" . Session::getFormToken() . '=1', false); ?> - + client; $itemId = $tjUcmFrontendHelper->getItemId($link); ?> - +
\ No newline at end of file diff --git a/src/components/com_tjucm/site/views/item/view.html.php b/src/components/com_tjucm/site/views/item/view.html.php index 4921e994..ba6c8bd6 100644 --- a/src/components/com_tjucm/site/views/item/view.html.php +++ b/src/components/com_tjucm/site/views/item/view.html.php @@ -10,6 +10,13 @@ // No direct access defined('_JEXEC') or die; +use Joomla\CMS\MVC\View\HtmlView; +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Uri\Uri; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Table\Table; +use Joomla\CMS\Plugin\PluginHelper; jimport('joomla.application.component.view'); @@ -18,7 +25,7 @@ * * @since 1.6 */ -class TjucmViewItem extends JViewLegacy +class TjucmViewItem extends HtmlView { protected $state; @@ -39,20 +46,20 @@ class TjucmViewItem extends JViewLegacy */ public function display($tpl = null) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); - if (!JFactory::getUser()->id) + if (!Factory::getUser()->id) { - $msg = JText::_('COM_TJUCM_LOGIN_MSG'); + $msg = Text::_('COM_TJUCM_LOGIN_MSG'); // Get current url. - $current = JUri::getInstance()->toString(); + $current = Uri::getInstance()->toString(); $url = base64_encode($current); - JFactory::getApplication()->redirect(JRoute::_('index.php?option=com_users&view=login&return=' . $url, false), $msg); + Factory::getApplication()->redirect(Route::_('index.php?option=com_users&view=login&return=' . $url, false), $msg); } // Load tj-fields language file - $lang = JFactory::getLanguage(); + $lang = Factory::getLanguage(); $lang->load('com_tjfields', JPATH_SITE); $this->state = $this->get('State'); @@ -76,7 +83,7 @@ public function display($tpl = null) // Check the view access to the article (the model has already computed the values). if ($this->item->params->get('access-view') == false) { - $app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'error'); + $app->enqueueMessage(Text::_('JERROR_ALERTNOAUTHOR'), 'error'); $app->setHeader('status', 403, true); return false; @@ -84,7 +91,7 @@ public function display($tpl = null) /* Get model instance here */ $model = $this->getModel(); - $this->client = JFactory::getApplication()->input->get('client'); + $this->client = Factory::getApplication()->input->get('client'); // If did not get the client from url then get if from menu param if (empty($this->client)) @@ -102,14 +109,14 @@ public function display($tpl = null) if (!empty($this->ucm_type)) { JLoader::import('components.com_tjfields.tables.type', JPATH_ADMINISTRATOR); - $ucmTypeTable = JTable::getInstance('Type', 'TjucmTable', array('dbo', JFactory::getDbo())); + $ucmTypeTable = Table::getInstance('Type', 'TjucmTable', array('dbo', Factory::getDbo())); $ucmTypeTable->load(array('alias' => $this->ucm_type)); $this->client = $ucmTypeTable->unique_identifier; } } } - $this->id = JFactory::getApplication()->input->get('id'); + $this->id = Factory::getApplication()->input->get('id'); $view = explode('.', $this->client); // Call to extra fields @@ -129,7 +136,7 @@ public function display($tpl = null) } JLoader::import('components.com_tjucm.tables.type', JPATH_ADMINISTRATOR); - $typeTable = JTable::getInstance('Type', 'TjucmTable', array('dbo', JFactory::getDbo())); + $typeTable = Table::getInstance('Type', 'TjucmTable', array('dbo', Factory::getDbo())); $typeTable->load(array('unique_identifier' => $this->client)); $typeParams = json_decode($typeTable->params); $this->title = $typeTable->title; @@ -140,7 +147,7 @@ public function display($tpl = null) } // Ucm triggger before item display - JPluginHelper::importPlugin('tjucm'); + PluginHelper::importPlugin('tjucm'); $dispatcher = JDispatcher::getInstance(); $dispatcher->trigger('tjucmOnBeforeItemDisplay', array(&$this->item, &$this->form_extra)); @@ -161,7 +168,7 @@ public function display($tpl = null) */ protected function _prepareDocument() { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); $menus = $app->getMenu(); $title = null; @@ -175,7 +182,7 @@ protected function _prepareDocument() } else { - $this->params->def('page_heading', JText::_('COM_TJUCM_DEFAULT_PAGE_TITLE')); + $this->params->def('page_heading', Text::_('COM_TJUCM_DEFAULT_PAGE_TITLE')); } $title = $this->params->get('page_title', ''); @@ -186,11 +193,11 @@ protected function _prepareDocument() } elseif ($app->get('sitename_pagetitles', 0) == 1) { - $title = JText::sprintf('JPAGETITLE', $app->get('sitename'), $title); + $title = Text::sprintf('JPAGETITLE', $app->get('sitename'), $title); } elseif ($app->get('sitename_pagetitles', 0) == 2) { - $title = JText::sprintf('JPAGETITLE', $title, $app->get('sitename')); + $title = Text::sprintf('JPAGETITLE', $title, $app->get('sitename')); } $this->document->setTitle($title); diff --git a/src/components/com_tjucm/site/views/itemform/tmpl/default.php b/src/components/com_tjucm/site/views/itemform/tmpl/default.php index 744fe6db..efd0056c 100644 --- a/src/components/com_tjucm/site/views/itemform/tmpl/default.php +++ b/src/components/com_tjucm/site/views/itemform/tmpl/default.php @@ -9,6 +9,10 @@ // No direct access defined('_JEXEC') or die; +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Uri\Uri; use Joomla\CMS\HTML\HTMLHelper; @@ -33,10 +37,10 @@ HTMLHelper::script('administrator/components/com_tjfields/assets/js/tjfields.js'); // Load admin language file -$lang = JFactory::getLanguage(); +$lang = Factory::getLanguage(); $lang->load('com_tjucm', JPATH_SITE); -$jinput = JFactory::getApplication(); +$jinput = Factory::getApplication(); $editRecordId = $jinput->input->get("id", '', 'INT'); $baseUrl = $jinput->input->server->get('REQUEST_URI', '', 'STRING'); $calledFrom = (strpos($baseUrl, 'administrator')) ? 'backend' : 'frontend'; @@ -78,13 +82,13 @@ } else { - alert("' . $this->escape(JText::_("JGLOBAL_VALIDATION_FORM_FAILED")) . '"); + alert("' . $this->escape(Text::_("JGLOBAL_VALIDATION_FORM_FAILED")) . '"); } } }; '); ?> -
+ allow_auto_save == '1') { @@ -93,7 +97,7 @@ ×
- +
@@ -123,7 +127,7 @@ ?> ×
- +
@@ -169,7 +173,7 @@ ?>
@@ -190,10 +194,10 @@ ?> " + value="" onclick="tjUcmItemForm.saveUcmFormData();" /> - " + " id="tjUcmSectionFinalSave" onclick="tjUcmItemForm.saveUcmFormData();" /> - " onclick="Joomla.submitbutton('itemform.cancel');" /> + " onclick="Joomla.submitbutton('itemform.cancel');" />
- +
diff --git a/src/components/com_tjucm/site/views/itemform/tmpl/default_extrafields.php b/src/components/com_tjucm/site/views/itemform/tmpl/default_extrafields.php index 75a5e681..1e5593ec 100644 --- a/src/components/com_tjucm/site/views/itemform/tmpl/default_extrafields.php +++ b/src/components/com_tjucm/site/views/itemform/tmpl/default_extrafields.php @@ -9,9 +9,13 @@ // No direct access defined('_JEXEC') or die; +use Joomla\CMS\Factory; +use Joomla\CMS\HTML\HTMLHelper; +use Joomla\CMS\Filter\OutputFilter; +use Joomla\CMS\Language\Text; $fieldsets_counter = 0; -$layout = JFactory::getApplication()->input->get('layout'); +$layout = Factory::getApplication()->input->get('layout'); if ($this->form_extra) { @@ -24,7 +28,7 @@ { if ($fieldsets_counter == 0) { - echo JHtml::_('bootstrap.startTabSet', 'tjucm_myTab'); + echo HTMLHelper::_('bootstrap.startTabSet', 'tjucm_myTab'); } $fieldsets_counter++; @@ -35,8 +39,8 @@ { if (!$field->hidden) { - $tabName = JFilterOutput::stringURLUnicodeSlug(trim($fieldset->name)); - echo JHtml::_("bootstrap.addTab", "tjucm_myTab", $tabName, $fieldset->name); + $tabName = OutputFilter::stringURLUnicodeSlug(trim($fieldset->name)); + echo HTMLHelper::_("bootstrap.addTab", "tjucm_myTab", $tabName, $fieldset->name); break; } } @@ -99,7 +103,7 @@ { if (!$field->hidden) { - echo JHtml::_("bootstrap.endTab"); + echo HTMLHelper::_("bootstrap.endTab"); break; } } @@ -109,14 +113,14 @@ if (count($fieldSets) > 1) { - echo JHtml::_('bootstrap.endTabSet'); + echo HTMLHelper::_('bootstrap.endTabSet'); } } else { ?>
- +
hidden) { - $tabName = JFilterOutput::stringURLUnicodeSlug(trim($fieldset->name)); + $tabName = OutputFilter::stringURLUnicodeSlug(trim($fieldset->name)); echo HTMLHelper::_("bootstrap.addTab", "tjucm_myTab", $tabName, $fieldset->name); break; } @@ -368,7 +370,7 @@ " id="tjUcmSectionFinalSaveClose" onclick="tjUcmItemForm.saveUcmFormData();" /> - + addScript(JUri::root() . 'media/com_dpe/js/tjucmreverselist.js'); +$doc->addScript(Uri::root() . 'media/com_dpe/js/tjucmreverselist.js'); ?>
- +
items)) @@ -101,7 +110,7 @@ function copySameUcmTypeItem() ?> allowedToAdd) { ?> - - + + canImport) { ?> - + canCopyToSameUcmType) {?> - - + + - - + + - JText::_('COM_TJUCM_COPY_ITEMS'), + 'title' => Text::_('COM_TJUCM_COPY_ITEMS'), ), $this->loadTemplate('copyitems') ); ?> @@ -171,7 +180,7 @@ function copySameUcmTypeItem() canCopyItem) { ?> - + - + - + ucmTypeParams->allow_draft_save) && $this->ucmTypeParams->allow_draft_save == 1) @@ -193,7 +202,7 @@ function copySameUcmTypeItem() $statusColumnWidth = 2; ?> - + load($fieldId); $fieldsData[$fieldId] = $tjFieldsFieldTable; } @@ -216,7 +225,7 @@ function copySameUcmTypeItem() { ?> - label, ENT_COMPAT, 'UTF-8'), $fieldId, $listDirn, $listOrder); ?> + label, ENT_COMPAT, 'UTF-8'), $fieldId, $listDirn, $listOrder); ?> - + @@ -250,7 +259,7 @@ function copySameUcmTypeItem() $view = explode('.', $this->client); JLoader::import('components.com_tjucm.models.itemform', JPATH_SITE); - $itemFormModel = JModelLegacy::getInstance('ItemForm', 'TjucmModel'); + $itemFormModel = BaseDatabaseModel::getInstance('ItemForm', 'TjucmModel'); $formObject = $itemFormModel->getFormExtra( array( "clientComponent" => 'com_tjucm', @@ -262,7 +271,7 @@ function copySameUcmTypeItem() foreach ($this->items as $i => $item) { // Call the JLayout to render the fields in the details view - $layout = new JLayoutFile('list.list', JPATH_ROOT . '/components/com_tjucm/'); + $layout = new FileLayout('list.list', JPATH_ROOT . '/components/com_tjucm/'); echo $layout->render( array( 'itemsData' => $item, @@ -282,14 +291,14 @@ function copySameUcmTypeItem() else { ?> -
+
-
+
@@ -308,10 +317,10 @@ function copySameUcmTypeItem() if ($this->allowedToAdd) { ?> - - + - +
- +
@@ -336,7 +345,7 @@ class="btn btn-success btn-small"> function deleteItem() { - if (!confirm("")) + if (!confirm("")) { return false; } diff --git a/src/components/com_tjucm/site/views/items/tmpl/default_filter.php b/src/components/com_tjucm/site/views/items/tmpl/default_filter.php index 0f45fe2f..396f6628 100644 --- a/src/components/com_tjucm/site/views/items/tmpl/default_filter.php +++ b/src/components/com_tjucm/site/views/items/tmpl/default_filter.php @@ -9,6 +9,9 @@ */ defined('JPATH_BASE') or die; +use Joomla\CMS\Factory; +use Joomla\CMS\HTML\HTMLHelper; +use Joomla\CMS\Language\Text; $data = $displayData; @@ -57,7 +60,7 @@ // Set some basic options $customOptions = array( 'filtersHidden' => isset($options['filtersHidden']) ? $options['filtersHidden'] : empty($data['view']->activeFilters) && !$filtered, - 'defaultLimit' => isset($options['defaultLimit']) ? $options['defaultLimit'] : JFactory::getApplication()->get('list_limit', 20), + 'defaultLimit' => isset($options['defaultLimit']) ? $options['defaultLimit'] : Factory::getApplication()->get('list_limit', 20), 'searchFieldSelector' => '#filter_search', 'orderFieldSelector' => '#list_fullordering', ); @@ -74,29 +77,29 @@
+ aria-invalid="false">
input; ?>
diff --git a/src/components/com_tjucm/site/views/items/tmpl/default_filters.php b/src/components/com_tjucm/site/views/items/tmpl/default_filters.php index 5dd97792..68c473c1 100644 --- a/src/components/com_tjucm/site/views/items/tmpl/default_filters.php +++ b/src/components/com_tjucm/site/views/items/tmpl/default_filters.php @@ -9,6 +9,11 @@ // No direct access defined('_JEXEC') or die; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper; +use Joomla\CMS\Factory; +use Joomla\CMS\Table\Table; +use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\CMS\Component\ComponentHelper; use Joomla\Registry\Registry; @@ -20,36 +25,36 @@
+ placeholder=""/>
- + + type="button" title="">
enabled) { JLoader::import('components.com_tjfields.tables.field', JPATH_ADMINISTRATOR); - $fieldTable = JTable::getInstance('Field', 'TjfieldsTable', array('dbo', $db)); + $fieldTable = Table::getInstance('Field', 'TjfieldsTable', array('dbo', $db)); $fieldTable->load(array('client' => $this->client, 'type' => 'cluster', 'state' => '1')); if ($fieldTable->id) @@ -60,7 +65,7 @@ $clusters = $clustersModel->getItems(); // Get list of clusters with data in UCM type - $db = JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true); $query->select($db->quoteName('cluster_id')); $query->from($db->quoteName('#__tj_ucm_data')); @@ -72,7 +77,7 @@ $usersClusters = array(); $clusterObj = new stdclass; - $clusterObj->text = JText::_("COM_TJFIELDS_OWNERSHIP_CLUSTER"); + $clusterObj->text = Text::_("COM_TJFIELDS_OWNERSHIP_CLUSTER"); $clusterObj->value = ""; $usersClusters[] = $clusterObj; @@ -81,7 +86,7 @@ { foreach ($clusters as $clusterList) { - if (RBACL::check(JFactory::getUser()->id, 'com_cluster', 'core.viewitem.' . $this->ucmTypeId, $clusterList->id) || RBACL::check(JFactory::getUser()->id, 'com_cluster', 'core.viewallitem.' . $this->ucmTypeId)) + if (RBACL::check(Factory::getUser()->id, 'com_cluster', 'core.viewitem.' . $this->ucmTypeId, $clusterList->id) || RBACL::check(Factory::getUser()->id, 'com_cluster', 'core.viewallitem.' . $this->ucmTypeId)) { if (!empty($clusterList->id)) { @@ -100,7 +105,7 @@ ?>