[ 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_associations 6 * 7 * @copyright (C) 2017 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\Associations\Administrator\Controller; 12 13 use Joomla\CMS\Language\Text; 14 use Joomla\CMS\MVC\Controller\FormController; 15 use Joomla\CMS\Router\Route; 16 use Joomla\Component\Associations\Administrator\Helper\AssociationsHelper; 17 18 // phpcs:disable PSR1.Files.SideEffects 19 \defined('_JEXEC') or die; 20 // phpcs:enable PSR1.Files.SideEffects 21 22 /** 23 * Association edit controller class. 24 * 25 * @since 3.7.0 26 */ 27 class AssociationController extends FormController 28 { 29 /** 30 * Method to edit an existing record. 31 * 32 * @param string $key The name of the primary key of the URL variable. 33 * @param string $urlVar The name of the URL variable if different from the primary key 34 * (sometimes required to avoid router collisions). 35 * 36 * @return FormController|boolean True if access level check and checkout passes, false otherwise. 37 * 38 * @since 3.7.0 39 */ 40 public function edit($key = null, $urlVar = null) 41 { 42 list($extensionName, $typeName) = explode('.', $this->input->get('itemtype', '', 'string'), 2); 43 44 $id = $this->input->get('id', 0, 'int'); 45 46 // Check if reference item can be edited. 47 if (!AssociationsHelper::allowEdit($extensionName, $typeName, $id)) { 48 $this->setMessage(Text::_('JLIB_APPLICATION_ERROR_EDIT_NOT_PERMITTED'), 'error'); 49 $this->setRedirect(Route::_('index.php?option=com_associations&view=associations', false)); 50 51 return false; 52 } 53 54 return parent::display(); 55 } 56 57 /** 58 * Method for canceling the edit action 59 * 60 * @param string $key The name of the primary key of the URL variable. 61 * 62 * @return void 63 * 64 * @since 3.7.0 65 */ 66 public function cancel($key = null) 67 { 68 $this->checkToken(); 69 70 list($extensionName, $typeName) = explode('.', $this->input->get('itemtype', '', 'string'), 2); 71 72 // Only check in, if component item type allows to check out. 73 if (AssociationsHelper::typeSupportsCheckout($extensionName, $typeName)) { 74 $ids = array(); 75 $targetId = $this->input->get('target-id', '', 'string'); 76 77 if ($targetId !== '') { 78 $ids = array_unique(explode(',', $targetId)); 79 } 80 81 $ids[] = $this->input->get('id', 0, 'int'); 82 83 foreach ($ids as $key => $id) { 84 AssociationsHelper::getItem($extensionName, $typeName, $id)->checkIn(); 85 } 86 } 87 88 $this->setRedirect(Route::_('index.php?option=com_associations&view=associations', false)); 89 } 90 }
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 |