[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * @package Joomla.Administrator 5 * @subpackage com_contenthistory 6 * 7 * @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org> 8 * @license GNU General Public License version 2 or later; see LICENSE.txt 9 */ 10 11 namespace Joomla\Component\Contenthistory\Administrator\Controller; 12 13 use Joomla\CMS\Language\Text; 14 use Joomla\CMS\MVC\Controller\AdminController; 15 use Joomla\CMS\Router\Route; 16 use Joomla\CMS\Session\Session; 17 18 // phpcs:disable PSR1.Files.SideEffects 19 \defined('_JEXEC') or die; 20 // phpcs:enable PSR1.Files.SideEffects 21 22 /** 23 * Contenthistory list controller class. 24 * 25 * @since 3.2 26 */ 27 class HistoryController extends AdminController 28 { 29 /** 30 * Proxy for getModel. 31 * 32 * @param string $name The name of the model 33 * @param string $prefix The prefix for the model 34 * @param array $config An additional array of parameters 35 * 36 * @return \Joomla\CMS\MVC\Model\BaseDatabaseModel The model 37 * 38 * @since 3.2 39 */ 40 public function getModel($name = 'History', $prefix = 'Administrator', $config = array('ignore_request' => true)) 41 { 42 return parent::getModel($name, $prefix, $config); 43 } 44 45 /** 46 * Toggles the keep forever value for one or more history rows. If it was Yes, changes to No. If No, changes to Yes. 47 * 48 * @return void 49 * 50 * @since 3.2 51 */ 52 public function keep() 53 { 54 $this->checkToken(); 55 56 // Get items to toggle keep forever from the request. 57 $cid = (array) $this->input->get('cid', array(), 'int'); 58 59 // Remove zero values resulting from input filter 60 $cid = array_filter($cid); 61 62 if (empty($cid)) { 63 $this->app->enqueueMessage(Text::_('COM_CONTENTHISTORY_NO_ITEM_SELECTED'), 'warning'); 64 } else { 65 // Get the model. 66 $model = $this->getModel(); 67 68 // Toggle keep forever status of the selected items. 69 if ($model->keep($cid)) { 70 $this->setMessage(Text::plural('COM_CONTENTHISTORY_N_ITEMS_KEEP_TOGGLE', count($cid))); 71 } else { 72 $this->setMessage($model->getError(), 'error'); 73 } 74 } 75 76 $this->setRedirect( 77 Route::_( 78 'index.php?option=com_contenthistory&view=history&layout=modal&tmpl=component&item_id=' 79 . $this->input->getCmd('item_id') . '&' . Session::getFormToken() . '=1', 80 false 81 ) 82 ); 83 } 84 85 /** 86 * Gets the URL arguments to append to a list redirect. 87 * 88 * @return string The arguments to append to the redirect URL. 89 * 90 * @since 4.0.0 91 */ 92 protected function getRedirectToListAppend() 93 { 94 return '&layout=modal&tmpl=component&item_id=' . $this->input->get('item_id') . '&' . Session::getFormToken() . '=1'; 95 } 96 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |