2016-01-30 20:28:43 +00:00
|
|
|
<?php
|
2018-08-07 13:27:08 +00:00
|
|
|
/**
|
|
|
|
* @package Joomla.Component.Builder
|
|
|
|
*
|
|
|
|
* @created 30th April, 2015
|
|
|
|
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
|
|
|
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
|
|
|
* @copyright Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved.
|
|
|
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
|
|
|
*/
|
2016-01-30 20:28:43 +00:00
|
|
|
|
|
|
|
// 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');
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ###Component### Ajax Model
|
|
|
|
*/
|
|
|
|
class ###Component###ModelAjax extends JModelList
|
|
|
|
{
|
|
|
|
protected $app_params;
|
2018-08-07 12:25:26 +00:00
|
|
|
|
|
|
|
public function __construct()
|
2016-01-30 20:28:43 +00:00
|
|
|
{
|
|
|
|
parent::__construct();
|
|
|
|
// get params
|
2018-08-07 12:25:26 +00:00
|
|
|
$this->app_params = JComponentHelper::getParams('com_###component###');
|
2016-01-30 20:28:43 +00:00
|
|
|
}
|
2018-08-07 12:25:26 +00:00
|
|
|
|
2016-01-30 20:28:43 +00:00
|
|
|
public function setFieldRequired($name,$form,$status)
|
|
|
|
{
|
|
|
|
// get the session
|
2018-08-07 12:25:26 +00:00
|
|
|
$session = JFactory::getSession();
|
2016-01-30 20:28:43 +00:00
|
|
|
// get this forms set fields
|
2018-08-07 12:25:26 +00:00
|
|
|
$fields = $session->get($form.'_requiredFieldFix');
|
2016-01-30 20:28:43 +00:00
|
|
|
if(###Component###Helper::checkArray($fields))
|
|
|
|
{
|
|
|
|
if ($status == 1)
|
|
|
|
{
|
|
|
|
$fields[] = $name;
|
|
|
|
$fields = array_unique($fields);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// remove from array
|
2018-08-07 12:25:26 +00:00
|
|
|
if(($key = array_search($name, $fields)) !== false)
|
|
|
|
{
|
2016-01-30 20:28:43 +00:00
|
|
|
unset($fields[$key]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ($status == 1)
|
|
|
|
{
|
|
|
|
$fields = array($name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// load the remaining values to seesion
|
|
|
|
if(###Component###Helper::checkArray($fields))
|
|
|
|
{
|
|
|
|
$session->set($form.'_requiredFieldFix', $fields);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$session->clear($form.'_requiredFieldFix');
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|