1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-20 04:32:01 +02:00

Issue #55 - more handling of 'not a member of' user class

This commit is contained in:
SteveD 2013-02-03 18:29:11 +00:00
parent fecd0cb015
commit 724a648706
2 changed files with 16 additions and 9 deletions

View File

@ -1078,6 +1078,9 @@ class e_form
// Callback for vetted_tree - Creates the option list for a selection box
function _uc_select_cb($treename, $classnum, $current_value, $nest_level)
{
$classIndex = abs($classnum); // Handle negative class values
$classSign = (substr($classnum, 0, 1) == '-') ? '-' : '';
if($classnum == e_UC_BLANK)
return $this->option(' ', '');
@ -1097,9 +1100,10 @@ class e_form
$prefix = '  '.str_repeat('--', $nest_level - 1).'>';
$style = '';
}
return $this->option($prefix.$this->_uc->uc_get_classname($classnum), $classnum, ($current_value !== '' && in_array($classnum, $tmp)), array("style"=>"{$style}"))."\n";
return $this->option($prefix.$this->_uc->uc_get_classname($classnum), '{$classSign}{$classIndex}', ($current_value !== '' && in_array($classnum, $tmp)), array("style"=>"{$style}"))."\n";
}
function optgroup_open($label, $disabled = false)
{
return "<optgroup class='optgroup' label='{$label}'".($disabled ? " disabled='disabled'" : '').">";

View File

@ -809,22 +809,25 @@ class user_class
*/
public function uc_get_classname($id)
{
if (isset($this->class_tree[$id]))
$cn = abs($id);
$ucString = '';
if (isset($this->class_tree[$cn]))
{
return $this->class_tree[$id]['userclass_name'];
$ucString = $this->class_tree[$cn]['userclass_name'];
}
if (isset($this->fixed_classes[$id]))
elseif (isset($this->fixed_classes[$cn]))
{
return $this->fixed_classes[$id];
$ucString = $this->fixed_classes[$cn];
}
if($id < 0)
{
$val = abs($id);
$name = isset($this->class_tree[$val]['userclass_name']) ? $this->class_tree[$val]['userclass_name'] : $this->fixed_classes[$val];
return str_replace('--CLASS--', $name, UC_LAN_INVERT);
//$val = abs($id);
//$name = isset($this->class_tree[$val]['userclass_name']) ? $this->class_tree[$val]['userclass_name'] : $this->fixed_classes[$val];
$ucString = str_replace('--CLASS--', $ucString, UC_LAN_INVERT);
}
return '';
return $ucString;
}