2016-01-30 20:28:43 +00:00
|
|
|
<?php
|
|
|
|
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
|
|
|
__ __ _ _____ _ _ __ __ _ _ _
|
|
|
|
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
|
|
|
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
|
|
|
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
|
|
|
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
|
|
|
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
|
|
|
| |
|
|
|
|
|_|
|
|
|
|
/-------------------------------------------------------------------------------------------------------------------------------/
|
|
|
|
|
|
|
|
@package Component Builder
|
|
|
|
@subpackage componentbuilder.php
|
|
|
|
@author Llewellyn van der Merwe <https://www.vdm.io/joomla-component-builder>
|
|
|
|
@my wife Roline van der Merwe <http://www.vdm.io/>
|
|
|
|
@copyright Copyright (C) 2015. All Rights Reserved
|
|
|
|
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
|
|
|
|
|
|
|
Builds Complex Joomla Components
|
|
|
|
|
|
|
|
/-----------------------------------------------------------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
// 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;
|
|
|
|
}
|
|
|
|
}
|