2021-03-05 03:08:47 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @package Joomla.Component.Builder
|
|
|
|
*
|
|
|
|
* @created 30th April, 2015
|
2024-03-09 19:47:28 +00:00
|
|
|
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
|
|
|
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
2021-03-05 03:08:47 +00:00
|
|
|
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
|
|
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
|
|
|
*/
|
|
|
|
|
|
|
|
// No direct access to this file
|
|
|
|
defined('_JEXEC') or die('Restricted access');
|
|
|
|
?>
|
|
|
|
###BOM###
|
|
|
|
|
|
|
|
// No direct access to this file
|
|
|
|
defined('_JEXEC') or die('Restricted access');
|
|
|
|
|
2024-03-09 19:47:28 +00:00
|
|
|
use Joomla\CMS\Factory;
|
|
|
|
use Joomla\CMS\Language\Text;
|
|
|
|
use Joomla\CMS\MVC\Model\ListModel;
|
|
|
|
use Joomla\CMS\Component\ComponentHelper;
|
|
|
|
|
2021-03-05 03:08:47 +00:00
|
|
|
/**
|
|
|
|
* ###Component### Ajax Model
|
|
|
|
*/
|
2024-03-09 19:47:28 +00:00
|
|
|
class ###Component###ModelAjax extends ListModel
|
2021-03-05 03:08:47 +00:00
|
|
|
{
|
|
|
|
protected $app_params;
|
|
|
|
|
|
|
|
public function __construct()
|
2024-03-09 19:47:28 +00:00
|
|
|
{
|
|
|
|
parent::__construct();
|
2021-03-05 03:08:47 +00:00
|
|
|
// get params
|
2024-03-09 19:47:28 +00:00
|
|
|
$this->app_params = ComponentHelper::getParams('com_###component###');
|
2021-03-05 03:08:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function setFieldRequired($name,$form,$status)
|
|
|
|
{
|
|
|
|
// get the session
|
2024-03-09 19:47:28 +00:00
|
|
|
$session = Factory::getSession();
|
2021-03-05 03:08:47 +00:00
|
|
|
// get this forms set fields
|
|
|
|
$fields = $session->get($form.'_requiredFieldFix');
|
2024-03-09 19:47:28 +00:00
|
|
|
if(Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check($fields))
|
2021-03-05 03:08:47 +00:00
|
|
|
{
|
|
|
|
if ($status == 1)
|
|
|
|
{
|
|
|
|
$fields[] = $name;
|
|
|
|
$fields = array_unique($fields);
|
|
|
|
}
|
|
|
|
else
|
2024-03-09 19:47:28 +00:00
|
|
|
{
|
2021-03-05 03:08:47 +00:00
|
|
|
// remove from array
|
|
|
|
if(($key = array_search($name, $fields)) !== false)
|
|
|
|
{
|
|
|
|
unset($fields[$key]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ($status == 1)
|
|
|
|
{
|
|
|
|
$fields = array($name);
|
|
|
|
}
|
|
|
|
}
|
2021-08-31 14:00:12 +00:00
|
|
|
// load the remaining values to session
|
2024-03-09 19:47:28 +00:00
|
|
|
if(Super___0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check($fields))
|
2021-03-05 03:08:47 +00:00
|
|
|
{
|
|
|
|
$session->set($form.'_requiredFieldFix', $fields);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$session->clear($form.'_requiredFieldFix');
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|