options for the checkbox field
*
*/
$class = $vars['class'];
if (!$class) $class = "input-checkboxes";
// We use our own style of providing options
$role_options = getKeProfileRoles();
// Changing the way of how vars value behaves
$role_value = $vars['value'];
if (!is_array($vars['value'])) {
if (substr_count($role_value, ",") > 0) {
$role_value = str_replace(" ", "", $role_value);
$role_value = split(",", $role_value);
}
}
foreach($role_options as $option => $label) {
//if (!in_array($option,$vars['value'])) {
if (is_array($role_value)) {
$valarray = $role_value;
$valarray = array_map('strtolower', $valarray);
if (!in_array(strtolower($option),$valarray)) {
$selected = "";
} else {
$selected = "checked = \"checked\"";
}
} else {
if (strtolower($option) != strtolower($role_value)) {
$selected = "";
} else {
$selected = "checked = \"checked\"";
}
}
$labelint = (int) $label;
if ("{$label}" == "{$labelint}") {
$label = $option;
}
$disabled = "";
if ($vars['disabled']) $disabled = ' disabled="yes" ';
echo "
";
}
?>