Example #1
0
 /**
  * @return 	string 	contains the displayable information for a selected group
  *
  * @access 	public
  */
 function getPageWithElement($regroup)
 {
     require_once _base_ . '/lib/lib.form.php';
     $lang =& DoceboLanguage::createInstance('admin_config', 'scs');
     if ($regroup == 'root') {
         return $this->_getRoot();
     }
     $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 sequence");
     $html = '';
     while (list($var_name, $var_value, $value_type, $max_size) = sql_fetch_row($reSetting)) {
         switch ($value_type) {
             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));
                 break;
             case "enum":
                 //on off
                 $html .= Form::openFormLine() . Form::getLabel($var_name . '_on', $lang->def('_' . strtoupper($var_name))) . Form::getInputCheckbox($var_name . '_on', 'option[' . $var_name . ']', 'on', $var_value == 'on', '') . Form::closeFormLine();
                 break;
             case "check":
                 //on off
                 $html .= Form::getCheckbox($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', 1, $var_value == 1);
                 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;
 }
Example #2
0
 /**
  * @param string $label_name
  * @param string $id
  * @param string $name
  * @param string $value
  * @param string $filename
  * @param string $show_current
  * @param string $show_del_checkbox
  * @param string $add_old_info
  * @param string $old_prefix
  * @param string $del_arr_name
  * @param string $alt_name
  * @param string $other_after
  * @param string $other_before
  */
 public static function getExtendedFileField($label_name, $id, $name, $value = FALSE, $filename = FALSE, $show_current = TRUE, $show_del_checkbox = TRUE, $add_old_info = TRUE, $old_prefix = FALSE, $del_arr_name = FALSE, $alt_name = '', $other_after = '', $other_before = '')
 {
     $res = "";
     $res .= '<div class="form_extended_file_field">';
     $res .= Form::getFilefield($label_name, $id, $name, $value, $alt_name, $other_after, $other_before);
     if ($show_current) {
         if ($value !== FALSE && !empty($value)) {
             if ($filename === FALSE) {
                 if (substr_count($value, "_") >= 3) {
                     $break_apart = explode('_', $value);
                     $break_apart[0] = $break_apart[1] = $break_apart[2] = '';
                     $filename = substr(implode('_', $break_apart), 3);
                 } else {
                     $filename = $value;
                 }
             }
             require_once _base_ . '/lib/lib.mimetype.php';
             $ext = strtolower(end(explode(".", $filename)));
             $img = "<img src=\"" . getPathImage('fw') . mimeDetect($filename) . "\" ";
             $img .= "alt=\"" . $ext . "\" title=\"" . $ext . "\" />";
             if ($show_del_checkbox) {
                 $del_arr_name = $del_arr_name !== FALSE ? $del_arr_name : "file_to_del";
                 $check_id = $del_arr_name . "_" . $id;
                 $check_name = $del_arr_name . "[" . $id . "]";
                 $checkbox = Form::getInputCheckbox($check_id, $check_name, $value, FALSE, "") . " ";
                 $checkbox .= Form::getLabel($check_id, Lang::t("_DELETE_FILE", "standard", "framework"), "nofloat");
                 $res .= Form::getLineBox($img . " " . $filename, $checkbox);
             } else {
                 $res .= Form::openFormLine();
                 $res .= Lang::t("_CURRENT_FILE", "standard", "framework") . ": " . $img . " " . $filename;
                 $res .= Form::closeFormLine();
             }
         } else {
             $res .= Form::openFormLine();
             $res .= Lang::t("_CURRENT_FILE", "standard", "framework") . ": " . Lang::t("_NONE", "standard", "framework");
             $res .= Form::closeFormLine();
         }
     }
     if ($add_old_info) {
         $old_prefix = $old_prefix !== FALSE ? $old_prefix : "old";
         $res .= "\n";
         $res .= Form::getHidden($old_prefix . "_" . $id, $old_prefix . "_" . $name, $value);
     }
     $res .= "</div>\n";
     return $res;
 }
 function printOut()
 {
     //		addScriptaculousJs();
     addJs($GLOBALS['where_lms_relative'] . '/modules/public_user_admin/', 'ajax.public_user_admin.js');
     require_once _base_ . '/lib/lib.user_profile.php';
     $profile = new UserProfile(getLogUserId());
     $profile->init('profile', 'framework', 'modname=public_user_admin&op=org_chart', 'ap');
     $profile->addStyleSheet('lms');
     $GLOBALS['page']->add('<script type="text/javascript">' . ' setup_directory(\'' . $GLOBALS['where_lms_relative'] . '/modules/directory/ajax.public_user_admin.php\'); ' . '</script>', 'page_head');
     $out = '';
     if ($this->select_all) {
         // This is not a beautiful position for this operation but at this point
         // I'm sure that all filter was applied
         $rs_all = $this->data->getAllRowsIdst();
         if ($rs_all !== FALSE) {
             $this->itemSelectedMulti = array();
             while (list($all_idst) = sql_fetch_row($rs_all)) {
                 $this->itemSelectedMulti[] = $all_idst;
             }
         }
         $this->itemSelected = $this->itemSelectedMulti;
     }
     require_once _base_ . '/lib/lib.form.php';
     $ord = importVar('ord', false, 'trans');
     $flip = importVar('flip', true, 0);
     $filter = new Form();
     $out .= $filter->getOpenFieldset($this->lang->def('_SEARCH'));
     $out .= $filter->getHidden('ord', 'ord', $ord);
     $out .= $filter->getHidden('flip', 'flip', $flip);
     if ($this->lms_editions_filter === true) {
         if (isset($GLOBALS['course_descriptor']) && $GLOBALS['course_descriptor']->hasEdition()) {
             // add editions filter ============================================================
             $ed_list = array();
             if ($this->editions == false) {
                 $this->editions = $GLOBALS['course_descriptor']->getEditionsSimpleList(getLogUserId(), true);
             }
             $sel = isset($_POST[$this->id]['edition_filter']) ? (int) $_POST[$this->id]['edition_filter'] : $GLOBALS['course_descriptor']->getActualEditionsForUser(getLogUserId());
             if (!empty($this->editions)) {
                 $out .= $filter->getDropdown($this->lang->def('_FILTER_BY_EDITION'), $this->id . '_edition_filter', $this->id . '[edition_filter]', $this->editions, $sel);
             }
         }
     }
     // end lms editions filter
     if ($this->show_simple_filter === TRUE) {
         // show simple filter ============================================================
         $out .= $filter->getTextfield($this->lang->def('_SIMPLE_FILTER'), $this->id . '_simple_fulltext_search', $this->id . '[simple_fulltext_search]', 255, isset($_POST[$this->id]['simple_fulltext_search']) ? strip_tags(html_entity_decode($_POST[$this->id]['simple_fulltext_search'])) : '', strip_tags($this->lang->def('_SIMPLE_FILTER')));
         $out .= '<div class="align_right">' . $filter->getButton($this->id . '_search', $this->id . '[search]', $this->lang->def('_SEARCH'), 'button_nowh') . '</div>';
     } else {
         // show complex filter ===========================================================
         $out .= '<h2 id="customize_filter">' . $this->lang->def('_CUSTOMIZE_FILTERS') . '</h2>';
         // --- print check box for flat mode
         if ($this->show_flat_mode_flag) {
             $out .= $filter->getCheckbox($this->lang->def('_DIRECTORY_FILTER_FLATMODE'), $this->id . '_flat_mode', $this->id . '[flat_mode]', 'flat_mode', $this->flat_mode, "onclick=\"window.document.forms['directory_org_chart'].submit();\"");
         } else {
             $out .= $filter->getHidden($this->id . '_flat_mode', $this->id . '[flat_mode]', $this->flat_mode ? 'flat_mode' : '');
         }
         // line for add a field filter
         $out .= $filter->openFormLine();
         foreach ($this->add_nat_fields as $nat_id => $nat_info) {
             $local_arr_fields_translation[$nat_id] = $this->lang->def('_DIRECTORY_FILTER_' . $nat_id);
         }
         $filter_to_show = $this->arr_fields_translation;
         if (is_array($this->arr_fields_filter)) {
             foreach ($this->arr_fields_filter as $filter_info) {
                 if (isset($filter_info['fieldname'])) {
                     unset($filter_to_show[$filter_info['fieldname']]);
                 } else {
                     unset($filter_to_show[$filter_info[0]]);
                 }
             }
         }
         if (is_array($filter_to_show) && !empty($filter_to_show)) {
             $out .= $filter->getInputDropdown('new_filter', $this->id . '_add_field_filter', $this->id . '[add_field_filter]', $filter_to_show, '', '');
             $out .= $filter->getButton($this->id . '_add_filter', $this->id . '[add_filter]', $this->lang->def('_NEW_FILTER'), 'button_nowh');
         }
         $out .= $filter->getButton($this->id . '_del_filter', $this->id . '[del_filter]', $this->lang->def('_RESET'), 'button_nowh');
         $out .= $filter->closeFormLine();
         if (is_array($this->arr_fields_filter)) {
             foreach ($this->arr_fields_filter as $field_id => $field_prop) {
                 if (!isset($field_prop['fieldname'])) {
                     // custom field
                     $arr_field_info = $this->field_list->getBaseFieldInfo($field_prop[FIELD_INFO_TYPE]);
                     require_once $GLOBALS['where_framework'] . '/modules/field/' . $arr_field_info[FIELD_BASEINFO_FILE];
                     $field_obj = new $arr_field_info[FIELD_BASEINFO_CLASS]($field_id);
                     $del_spot = '<input type="image" class="cancel_filter" ' . ' src="' . getPathImage('framework') . 'standard/cancel.png"' . ' id="' . $this->id . '_del_filter_' . $field_id . '"' . ' name="' . $this->id . '[del_filter][' . $field_id . ']"' . ' title="' . $this->lang->def('_DEL') . '"' . ' alt="' . $this->lang->def('_DEL') . '" />';
                     $out .= $field_obj->play_filter($field_id, isset($field_prop['value']) ? $field_prop['value'] : false, $field_prop[FIELD_INFO_TRANSLATION], $this->id, $del_spot, '', $field_prop[FIELD_INFO_ID]);
                     //play_filter( $id_field, $value = FALSE, $label = FALSE, $field_prefix = FALSE, $other_after = '', $other_before = '', $field_special = FALSE )
                 } else {
                     // base field
                     $arr_field_info = $this->field_list->getBaseFieldInfo($field_prop['field_type']);
                     require_once $GLOBALS['where_framework'] . '/modules/field/' . $arr_field_info[FIELD_BASEINFO_FILE];
                     $field_obj = new $arr_field_info[FIELD_BASEINFO_CLASS](0);
                     $del_spot = '<input type="image" class="cancel_filter" ' . ' src="' . getPathImage('framework') . 'standard/cancel.png"' . ' id="' . $this->id . '_del_filter_' . $field_id . '"' . ' name="' . $this->id . '[del_filter][' . $field_id . ']"' . ' title="' . $this->lang->def('_DEL') . '"' . ' alt="' . $this->lang->def('_DEL') . '" />';
                     $out .= $field_obj->play_filter($field_id, isset($field_prop['value']) ? $field_prop['value'] : false, $this->lang->def('_DIRECTORY_FILTER_' . $field_prop['fieldname']), $this->id, $del_spot, '', '');
                 }
             }
         }
         $out .= $filter->openButtonSpace();
         $out .= $filter->getButton('search', 'search', $this->lang->def('_SEARCH'));
         $out .= $filter->closeButtonSpace();
     }
     // end else for filter
     $out .= $filter->getCloseFieldset();
     // ---------------------------------------------------------------------------------------
     // set order rows
     if (is_array($this->arr_fields_order)) {
         foreach ($this->arr_fields_order as $ordFieldName => $isDesc) {
             $this->data->setOrderCol($ordFieldName, $isDesc);
         }
     }
     $this->getRows($this->_getStartRow(), $this->_getRowsPage());
     $totRow = $this->getTotalRows();
     if ($totRow == -1) {
         $totRow = $this->getLoadedRows();
     }
     $colInfo = $this->_getCols();
     $colData = $colInfo;
     $this->rend->setCaption($this->_getTitle());
     $type_h = array();
     $cont_h = array();
     while (list($key, $contentCell) = each($colInfo)) {
         if ($contentCell['toDisplay']) {
             $type_h[] = $contentCell['hClass'];
             $cont_h[] = $contentCell['hLabel'];
         }
     }
     reset($colInfo);
     $this->rend->addHead($cont_h, $type_h);
     while ($values = $this->fetchRecord()) {
         $colData = array();
         foreach ($colInfo as $key => $fieldInfo) {
             $colData[] = $values[$colInfo[$key]['data']];
         }
         $this->rend->addBody($colData, false, false, 'user_row_' . $values['idst']);
         if ($this->_expand_user == $values['idst']) {
             // extra user info if requested
             $this->rend->addBodyExpanded($this->userExtraData($this->_expand_user), 'user_more_info');
         }
     }
     if ($this->insNew) {
         $this->rend->addActionAdd('<input type="submit" class="transparent_add_button"' . ' id="' . $this->id . '_' . $this->_getOpCreateItemId() . '" ' . ' name="' . $this->id . '[' . $this->_getOpCreateItemId() . '][0]" ' . ' value="' . $this->lang->def('_ADD') . '"' . ' title="' . $this->_getCreateLabel() . '" ' . ' alt="' . $this->_getCreateAlt() . '" />');
     }
     $this->rend->initNavBar($this->_getIdInitRowId(), 'button');
     $out .= $this->rend->getTable() . $this->rend->getNavBar($this->_getStartRow(), $totRow) . $this->printState();
     // ---------------------------------------------------------------------------------------
     if ($this->select_all) {
         $arr_notPrint = array_diff($this->itemSelectedMulti, $this->printedItems);
         foreach ($arr_notPrint as $id_notPrint) {
             $out .= '<input type="checkbox" ' . ' id="' . DIRECTORY_ID . DIRECTORY_OP_SELECTITEM . '_' . $id_notPrint . '" ' . 'name="' . DIRECTORY_ID . '[' . DIRECTORY_OP_SELECTITEM . '][' . $id_notPrint . ']" ' . 'value="" checked="checked" style="display:none;" />';
         }
     }
     return $out;
 }
Example #4
0
 /**
  * @param string	$base_path 		if specified load only preference form this base_path
  * @param bool		$only_visible 	if true only the visible
  *
  * @return string	the code for the mod mask
  */
 function getModifyMask($base_path = false, $only_visible = true, $separate_output = false)
 {
     require_once _base_ . '/lib/lib.form.php';
     $lang =& DoceboLanguage::createInstance('preferences', 'framework');
     $preferences = $this->_up_db->getFullPreferences($this->id_user, $only_visible, false, $base_path);
     $html = array();
     while (list(, $pref) = each($preferences)) {
         // Navigation trought the preferences
         // array( 'path_name', 'label', 'default_value', 'type', 'visible', 'load_at_startup', 'user_value' )
         switch ($pref['type']) {
             case "language":
                 //drop down language
                 $lang_sel = $this->getLanguage();
                 $langs_var = Docebo::langManager()->getAllLangCode();
                 $langs = array();
                 foreach ($langs_var as $k => $v) {
                     $langs[$k] = $v;
                 }
                 /* XXX: remove when alll lang ready*/
                 $html[$pref['path_name']] = Form::getDropdown($lang->def($pref['label']), $this->base_name . '_' . $pref['path_name'], $this->base_name . '[' . $pref['path_name'] . ']', $langs, array_search($lang_sel, $langs));
                 break;
             case "template":
                 //drop down template
                 $templ_sel = $this->getTemplate();
                 $templ = getTemplateList();
                 $html[$pref['path_name']] = Form::getDropdown($lang->def($pref['label']), $this->base_name . '_' . $pref['path_name'], $this->base_name . '[' . $pref['path_name'] . ']', $templ, array_search($templ_sel, $templ));
                 break;
             case "hteditor":
                 //drop down hteditor
                 $ht_edit = getHTMLEditorList();
                 $html[$pref['path_name']] = Form::getDropdown($lang->def($pref['label']), $this->base_name . '_' . $pref['path_name'], $this->base_name . '[' . $pref['path_name'] . ']', $ht_edit, $pref['user_value'] ? $pref['user_value'] : $pref['default_value']);
                 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[$pref['path_name']] = Form::getDropdown($lang->def($pref['label']), $this->base_name . '_' . $pref['path_name'], $this->base_name . '[' . $pref['path_name'] . ']', $layout, $pref['user_value'] ? $pref['user_value'] : $pref['default_value']);
                 break;
             case "enum":
                 //on off
                 $value = $pref['user_value'] ? $pref['user_value'] : $pref['default_value'];
                 $html[$pref['path_name']] = Form::openFormLine() . Form::getInputCheckbox($this->base_name . '_' . $pref['path_name'] . '_on', $this->base_name . '[' . $pref['path_name'] . ']', 'on', $value == 'on', '') . ' ' . Form::getLabel($this->base_name . '_' . $pref['path_name'] . '_on', $lang->def($pref['label'])) . Form::closeFormLine();
                 break;
                 //string or int
             //string or int
             default:
                 $html[$pref['path_name']] = Form::getTextfield($lang->def($pref['label']), $this->base_name . '_' . $pref['path_name'], $this->base_name . '[' . $pref['path_name'] . ']', '65535', $pref['user_value'] ? $pref['user_value'] : $pref['default_value']);
         }
     }
     return $separate_output ? $html : implode("", $html) . '<div class="nofloat"></div>';
 }
Example #5
0
function defmodality()
{
    checkPerm('view', false, 'storage');
    $lang =& DoceboLanguage::createInstance('test');
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.json.php';
    $idTest = importVar('idTest', true, 0);
    $back_url = urldecode(importVar('back_url'));
    $url_coded = htmlentities(urlencode($back_url));
    list($title, $description, $display_type, $order_type, $shuffle_answer, $question_random_number, $save_keep, $mod_doanswer, $can_travel, $show_score, $show_score_cat, $show_doanswer, $show_solution, $max_attempt, $hide_info, $order_info, $use_suspension, $suspension_num_attempts, $suspension_num_hours, $suspension_prerequisites, $mandatory_answer) = sql_fetch_row(sql_query("\r\n\tSELECT title, description, display_type, order_type, shuffle_answer, question_random_number, \r\n\t\tsave_keep, mod_doanswer, can_travel, \r\n\t\tshow_score, show_score_cat, show_doanswer, show_solution, \r\n\t\tmax_attempt, hide_info,\r\n\t\torder_info, use_suspension, suspension_num_attempts, suspension_num_hours, suspension_prerequisites, mandatory_answer\r\n\tFROM %lms_test\r\n\tWHERE idTest = '" . $idTest . "'"));
    list($tot_quest) = sql_fetch_row(sql_query("\r\n\tSELECT COUNT(*) \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_testquest \r\n\tWHERE idTest = '" . (int) $idTest . "' AND type_quest <> 'title' AND type_quest <> 'break_page'"));
    $GLOBALS['page']->add(getTitleArea($lang->def('_TEST_SECTION'), 'test') . '<div class="std_block">' . '<div class="title_big">' . $lang->def('_TEST_MODALITY') . '</div>' . getBackUi('index.php?modname=test&amp;op=modtestgui&amp;idTest=' . $idTest . '&amp;back_url=' . $url_coded, $lang->def('_BACK')) . Form::openForm('defmodality', 'index.php?modname=test&amp;op=updatemodality') . Form::getOpenFieldset($lang->def('_TEST_MM_ONE')) . Form::getHidden('idTest', 'idTest', $idTest) . Form::getHidden('back_url', 'back_url', $url_coded) . Form::getRadio($lang->def('_TEST_MM1_GROUPING'), 'display_type_page', 'display_type', 0, !$display_type) . Form::getRadio($lang->def('_TEST_MM1_ONEFORPAGE'), 'display_type_one', 'display_type', 1, $display_type) . '<br />', 'content');
    //-order-----------------------------------------------------
    $cat_info = array();
    if ($order_info != '') {
        require_once _base_ . '/lib/lib.json.php';
        $json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
        $arr = $json->decode($order_info);
        if (is_array($arr)) {
            foreach ($arr as $value) {
                $cat_info[$value['id_category']] = $value['selected'];
            }
        }
    }
    $has_categories = false;
    $categories = array();
    $query = "SELECT tq.idCategory, qc.name, COUNT(tq.idcategory) FROM " . $GLOBALS['prefix_lms'] . "_testquest as tq LEFT JOIN " . $GLOBALS['prefix_lms'] . "_quest_category as qc " . " ON (tq.idCategory = qc.idCategory) WHERE idTest='" . (int) $idTest . "' GROUP BY tq.idCategory";
    $res = mysql_query($query);
    if (mysql_num_rows($res) > 0) {
        $has_categories = true;
        while (list($id_cat, $name_cat, $num_quest) = sql_fetch_row($res)) {
            if ($id_cat == 0) {
                $name_cat = $lang->def('_NO_CATEGORY');
            }
            if (isset($cat_info[$id_cat])) {
                $selected = $cat_info[$id_cat];
            } else {
                $selected = '0';
            }
            $categories[$id_cat] = array('name' => $name_cat, 'total' => $num_quest, 'selected' => (int) $selected);
        }
    }
    $script = "";
    if ($has_categories) {
        $GLOBALS['page']->add('<script type="text/javascript">
				function toggleCategoryList(o) {
					var ul = document.getElementById(\'category_list\'), radio = document.getElementById(\'order_type_random_category\');
					if (ul && radio) {
						if (radio.checked) ul.style.display = "block"; else ul.style.display = "none";
					}
				}
			</script>', 'page_head');
        $script = 'onclick="toggleCategoryList();"';
    }
    $GLOBALS['page']->add('<div class="text_bold">' . $lang->def('_ORDER_BY') . '</div>' . Form::getRadio($lang->def('_TEST_MM1_SEQUENCE'), 'order_type_seq', 'order_type', 0, $order_type == 0) . Form::getRadio($lang->def('_TEST_MM1_RANDOM'), 'order_type_random', 'order_type', 1, $order_type == 1), 'content');
    //-random question
    $input_field = Form::getInputTextfield('textfield_nowh', 'question_random_number', 'question_random_number', $question_random_number, 4, '', '');
    $label = str_replace('[random_quest]', '</label>' . $input_field . '<label for="question_random_number">', $lang->def('_TEST_MM1_QUESTION_RANDOM_NUMBER'));
    $GLOBALS['page']->add(Form::openFormLine() . Form::getInputRadio('order_type_random_quest', 'order_type', 2, $order_type == 2, '') . '<label for="order_type_random_quest">' . $lang->def('_ORDER_TYPE_RANDOM') . '</label> - ' . '<label for="question_random_number">' . str_replace('[tot_quest]', $tot_quest, $label) . '</label>' . Form::closeFormLine(), 'content');
    //------------------------------------------------------------------------------
    $label = '';
    if ($has_categories) {
        $category_selector = '<ul id="category_list" style="display:' . ($order_type == 3 ? "block" : "none") . '">';
        foreach ($categories as $key => $value) {
            $input_field = Form::getInputTextfield('textfield_nowh', 'question_random_category_' . $key, 'question_random_category[' . $key . ']', $value['selected'], 4, '', '');
            $category_selector .= '<li><label for="question_random_category_' . $key . '">' . $value['name'] . ':</label> ' . str_replace(array('[random_quest]', '[tot_quest]'), array($input_field, $value['total']), $lang->def('_TEST_MM1_QUESTION_RANDOM_NUMBER')) . '</li>';
        }
        $category_selector .= '</ul>';
        $GLOBALS['page']->add(Form::openFormLine() . Form::getInputRadio('order_type_random_category', 'order_type', 3, $order_type == 3, $script) . '<label for="order_type_random_category">' . $lang->def('_ORDER_TYPE_CATEGORY') . '</label>' . $category_selector . Form::closeFormLine() . '<br />', 'content');
    }
    //------------------------------------------------------------------------------
    /*
    $chart_options_decoded = new stdClass();
    if ($chart_options!="") {
    	$json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
    	$decoded = $json->decode($chart_options);
    }
    $chart_options_decoded->use_charts = (isset($decoded['use_charts']) ? (bool)$decoded['use_charts'] : false);
    $chart_options_decoded->selected_chart = (isset($decoded['selected_chart']) ? (string)$decoded['selected_chart'] : 'column');
    $chart_options_decoded->show_mode = (isset($decoded['show_mode']) ? $decoded['show_mode'] : 'teacher');
    
    $chart_list = array(
    		'stacked' => $lang->def('_STACKED_CHART'),
    		'bar' => $lang->def('_BAR_CHART'),
    		//'radar' => $lang->def('_RADAR_CHART'),
    		'column' => $lang->def('_COLUMN_CHART')
    	);
    
    $chart_show = array(
    		'teacher' => $lang->def('_SHOWMODE_TEACHER'),
    		'course' => $lang->def('_SHOWMODE_COURSE')
    	);
    
    $chart_list = array_flip($chart_list);
    $chart_show = array_flip($chart_show);
    */
    //-order-answer----------------------------------------------
    $GLOBALS['page']->add('<div class="text_bold">' . $lang->def('_TEST_MM1_ANSWER_ORDER') . '</div>' . Form::getRadio($lang->def('_TEST_MM1_ANSWER_SEQUENCE'), 'shuffle_answer_seq', 'shuffle_answer', 0, !$shuffle_answer) . Form::getRadio($lang->def('_TEST_MM1_ANSWER_RANDOM'), 'shuffle_answer_random', 'shuffle_answer', 1, $shuffle_answer) . Form::getCloseFieldset() . Form::getOpenFieldset($lang->def('_TEST_MM_TWO')) . Form::getCheckBox($lang->def('_MANDATORY_ANSWER'), 'mandatory_answer', 'mandatory_answer', 1, $mandatory_answer) . $lang->def('_TEST_MM2_HIDE_INFO') . '<br />' . '<input class="valign_middle" type="radio" id="mod_hide_info_no" name="mod_hide_info" value="0"' . (!$hide_info ? '  checked="checked"' : '') . ' /> ' . '<label for="mod_doanswer_no">' . $lang->def('_NO') . '</label>&nbsp;&nbsp;' . '<input class="valign_middle" type="radio" id="mod_hide_info_yes" name="mod_hide_info" value="1"' . ($hide_info ? '  checked="checked"' : '') . ' /> ' . '<label for="mod_doanswer_yes">' . $lang->def('_YES') . '</label>' . '<br /><br />' . $lang->def('_TEST_MM2_MODANSWER') . '<br />' . '<input class="valign_middle" type="radio" id="mod_doanswer_no" name="mod_doanswer" value="0"' . (!$mod_doanswer ? '  checked="checked"' : '') . ' /> ' . '<label for="mod_doanswer_no">' . $lang->def('_NO') . '</label>&nbsp;&nbsp;' . '<input class="valign_middle" type="radio" id="mod_doanswer_yes" name="mod_doanswer" value="1"' . ($mod_doanswer ? '  checked="checked"' : '') . ' /> ' . '<label for="mod_doanswer_yes">' . $lang->def('_YES') . '</label>' . '<br /><br />' . $lang->def('_TEST_MM2_CANTRAVEL') . '<br />' . '<input class="valign_middle" type="radio" id="can_travel_no" name="can_travel" value="0"' . (!$can_travel ? '  checked="checked"' : '') . ' /> ' . '<label for="can_travel_no">' . $lang->def('_NO') . '</label>&nbsp;&nbsp;' . '<input class="valign_middle" type="radio" id="can_travel_yes" name="can_travel" value="1"' . ($can_travel ? '  checked="checked"' : '') . ' /> ' . '<label for="can_travel_yes">' . $lang->def('_YES') . '</label>' . '<br /><br />' . $lang->def('_TEST_MM2_SAVEKEEP') . '<br />' . '<input class="valign_middle" type="radio" id="save_keep_no" name="save_keep" value="0"' . ($save_keep == 0 ? '  checked="checked"' : '') . ' /> ' . '<label for="save_keep_no">' . $lang->def('_NO') . '</label>&nbsp;&nbsp;' . '<input class="valign_middle" type="radio" id="save_keep_yes" name="save_keep" value="1"' . ($save_keep == 1 ? '  checked="checked"' : '') . ' /> ' . '<label for="save_keep_yes">' . $lang->def('_YES') . '</label>' . '<br /><br />' . Form::getTextfield($lang->def('_MAX_ATTEMPT'), 'max_attempt', 'max_attempt', 3, $max_attempt) . '<br />' . Form::getCheckbox($lang->def('_USE_SUSPENSION'), 'use_suspension', 'use_suspension', 1, $use_suspension, 'onclick="setSuspension();"') . Form::getTextfield($lang->def('_SUSPENSION_NUM_ATTEMPTS'), 'suspension_num_attempts', 'suspension_num_attempts', 5, $suspension_num_attempts) . Form::getTextfield($lang->def('_SUSPENSION_NUM_HOURS'), 'suspension_num_hours', 'suspension_num_hours', 5, $suspension_num_hours) . Form::getCheckBox($lang->def('_SUSPENSION_PREREQUISITES'), 'suspension_prerequisites', 'suspension_prerequisites', 1, $suspension_prerequisites) . '<br /><br />' . Form::getCloseFieldset() . Form::getOpenFieldset($lang->def('_TEST_MM_FOUR')) . $lang->def('_TEST_MM4_SHOWTOT') . '<br />' . '<input class="valign_middle" type="radio" id="show_tot_no" name="show_tot" value="0"' . (!$show_score ? '  checked="checked"' : '') . ' /> ' . '<label for="show_tot_no">' . $lang->def('_NO') . '</label>&nbsp;&nbsp;' . '<input class="valign_middle" type="radio" id="show_tot_yes" name="show_tot" value="1"' . ($show_score ? '  checked="checked"' : '') . ' /> ' . '<label for="show_tot_yes">' . $lang->def('_YES') . '</label>' . '<br /><br />' . $lang->def('_TEST_MM4_SHOWCAT') . '<br />' . '<input class="valign_middle" type="radio" id="show_cat_no" name="show_cat" value="0"' . (!$show_score_cat ? '  checked="checked"' : '') . ' /> ' . '<label for="show_cat_no">' . $lang->def('_NO') . '</label>&nbsp;&nbsp;' . '<input class="valign_middle" type="radio" id="show_cat_yes" name="show_cat" value="1"' . ($show_score_cat ? '  checked="checked"' : '') . ' /> ' . '<label for="show_cat_yes">' . $lang->def('_YES') . '</label>' . '<br /><br />' . $lang->def('_TEST_MM4_SHOWDOANSWER') . '<br />' . '<input class="valign_middle" type="radio" id="show_doanswer_no" name="show_doanswer" value="0"' . ($show_doanswer == 0 ? '  checked="checked"' : '') . ' /> ' . '<label for="show_doanswer_no">' . $lang->def('_NO') . '</label>&nbsp;&nbsp;' . '<input class="valign_middle" type="radio" id="show_doanswer_yes" name="show_doanswer" value="1"' . ($show_doanswer == 1 ? '  checked="checked"' : '') . ' /> ' . '<label for="show_doanswer_yes">' . $lang->def('_YES') . '</label>&nbsp;&nbsp;' . '<input class="valign_middle" type="radio" id="show_doanswer_yes_if_passed" name="show_doanswer" value="2"' . ($show_doanswer == 2 ? '  checked="checked"' : '') . ' /> ' . '<label for="show_doanswer_yes_if_passed">' . $lang->def('_YES_IF_PASSED') . '</label>' . '<br /><br />' . $lang->def('_TEST_MM4_SHOWSOL') . '<br />' . '<input class="valign_middle" type="radio" id="show_solution_no" name="show_solution" value="0"' . ($show_solution == 0 ? '  checked="checked"' : '') . ' /> ' . '<label for="show_solution_no">' . $lang->def('_NO') . '</label>&nbsp;&nbsp;' . '<input class="valign_middle" type="radio" id="show_solution_yes" name="show_solution" value="1"' . ($show_solution == 1 ? '  checked="checked"' : '') . ' /> ' . '<label for="show_solution_yes">' . $lang->def('_YES') . '</label>&nbsp;&nbsp;' . '<input class="valign_middle" type="radio" id="show_solution_yes_if_passed" name="show_solution" value="2"' . ($show_solution == 2 ? '  checked="checked"' : '') . ' /> ' . '<label for="show_solution_yes_if_passed">' . $lang->def('_YES_IF_PASSED') . '</label>' . '<br /><br />' . Form::getCloseFieldset() . '<div class="align_right">' . '<input class="button" type="submit" value="' . $lang->def('_SAVE') . '" />' . '</div>' . Form::closeForm() . getBackUi('index.php?modname=test&amp;op=modtestgui&amp;idTest=' . $idTest . '&amp;back_url=' . $url_coded, $lang->def('_BACK')) . '</div>', 'content');
    //----------------------------------------------------------------------------
    $script = '<script type="text/javascript">
			function setSuspension() {/*
				if (document.getElementById("use_suspension").checked) {
					document.getElementById("suspension_num_attempts").disabled = false;
					document.getElementById("suspension_num_hours").disabled = false;
					document.getElementById("suspension_prerequisites").disabled = false;
				} else {
					document.getElementById("suspension_num_attempts").disabled = true;
					document.getElementById("suspension_num_hours").disabled = true;
					document.getElementById("suspension_prerequisites").disabled = true;
				}
			*/}
		</script>';
    cout($script, 'content');
}
Example #6
0
 /**
  * Assign fields mandatory and user for group
  **/
 function loadAssignField2($groupid)
 {
     $arr_fields = $_POST[DIRECTORY_ID][DIRECTORY_OP_ADDFIELD];
     $idst_group = $_POST[DIRECTORY_ID]['idst_group'];
     require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
     if (isset($_POST[DIRECTORY_ID]['save_assignfield2'])) {
         $fl = new FieldList();
         $arr_fields_mandatory = $_POST[DIRECTORY_ID]['field_mandatory'];
         $arr_fields_useraccess = $_POST[DIRECTORY_ID]['field_useraccess'];
         foreach ($arr_fields as $id_filed => $status) {
             switch ($status) {
                 case GROUP_FIELD_NO:
                     $fl->removeFieldFromGroup($id_filed, $idst_group);
                     break;
                 case GROUP_FIELD_NORMAL:
                     $fl->addFieldToGroup($id_filed, $idst_group, isset($arr_fields_mandatory[$id_filed]) ? $arr_fields_mandatory[$id_filed] : 'false', isset($arr_fields_useraccess[$id_filed]) ? $arr_fields_useraccess[$id_filed] : 'readonly');
                     break;
             }
         }
         Util::jump_to('index.php?modname=directory&op=listgroup');
     } elseif (isset($_POST[DIRECTORY_ID]['cancel_assignfield'])) {
         Util::jump_to('index.php?modname=directory&op=listgroup');
     }
     $fl = new FieldList();
     $arr_all_fields = $fl->getAllFields();
     require_once _base_ . '/lib/lib.form.php';
     $form = new Form();
     $GLOBALS['page']->setWorkingZone('content');
     $GLOBALS['page']->add(getTitleArea($this->lang->def('_GROUPS') . ': ' . $groupid, 'directory_group'));
     $GLOBALS['page']->add('<div class="std_block">');
     $GLOBALS['page']->add($form->openForm('directoryassignfieldgroupmandatory', 'index.php?modname=directory&amp;op=assignfieldmandatory'));
     $GLOBALS['page']->add($form->openElementSpace());
     // print custom fields status
     $arr_fields_normal = $fl->getFieldsFromIdst(array($idst_group));
     $GLOBALS['page']->add($form->getHidden(DIRECTORY_ID . '_idst_group', DIRECTORY_ID . '[idst_group]', $idst_group));
     foreach ($arr_fields as $id_filed => $status) {
         $GLOBALS['page']->add($form->getHidden(DIRECTORY_ID . '_' . $id_filed, DIRECTORY_ID . '[' . DIRECTORY_OP_ADDFIELD . '][' . $id_filed . ']', $status));
     }
     $GLOBALS['page']->add($form->openFormLine() . '<div class="label_effect">&nbsp;</div>' . '<div class="label_head">' . $this->lang->def('_MANDATORY') . '</div>' . '<div class="label_head">' . $this->lang->def('_DIRECTORY_GROUP_FIELD_WRITE') . '</div>' . $form->closeFormLine());
     // checkbox for mandatory and useraccess
     foreach ($arr_fields as $id_filed => $status) {
         if ($status == GROUP_FIELD_NORMAL) {
             $GLOBALS['page']->add($form->openFormLine() . '<div class="label_effect">' . $arr_all_fields[$id_filed][FIELD_INFO_TRANSLATION] . '</div>' . '<input class="label_head" type="checkbox"' . ' id="' . DIRECTORY_ID . '_' . $id_filed . '_mandatory"' . ' name="' . DIRECTORY_ID . '[field_mandatory][' . $id_filed . ']"' . ' value="true"');
             if (isset($arr_fields_normal[$id_filed]) && $arr_fields_normal[$id_filed][FIELD_INFO_MANDATORY] == 'true') {
                 $GLOBALS['page']->add(' checked="checked"');
             }
             $GLOBALS['page']->add(' />');
             $GLOBALS['page']->add($form->getLabel(DIRECTORY_ID . '_' . $id_filed . '_mandatory', $this->lang->def('_MANDATORY'), 'label_bold access-only'));
             // checkbox for useraccess
             $GLOBALS['page']->add('<input class="label_head" type="checkbox"' . ' id="' . DIRECTORY_ID . '_' . $id_filed . '_useraccess"' . ' name="' . DIRECTORY_ID . '[field_useraccess][' . $id_filed . ']"' . ' value="readwrite"');
             if (isset($arr_fields_normal[$id_filed]) && $arr_fields_normal[$id_filed][FIELD_INFO_USERACCESS] == 'readwrite') {
                 $GLOBALS['page']->add(' checked="checked"');
             }
             $GLOBALS['page']->add(' />');
             $GLOBALS['page']->add($form->getLabel(DIRECTORY_ID . '_' . $id_filed . '_useraccess', $this->lang->def('_DIRECTORY_GROUP_FIELD_WRITE'), 'label_bold access-only'));
             $GLOBALS['page']->add($form->closeFormLine());
         }
     }
     $GLOBALS['page']->add($form->closeElementSpace() . $form->openButtonSpace() . $form->getButton('save_assignfield2' . DIRECTORY_ID, DIRECTORY_ID . '[save_assignfield2]', $this->lang->def('_SAVE')) . $form->getButton('cancel_assignfield' . DIRECTORY_ID, DIRECTORY_ID . '[cancel_assignfield]', $this->lang->def('_UNDO')) . $form->closeButtonSpace());
 }
Example #7
0
function modforum()
{
    checkPerm('mod');
    require_once _base_ . '/lib/lib.form.php';
    $lang =& DoceboLanguage::createInstance('forum');
    list($title, $text, $emoticons) = sql_fetch_row(sql_query("\r\n\tSELECT title, description, emoticons\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_forum\r\n\tWHERE idForum = '" . (int) $_GET['idForum'] . "'"));
    $onchange = "onchange=\"if(document.images) document.images['forum_icon'].src='" . getPathImage() . "emoticons/" . "'+this.options[this.selectedIndex].value;\"";
    $GLOBALS['page']->add(getTitleArea($lang->def('_FORUM'), 'forum', $lang->def('_FORUM')) . '<div class="std_block">' . Form::openForm('addforumform', 'index.php?modname=forum&amp;op=upforum') . Form::openElementSpace() . Form::getHidden('idForum', 'idForum', (int) $_GET['idForum']) . Form::getTextfield($lang->def('_TITLE'), 'title', 'title', 255, $title) . Form::getTextarea($lang->def('_DESCRIPTION'), 'description', 'description', $text) . Form::openFormLine() . '<div id="emoticon_menu_box">
		<input type="button" id="emoticon_btn" name="emoticon_btn" value="' . $lang->def('_EMOTICONS') . '">
		</div>' . '<select class="dropdown" style="display: none;" id="emoticons" name="emoticons">', 'content');
    /*$templ = dir(getPathImage().'emoticons/');
    	while($elem = $templ->read()) {
    
    		if(strpos($elem, '.gif') !== false) {
    			$GLOBALS['page']->add(
    				'<option value="'.$elem.'" class="option_with_image" style="background-image: url(\''.getPathImage().'emoticons/'.$elem.'\');"'
    				.( $elem == $emoticons ? ' selected="selected"' : '' )
    				.'>'
    				.$elem.'</option>'
    			, 'content');
    		}
    	}
    	closedir($templ->handle); */
    Util::get_js(Get::rel_path('lms') . '/modules/forum/forum.js', true, true);
    $emoticon_items = '';
    $emoticons_arr = getEmoticonsArr();
    foreach ($emoticons_arr as $elem) {
        $emoticon_items .= '<option value="' . $elem . '" ' . ($elem == $emoticons ? ' selected="selected"' : '') . '>' . $elem . '</option>';
    }
    $GLOBALS['page']->add($emoticon_items, 'content');
    $GLOBALS['page']->add('</select>' . '<select class="dropdown" id="emoticons_menu" name="emoticons">' . $emoticon_items . '</select>' . Form::closeFormLine() . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('insforum', 'insforum', $lang->def('_SAVE')) . Form::getButton('undo', 'undo', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content');
}
Example #8
0
 /**
  * @return 	string 	contains the displayable information for a selected group
  *
  * @access 	public
  */
 function getPageWithElement($regroup)
 {
     require_once _base_ . '/lib/lib.form.php';
     $lang =& DoceboLanguage::createInstance('configuration', 'lms');
     $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 sequence");
     $html = '';
     while (list($var_name, $var_value, $value_type, $max_size) = sql_fetch_row($reSetting)) {
         switch ($value_type) {
             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);
                 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));
                 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));
                 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);
                 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);
                 break;
             case "sel_news":
                 $mode = array('off' => Lang::t('_DONT_SHOW'), 'link' => Lang::t('_SHOW_AS_LINK'), 'block' => Lang::t('_SHOW_AS_BLOCK'));
                 $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $mode, $var_value);
                 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))) . Form::closeFormLine();
                 break;
             case "menuvoice":
             case "menuvoice_course_public":
             case "check":
                 //on off
                 $html .= Form::getCheckbox($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', 1, $var_value == 1);
                 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]));
                 }
                 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);
                 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 .= '</div>';
                 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;
 }
Example #9
0
 /**
  * @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;
 }
 public function multimod_dialog()
 {
     if (!$this->permissions['subscribe_course']) {
         $output = array('success' => false, 'message' => $this->_getMessage("no permission"));
         echo $this->json->encode($output);
         return;
     }
     $output = array();
     if (Get::req('count_sel', DOTY_INT, 0) <= 0) {
         $output['success'] = true;
         $output['header'] = Lang::t('_MOD', 'subscribe') . '&nbsp;';
         $output['body'] = '<p>' . Lang::t('_EMPTY_SELECTION', 'admin_directory') . '</p>';
         echo $this->json->encode($output);
         return;
     }
     $sel_level = Form::getInputCheckbox('multimod_level_set', 'multimod_level_set', 1, false, '') . ' ';
     $sel_status = Form::getInputCheckbox('multimod_status_set', 'multimod_status_set', 1, false, '') . ' ';
     $sel_date_begin = Form::getInputCheckbox('multimod_date_begin_set', 'multimod_date_begin_set', 1, false, '') . ' ';
     $sel_date_expire = Form::getInputCheckbox('multimod_date_expire_set', 'multimod_date_expire_set', 1, false, '') . ' ';
     $sel_date_begin_reset = Form::getInputCheckbox('multimod_date_begin_reset', 'multimod_date_begin_reset', 1, false, '') . ' ';
     $sel_date_expire_reset = Form::getInputCheckbox('multimod_date_expire_reset', 'multimod_date_expire_reset', 1, false, '') . ' ';
     $body = Form::openForm('multimod_dialog', 'ajax.adm_server.php?r=' . $this->link . '/multimod') . Form::getDropdown(Lang::t('_LEVEL', 'subscribe'), 'multimod_level', 'multimod_level', $this->model->getUserLevelList(), '', '', $sel_level) . Form::getDropdown(Lang::t('_STATUS', 'subscribe'), 'multimod_status', 'multimod_status', $this->model->getUserStatusList(), '', '', $sel_status) . Form::getDatefield(Lang::t('_DATE_BEGIN_VALIDITY', 'subscribe'), 'multimod_date_begin', 'multimod_date_begin', '', false, false, '', '', $sel_date_begin) . Form::getDateField(Lang::t('_DATE_EXPIRE_VALIDITY', 'subscribe'), 'multimod_date_expire', 'multimod_date_expire', '', false, false, '', '', $sel_date_expire) . Form::openFormLine() . $sel_date_begin_reset . '<p>' . Form::getLabel('multimod_date_begin_reset', Lang::t('_RESET', 'subscribe') . ': ' . Lang::t('_DATE_BEGIN_VALIDITY', 'subscribe')) . '</p>' . Form::closeFormLine() . Form::openFormLine() . $sel_date_expire_reset . '<p>' . Form::getLabel('multimod_date_expire_reset', Lang::t('_RESET', 'subscribe') . ': ' . Lang::t('_DATE_EXPIRE_VALIDITY', 'subscribe')) . '</p>' . Form::closeFormLine() . Form::getHidden('mod_dialog_users', 'users', '') . Form::getHidden('id_course', 'id_course', $this->id_course) . Form::getHidden('id_edition', 'id_edition', $this->id_edition) . Form::getHidden('id_date', 'id_date', $this->id_date) . Form::closeForm();
     $output['success'] = true;
     $output['header'] = Lang::t('_MOD', 'subscribe') . '&nbsp;';
     $output['body'] = $body;
     //$output['script'] = 'YAHOO.util.Dom.get("mod_dialog_users").value = DataTableSelector_subscribed_table.toString();';
     $output['__date_inputs'] = $GLOBALS['date_inputs'];
     echo $this->json->encode($output);
 }
Example #11
0
 function loadAssignField()
 {
     $tdb =& $this->tdb;
     $folder = $tdb->getFolderById($this->getSelectedFolderId());
     require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
     require_once _base_ . '/lib/lib.form.php';
     $form = new Form();
     $fl = new FieldList();
     $tree = $form->getFormHeader($this->lang->def('_ORG_CHART_LIST_FIELDS'));
     $tree .= $form->openElementSpace();
     $tree .= $this->printState();
     $acl =& Docebo::user()->getACL();
     $aclManager =& $acl->getACLManager();
     $arr_all_fields = $fl->getAllFields();
     $idst_group = $tdb->getGroupST($this->getSelectedFolderId());
     $idst_desc = $tdb->getGroupDescendantsST($this->getSelectedFolderId());
     $arr_fields_normal = $fl->getFieldsFromIdst(array($idst_group));
     $arr_fields_descend = $fl->getFieldsFromIdst(array($idst_desc));
     $arr_idst_inherit = array_merge($acl->getGroupGroupsST($idst_desc), $acl->getGroupGroupsST($idst_group));
     $arr_fields_inherit = $fl->getFieldsFromIdst($arr_idst_inherit);
     if (count($arr_idst_inherit)) {
         $arr_groupid = $aclManager->getGroupsId($arr_idst_inherit);
     } else {
         $arr_groupid = array();
     }
     $arr_tree_translations = $tdb->getFoldersCurrTranslation($arr_groupid);
     $arr_values = array($this->lang->def('_NO') => ORG_CHART_FIELD_NO, $this->lang->def('_YES') => ORG_CHART_FIELD_NORMAL, $this->lang->def('_ORG_CHART_FIELD_DESCEND') => ORG_CHART_FIELD_DESCEND);
     $tree .= $form->getHidden($this->id . '_idst_group', $this->id . '[idst_group]', $idst_group);
     $tree .= $form->getHidden($this->id . '_idst_desc', $this->id . '[idst_desc]', $idst_desc);
     foreach ($arr_all_fields as $field) {
         $def_value = ORG_CHART_FIELD_NO;
         if (isset($arr_fields_inherit[$field[FIELD_INFO_ID]])) {
             $def_value = ORG_CHART_FIELD_INHERIT;
         } elseif (isset($arr_fields_normal[$field[FIELD_INFO_ID]])) {
             $def_value = ORG_CHART_FIELD_NORMAL;
         } elseif (isset($arr_fields_descend[$field[FIELD_INFO_ID]])) {
             $def_value = ORG_CHART_FIELD_DESCEND;
         }
         $tree .= $form->openFormLine();
         $tree .= '<div class="label_effect">' . $field[FIELD_INFO_TRANSLATION] . '</div>';
         foreach ($arr_values as $label => $value) {
             $tree .= '<input class="radio" type="radio"' . ' id="' . $this->id . '_' . $field[FIELD_INFO_ID] . '_' . $value . '"' . ' name="' . $this->id . '[field_set][' . $field[FIELD_INFO_ID] . ']"' . ' value="' . $value . '"' . ($value == $def_value ? ' checked="checked"' : '') . (($value == ORG_CHART_FIELD_NO and $def_value == ORG_CHART_FIELD_INHERIT) ? ' disabled="true"' : '') . ' />';
             $tree .= $form->getLabel($this->id . '_' . $field[FIELD_INFO_ID] . '_' . $value, $label, 'label_bold');
         }
         if ($def_value == ORG_CHART_FIELD_INHERIT) {
             $gid = $arr_fields_inherit[$field[FIELD_INFO_ID]][FIELD_INFO_GROUPID];
             if ($gid == '/ocd_0') {
                 $text = Get::sett('title_organigram_chart');
             } else {
                 if (isset($arr_tree_translations[$gid])) {
                     $text = $arr_tree_translations[$gid];
                 } else {
                     //$text = $arr_groupid[$gid];
                     $text = $gid;
                 }
             }
             $tree .= '<span class="label_bold">' . $this->lang->def('_ORG_CHART_FIELD_INHERIT') . ' [' . $text . ']' . '</span>';
         }
         //$tree .= $form->getLabel( $id, $field[FIELD_INFO_TRANSLATION] );
         $tree .= $form->closeFormLine();
     }
     $tree .= $form->closeElementSpace() . $form->openButtonSpace() . $form->getButton('next1_assignfield' . $this->id, $this->id . '[next1_assignfield]', $this->lang->def('_SAVE')) . $form->getButton($this->_getCancelId(), $this->_getCancelId(), $this->lang->def('_UNDO')) . $form->closeButtonSpace();
     return $tree;
 }