function adminConf()
 {
     require_once _base_ . '/lib/lib.form.php';
     $lang =& DoceboLanguage::createInstance('admin_config', 'scs');
     $out =& $GLOBALS['page'];
     $out->setWorkingZone('content');
     $out->add(getTitleArea($lang->def('_ADMIN_CONF'), 'admin_conf') . '<div class="std_block">');
     if (isset($_POST['save'])) {
         $query_update = "UPDATE " . $GLOBALS['prefix_scs'] . "_rules_admin SET ";
         if (isset($_POST['rules'])) {
             while (list($var_name, $new_value) = each($_POST['rules'])) {
                 $query_update .= " {$var_name} = '" . $new_value . "',";
             }
             $re = sql_query(substr($query_update, 0, -1));
         }
         if ($re) {
             $out->add(getResultUi($lang->def('_MOD_OK')));
         } else {
             $out->add(getErrorUi($lang->def('_MOD_ERR')));
         }
     }
     $query_rules_admin = "\r\n\tSELECT server_status, \r\n\t\tenable_recording_function, enable_advice_insert, enable_write, enable_chat_recording, \r\n\t\tenable_private_subroom, enable_public_subroom, \r\n\t\tenable_drawboard_watch, enable_drawboard_write, \r\n\t\tenable_audio, enable_webcam, enable_stream_watch, enable_strem_write, enable_remote_desktop \r\n\tFROM " . $GLOBALS['prefix_scs'] . "_rules_admin";
     $re_rules_admin = sql_query($query_rules_admin);
     $rules = mysql_fetch_array($re_rules_admin);
     $out->add(Form::openForm('rules_admin', 'index.php?modname=admin_configuration&amp;op=conf') . Form::openElementSpace() . Form::getOpenCombo($lang->def('_SERVER_STATUS')) . Form::getInputRadio('rules_server_status_yes', 'rules[server_status]', 'yes', $rules['server_status'] == 'yes', '') . '&nbsp;' . Form::getLabel('', $lang->def('_YES'), 'label_padded') . '&nbsp;' . Form::getInputRadio('rules_server_status_no', 'rules[server_status]', 'no', $rules['server_status'] == 'no', '') . '&nbsp;' . Form::getLabel('', $lang->def('_NO'), 'label_padded') . '&nbsp;' . Form::getCloseCombo() . maskMultiple('enable_recording_function', $rules['enable_recording_function']) . maskMultiple('enable_advice_insert', $rules['enable_advice_insert']) . maskMultiple('enable_write', $rules['enable_write']) . maskMultiple('enable_chat_recording', $rules['enable_chat_recording']) . maskMultiple('enable_private_subroom', $rules['enable_private_subroom']) . maskMultiple('enable_public_subroom', $rules['enable_public_subroom']) . maskMultiple('enable_drawboard_watch', $rules['enable_drawboard_watch']) . maskMultiple('enable_drawboard_write', $rules['enable_drawboard_write']) . maskMultiple('enable_audio', $rules['enable_audio']) . maskMultiple('enable_webcam', $rules['enable_webcam']) . maskMultiple('enable_stream_watch', $rules['enable_stream_watch']) . maskMultiple('enable_strem_write', $rules['enable_strem_write']) . maskMultiple('enable_remote_desktop', $rules['enable_remote_desktop']) . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('save', 'save', $lang->def('_SAVE')) . Form::getButton('undo', 'undo', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm());
     $out->add('</div>');
 }
Example #2
0
 public static function getRadioHoriz($group_name, $id, $name, $all_value, $selected = '', $other_after = '', $other_before = '')
 {
     $count = 0;
     $out = '<div class="form_line_l">' . $other_before . '<p><span>' . $group_name . '</span></p>';
     //.'<span class="grouping">';
     foreach ($all_value as $label_item => $val_item) {
         $out .= Form::getInputRadio($id . '_' . $count, $name, $val_item, $val_item == $selected, '');
         $out .= ' <label class="label_padded" for="' . $id . '_' . $count . '">' . $label_item . '</label> &nbsp;';
         $count++;
     }
     $out .= $other_after . '</div>';
     return $out;
 }
Example #3
0
 function maskMultiple($name, $value)
 {
     require_once _base_ . '/lib/lib.form.php';
     $lang =& DoceboLanguage::createInstance('admin_config', 'scs');
     return Form::getOpenCombo($lang->def('_' . strtoupper($name))) . Form::getInputRadio('rules_' . $name . '_admin', 'rules[' . $name . ']', 'admin', $value == 'admin', '') . '&nbsp' . Form::getLabel('rules_' . $name . '_admin', $lang->def('_ADMIN'), 'label_padded') . '&nbsp' . Form::getInputRadio('rules_' . $name . '_alluser', 'rules[' . $name . ']', 'alluser', $value == 'alluser', '') . '&nbsp' . Form::getLabel('rules_' . $name . '_alluser', $lang->def('_ALLUSER'), 'label_padded') . '&nbsp' . Form::getInputRadio('rules_' . $name . '_noone', 'rules[' . $name . ']', 'noone', $value == 'noone', '') . '&nbsp' . Form::getLabel('rules_' . $name . '_noone', $lang->def('_NOONE'), 'label_padded') . '&nbsp' . Form::getCloseCombo();
 }
Example #4
0
function schedule_set($idrep)
{
    checkPerm('mod');
    $lang =& DoceboLanguage::createInstance('report', 'framework');
    //initialize session data for schedulation, if not updating
    if (!isset($_SESSION['schedule_tempdata'])) {
        $_SESSION['schedule_tempdata'] = array('name' => '', 'period' => 'day', 'period_info' => '', 'time' => '', 'recipients' => array());
    }
    $ref =& $_SESSION['schedule_tempdata'];
    require_once _base_ . '/lib/lib.form.php';
    $jump_url = 'index.php?modname=report&op=report_schedule&idrep=' . $idrep;
    $back_url = 'index.php?modname=report&op=schedulelist&idrep=' . $idrep;
    $body = Form::openForm('report_schedule_time', $jump_url);
    $body .= Form::getTextfield($lang->def('_SAVE_SCHED_NAME'), 'sched_name', 'sched_name', '200', $ref['name']) . Form::getHidden('next_step', 'next_step', 'sched_setrecipients');
    //create selections for crontab specification
    $month_days = array();
    for ($i = 1; $i <= 31; $i++) {
        $month_days[$i] = $i;
        //TO DO : format with 2 digits filling with 0
    }
    $year_months = array();
    for ($i = 1; $i <= 12; $i++) {
        $year_months[$i] = $i;
        //TO DO : format with 2 digits filling with 0
    }
    $lang_days =& DoceboLanguage::createInstance('calendar', 'lms');
    $week_days = array('0' => $lang_days->def('_MONDAY'), '1' => $lang_days->def('_TUESDAY'), '2' => $lang_days->def('_WEDNESDAY'), '3' => $lang_days->def('_THURSDAY'), '4' => $lang_days->def('_FRIDAY'), '5' => $lang_days->def('_SATURDAY'), '6' => $lang_days->def('_SUNDAY'));
    $body .= Form::getRadio($lang->def('_REPORT_DAILY'), 'cron_radio_1', 'cron_radio', 'day', $ref['period'] == 'day' ? true : false) . '<div class="form_line_l">' . Form::getInputRadio('cron_radio_2', 'cron_radio', 'week', $ref['period'] == 'week' ? true : false, '') . ' <label class="label_normal" for="cron_radio_2">' . $lang->def('_REPORT_WEEKLY') . '</label> ' . Form::getInputDropdown('', 'cron_weekly', 'cron_weekly', $week_days, $ref['period'] == 'week' ? $ref['period_info'] : '', '') . '</div>' . '<div class="form_line_l">' . Form::getInputRadio('cron_radio_3', 'cron_radio', 'month', $ref['period'] == 'month' ? true : false, '') . ' <label class="label_normal" for="cron_radio_3">' . $lang->def('_REPORT_MONTHLY') . '</label> ' . Form::getInputDropdown('', 'cron_monthly', 'cron_monthly', $month_days, $ref['period'] == 'month' ? $ref['period_info'] : '', '') . '</div>' . Form::getHidden('idrep', 'idrep', $idrep);
    $body .= Form::openButtonSpace() . Form::getButton('', 'schedule_confirm', $lang->def('_NEXT')) . Form::getButton('', 'schedule_undo', $lang->def('_UNDO')) . form::closeButtonSpace();
    $body .= Form::closeForm();
    //output content
    cout(getTitleArea($lang->def('_SCHEDULE')));
    cout('<div class="std_block">');
    cout($body);
    cout('</div>');
    //close std_block div
}
Example #5
0
 function waitingUserGroup($groupid)
 {
     require_once _base_ . '/lib/lib.form.php';
     require_once _base_ . '/lib/lib.table.php';
     require_once $GLOBALS['where_framework'] . "/lib/lib.field.php";
     $acl =& Docebo::user()->getAcl();
     $groupLabel = $groupid;
     if ($groupid != '') {
         $arrGroup = $this->aclManager->getGroup(FALSE, $groupid);
         if ($arrGroup !== FALSE) {
             $idst = $arrGroup[0];
         }
     }
     $tb = new Table(0, $this->lang->def('_DIRECTORY_GROUPWAIT_ACCORDECLINE'), $this->lang->def('_DIRECTORY_GROUPWAIT_ACCORDECLINE_SUMMARY'));
     $tb->setColsStyle(array('', '', 'image', 'image'));
     $tb->addHead(array($this->lang->def('_USERNAME'), $this->lang->def('_LASTNAME_FIRSTNAME'), $this->lang->def('_EMAIL'), $this->lang->def('_ACCEPT'), $this->lang->def('_DECLINE'), $this->lang->def('_POSTPONE')));
     $waiting_users =& $this->aclManager->getWaitingUserForGroup($idst);
     if ($waiting_users) {
         while (list($idst_u, $user_info) = each($waiting_users)) {
             $more = '';
             $more = isset($_GET['id_user']) && $_GET['id_user'] == $idst_u ? '<a href="index.php?modname=directory&amp;op=waitinggroup&groupid=' . $groupid . '"><img src="' . getPathImage() . 'standard/less.gif"></a> ' : '<a href="index.php?modname=directory&amp;op=waitinggroup&groupid=' . $groupid . '&amp;id_user='******'"><img src="' . getPathImage() . 'standard/more.gif"></a> ';
             $tb->addBody(array($more . $this->aclManager->relativeId($user_info[ACL_INFO_USERID]), $user_info[ACL_INFO_LASTNAME] . ' ' . $user_info[ACL_INFO_FIRSTNAME], '<a href="mailto:' . $user_info[ACL_INFO_EMAIL] . '">' . $user_info[ACL_INFO_EMAIL] . '</a>', Form::getInputRadio('waiting_user_accept_' . $idst_u, 'waiting_user[' . $idst_u . ']', 'accept', true, '') . '' . Form::getLabel('waiting_user_accept_' . $idst_u, $this->lang->def('_ACCEPT'), 'access-only'), Form::getInputRadio('waiting_user_decline_' . $idst_u, 'waiting_user[' . $idst_u . ']', 'decline', false, '') . '' . Form::getLabel('waiting_user_decline_' . $idst_u, $this->lang->def('_DECLINE'), 'access-only'), Form::getInputRadio('waiting_user_postpone_' . $idst_u, 'waiting_user[' . $idst_u . ']', 'postpone', false, '') . '' . Form::getLabel('waiting_user_postpone_' . $idst_u, $this->lang->def('_POSTPONE'), 'access-only')));
             if (isset($_GET['id_user']) && $idst_u == $_GET['id_user']) {
                 $field = new FieldList();
                 $temp = array($idst);
                 $idst_list = array_merge($temp, $acl->getUserGroupsST($idst_u));
                 $tb->addBodyExpanded($field->playFieldsForUser($idst_u, $idst_list, true), 'user_specific_info');
             }
         }
     }
     $GLOBALS['page']->add(getTitleArea($this->lang->def('_GROUPS') . ': ' . $groupLabel, 'directory_group'), 'content');
     $GLOBALS['page']->add('<div class="std_block">', 'content');
     $GLOBALS['page']->add(Form::openForm('directoryeditgroup', 'index.php?modname=directory&amp;op=listgroup'), 'content');
     $GLOBALS['page']->add(Form::openElementSpace(), 'content');
     $GLOBALS['page']->add(Form::getHidden('idst', 'idst', $idst), 'content');
     $GLOBALS['page']->add($tb->getTable(), 'content');
     $GLOBALS['page']->add(Form::closeElementSpace(), 'content');
     $GLOBALS['page']->add(Form::openButtonSpace(), 'content');
     $GLOBALS['page']->add(Form::getButton("editwaitsave", "editwaitsave", $this->lang->def('_SAVE')), 'content');
     $GLOBALS['page']->add(Form::getButton("editgroupcancel", "editgroupcancel", $this->lang->def('_CANCEL')), 'content');
     $GLOBALS['page']->add(Form::closeButtonSpace(), 'content');
     $GLOBALS['page']->add(Form::closeForm(), 'content');
     $GLOBALS['page']->add('</div>', 'content');
 }
Example #6
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 #7
0
function view_report_certificate()
{
    checkPerm('view');
    require_once _lms_ . '/lib/lib.certificate.php';
    require_once _lms_ . '/lib/lib.course.php';
    $out =& $GLOBALS['page'];
    $out->setWorkingZone('content');
    $lang =& DoceboLanguage::createInstance('certificate', 'lms');
    $deletion = importVar('deletion', true, 0);
    if ($deletion) {
        switch ($deletion) {
            case 1:
                $out->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')));
                break;
            case 2:
                $out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
                break;
            case 3:
                $out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
                break;
        }
    }
    $certificate = new Certificate();
    $id_certificate = importVar('id_certificate', true, 0);
    $id_course = importVar('id_course', true, 0);
    $selection = importVar('selection', false, array());
    //all possible selected values
    $selected = importVar('selected', false, array());
    //effectively selected values with checkbox
    $sel = importVar('old_selection', false, '');
    //selected values from previous table pages
    if ($sel != '') {
        $total_selection = explode(',', $sel);
    } else {
        $total_selection = array();
    }
    //update total selection
    foreach ($selection as $key => $val) {
        if (in_array($val, $selected)) {
            if (!in_array($val, $total_selection)) {
                $total_selection[] = $val;
            }
        } else {
            $index = array_search($val, $total_selection);
            if ($index !== false) {
                array_splice($total_selection, $index, 1);
            }
        }
    }
    $search_filter = importVar('filter', false, '');
    $only_released = importVar('only_released', true, 0);
    //which command?
    if (importVar('search_button', false, false) !== false) {
    }
    if (importVar('reset_button', false, false) !== false) {
        $search_filter = '';
        $only_released = 0;
    }
    if (importVar('print_button', false, false) !== false) {
    }
    $numtablerows = $GLOBALS['framework']['visuItem'];
    $tb = new Table($numtablerows, $lang->def('_CERTIFICATE_VIEW_CAPTION'), $lang->def('_CERTIFICATE_VIEW_CAPTION'));
    $tb->initNavBar('ini', 'button');
    $ini = $tb->getSelectedElement();
    $tca = $GLOBALS['prefix_lms'] . "_certificate_assign as ca";
    $tcc = $GLOBALS['prefix_lms'] . "_certificate_course as cc";
    $tcu = $GLOBALS['prefix_lms'] . "_courseuser as cu";
    $tu = $GLOBALS['prefix_fw'] . "_user as u";
    $where = "";
    if ($search_filter != '') {
        $where .= " AND (u.userid LIKE '%" . $search_filter . "%' OR u.lastname LIKE '%" . $search_filter . "%' OR u.firstname LIKE '%" . $search_filter . "%') ";
    }
    if ($only_released > 0) {
        $where = " AND ca.on_date " . ($only_released == 1 ? "IS NOT" : "IS") . " NULL ";
    }
    //$where .= " AND ".$aval_status." ".($only_released==1 ? "<" : ">=")." cu.status ";
    list($aval_status) = sql_fetch_row(sql_query("SELECT available_for_status FROM " . $tcc . " " . " WHERE id_certificate='" . (int) $id_certificate . "' AND id_course='" . (int) $id_course . "'"));
    switch ($aval_status) {
        case AVS_ASSIGN_FOR_ALL_STATUS:
            $aval_status = " 1 ";
            break;
        case AVS_ASSIGN_FOR_STATUS_INCOURSE:
            $aval_status = " cu.status = " . _CUS_BEGIN . " ";
            break;
        case AVS_ASSIGN_FOR_STATUS_COMPLETED:
            $aval_status = " cu.status = " . _CUS_END . " ";
            break;
    }
    list($totalrows) = sql_fetch_row(sql_query("SELECT COUNT(*) " . " FROM ( " . $tu . " JOIN " . $tcu . " ON (u.idst = cu.idUser) ) LEFT JOIN " . $tca . " " . " ON ( ca.id_course = cu.idCourse AND ca.id_user=cu.idUser ) " . " WHERE (ca.id_certificate='" . (int) $id_certificate . "' OR ca.id_certificate IS NULL) AND " . $aval_status . " " . " AND cu.idCourse='" . (int) $id_course . "' " . $where));
    $query = "SELECT u.userid, u.firstname, u.lastname, cu.date_complete, ca.on_date, cu.idUser as id_user, cu.status " . " FROM ( " . $tu . " JOIN " . $tcu . " ON (u.idst = cu.idUser) ) LEFT JOIN " . $tca . " " . " ON ( ca.id_course = cu.idCourse AND ca.id_user=cu.idUser ) " . " WHERE (ca.id_certificate='" . (int) $id_certificate . "' OR ca.id_certificate IS NULL) AND " . $aval_status . " " . " AND cu.idCourse='" . (int) $id_course . "' " . $where . " ORDER BY u.userid LIMIT " . $ini . ", " . $numtablerows;
    $res = sql_query($query);
    $from = Get::req('from', DOTY_MIXED, '');
    $back_ui = getBackUi('index.php?r=lms/pcourse/certificate&amp;id_course=' . (int) $id_course, $lang->def('_BACK'));
    $out->add(getTitleArea(array('index.php?r=lms/pcourse/certificate&amp;id_course=' . (int) $id_course => $lang->def('_CERTIFICATE_ASSIGN_STATUS', 'course'), $lang->def('_CERTIFICATE_REPORT_COURSE_CERT')), 'certificate'));
    $out->add('<div class="std_block">' . $back_ui);
    $numrows = sql_num_rows($res);
    $downloadables = array();
    if ($numrows > 0) {
        $clang =& DoceboLanguage::CreateInstance('course', 'lms');
        $type_h = array('image', '', '', '', '', '', '', 'image', 'image');
        $cont_h = array('', $lang->def('_USERNAME'), $lang->def('_LASTNAME'), $lang->def('_FIRSTNAME'), $clang->def('_STATUS'), $lang->def('_DATE'), $lang->def('_RELASE_DATE'), Get::img('course/certificate.png', Lang::t('_TITLE_VIEW_CERT', 'certificate')), Get::img('standard/delete.png', Lang::t('_DEL', 'certificate')));
        $tb->setColsStyle($type_h);
        $tb->addHead($cont_h);
        $acl_man =& $GLOBALS['current_user']->getAclManager();
        $arr_status = array(_CUS_CONFIRMED => $clang->def('_USER_STATUS_CONFIRMED'), _CUS_SUBSCRIBED => $clang->def('_USER_STATUS_SUBS'), _CUS_BEGIN => $clang->def('_USER_STATUS_BEGIN'), _CUS_END => $clang->def('_USER_STATUS_END'), _CUS_SUSPEND => $clang->def('_USER_STATUS_SUSPEND'));
        //foreach($report_info as $info_report)
        while ($info = sql_fetch_assoc($res)) {
            $cont = array();
            $can_assign = (bool) ($info['on_date'] == '');
            $input_id = $info['id_user'];
            $sel_cell_content = '';
            $label_open = '';
            $label_close = '';
            if ($can_assign) {
                $input = '<input type="hidden" id="selection_' . $input_id . '" name="selection[' . $input_id . ']" value="' . $input_id . '"/> ';
                if (in_array($input_id, $total_selection)) {
                    $checked = ' checked="checked"';
                } else {
                    $checked = '';
                }
                $sel_cell_content .= $input . '<input type="checkbox" id="selected_' . $input_id . '" name="selected[' . $input_id . ']" value="' . $input_id . '"' . $checked . '/>';
                $label_open = '<label for="selected_' . $input_id . '">';
                $label_close = '</label>';
            }
            $userid = $acl_man->relativeId($info['userid']);
            $cont[] = $sel_cell_content;
            $cont[] = $label_open . ($search_filter != '' ? highlightText($userid, $search_filter) : $userid) . $label_close;
            $cont[] = $label_open . ($search_filter != '' ? highlightText($info['lastname'], $search_filter) : $info['lastname']) . $label_close;
            $cont[] = $label_open . ($search_filter != '' ? highlightText($info['firstname'], $search_filter) : $info['firstname']) . $label_close;
            $cont[] = $arr_status[$info['status']];
            $cont[] = $info['date_complete'];
            $cont[] = $info['on_date'];
            $url = 'index.php?modname=pcertificate&amp;certificate_id=' . $id_certificate . '&amp;course_id=' . $id_course . '&amp;user_id=' . $info['id_user'];
            $dl_url = $url . "&amp;op=send_certificate";
            if ($can_assign) {
                $downloadables[] = 'dl_single_' . $input_id;
            }
            $cont[] = '<a href="' . ($can_assign ? "javascript:;" : $dl_url) . '" id="dl_single_' . $input_id . '">' . Get::img('course/certificate.png', Lang::t('_TITLE_VIEW_CERT', 'certificate')) . ($can_assign ? $lang->def('_GENERATE') : $lang->def('_DOWNLOAD')) . '</a>';
            $cont[] = $can_assign ? "" : '<a href="' . $url . '&amp;op=del_report_certificate">' . Get::img('standard/delete.png', Lang::t('_DEL', 'certificate')) . '</a>';
            $tb->addBody($cont);
        }
        require_once _base_ . '/lib/lib.dialog.php';
        setupHrefDialogBox('a[href*=del_report_certificate]');
        $form = new Form();
        $form_url = "index.php?modname=pcertificate&amp;op=view_report_certificate&amp;id_certificate=" . (int) $id_certificate . "&amp;id_course=" . (int) $id_course;
        $out->add($form->openForm("certificates_emission", $form_url));
        $out->add($form->getHidden('old_selection', 'old_selection', implode(',', $total_selection)));
        //search filter ...
        $release_options = array($lang->def('_ALL') => 0, $lang->def('_ONLY_RELEASED') => 1, $lang->def('_ONLY_TO_RELEASE') => 2);
        /*
        		$out->add($form->getOpenFieldset($lang->def('_SEARCH_FILTER')));
        		$out->add($form->getTextfield($lang->def('_FILTER'), "filter", "filter", 255, $search_filter));
        		$out->add($form->getRadioSet($lang->def('_RELEASE_OPTIONS'), 'only_released', 'only_released', $release_options, $only_released).'<div class="no_float"></div>');
        		$out->add($form->openButtonSpace());
        		$out->add($form->getButton("search_button", "search_button", $lang->def('_SEARCH')));
        		$out->add($form->getButton("reset_button", "reset_button", $lang->def('_UNDO')));
        		$out->add($form->closeButtonSpace());
        		$out->add($form->getCloseFieldset());
        */
        $print_button_1 = '<div><a id="print_selected_button_1" href="javascript:;">' . Get::img('course/certificate.png', Lang::t('_GENERATE_ALL_SELECTED', 'certificate')) . Lang::t('_GENERATE_ALL_SELECTED', 'certificate') . '</a></div>';
        $print_button_2 = '<div><a id="print_selected_button_2" href="javascript:;">' . Get::img('course/certificate.png', Lang::t('_GENERATE_ALL_SELECTED', 'certificate')) . Lang::t('_GENERATE_ALL_SELECTED', 'certificate') . '</a></div>';
        cout('<div class="quick_search_form">' . Form::getInputTextfield("_FILTER", "filter", "filter", $search_filter, '', 255, '') . Form::getButton("search_button", "search_button", Lang::t('_SEARCH', 'standard'), "search_b") . Form::getButton("reset_button", "reset_button", Lang::t('_RESET', 'standard'), "reset_b") . '<br />' . '<br />' . $lang->def('_RELEASE_OPTIONS') . ': ' . Form::getInputRadio('only_released_0', 'only_released', '0', $only_released == 0, '') . ' <label class="label_normal" for="only_released_0">' . Lang::t('_ALL', 'certificate') . '</label>' . '&nbsp;&nbsp;&nbsp;&nbsp;' . Form::getInputRadio('only_released_1', 'only_released', '1', $only_released == 1, '') . ' <label class="label_normal" for="only_released_1">' . Lang::t('_ONLY_RELEASED', 'certificate') . '</label>' . '&nbsp;&nbsp;&nbsp;&nbsp;' . Form::getInputRadio('only_released_2', 'only_released', '2', $only_released == 2, '') . ' <label class="label_normal" for="only_released_2">' . Lang::t('_ONLY_TO_RELEASE', 'certificate') . '</label>' . Form::closeForm() . '</div>', 'content');
        $navbar = $tb->getNavBar($ini, $totalrows);
        $out->add($print_button_1 . '<br />' . $navbar . $tb->getTable() . $navbar . '<br />' . $print_button_2);
        $out->add($form->closeForm());
    } else {
        $out->add($lang->def('_NO_USER_FOR_CERTIFICATE'));
    }
    $out->add($back_ui . '</div>');
    addCss('style_menu', 'lms');
    Util::get_js(Get::rel_path('lms') . '/modules/pcertificate/pcertificate.js', true, true);
    $script = 'var ajax_url="ajax.server.php?plf=lms&mn=pcertificate"; var _STOP="' . $lang->def('_STOP') . '"; ' . 'var glob_id_certificate = ' . (int) $id_certificate . ', glob_id_course = ' . (int) $id_course . ';' . 'var single_list = [' . (count($downloadables) ? '"' . implode('","', $downloadables) . '"' : '') . ']; ' . 'var reload_url = "' . str_replace('&amp;', '&', isset($form_url) ? $form_url : '') . '", _ERROR_PARSE = "' . $lang->def('_OPERATION_FAILURE') . '", _SUCCESS = "' . $lang->def('_OPERATION_SUCCESSFUL') . '";';
    $out->add('<script type="text/javascript">' . $script . '</script>', 'page_head');
}
Example #8
0
function waitinguser()
{
    checkPerm('moderate', false, 'course');
    require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
    require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.table.php';
    require_once _base_ . '/lib/lib.user_profile.php';
    $id_course = importVar('id_course', true, 0);
    $man_course = new Man_Course();
    $course_info = $man_course->getCourseInfo($id_course);
    $edition_id = getCourseEditionId();
    $ed_url_param = getEditionUrlParameter($edition_id);
    $out =& $GLOBALS['page'];
    $lang =& DoceboLanguage::CreateInstance('course', 'lms');
    $lang =& DoceboLanguage::CreateInstance('subscribe', 'lms');
    $acl_man =& Docebo::user()->getAclManager();
    $levels = CourseLevel::getLevels();
    $waiting_users =& $man_course->getWaitingSubscribed($id_course, $edition_id);
    $users_name =& $acl_man->getUsers($waiting_users['all_users_id']);
    $arr_status = array(_CUS_WAITING_LIST => $lang->def('_WAITING_USERS'), _CUS_CONFIRMED => $lang->def('_USER_STATUS_CONFIRMED'), _CUS_SUBSCRIBED => $lang->def('_USER_STATUS_SUBS'), _CUS_BEGIN => $lang->def('_USER_STATUS_BEGIN'), _CUS_END => $lang->def('_USER_STATUS_END'), _CUS_SUSPEND => $lang->def('_SUSPENDED'));
    $page_title = array('index.php?modname=course&amp;op=course_list' => $lang->def('_COURSE', 'course', 'lms'), $course_info['name'], $lang->def('_USERWAITING', 'course', 'lms'));
    $GLOBALS['page']->add(getTitleArea($page_title, 'subscribe') . '<div class="std_block">' . Form::openForm('approve users', 'index.php?modname=subscribe&amp;op=approveusers') . Form::getHidden('id_course', 'id_course', $id_course) . Form::getHidden('edition_id', 'edition_id', $edition_id), 'content');
    $tb = new Table(0, $lang->def('_SELECT_WHO_CONFIRM'), $lang->def('_SUMMARY_SELECT_WHO_CONFIRM'));
    $type_h = array('', '', '', '', '', 'image', 'image', 'image');
    $content_h = array($lang->def('_USERNAME'), $lang->def('_FULLNAME'), $lang->def('_LEVEL'), $lang->def('_SUBSCRIBED_BY'), $lang->def('_STATUS'), $lang->def('_APPROVE'), $lang->def('_DENY'), $lang->def('_WAIT'));
    $tb->addHead($content_h, $type_h);
    if (is_array($waiting_users['users_info'])) {
        reset($waiting_users['users_info']);
        while (list($id_user, $info) = each($waiting_users['users_info'])) {
            $id_sub_by = $info['subscribed_by'];
            $subscribed = $users_name[$id_sub_by][ACL_INFO_LASTNAME] . '' . $users_name[$id_sub_by][ACL_INFO_FIRSTNAME] != '' ? $users_name[$id_sub_by][ACL_INFO_LASTNAME] . ' ' . $users_name[$id_sub_by][ACL_INFO_FIRSTNAME] : $acl_man->relativeId($users_name[$id_sub_by][ACL_INFO_USERID]);
            $more = isset($_GET['id_user']) && $_GET['id_user'] == $id_user ? '<a href="index.php?modname=subscribe&amp;op=waitinguser&amp;id_course=' . $id_course . $ed_url_param . '"><img src="' . getPathImage() . 'standard/less.gif"></a> ' : '<a href="index.php?modname=subscribe&amp;op=waitinguser&amp;id_course=' . $id_course . $ed_url_param . '&amp;id_user='******'"><img src="' . getPathImage() . 'standard/more.gif"></a> ';
            $content = array($more . $acl_man->relativeId($users_name[$id_user][ACL_INFO_USERID]), $users_name[$id_user][ACL_INFO_LASTNAME] . ' ' . $users_name[$id_user][ACL_INFO_FIRSTNAME], $levels[$info['level']], $subscribed . ' [' . $users_name[$id_user][ACL_INFO_EMAIL] . ']');
            $content[] = $arr_status[$info['status']];
            $content[] = Form::getInputRadio('waiting_user_0_' . $id_user, 'waiting_user[' . $id_user . ']', '0', false, '') . '<label class="access-only" for="waiting_user_0_' . $id_user . '">' . $users_name[$id_user][ACL_INFO_USERID] . '</label>';
            $content[] = Form::getInputRadio('waiting_user_1_' . $id_user, 'waiting_user[' . $id_user . ']', '1', false, '') . '<label class="access-only" for="waiting_user_1_' . $id_user . '">' . $users_name[$id_user][ACL_INFO_USERID] . '</label>';
            $content[] = Form::getInputRadio('waiting_user_2_' . $id_user, 'waiting_user[' . $id_user . ']', '2', true, '') . '<label class="access-only" for="waiting_user_1_' . $id_user . '">' . $users_name[$id_user][ACL_INFO_USERID] . '</label>';
            $tb->addBody($content);
            if (isset($_GET['id_user']) && $id_user == $_GET['id_user']) {
                $field = new FieldList();
                $info = $field->playFieldsForUser($id_user, false, true);
                $tb->addBodyExpanded($info != '' ? $info : $lang->def('_NO_EXTRAINFO_AVAILABLE'), 'user_specific_info');
            }
        }
    }
    $GLOBALS['page']->add($tb->getTable() . '<br />' . Form::openElementSpace() . Form::getSimpleTextarea($lang->def('_SUBSCRIBE_ACCEPT'), 'subscribe_accept', 'subscribe_accept') . Form::getSimpleTextarea($lang->def('_SUBSCRIBE_REFUSE'), 'subscribe_refuse', 'subscribe_refuse') . Form::closeElementSpace() . Form::openButtonSpace() . '<br />' . Form::getButton('subscribe', 'subscribe', $lang->def('_SAVE')) . Form::getButton('cancelselector', 'cancelselector', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm(), 'content');
    $GLOBALS['page']->add('</div>', 'content');
}
Example #9
0
<?php 
$array_style = array('userid' => '', 'fullname' => '', 'administrator' => 'image', 'instructor' => 'image', 'mentor' => 'image', 'tutor' => 'image', 'student' => 'image', 'ghost' => 'image', 'guest' => 'image', 'undo' => 'image');
$array_header = array('userid' => Lang::t('_USERNAME', 'subscribe'), 'fullname' => Lang::t('_FULLNAME', 'subscribe'), 'administrator' => '<a href="javascript:SelAll(\'7\');">' . $model->level[7] . '</a>', 'instructor' => '<a href="javascript:SelAll(\'6\');">' . $model->level[6] . '</a>', 'mentor' => '<a href="javascript:SelAll(\'5\');">' . $model->level[5] . '</a>', 'tutor' => '<a href="javascript:SelAll(\'4\');">' . $model->level[4] . '</a>', 'student' => '<a href="javascript:SelAll(\'3\');">' . $model->level[3] . '</a>', 'ghost' => '<a href="javascript:SelAll(\'2\');">' . $model->level[2] . '</a>', 'guest' => '<a href="javascript:SelAll(\'1\');">' . $model->level[1] . '</a>', 'undo' => '<a href="javascript:SelAll(\'0\');">' . Lang::t('_UNDO', 'subscribe') . '</a>');
$array_content = array();
echo Form::openForm('choose_level', 'index.php?r=' . $this->link . '/ins&amp;id_course=' . $model->getIdCourse() . '&amp;id_edition=' . $model->getIdEdition() . '&amp;id_date=' . $model->getIdDate()) . Form::getHidden('send_alert', 'send_alert', $send_alert);
if ($date_begin_validity) {
    echo Form::getLineBox(Lang::t('_DATE_BEGIN_VALIDITY', 'subscribe'), Format::date(substr($date_begin_validity, 0, 10), 'date'));
    echo Form::getHidden('set_date_begin_validity', 'set_date_begin_validity', $date_begin_validity);
}
if ($date_expire_validity) {
    echo Form::getLineBox(Lang::t('_DATE_EXPIRE_VALIDITY', 'subscribe'), Format::date(substr($date_expire_validity, 0, 10), 'date'));
    echo Form::getHidden('set_date_expire_validity', 'set_date_expire_validity', $date_expire_validity);
}
if (is_array($model->data)) {
    foreach ($model->data as $id_user => $user_info) {
        $array_content[] = array('userid' => substr($user_info[ACL_INFO_USERID], 1), 'fullname' => $user_info[ACL_INFO_FIRSTNAME] . ' ' . $user_info[ACL_INFO_LASTNAME], 'administrator' => Form::getInputRadio('user_level_sel_' . $id_user . '_7', 'user_level_sel[' . $id_user . ']', 7, false, ''), 'instructor' => Form::getInputRadio('user_level_sel_' . $id_user . '_6', 'user_level_sel[' . $id_user . ']', 6, false, ''), 'mentor' => Form::getInputRadio('user_level_sel_' . $id_user . '_5', 'user_level_sel[' . $id_user . ']', 5, false, ''), 'tutor' => Form::getInputRadio('user_level_sel_' . $id_user . '_4', 'user_level_sel[' . $id_user . ']', 4, false, ''), 'student' => Form::getInputRadio('user_level_sel_' . $id_user . '_3', 'user_level_sel[' . $id_user . ']', 3, true, ''), 'ghost' => Form::getInputRadio('user_level_sel_' . $id_user . '_2', 'user_level_sel[' . $id_user . ']', 2, false, ''), 'guest' => Form::getInputRadio('user_level_sel_' . $id_user . '_1', 'user_level_sel[' . $id_user . ']', 1, false, ''), 'undo' => Form::getInputRadio('user_level_sel_' . $id_user . '_0', 'user_level_sel[' . $id_user . ']', 0, false, ''));
    }
}
$this->widget('table', array('id' => 'subscribed_table', 'styles' => $array_style, 'header' => $array_header, 'data' => $array_content, 'summary' => Lang::t('_LEVELS', 'subscribe'), 'caption' => false));
echo Form::openButtonSpace();
echo Form::getButton('subscribe', 'subscribe', Lang::t('_SUBSCRIBE', 'subscribe'));
echo Form::getButton('undo', 'undo', Lang::t('_UNDO', 'subscribe'));
echo Form::closeElementSpace();
echo Form::closeForm();
echo '<script>' . $model->js_user . ');
		function SelAll (lvl)
		{
        var nb;
        ne = elementi.length;
        mod = document.getElementById(\'levelselection\');
        for (var i=0;i<ne;i++)
 function waitinguser()
 {
     if (!$this->permissions['moderate']) {
         die("You can't access");
     }
     require_once _lms_ . '/lib/lib.course.php';
     require_once _adm_ . '/lib/lib.field.php';
     require_once _base_ . '/lib/lib.form.php';
     require_once _base_ . '/lib/lib.table.php';
     require_once _base_ . '/lib/lib.user_profile.php';
     $id_course = Get::req('id_course', DOTY_INT, 0);
     $man_course = new Man_Course();
     $course_info = $man_course->getCourseInfo($id_course);
     $is_classroom = $course_info['course_type'] == 'classroom';
     $edition_id = Get::req('id_edition', DOTY_INT, 0);
     $ed_url_param = '&id_edition=' . $edition_id;
     $out =& $GLOBALS['page'];
     $lang =& DoceboLanguage::CreateInstance('course', 'lms');
     $lang =& DoceboLanguage::CreateInstance('subscribe', 'lms');
     $acl_man =& Docebo::user()->getAclManager();
     $levels = CourseLevel::getLevels();
     $waiting_users =& $man_course->getWaitingSubscribed($id_course, $edition_id);
     $users_name =& $acl_man->getUsers($waiting_users['all_users_id']);
     $arr_status = array(_CUS_WAITING_LIST => $lang->def('_WAITING_USERS'), _CUS_CONFIRMED => $lang->def('_USER_STATUS_CONFIRMED'), _CUS_SUBSCRIBED => $lang->def('_USER_STATUS_SUBS'), _CUS_BEGIN => $lang->def('_USER_STATUS_BEGIN'), _CUS_END => $lang->def('_USER_STATUS_END'), _CUS_SUSPEND => $lang->def('_SUSPENDED'));
     $page_title = array('index.php?r=' . $this->link_course . '/show' => Lang::t('_COURSES', 'course'), Lang::t('_USERWAITING', 'course') . ': ' . $course_info['name']);
     $GLOBALS['page']->add(getTitleArea($page_title, 'subscribe') . '<div class="std_block">' . Form::openForm('approve users', 'index.php?r=' . $this->link . '/approveusers') . Form::getHidden('id_course', 'id_course', $id_course) . Form::getHidden('edition_id', 'edition_id', $edition_id), 'content');
     $tb = new Table(0, $lang->def('_SELECT_WHO_CONFIRM'), $lang->def('_SUMMARY_SELECT_WHO_CONFIRM'));
     $type_h = array();
     $type_h[] = '';
     $type_h[] = '';
     $type_h[] = '';
     if ($is_classroom) {
         $type_h[] = '';
     }
     $type_h[] = '';
     $type_h[] = '';
     $type_h[] = 'image';
     $type_h[] = 'image';
     $type_h[] = 'image';
     $content_h = array();
     $content_h[] = $lang->def('_USERNAME');
     $content_h[] = $lang->def('_FULLNAME');
     $content_h[] = $lang->def('_LEVEL');
     if ($is_classroom) {
         $content_h[] = $lang->def('_CLASSROOM');
     }
     $content_h[] = $lang->def('_SUBSCRIBED_BY');
     $content_h[] = $lang->def('_STATUS');
     $content_h[] = $lang->def('_APPROVE');
     $content_h[] = $lang->def('_DENY');
     $content_h[] = $lang->def('_WAIT');
     $tb->addHead($content_h, $type_h);
     if (is_array($waiting_users['users_info'])) {
         reset($waiting_users['users_info']);
         while (list($id_user, $info) = each($waiting_users['users_info'])) {
             $id_sub_by = $info['subscribed_by'];
             $subscribed = $users_name[$id_sub_by][ACL_INFO_LASTNAME] . '' . $users_name[$id_sub_by][ACL_INFO_FIRSTNAME] != '' ? $users_name[$id_sub_by][ACL_INFO_LASTNAME] . ' ' . $users_name[$id_sub_by][ACL_INFO_FIRSTNAME] : $acl_man->relativeId($users_name[$id_sub_by][ACL_INFO_USERID]);
             $more = isset($_GET['id_user']) && $_GET['id_user'] == $id_user ? '<a href="index.php?r=' . $this->link . '/waitinguser&amp;id_course=' . $id_course . $ed_url_param . '"><img src="' . getPathImage() . 'standard/menu_open.png"></a> ' : '<a href="index.php?r=' . $this->link . '/waitinguser&amp;id_course=' . $id_course . $ed_url_param . '&amp;id_user='******'"><img src="' . getPathImage() . 'standard/menu_closed.png"></a> ';
             $is_overbooking = FALSE;
             if ($is_classroom) {
                 $is_overbooking = $info['overbooking'];
             } else {
                 $is_overbooking = FALSE;
                 //$info['status'] == _CUS_OVERBOOKING
             }
             $content = array();
             $content[] = $more . $acl_man->relativeId($users_name[$id_user][ACL_INFO_USERID]);
             $content[] = $users_name[$id_user][ACL_INFO_LASTNAME] . ' ' . $users_name[$id_user][ACL_INFO_FIRSTNAME];
             $content[] = $levels[$info['level']];
             if ($is_classroom) {
                 $content[] = ($info['code'] != '' ? '[' . $info['code'] . '] ' : '') . $info['name'];
             }
             $content[] = $subscribed . ' [' . $users_name[$id_sub_by][ACL_INFO_EMAIL] . ']';
             $content[] = $is_overbooking ? $lang->def('_OVERBOOKING') : $arr_status[$info['status']];
             if ($is_overbooking) {
                 $content[] = '';
                 $content[] = '';
                 $content[] = '';
             } else {
                 $content[] = Form::getInputRadio('waiting_user_0_' . $id_user, 'waiting_user[' . $id_user . ']', '0', false, '') . '<label class="access-only" for="waiting_user_0_' . $id_user . '">' . $users_name[$id_user][ACL_INFO_USERID] . '</label>';
                 $content[] = Form::getInputRadio('waiting_user_1_' . $id_user, 'waiting_user[' . $id_user . ']', '1', false, '') . '<label class="access-only" for="waiting_user_1_' . $id_user . '">' . $users_name[$id_user][ACL_INFO_USERID] . '</label>';
                 $content[] = Form::getInputRadio('waiting_user_2_' . $id_user, 'waiting_user[' . $id_user . ']', '2', true, '') . '<label class="access-only" for="waiting_user_1_' . $id_user . '">' . $users_name[$id_user][ACL_INFO_USERID] . '</label>';
             }
             $tb->addBody($content);
             if (isset($_GET['id_user']) && $id_user == $_GET['id_user']) {
                 $field = new FieldList();
                 $info = $field->playFieldsForUser($id_user, false, true);
                 $tb->addBodyExpanded($info != '' ? $info : $lang->def('_NO_EXTRAINFO_AVAILABLE'), 'user_specific_info');
             }
         }
     }
     $GLOBALS['page']->add($tb->getTable() . '<br />' . Form::openElementSpace() . Form::getSimpleTextarea($lang->def('_SUBSCRIBE_ACCEPT'), 'subscribe_accept', 'subscribe_accept') . Form::getSimpleTextarea($lang->def('_SUBSCRIBE_REFUSE'), 'subscribe_refuse', 'subscribe_refuse') . Form::closeElementSpace() . Form::openButtonSpace() . '<br />' . Form::getButton('subscribe', 'subscribe', $lang->def('_SAVE')) . Form::getButton('cancelselector', 'cancelselector', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm(), 'content');
     $GLOBALS['page']->add('</div>', 'content');
 }