/** * @return string contains the displayable information for a selected group * * @access public */ function getPageWithElement($regroup) { require_once _base_ . '/lib/lib.form.php'; if ($regroup == 'templ_man') { return $this->_maskTemplateManager(); } elseif ($regroup == 'suiteman') { return $this->_maskSuiteManager(); } $lang =& DoceboLanguage::createInstance('configuration', 'framework'); $reSetting = sql_query("\r\n\t\tSELECT param_name, param_value, value_type, max_size\r\n\t\tFROM " . $this->table . "\r\n\t\tWHERE regroup = '" . $regroup . "' AND\r\n\t\t\thide_in_modify = '0'\r\n\t\tORDER BY regroup, pack, sequence"); $html = ''; while (list($var_name, $var_value, $value_type, $max_size) = sql_fetch_row($reSetting)) { $i_after = ' <span class="ico-tooltip" id="tt_target_' . $var_name . '" title="' . $lang->def('_CONF_DESCR_' . strtoupper($var_name)) . '">info</span>'; switch ($value_type) { case "register_type": //on off $html .= Form::getOpenCombo($lang->def('_' . strtoupper($var_name))) . Form::getLineRadio('', 'label_bold', $lang->def('_REGISTER_TYPE_SELF'), $var_name . '_self', 'option[' . $var_name . ']', 'self', $var_value == 'self') . Form::getLineRadio('', 'label_bold', $lang->def('_REGISTER_TYPE_SELF_OPTIN'), $var_name . '_self_optin', 'option[' . $var_name . ']', 'self_optin', $var_value == 'self_optin') . Form::getLineRadio('', 'label_bold', $lang->def('_REGISTER_TYPE_MODERATE'), $var_name . '_moderate', 'option[' . $var_name . ']', 'moderate', $var_value == 'moderate') . Form::getLineRadio('', 'label_bold', $lang->def('_REGISTER_TYPE_ADMIN'), $var_name . '_admin', 'option[' . $var_name . ']', 'admin', $var_value == 'admin') . Form::getCloseCombo($i_after); break; case "register_tree": $register_possible_option = array('off' => $lang->def('_DONT_USE_TREE_REGISTRATION'), 'manual_insert' => $lang->def('_USE_WITH_MANUALEINSERT'), 'selection' => $lang->def('_USE_WITH_SELECTION')); $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $register_possible_option, $var_value, $i_after); break; case "field_tree": require_once $GLOBALS['where_framework'] . '/lib/lib.field.php'; $fl = new FieldList(); $all_fields = $fl->getAllFields(false); $fields[0] = $lang->def('_NO_VALUE'); foreach ($all_fields as $key => $val) { $fields[$val[FIELD_INFO_ID]] = $val[FIELD_INFO_TRANSLATION]; } $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $fields, $var_value, $i_after); break; case "save_log_attempt": //on off $html .= Form::getOpenCombo($lang->def('_' . strtoupper($var_name))) . Form::getLineRadio('', 'label_bold', $lang->def('_SAVE_LA_ALL'), $var_name . '_all', 'option[' . $var_name . ']', 'all', $var_value == 'all') . Form::getLineRadio('', 'label_bold', $lang->def('_SAVE_LA_AFTER_MAX'), $var_name . '_after_max', 'option[' . $var_name . ']', 'after_max', $var_value == 'after_max') . Form::getLineRadio('', 'label_bold', $lang->def('_NO'), $var_name . '_no', 'option[' . $var_name . ']', 'no', $var_value == 'no') . Form::getCloseCombo($i_after); break; case "language": //drop down language $langs = Docebo::langManager()->getAllLangCode(); $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $langs, array_search($var_value, $langs), $i_after); break; case "template": //drop down template $templ = getTemplateList(); $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $templ, array_search($var_value, $templ), $i_after); break; case "hteditor": //drop down hteditor $ht_edit = getHTMLEditorList(); $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $ht_edit, $var_value, $i_after); break; case "layout_chooser": //drop down hteditor $layout = array('left' => Lang::t('_LAYOUT_LEFT'), 'over' => Lang::t('_LAYOUT_OVER'), 'right' => Lang::t('_LAYOUT_RIGHT')); $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $layout, $var_value, $i_after); break; case "pubflow_method_chooser": //drop down hteditor $options = array('onestate' => Lang::t('_PUBFLOW_ONESTATE'), 'twostate' => Lang::t('_PUBFLOW_TWOSTATE'), 'advanced' => Lang::t('_PUBFLOW_ADVANCED')); $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $options, $var_value, $i_after); break; case "field_select": require_once $GLOBALS['where_framework'] . '/lib/lib.field.php'; $fl = new FieldList(); $all_fields = $fl->getAllFields(); $fields = array(); foreach ($all_fields as $key => $val) { $fields[$val[FIELD_INFO_ID]] = $val[FIELD_INFO_TRANSLATION]; } $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $fields, $var_value, $i_after); break; case "sel_sms_gateway": $options = array('0' => Lang::t('_SMS_GATEWAY_AUTO'), '1' => Lang::t('_SMS_GATEWAY_1'), '2' => Lang::t('_SMS_GATEWAY_2'), '3' => Lang::t('_SMS_GATEWAY_3'), '4' => Lang::t('_SMS_GATEWAY_4')); $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $options, $var_value, $i_after); break; case "menuvoice": case "menuvoice_course_public": case "layout_chooser": //drop down hteditor $layout = array('left' => Lang::t('_LAYOUT_LEFT'), 'over' => Lang::t('_LAYOUT_OVER'), 'right' => Lang::t('_LAYOUT_RIGHT')); $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $layout, $var_value, $i_after); break; case "grpsel_chooser": $layout = array('group' => $lang->def('_GROUPS'), 'orgchart' => $lang->def('_ORGCHART')); $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $layout, $var_value, $i_after); break; case "tablist_coursecatalogue": $lang_c =& DoceboLanguage::createInstance('catalogue', 'lms'); $tab_selected = unserialize(urldecode($var_value)); $tab_list = array('time' => $lang_c->def('_TAB_VIEW_TIME'), 'category' => $lang_c->def('_TAB_VIEW_CATEGORY'), 'all' => $lang_c->def('_ALL')); if (Get::sett('use_coursepath') == '1') { $tab_list['pathcourse'] = $lang_c->def('_COURSEPATH'); } if (Get::sett('use_social_courselist') == 'on') { $tab_list['mostscore'] = $lang_c->def('_TAB_VIEW_MOSTSCORE'); $tab_list['popular'] = $lang_c->def('_TAB_VIEW_MOSTPOPULAR'); $tab_list['recent'] = $lang_c->def('_TAB_VIEW_RECENT'); } foreach ($tab_list as $tab_code => $name) { $html .= Form::getCheckbox($name, 'tablist_' . $tab_code, 'tablist[' . $tab_code . ']', 1, isset($tab_selected[$tab_code]), '', $i_after); } break; case "first_coursecatalogue_tab": $lang_c =& DoceboLanguage::createInstance('catalogue', 'lms'); $tab_list = array('time' => $lang_c->def('_TAB_VIEW_TIME'), 'category' => $lang_c->def('_TAB_VIEW_CATEGORY'), 'all' => $lang_c->def('_ALL')); if (Get::sett('use_coursepath') == '1') { $tab_list['pathcourse'] = $lang_c->def('_COURSEPATH'); } if (Get::sett('use_social_courselist') == 'on') { $tab_list['mostscore'] = $lang_c->def('_TAB_VIEW_MOSTSCORE'); $tab_list['popular'] = $lang_c->def('_TAB_VIEW_MOSTPOPULAR'); $tab_list['recent'] = $lang_c->def('_TAB_VIEW_RECENT'); } $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $tab_list, $var_value, $i_after); break; case "tablist_mycourses": //$var_value=deformat($var_value); $arr_value = explode(',', $var_value); //$arr_value=array(); $tab_list = array(); $tab_list[''] = $lang->def('_MYCOURSES_NOTUSED'); $tab_list['status'] = $lang->def('_STATUS'); $tab_list['name'] = $lang->def('_NAME'); $tab_list['code'] = $lang->def('_CODE'); $html .= '<div class="form_line_l"><p>' . '<label class="floating">' . $lang->def('_' . strtoupper($var_name)) . '</label></p>'; for ($i = 0; $i < 3; $i++) { $html .= Form::getInputDropdown('dropdown', $var_name . '_' . $i, "mycourses[{$i}]", $tab_list, isset($arr_value[$i]) ? $arr_value[$i] : '', ''); } $html .= $i_after . '</div>'; break; case "point_field": require_once $GLOBALS['where_framework'] . '/lib/lib.field.php'; $fl = new FieldList(); $all_fields = $fl->getAllFields(); $fields[0] = $lang->def('_NO_VALUE'); foreach ($all_fields as $key => $val) { $fields[$val[FIELD_INFO_ID]] = $val[FIELD_INFO_TRANSLATION]; } $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $fields, $var_value, $i_after); break; case "rest_auth_sel_method": $value_set = array($lang->def('_REST_AUTH_UCODE') => 0, $lang->def('_REST_AUTH_TOKEN') => 1); $html .= Form::getRadioSet($lang->def('_REST_AUTH_SEL_METHOD'), $var_name, 'option[' . $var_name . ']', $value_set, $var_value, $i_after); break; // Common types // Common types case "password": $html .= Form::getPassword($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $max_size, $var_value, $i_after); break; case "textarea": $html .= Form::getSimpletextarea($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $var_value, $i_after); break; case "check": $html .= Form::getCheckbox($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', 1, $var_value == 1, '', '', $i_after . ' '); break; case "enum": $html .= Form::getCheckbox($lang->def('_' . strtoupper($var_name)), $var_name . '_on', 'option[' . $var_name . ']', 'on', $var_value == 'on', '', '', $i_after . ' '); break; default: //string or int $html .= Form::getTextfield($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $max_size, $var_value, false, $i_after); } } return $html; }
/** * public static function getRadio( $label_name, $id, $name, $is_checked = false, $value = 1 ) * * @param string $label_name text contained into the label * @param string $id the id of the element * @param string $name the name of the element * @param string $value value for the input field * @param boolean $is_checked optional,if true the radio is checked, default is false * * @return string with the html code for the input type="radio" element */ public static function getRadio($label_name, $id, $name, $value, $is_checked = false) { return Form::getLineRadio('form_line_l', 'label_normal', $label_name, $id, $name, $value, $is_checked); }
/** * @param string contains the group selected * * @return string contains the displayable information for a selected group */ function getPageWithElement($group_selected) { if ($group_selected != 'user_manager') { return ''; } require_once _base_ . '/lib/lib.form.php'; $lang =& DoceboLanguage::createInstance('user_managment', 'framework'); $reSetting = sql_query("\r\n\t\tSELECT param_name, param_value, value_type, max_size\r\n\t\tFROM " . $this->_table . "\r\n\t\tWHERE pack = 'log_option' AND\r\n\t\t\thide_in_modify = '0'\r\n\t\tORDER BY sequence"); $html = ''; while (list($var_name, $var_value, $value_type, $max_size) = sql_fetch_row($reSetting)) { switch ($value_type) { case "register_type": //on off $html .= Form::getOpenCombo($lang->def('_' . strtoupper($var_name))) . Form::getLineRadio('', 'label_bold', $lang->def('_REGISTER_TYPE_SELF'), $var_name . '_self', 'option[' . $var_name . ']', 'self', $var_value == 'self') . Form::getLineRadio('', 'label_bold', $lang->def('_REGISTER_TYPE_SELF_OPTIN'), $var_name . '_self_optin', 'option[' . $var_name . ']', 'self_optin', $var_value == 'self_optin') . Form::getLineRadio('', 'label_bold', $lang->def('_REGISTER_TYPE_MODERATE'), $var_name . '_moderate', 'option[' . $var_name . ']', 'moderate', $var_value == 'moderate') . Form::getLineRadio('', 'label_bold', $lang->def('_REGISTER_TYPE_ADMIN'), $var_name . '_admin', 'option[' . $var_name . ']', 'admin', $var_value == 'admin') . Form::getCloseCombo(); break; case "register_tree": $register_possible_option = array('off' => $lang->def('_DONT_USE_TREE_REGISTRATION'), 'manual_insert' => $lang->def('_USE_WITH_MANUALEINSERT'), 'selection' => $lang->def('_USE_WITH_SELECTION')); $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $register_possible_option, $var_value); break; case "field_tree": require_once $GLOBALS['where_framework'] . '/lib/lib.field.php'; $fl = new FieldList(); $all_fields = $fl->getAllFields(false); $fields[0] = $lang->def('_NO_VALUE'); foreach ($all_fields as $key => $val) { $fields[$val[FIELD_INFO_ID]] = $val[FIELD_INFO_TRANSLATION]; } $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $fields, $var_value); break; case "save_log_attempt": //on off $html .= Form::getOpenCombo($lang->def('_' . strtoupper($var_name))) . Form::getLineRadio('', 'label_bold', $lang->def('_SAVE_LA_ALL'), $var_name . '_all', 'option[' . $var_name . ']', 'all', $var_value == 'all') . Form::getLineRadio('', 'label_bold', $lang->def('_SAVE_LA_AFTER_MAX'), $var_name . '_after_max', 'option[' . $var_name . ']', 'after_max', $var_value == 'after_max') . Form::getLineRadio('', 'label_bold', $lang->def('_NO'), $var_name . '_no', 'option[' . $var_name . ']', 'no', $var_value == 'no') . Form::getCloseCombo(); break; case "enum": //on off $html .= Form::openFormLine() . Form::getInputCheckbox($var_name . '_on', 'option[' . $var_name . ']', 'on', $var_value == 'on', '') . ' ' . Form::getLabel($var_name . '_on', $lang->def('_' . strtoupper($var_name)), 'label_bold') . Form::closeFormLine(); break; //uncrypted password //uncrypted password case "password": $html .= Form::getPassword($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $max_size, $var_value); break; //string or int //string or int default: $html .= Form::getTextfield($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $max_size, $var_value); } } return $html; }