function get_LO_filter()
 {
     //addCss('style_filterbox');
     $back_url = $this->back_url;
     $jump_url = $this->jump_url;
     $next_url = $this->next_url;
     require_once _base_ . '/lib/lib.form.php';
     require_once _lms_ . '/lib/lib.course.php';
     $ref =& $_SESSION['report_tempdata']['columns_filter'];
     YuiLib::load();
     Util::get_js(Get::rel_path('lms') . '/admin/modules/report/courses_filter.js', true, true);
     //back to columns category selection
     if (isset($_POST['undo_filter'])) {
         //go back at the previous step
         Util::jump_to($back_url);
     }
     //set $_POST data in $_SESSION['report_tempdata']
     $selector = new Selector_Course();
     if (isset($_POST['update_tempdata'])) {
         $selector->parseForState($_POST);
         $temp = array('all_courses' => $_POST['all_courses'] == 1 ? true : false, 'selected_courses' => $selector->getSelection(), 'lo_types' => isset($_POST['lo_types']) ? $_POST['lo_types'] : array(), 'lo_milestones' => isset($_POST['lo_milestones']) ? $_POST['lo_milestones'] : array(), 'showed_columns' => isset($_POST['cols']) ? $_POST['cols'] : array(), 'custom_fields' => array(), 'order_by' => Get::req('order_by', DOTY_STRING, 'userid'), 'order_dir' => Get::req('order_dir', DOTY_STRING, 'asc'), 'show_suspended' => Get::req('show_suspended', DOTY_INT, 0) > 0);
         foreach ($ref['custom_fields'] as $val) {
             $temp['custom_fields'][] = array('id' => $val['id'], 'label' => $val['label'], 'selected' => isset($_POST['custom'][$val['id']]) ? true : false);
         }
         $_SESSION['report_tempdata']['columns_filter'] = $temp;
     } else {
         //first loading of this page -> prepare $_SESSION data structure
         //if (isset($_SESSION['report_update']) /* && is equal to id_report */) break;
         //get users' custom fields
         require_once _adm_ . '/lib/lib.field.php';
         $fman = new FieldList();
         $fields = $fman->getFlatAllFields();
         $custom = array();
         foreach ($fields as $key => $val) {
             $custom[] = array('id' => $key, 'label' => $val, 'selected' => false);
         }
         if (!isset($_SESSION['report_tempdata']['columns_filter'])) {
             $_SESSION['report_tempdata']['columns_filter'] = array('all_courses' => false, 'selected_courses' => $selector->getSelection(), 'lo_types' => array(), 'lo_milestones' => array(), 'showed_columns' => array(), 'custom_fields' => $custom, 'order_by' => 'userid', 'order_dir' => 'asc', 'show_suspended' => 'show_suspended');
         }
     }
     //filter setting done, go to next step
     if (isset($_POST['import_filter']) || isset($_POST['show_filter']) || isset($_POST['pre_filter'])) {
         $temp_url = $next_url;
         if (isset($_POST['pre_filter'])) {
             $temp_url .= '&show=1&nosave=1';
         }
         if (isset($_POST['show_filter'])) {
             $temp_url .= '&show=1';
         }
         Util::jump_to($temp_url);
     }
     cout(Form::getHidden('update_tempdata', 'update_tempdata', 1), 'content');
     $lang = $this->lang;
     //box for direct course selection
     $selection =& $ref['selected_courses'];
     $selector->parseForState($_POST);
     $selector->resetSelection($selection);
     $temp = count($selection);
     $box = new ReportBox('course_selector');
     $box->title = Lang::t('_REPORT_COURSE_SELECTION', 'report');
     $box->description = false;
     $box->body .= '<div class="fc_filter_line filter_corr">';
     $box->body .= '<input id="all_courses" name="all_courses" type="radio" value="1" ' . ($ref['all_courses'] ? 'checked="checked"' : '') . ' />';
     $box->body .= ' <label for="all_courses">' . $lang->def('_ALL_COURSES') . '</label>';
     $box->body .= ' <input id="sel_courses" name="all_courses" type="radio" value="0" ' . ($ref['all_courses'] ? '' : 'checked="checked"') . ' />';
     $box->body .= ' <label for="sel_courses">' . $lang->def('_SEL_COURSES') . '</label>';
     $box->body .= '</div>';
     $box->body .= '<div id="selector_container"' . ($ref['all_courses'] ? ' style="display:none"' : '') . '>';
     //$box->body .= Form::openElementSpace();
     $box->body .= $selector->loadCourseSelector(true);
     //$box->body .= Form::closeElementSpace();
     $box->body .= '<br /></div>';
     $box->footer = $lang->def('_CURRENT_SELECTION') . ':&nbsp;<span id="csel_foot">' . ($ref['all_courses'] ? Lang::t('_ALL', 'standard') : ($temp != '' ? $temp : '0')) . '</span>';
     //.'</div>';
     cout($box->get(), 'content');
     cout('<script type="text/javascript">courses_count=' . ($temp == '' ? '0' : $temp) . ';' . 'courses_all="' . Lang::t('_ALL', 'standard') . '";' . "\n" . 'YAHOO.util.Event.addListener(window, "load", courses_selector_init);</script>', 'page_head');
     $box = new ReportBox('lo_selection');
     $box->title = $lang->def('_SELECT_LO_OPTIONS');
     //LO columns selection
     $lo_trans = $this->getLOTypesTranslations();
     $box->body .= Form::getOpenFieldset(Lang::t('_RU_LO_TYPES', 'report'), 'lotypes_fieldset');
     $res = sql_query("SELECT * FROM %lms_lo_types");
     while ($row = mysql_fetch_assoc($res)) {
         $trans = isset($lo_trans[$row['objectType']]) ? $lo_trans[$row['objectType']] : "";
         $box->body .= Form::getCheckBox($trans, 'lo_type_' . $row['objectType'], 'lo_types[' . $row['objectType'] . ']', $row['objectType'], in_array($row['objectType'], $ref['lo_types']) ? true : false);
     }
     $box->body .= Form::getCloseFieldset();
     $box->body .= Form::getOpenFieldset($lang->def('_RU_LO_MILESTONES'), 'lomilestones_fieldset');
     $box->body .= Form::getCheckBox($lang->def('_NONE'), 'lo_milestone_0', 'lo_milestones[]', _MILESTONE_NONE, in_array(_MILESTONE_NONE, $ref['lo_milestones']) ? true : false);
     $box->body .= Form::getCheckBox($lang->def('_START'), 'lo_milestone_1', 'lo_milestones[]', _MILESTONE_START, in_array(_MILESTONE_START, $ref['lo_milestones']) ? true : false);
     $box->body .= Form::getCheckBox($lang->def('_END'), 'lo_milestone_2', 'lo_milestones[]', _MILESTONE_END, in_array(_MILESTONE_END, $ref['lo_milestones']) ? true : false);
     $box->body .= Form::getCloseFieldset();
     cout($box->get(), 'content');
     function is_showed($which)
     {
         if (isset($_SESSION['report_tempdata']['columns_filter'])) {
             return in_array($which, $_SESSION['report_tempdata']['columns_filter']['showed_columns']);
         } else {
             return false;
         }
     }
     //box for columns selection
     $arr_fieldset = array('user' => '', 'course' => '', 'lo' => '');
     $box = new ReportBox('columns_selection');
     $box->title = $lang->def('_SELECT_THE_DATA_COL_NEEDED');
     $box->description = false;
     //prepare fieldsets
     foreach ($this->LO_columns as $val) {
         if ($val['select']) {
             $line = Form::getCheckBox($val['label'], 'col_sel_' . $val['key'], 'cols[]', $val['key'], is_showed($val['key']));
             switch ($val['group']) {
                 case 'user':
                     $arr_fieldset['user'] .= $line;
                     break;
                 case 'course':
                     $arr_fieldset['course'] .= $line;
                     break;
                 case 'lo':
                     $arr_fieldset['lo'] .= $line;
                     break;
             }
         } else {
             if ($val['key'] == '_CUSTOM_FIELDS_') {
                 //custom fields
                 if (count($ref['custom_fields']) > 0) {
                     foreach ($ref['custom_fields'] as $key => $val) {
                         $arr_fieldset['user'] .= Form::getCheckBox($val['label'], 'col_custom_' . $val['id'], 'custom[' . $val['id'] . ']', $val['id'], $val['selected']);
                     }
                 }
             }
         }
     }
     //print fieldsets
     foreach ($arr_fieldset as $fid => $fieldset) {
         $ftitle = '';
         switch ($fid) {
             case 'user':
                 $ftitle = Lang::t('_USER_CUSTOM_FIELDS', 'report');
                 break;
             case 'course':
                 $ftitle = Lang::t('_COURSE_FIELDS', 'report');
                 break;
             case 'lo':
                 $ftitle = Lang::t('_LEARNING_OBJECTS', 'standard');
                 break;
         }
         $box->body .= Form::getOpenFieldset($ftitle, 'fieldset_' . $fid . '_fields');
         $box->body .= $fieldset;
         $box->body .= Form::getCloseFieldset();
     }
     cout($box->get(), 'content');
     //other options
     $box = new ReportBox('other_options');
     $box->title = Lang::t('_OTHER_OPTION', 'course');
     $box->description = false;
     $sort_list = array('userid' => Lang::t('_USERID', 'standard'), 'firstname' => Lang::t('_FIRSTNAME', 'standard'), 'lastname' => Lang::t('_LASTNAME', 'standard'), 'email' => Lang::t('_EMAIL', 'standard'), 'course_code' => Lang::t('_COURSE_CODE', 'standard'), 'course_name' => Lang::t('_COURSE_NAME', 'standard'), 'object_title' => Lang::t('_LEARNING_OBJECTS', 'standard'), 'object_type' => Lang::t('_RU_LO_TYPES', 'report'), 'first_attempt' => Lang::t('_LO_COL_FIRSTATT', 'report'), 'last_attempt' => Lang::t('_LO_COL_LASTATT', 'report'));
     $dir_list = array('asc' => Lang::t('_ORD_ASC_TITLE', 'standard'), 'desc' => Lang::t('_ORD_DESC_TITLE', 'standard'));
     $sort_selected = array_key_exists($ref['order_by'], $sort_list) ? $ref['order_by'] : 'userid';
     $dir_selected = array_key_exists($ref['order_dir'], $dir_list) ? $ref['order_dir'] : 'asc';
     $sort_dir_dropdown = Form::getInputDropdown('', 'order_dir', 'order_dir', $dir_list, $dir_selected, '');
     $box->body .= Form::getDropdown(Lang::t('_ORDER_BY', 'standard'), 'order_by', 'order_by', $sort_list, $sort_selected, $sort_dir_dropdown);
     $box->body .= Form::getCheckbox(Lang::t('_SHOW_SUSPENDED', 'organization_chart'), 'show_suspended', 'show_suspended', 1, (bool) $ref['show_suspended']);
     cout($box->get(), 'content');
 }
 /**
  * gui for user info management
  */
 function getUserInfoModUi()
 {
     require_once _base_ . '/lib/lib.form.php';
     require_once _base_ . '/lib/lib.preference.php';
     $this->loadUserData($this->_user_profile->getIdUser());
     $preference = new UserPreferences($this->_user_profile->getIdUser());
     $html = '<div class="up_user_info">' . '<div class="up_name">' . $this->resolveUsername(false, $this->_user_profile->getIdUser()) . '</div>';
     // user standard info -----------------------------------------------------------------
     $html .= Form::openForm('mod_up', $this->_url_man->getUrl($this->_varname_action . '=saveinfo'), false, false, 'multipart/form-data');
     if ($this->_user_profile->godMode()) {
         $html .= Form::getTextfield($this->_lang->def('_USERNAME'), 'up_userid', 'up_userid', '255', Get::req('up_userid', DOTY_MIXED, $this->acl_man->relativeId($this->user_info[ACL_INFO_USERID]), true));
     } else {
         $html .= Form::getLineBox($this->_lang->def('_USERNAME'), $this->acl_man->relativeId($this->user_info[ACL_INFO_USERID]));
     }
     $html .= Form::getTextfield($this->_lang->def('_LASTNAME'), 'up_lastname', 'up_lastname', '255', Get::req('up_lastname', DOTY_MIXED, $this->user_info[ACL_INFO_LASTNAME], true)) . Form::getTextfield($this->_lang->def('_FIRSTNAME'), 'up_firstname', 'up_firstname', '255', Get::req('up_firstname', DOTY_MIXED, $this->user_info[ACL_INFO_FIRSTNAME], true)) . Form::getTextfield($this->_lang->def('_EMAIL'), 'up_email', 'up_email', '255', Get::req('up_email', DOTY_MIXED, $this->user_info[ACL_INFO_EMAIL], true));
     // user extra field ------------------------------------------------------------------
     $html .= $this->getPlayField();
     $html .= $preference->getModifyMask('ui.');
     if ($this->_user_profile->godMode()) {
         $acl_man =& Docebo::user()->getAclManager();
         $html .= Form::getPassword(Lang::t('_NEW_PASSWORD', 'register'), 'up_new_pwd', 'up_new_pwd', '255');
         $html .= Form::getPassword(Lang::t('_RETYPE_PASSWORD', 'register'), 'up_repeat_pwd', 'up_repeat_pwd', '255');
         if (Docebo::user()->getUserLevelId() == ADMIN_GROUP_GODADMIN && Get::cur_plat() === 'framework') {
             $html .= Form::getCheckBox(Lang::t('_FORCE_PASSWORD_CHANGE', 'admin_directory'), 'force_changepwd', 'force_changepwd', 1, $this->user_info[ACL_INFO_FORCE_CHANGE]);
         }
         $lv_lang =& DoceboLanguage::createInstance('admin_directory', 'framework');
         if (Docebo::user()->getUserLevelId() == ADMIN_GROUP_GODADMIN) {
             $level_list = array(ADMIN_GROUP_GODADMIN => $lv_lang->def('_DIRECTORY_' . ADMIN_GROUP_GODADMIN), ADMIN_GROUP_ADMIN => $lv_lang->def('_DIRECTORY_' . ADMIN_GROUP_ADMIN), ADMIN_GROUP_PUBLICADMIN => $lv_lang->def('_DIRECTORY_' . ADMIN_GROUP_PUBLICADMIN), ADMIN_GROUP_USER => $lv_lang->def('_DIRECTORY_' . ADMIN_GROUP_USER));
         } else {
             $level_list = array(ADMIN_GROUP_USER => $lv_lang->def('_DIRECTORY_' . ADMIN_GROUP_USER));
         }
         $html .= Form::getDropdown($this->_lang->def('_LEVEL'), 'up_level', 'up_level', $level_list, $acl_man->getUserLevelId($this->_user_profile->getIdUser()));
     }
     // Social ------------------------------------------------------------------
     /* $html.=Form::getTextfield(	$this->_lang->def('_FACEBOOK_ID'),
     										'facebook_id',
     										'facebook_id',
     										'255',
     										Get::req('facebook_id', DOTY_MIXED, $this->user_info[ACL_INFO_FACEBOOK_ID], true ) );
     
     		$html.=Form::getTextfield(	$this->_lang->def('_TWITTER_ID'),
     										'twitter_id',
     										'twitter_id',
     										'255',
     										Get::req('twitter_id', DOTY_MIXED, $this->user_info[ACL_INFO_TWITTER_ID], true ) );
     
     		$html.=Form::getTextfield(	$this->_lang->def('_LINKEDIN_ID'),
     										'linkedin_id',
     										'linkedin_id',
     										'255',
     										Get::req('linkedin_id', DOTY_MIXED, $this->user_info[ACL_INFO_LINKEDIN_ID], true ) );
     
     		$html.=Form::getTextfield(	$this->_lang->def('_GOOGLE_ID'),
     										'google_id',
     										'google_id',
     										'255',
     										Get::req('google_id', DOTY_MIXED, $this->user_info[ACL_INFO_GOOGLE_ID], true ) ); */
     //signature --------------------------------------------------------------------------
     $html .= Form::getTextarea($this->_lang->def('_SIGNATURE'), 'up_signature', 'up_signature', Get::req('up_signature', DOTY_MIXED, $this->user_info[ACL_INFO_SIGNATURE], true));
     if (isset($_GET['modname']) && $_GET['modname'] == 'reservation') {
         $html .= Form::openButtonSpace() . Form::getButton('save', 'save', $this->_lang->def('_SAVE')) . Form::getButton('undo_profile', 'undo_profile', $this->_lang->def('_UNDO')) . Form::closeButtonSpace();
         $html .= Form::closeForm() . '</div>';
     } else {
         $html .= Form::openButtonSpace() . Form::getButton('save', 'save', $this->_lang->def('_SAVE')) . Form::getButton('undo', 'undo', $this->_lang->def('_UNDO')) . Form::closeButtonSpace();
         $html .= Form::closeForm() . '</div>';
     }
     return $html;
 }
Example #3
0
 function getMultiLangCheck($use_multi_lang = FALSE)
 {
     $res = "";
     $label = Lang::t('_USE_MULTI_LANG_WHEN_AVAILABLE', 'field');
     if ($this->getUseMultiLang()) {
         $res .= Form::getCheckBox($label, 'use_multi_lang', 'use_multi_lang', 1, $use_multi_lang);
     }
     return $res;
 }
 function get_courses_filter()
 {
     $back_url = $this->back_url;
     $jump_url = $this->jump_url;
     $next_url = $this->next_url;
     require_once _base_ . '/lib/lib.form.php';
     require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
     require_once $GLOBALS['where_lms'] . '/lib/lib.course_managment.php';
     $lang =& DoceboLanguage::createInstance('report', 'framework');
     //$sel = new Course_Manager();
     //$sel->setLink('index.php?modname=report&op=report_rows_filter');
     if (isset($_POST['undo_filter'])) {
         Util::jump_to($back_url);
     }
     //set $_POST data in $_SESSION['report_tempdata']
     $selector = new Selector_Course();
     if (!isset($_SESSION['report_tempdata']['columns_filter'])) {
         $_SESSION['report_tempdata']['columns_filter'] = array('all_courses' => true, 'selected_courses' => array(), 'showed_columns' => array('completed' => true, 'initinere' => true, 'notstarted' => true, 'show_percentages' => true));
     }
     $ref =& $_SESSION['report_tempdata']['columns_filter'];
     if (isset($_POST['update_tempdata'])) {
         $selector->parseForState($_POST);
         $temp = $selector->getSelection($_POST);
         $ref['selected_courses'] = $temp;
         $ref['all_courses'] = Get::req('all_courses', DOTY_INT, 1) == 1 ? true : false;
         $ref['showed_columns'] = array('completed' => Get::req('cols_completed', DOTY_INT, 0) > 0 ? true : false, 'initinere' => Get::req('cols_initinere', DOTY_INT, 0) > 0 ? true : false, 'notstarted' => Get::req('cols_notstarted', DOTY_INT, 0) > 0 ? true : false, 'show_percentages' => Get::req('cols_show_percentages', DOTY_INT, 0) > 0 ? true : false);
     } else {
         $selector->resetSelection($ref['selected_courses']);
     }
     //back to columns category selection
     if (isset($_POST['undo_filter'])) {
         Util::jump_to($back_url);
     }
     //filter setting done, go to next step
     if (isset($_POST['import_filter']) || isset($_POST['show_filter']) || isset($_POST['pre_filter'])) {
         $temp_url = $next_url;
         if (isset($_POST['pre_filter'])) {
             $temp_url .= '&show=1&nosave=1';
         }
         if (isset($_POST['show_filter'])) {
             $temp_url .= '&show=1';
         }
         Util::jump_to($temp_url);
     }
     $temp = count($ref['selected_courses']);
     $box = new ReportBox('courses_selector');
     $box->title = $this->lang->def('_COURSES_SELECTION_TITLE');
     $box->description = false;
     $boxlang =& DoceboLanguage::createInstance('report', 'framework');
     $box->body .= '<div class="fc_filter_line filter_corr">';
     $box->body .= '<input id="all_courses" name="all_courses" type="radio" value="1" ' . ($ref['all_courses'] ? 'checked="checked"' : '') . ' />';
     $box->body .= ' <label for="all_courses">' . $boxlang->def('_ALL_COURSES') . '</label>';
     $box->body .= ' <input id="sel_courses" name="all_courses" type="radio" value="0" ' . ($ref['all_courses'] ? '' : 'checked="checked"') . ' />';
     $box->body .= ' <label for="sel_courses">' . $boxlang->def('_SEL_COURSES') . '</label>';
     $box->body .= '</div>';
     $box->body .= '<div id="selector_container"' . ($ref['all_courses'] ? ' style="display:none"' : '') . '>';
     $box->body .= $selector->loadCourseSelector(true) . '</div>';
     $box->footer = $boxlang->def('_CURRENT_SELECTION') . ':&nbsp;<span id="csel_foot">' . ($ref['all_courses'] ? $boxlang->def('_ALL') : ($temp != '' ? $temp : '0')) . '</span>';
     YuiLib::load(array('yahoo' => 'yahoo-min.js', 'yahoo-dom-event' => 'yahoo-dom-event.js', 'element' => 'element-beta-min.js', 'datasource' => 'datasource-beta-min.js', 'connection' => 'connection-min.js', 'event' => 'event-min.js', 'json' => 'json-beta-min.js'), array('/assets/skins/sam' => 'skin.css'));
     addJs($GLOBALS['where_lms_relative'] . '/admin/modules/report/', 'courses_filter.js');
     cout('<script type="text/javascript"> ' . "\n" . 'var courses_count="' . ($temp != '' ? $temp : '0') . '";' . "\n" . 'var courses_all="' . $boxlang->def('_ALL') . '";' . "\n" . 'YAHOO.util.Event.addListener(window, "load", function(e){ courses_selector_init(); });' . "\n" . '</script>', 'page_head');
     //columns selection
     $col_box = new ReportBox('columns_selection');
     $col_box->title = $this->lang->def('_REPORT_SEL_COLUMNS');
     $col_box->description = $this->lang->def('_SELECT_THE_DATA_COL_NEEDED');
     $col_box->body .= Form::getOpenFieldSet($this->lang->def('_STATUS'));
     $col_box->body .= Form::getCheckBox(Lang::t('_USER_STATUS_SUBS', 'course'), 'cols_notstarted', 'cols_notstarted', 1, $ref['showed_columns']['notstarted']);
     $col_box->body .= Form::getCheckBox(Lang::t('_USER_STATUS_BEGIN', 'course'), 'cols_initinere', 'cols_initinere', 1, $ref['showed_columns']['initinere']);
     $col_box->body .= Form::getCheckBox(Lang::t('_USER_STATUS_END', 'course'), 'cols_completed', 'cols_completed', 1, $ref['showed_columns']['completed']);
     $col_box->body .= Form::getCheckBox(Lang::t('_PERCENTAGE', 'course'), 'cols_show_percentages', 'cols_show_percentages', 1, $ref['showed_columns']['show_percentages']);
     $col_box->body .= Form::getCloseFieldSet();
     cout(Form::openForm('first_step_user_filter', $jump_url, false, 'post') . $box->get() . $col_box->get() . Form::getHidden('update_tempdata', 'update_tempdata', 1));
 }
Example #5
0
function statuserfilter()
{
    require_once _base_ . '/lib/lib.table.php';
    require_once _base_ . '/lib/lib.form.php';
    require_once _lms_ . '/lib/lib.subscribe.php';
    $lang =& DoceboLanguage::createInstance('stats', 'lms');
    $out =& $GLOBALS['page'];
    $form = new Form();
    $aclManager =& Docebo::user()->getACLManager();
    $out->setWorkingZone('content');
    $GLOBALS['module_assigned_name'][$GLOBALS['modname']] = $lang->def('_STATFORUSER');
    $out->add(getTitleArea($lang->def('_STATFORUSER'), 'stats'));
    $out->add('<div class="std_block">');
    $group_filter = Get::req('group_filter', DOTY_INT, STATFILTER_ALL_GROUP);
    $status_filter = Get::req('status_filter', DOTY_INT, STATFILTER_ALL_STATUS);
    $editions_filter = Get::req('editions_filter', DOTY_INT, STATFILTER_ALL_EDITION);
    $date_filter = Get::req('date_filter', DOTY_INT, STATFILTER_ALL_EDITION);
    $user_filter = Get::req('user_filter', DOTY_MIXED, '');
    $cs = new CourseSubscribe_Manager();
    /*
     * Print form for group and status selection
     */
    $out->add($form->openForm("statuserfilter", "index.php?modname=stats&amp;op=statuser"));
    // ------- Filter on group
    $arr_idst = $aclManager->getBasePathGroupST('/lms/course/' . (int) $_SESSION['idCourse'] . '/group');
    $arr_result_groups = $aclManager->getGroups($arr_idst);
    $std_content = $aclManager->getContext();
    $aclManager->setContext('/lms/course/' . (int) $_SESSION['idCourse'] . '/group');
    $arr_groups = array(STATFILTER_ALL_GROUP => $lang->def('_ALL'));
    foreach ($arr_result_groups as $idst_group => $info_group) {
        if (!$info_group[ACL_INFO_GROUPHIDDEN]) {
            $arr_groups[$idst_group] = $aclManager->relativeId($info_group[ACL_INFO_GROUPID]);
        }
    }
    $aclManager->setContext($std_content);
    $out->add(Form::getTextField(Lang::t('_FULLNAME', 'standard'), 'user_filter', 'user_filter', 255, $user_filter));
    $out->add($form->getDropdown($lang->def('_GROUPS'), 'group_filter', 'group_filter', $arr_groups, $group_filter));
    // ------ Filter on status
    $arr_status = array(STATFILTER_ALL_STATUS => $lang->def('_FILTERSTATUSSELECTONEOPTION'));
    $arr_status = $arr_status + $cs->getUserStatus();
    $out->add($form->getDropdown($lang->def('_ORDER_BY'), 'status_filter', 'status_filter', $arr_status, $status_filter));
    //--- filter on edition ------------------------------------------------------
    //retrieve edition
    $query = "SELECT * FROM %lms_course_editions WHERE id_course = " . (int) $_SESSION['idCourse'];
    $res = sql_query($query);
    //is there more any edition ?
    if (sql_num_rows($res) > 0) {
        $arr_editions = array(STATFILTER_ALL_EDITION => $lang->def('_FILTEREDITIONSELECTONEOPTION'));
        //list of editions for the dropdown, in the format: "[code] name (date_begin - date_end)"
        while ($einfo = sql_fetch_object($res)) {
            $_label = '';
            if ($einfo->code != '') {
                $_label .= '[' . $einfo->code . '] ';
            }
            if ($einfo->name != '') {
                $_label .= $einfo->neme;
            }
            if (($einfo->date_begin != '' || $einfo->date_begin != '0000-00-00') && ($einfo->date_end != '' || $einfo->date_end != '0000-00-00')) {
                $_label .= ' (' . Format::date($einfo->date_begin, 'date') . ' - ' . Format::date($einfo->date_end, 'date') . ')';
            }
            if ($_label == '') {
                //...
            }
            $arr_editions[$einfo->id_edition] = $_label;
        }
        //draw editions dropdown
        $out->add($form->getDropdown($lang->def('_FILTEREDITIONSELECTTITLE'), 'editions_filter', 'editions_filter', $arr_editions, $editions_filter));
    }
    //--- filter on class ------------------------------------------------------
    //retrieve class (date)
    //$query = "SELECT * FROM %lms_course_date WHERE id_course = ".(int)$_SESSION['idCourse'];
    $query = "SELECT dt.id_date, dt.code, dt.name, MIN( dy.date_begin ) AS sub_start_date, MAX( dy.date_end ) AS sub_end_date\r\n\t\tFROM %lms_course_date AS dt\r\n\t\tJOIN %lms_course_date_day AS dy ON dy.id_date = dt.id_date\r\n\t\tWHERE dt.id_course = " . (int) $_SESSION['idCourse'] . "\r\n\t\tGROUP BY dt.id_date\r\n\t\tORDER BY dy.date_begin";
    $res = sql_query($query);
    //is there more any edition ?
    if (sql_num_rows($res) > 0) {
        $arr_date = array(STATFILTER_ALL_EDITION => $lang->def('_FILTEREDITIONSELECTONEOPTION'));
        //list of editions for the dropdown, in the format: "[code] name (date_begin - date_end)"
        while ($einfo = sql_fetch_object($res)) {
            $_label = '';
            if ($einfo->code != '') {
                $_label .= '[' . $einfo->code . '] ';
            }
            if ($einfo->name != '') {
                $_label .= $einfo->neme;
            }
            if (($einfo->sub_start_date != '' || $einfo->sub_start_date != '0000-00-00') && ($einfo->sub_end_date != '' || $einfo->sub_end_date != '0000-00-00')) {
                $_label .= ' (' . Format::date($einfo->sub_start_date, 'date') . ' - ' . Format::date($einfo->sub_end_date, 'date') . ')';
            }
            if ($_label == '') {
                //...
            }
            $arr_date[$einfo->id_date] = $_label;
        }
        //draw editions dropdown
        $out->add($form->getDropdown($lang->def('_FILTEREDITIONSELECTTITLE'), 'date_filter', 'date_filter', $arr_date, $date_filter));
    }
    //------------------------------------------------------------------------------
    if (isset($_POST['start_filter']) && ($_POST['start_filter'] = 1)) {
        $out->add($form->getCheckBox($lang->def('_FILTEROBJECTFINISHED'), 'start_filter', 'start_filter', '1', true));
    } else {
        $out->add($form->getCheckBox($lang->def('_FILTEROBJECTFINISHED'), 'start_filter', 'start_filter', '1'));
    }
    $out->add('<br/>');
    $out->add($form->getButton('gofilter', 'gofilter', $lang->def('_SEARCH')));
    /*
     * Get all students of course that is contained in selected group
     * For any student compute progress
     */
    $tabStat = new Table(Get::sett('visuItem'), $lang->def('_STATS_USERS'), $lang->def('_STATS_USERS'));
    $tabStat->initNavBar('ini', 'button');
    $limit = $tabStat->getSelectedElement();
    // step 2) load all students of course in selected group
    $lev = false;
    $group_all_members = false;
    if ($group_filter != STATFILTER_ALL_GROUP) {
        $group_all_members = $aclManager->getGroupAllUser($group_filter);
    }
    //$students = getSubscribedInfo((int)$_SESSION['idCourse'], FALSE, $lev, TRUE, ( $status_filter != -1 ? $status_filter : false ), false, true);
    $students = getSubscribedInfo((int) $_SESSION['idCourse'], false, $lev, true, $status_filter != STATFILTER_ALL_STATUS ? $status_filter : false, $editions_filter != STATFILTER_ALL_EDITION ? $editions_filter : false, true, $user_filter, $group_all_members, $limit, $date_filter != STATFILTER_ALL_EDITION ? $date_filter : false);
    $query = "SELECT COUNT(*)" . " FROM %lms_courseuser AS cu" . ($user_filter !== '' ? " JOIN " . $GLOBALS['prefix_fw'] . "_user AS u ON u.idst = cu.idUser" : '') . " WHERE cu.idCourse = " . (int) $_SESSION['idCourse'] . ($status_filter != STATFILTER_ALL_STATUS ? " AND cu.status = '" . $status_filter . "'" : '') . ($user_filter !== '' ? " AND (u.firstname LIKE '%" . $user_filter . "%' OR u.lastname LIKE '%" . $user_filter . "%' OR u.userid LIKE '%" . $user_filter . "%')" : '') . ($group_all_members !== false ? " AND c.idUser IN (" . implode(',', $group_all_members) . ")" : '');
    list($total_user) = sql_fetch_row(sql_query($query));
    $content_h = array($lang->def('_USERNAME'), $lang->def('_STATS_FULLNAME'), $lang->def('_STATUS'), $lang->def('_LEARNING_OBJECTS'), $lang->def('_PROGRESS'));
    $type_h = array('', '', 'image', 'image', 'image');
    $tabStat->setColsStyle($type_h);
    $tabStat->addHead($content_h);
    $aclManager =& Docebo::user()->getACLManager();
    $acl =& Docebo::user()->getACL();
    // search memebers of the selected group
    foreach ($students as $idst => $user_course_info) {
        if ($group_filter == STATFILTER_ALL_GROUP || in_array($idst, $group_all_members)) {
            $user_info = $aclManager->getUser($idst, FALSE);
            if ($user_info != false) {
                $totItems = getNumCourseItems((int) $_SESSION['idCourse'], FALSE, $idst, FALSE);
                $totComplete = getStatStatusCount($idst, (int) $_SESSION['idCourse'], array('completed', 'passed'));
                $totFailed = getStatStatusCount($idst, (int) $_SESSION['idCourse'], array('failed'));
                $stat_status = $cs->getUserStatusTr($user_course_info['status']);
                if (isset($_POST['start_filter']) && ($_POST['start_filter'] = 1)) {
                    if ($totComplete) {
                        // now print entry
                        $content = array('<a href="index.php?modname=stats&amp;op=statoneuser&amp;idUser='******'" >' . $aclManager->relativeId($user_info[ACL_INFO_USERID]) . '</a>', $user_info[ACL_INFO_LASTNAME] . '&nbsp;' . $user_info[ACL_INFO_FIRSTNAME], '<a href="index.php?modname=stats&amp;op=modstatus&amp;idUser='******'">' . $stat_status . '</a>');
                        $content[] = $totComplete . '/' . $totFailed . '/' . $totItems;
                        $content[] = renderProgress($totComplete, $totFailed, $totItems);
                        $tabStat->addBody($content);
                    }
                } else {
                    // now print entry
                    $content = array('<a href="index.php?modname=stats&amp;op=statoneuser&amp;idUser='******'" >' . $aclManager->relativeId($user_info[ACL_INFO_USERID]) . '</a>', $user_info[ACL_INFO_LASTNAME] . '&nbsp;' . $user_info[ACL_INFO_FIRSTNAME], '<a href="index.php?modname=stats&amp;op=modstatus&amp;idUser='******'">' . $stat_status . '</a>');
                    $content[] = $totComplete . '/' . $totFailed . '/' . $totItems;
                    $content[] = renderProgress($totComplete, $totFailed, $totItems);
                    $tabStat->addBody($content);
                }
            }
        }
    }
    $out->add($tabStat->getTable());
    $out->add($tabStat->getNavBar($limit, $total_user));
    $out->add($form->closeForm());
    $out->add('</div>');
}
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
    echo '</ul>';
    echo '<div class="yui-content">';
    echo '<div id="create_user_tab1">';
}
echo Form::getTextField(Lang::t('_USERNAME', 'standard'), 'username', 'username', 255, $info->userid);
echo Form::getTextField(Lang::t('_FIRSTNAME', 'standard'), 'firstname', 'firstname', 255, $info->firstname);
echo Form::getTextField(Lang::t('_LASTNAME', 'standard'), 'lastname', 'lastname', 255, $info->lastname);
echo Form::getTextField(Lang::t('_EMAIL', 'standard'), 'email', 'email', 255, $info->email);
if ($is_editing) {
    echo Form::getPassword(Lang::t('_NEW_PASSWORD', 'register'), 'new_password', 'new_password', 255, "");
    echo Form::getPassword(Lang::t('_RETYPE_PASSWORD', 'register'), 'new_password_confirm', 'new_password_confirm', 255, "");
    echo Form::getCheckBox(Lang::t('_FORCE_PASSWORD_CHANGE', 'admin_directory'), 'force_changepwd', 'force_changepwd', 1, $info->force_change > 0);
} else {
    echo Form::getPassword(Lang::t('_PASSWORD', 'standard'), 'password', 'password', 255, "");
    echo Form::getPassword(Lang::t('_RETYPE_PASSWORD', 'register'), 'password_confirm', 'password_confirm', 255, "");
    echo Form::getCheckBox(Lang::t('_FORCE_PASSWORD_CHANGE', 'admin_directory'), 'force_changepwd', 'force_changepwd', 1, false);
}
if (Docebo::user()->user_level == ADMIN_GROUP_GODADMIN) {
    echo Form::getDropdown(Lang::t('_LEVEL', 'admin_directory'), 'level', 'level', $levels, $info->level);
}
echo $modify_mask;
echo $fields_mask;
/* $social =new Social();
if ($social->isActive('facebook')) {
	echo Form::getTextField(Lang::t('_FACEBOOK_ID', 'standard'), 'facebook_id', 'facebook_id', 255, $info->facebook_id);
}
if ($social->isActive('twitter')) {
	echo Form::getTextField(Lang::t('_TWITTER_ID', 'standard'), 'twitter_id', 'twitter_id', 255, $info->twitter_id);
}
if ($social->isActive('linkedin')) {
	echo Form::getTextField(Lang::t('_LINKEDIN_ID', 'standard'), 'linkedin_id', 'linkedin_id', 255, $info->linkedin_id);
Example #8
0
 function addeditWiki($id = 0)
 {
     $res = "";
     require_once _base_ . "/lib/lib.form.php";
     $form = new Form();
     $form_code = "";
     $um =& UrlManager::getInstance();
     $url = $um->getUrl("op=savewiki");
     $lang_arr = $this->wikiManager->getLanguageArr();
     if ($id == 0) {
         $todo = "add";
         $form_code = $form->openForm("main_form", $url);
         $submit_lbl = $this->lang->def("_INSERT");
         $public = FALSE;
         $title = "";
         $description = "";
         $sel_lang = getLanguage();
         $other_lang = array();
     } else {
         if ($id > 0) {
             $todo = "edit";
             $form_code = $form->openForm("main_form", $url);
             $submit_lbl = $this->lang->def("_SAVE");
             $info = $this->wikiManager->getWikiInfo($id);
             $public = $info["public"] == 1 ? TRUE : FALSE;
             $title = $info["title"];
             $description = $info["description"];
             if (!empty($info["language"])) {
                 $sel_lang = $info["language"];
             } else {
                 $sel_lang = FALSE;
             }
             if (!empty($info["other_lang"])) {
                 $other_lang = explode(",", $info["other_lang"]);
             } else {
                 $other_lang = array();
             }
         }
     }
     $res .= $form_code;
     $res .= $form->openElementSpace();
     $res .= $form->getTextfield($this->lang->def("_TITLE"), "title", "title", 255, $title);
     $res .= $form->getSimpleTextarea($this->lang->def("_DESCRIPTION"), "description", "description", $description);
     if (Get::cur_plat() !== 'framework') {
         $res .= $form->getHidden("public", "public", 1);
     }
     $res .= $form->getHidden("id", "id", $id);
     if ($todo == "add") {
         $res .= $form->getDropdown($this->lang->def("_WIKI_LANGUAGE"), "language", "language", $lang_arr, $sel_lang);
     } else {
         if ($todo == "edit") {
             $res .= $form->getLineBox($this->lang->def("_WIKI_LANGUAGE") . ":", ucfirst($sel_lang));
             $res .= $form->getHidden("language", "language", $sel_lang);
             //$form->getDropdown($this->lang->def("_WIKI_LANGUAGE"), "language", "language", $lang_arr, $sel_lang);
         }
     }
     $res .= $form->getOpenCombo($this->lang->def('_WIKI_OTHER_LANGUAGES'));
     foreach ($lang_arr as $lang_code => $label) {
         $to_show = TRUE;
         $name = "other_lang[" . $lang_code . "]";
         $id = "other_lang_" . $lang_code;
         if ($todo == "edit" && $lang_code == $sel_lang) {
             $to_show = FALSE;
         }
         $checked = in_array($lang_code, $other_lang) ? TRUE : FALSE;
         if ($to_show) {
             $res .= $form->getCheckBox($label, $id, $name, $lang_code, $checked);
         }
     }
     $res .= $form->getCloseCombo();
     $res .= $form->closeElementSpace();
     $res .= $form->openButtonSpace();
     $res .= $form->getButton('save', 'save', $submit_lbl);
     $res .= $form->getButton('undo', 'undo', $this->lang->def('_UNDO'));
     $res .= $form->closeButtonSpace();
     $res .= $form->closeForm();
     return $res;
 }
 function get_course_val_filter()
 {
     $back_url = $this->back_url;
     $jump_url = $this->jump_url;
     $next_url = $this->next_url;
     require_once _base_ . '/lib/lib.form.php';
     require_once _adm_ . '/lib/lib.directory.php';
     require_once _adm_ . '/class.module/class.directory.php';
     require_once _lms_ . '/lib/lib.course.php';
     $lang =& DoceboLanguage::createInstance('report', 'framework');
     $glang =& DoceboLanguage::createInstance('admin_course_managment', 'lms');
     if (!isset($_SESSION['report_tempdata']['columns_filter'])) {
         $_SESSION['report_tempdata']['columns_filter'] = array();
     }
     $ref =& $_SESSION['report_tempdata']['columns_filter'];
     if (Get::req('is_updating', DOTY_INT, 0) > 0) {
         $ref['showed_cols'] = Get::req('cols', DOTY_MIXED, array());
     }
     function is_showed($which, &$arr)
     {
         if (isset($arr['showed_cols'])) {
             return in_array($which, $arr['showed_cols']);
         } else {
             return false;
         }
     }
     if (isset($_POST['import_filter']) || isset($_POST['show_filter']) || isset($_POST['pre_filter'])) {
         $temp_url = $next_url;
         if (isset($_POST['pre_filter'])) {
             $temp_url .= '&show=1&nosave=1';
         }
         if (isset($_POST['show_filter'])) {
             $temp_url .= '&show=1';
         }
         Util::jump_to($temp_url);
     }
     cout($this->page_title . Form::openForm('user_report_rows_courses', $jump_url) . Form::getHidden('update_tempdata', 'update_tempdata', 1) . Form::getHidden('is_updating', 'is_updating', 1) . Form::getOpenFieldset($lang->def('_COURSE_FIELDS'), 'fieldset_course_fields') . Form::getCheckBox($lang->def('_COURSE_CODE'), 'col_sel_coursecode', 'cols[]', '_CODE_COURSE', is_showed('_CODE_COURSE', $ref)) . Form::getCheckBox($glang->def('_COURSE_NAME'), 'col_sel_coursename', 'cols[]', '_NAME_COURSE', is_showed('_NAME_COURSE', $ref)) . Form::getCheckBox($glang->def('_CATEGORY'), 'col_sel_category', 'cols[]', '_COURSE_CATEGORY', is_showed('_COURSE_CATEGORY', $ref)) . Form::getCheckBox($glang->def('_STATUS'), 'col_sel_status', 'cols[]', '_COURSESTATUS', is_showed('_COURSESTATUS', $ref)) . Form::getCheckBox($glang->def('_CREATION_DATE', 'report'), 'col_sel_publication', 'cols[]', '_PUBLICATION_DATE', is_showed('_PUBLICATION_DATE', $ref)) . Form::getCloseFieldset() . Form::getOpenFieldset($lang->def('_COURSE', 'levels'), 'fieldset_course_fields') . Form::getCheckBox($lang->def('_MAX_SCORE'), 'col_hight_vote', 'cols[]', '_HIGH_VOTE', is_showed('_HIGH_VOTE', $ref)) . Form::getCheckBox($lang->def('_MIN_SCORE'), 'col_less_vote', 'cols[]', '_LESS_VOTE', is_showed('_LESS_VOTE', $ref)) . Form::getCheckBox($lang->def('_SCORE'), 'show_medium_vote', 'cols[]', '_MEDIUM_VOTE', is_showed('_MEDIUM_VOTE', $ref)) . Form::getCloseFieldset() . Form::openButtonSpace() . Form::getBreakRow() . Form::getButton('pre_filter', 'pre_filter', $lang->def('_SHOW_NOSAVE', 'report')) . Form::getButton('ok_filter', 'import_filter', $lang->def('_SAVE_BACK')) . Form::getButton('show_filter', 'show_filter', $lang->def('_SAVE_SHOW')) . Form::getButton('undo_filter', 'undo_filter', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm() . '</div>');
 }