1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-02 20:57:26 +02:00

AdminUI: Fixes saving of checkbox values when values are empty. Language-class: additional option added to installed() for en=>English array format.

This commit is contained in:
Cameron
2016-09-12 11:30:08 -07:00
parent 90958fb141
commit a5c006b593
2 changed files with 39 additions and 10 deletions

View File

@@ -5403,8 +5403,17 @@ class e_admin_ui extends e_admin_controller_ui
{ {
$data = $this->getPosted(); $data = $this->getPosted();
foreach($this->prefs as $k=>$v) // fix for empty checkboxes - need to save a value.
{
if(!isset($data[$k]) && $v['data'] !== false && ($v['type'] == 'checkboxes' || $v['type'] == 'checkbox'))
{
$data[$k] = null;
}
}
foreach($data as $key=>$val) foreach($data as $key=>$val)
{ {
if(!empty($this->prefs[$key]['multilan'])) if(!empty($this->prefs[$key]['multilan']))
{ {

View File

@@ -392,6 +392,7 @@ class language{
* @param str $type - English or Native. * @param str $type - English or Native.
* @example type = english: array(0=>'English', 1=>'French' ...) * @example type = english: array(0=>'English', 1=>'French' ...)
* @example type = native: array('English'=>'English', 'French'=>'Francais'...) * @example type = native: array('English'=>'English', 'French'=>'Francais'...)
* @example type = abbr: array('en'=>'English, 'fr'=>'French' ... )
* @return array * @return array
*/ */
function installed($type='english') function installed($type='english')
@@ -415,8 +416,9 @@ class language{
$this->lanlist = array_intersect($lanlist,$this->list); $this->lanlist = array_intersect($lanlist,$this->list);
} }
if($type == 'native') switch($type)
{ {
case "native":
$natList = array(); $natList = array();
foreach($this->lanlist as $lang) foreach($this->lanlist as $lang)
{ {
@@ -426,12 +428,30 @@ class language{
natsort($natList); natsort($natList);
return $natList; return $natList;
break;
case "abbr":
$natList = array();
foreach($this->lanlist as $lang)
{
$iso = $this->convert($lang);
$natList[$iso] = $lang;
} }
natsort($natList);
return $natList;
break;
case "english":
default:
return $this->lanlist; return $this->lanlist;
} }
}
/** /**
* Convert a Language to its Native title. eg. 'Spanish' becomes 'Español' * Convert a Language to its Native title. eg. 'Spanish' becomes 'Español'
* @param string $lang * @param string $lang