public function showTask()
 {
     //we will need some date input fields in popups; since we can't declare them
     //in an ajax response (for the moment), than prepare here the necessary script
     Form::loadDatefieldScript();
     //prepare view to render
     $params = array('permissions' => $this->permissions);
     $this->render('show', $params);
 }
 public function show()
 {
     //if (!checkPerm('view', true)) return;
     YuiLib::load('tabview,charts');
     $charts_num_days = 7;
     //check if there are any problems with technical configuration of the server
     $php_conf = ini_get_all();
     //this
     $problem = false;
     if ($php_conf['register_globals']['local_value']) {
         $problem = true;
     }
     if (version_compare(phpversion(), "5.2.0", ">")) {
         if ($php_conf['allow_url_include']['local_value']) {
             $problem = true;
         }
     }
     $user_idst = Docebo::user()->getIdSt();
     $user_level = Docebo::user()->getUserLevelId();
     $acl_man = Docebo::user()->getAclManager();
     $where = "";
     if ($user_level != ADMIN_GROUP_GODADMIN) {
         $where .= "AND (author='" . $user_idst . "' OR is_public>0)";
     }
     $num_reports = 0;
     $query = "SELECT id_filter, filter_name, author, creation_date, is_public " . " FROM %lms_report_filter " . " WHERE (author>0 OR is_public>0) " . $where . " ORDER BY filter_name ASC " . ($num_reports > 0 ? " LIMIT 0," . (int) $num_reports : "");
     //creation_date DESC
     $res = sql_query($query);
     $arr_report = array();
     while (list($idrep, $name, $author, $creation_date, $is_public) = sql_fetch_row($res)) {
         $arr_report[$idrep] = $name;
     }
     //load date script for user creation and editing mask
     Form::loadDatefieldScript();
     //render view
     $this->render('show', array('diagnostic_problem' => $problem, 'lang_dir' => Lang::direction(), 'can_approve' => checkPerm('approve_waiting_user', true, 'directory', 'framework'), 'version' => $this->model->getVersionExternalInfo(), 'user_stats' => $this->model->getUsersStats(), 'course_stats' => $this->model->getCoursesStats(), 'course_months_stats' => $this->model->getCoursesMonthsStats(), 'userdata_accesses' => $this->json->encode($this->model->getUsersChartAccessData($charts_num_days)), 'userdata_registrations' => $this->json->encode($this->model->getUsersChartRegisterData($charts_num_days)), 'coursedata_subscriptions' => $this->json->encode($this->model->getCoursesChartSubscriptionData($charts_num_days)), 'coursedata_startattendings' => $this->json->encode($this->model->getCoursesChartStartAttendingData($charts_num_days)), 'coursedata_completed' => $this->json->encode($this->model->getCoursesChartCompletedData($charts_num_days)), 'permissions' => $this->permissions, 'reports' => $arr_report));
 }
Example #3
0
 public static function getInputDatefield($css_field, $id, $name, $value = '', $date_format = FALSE, $sel_time = FALSE, $alt_name = '', $other_param = '')
 {
     $value = $value == '00-00-0000' ? '' : $value;
     if ($date_format == false) {
         $regset = Format::instance();
         $date_format = $regset->date_token;
     }
     if ($css_field == false) {
         $css_field = 'textfield';
     }
     Form::loadDatefieldScript($date_format);
     $date = "";
     $iso = Format::dateDb($value, 'date');
     if ($value != '' && $value != '0000-00-00 00:00:00') {
         $timestamp = mktime(0, 0, 0, (int) substr($iso, 5, 2), (int) substr($iso, 8, 2), (int) substr($iso, 0, 4));
         $date = date("m/d/Y", $timestamp);
     }
     $other_after_b = '<span id="calendar_button_' . $id . '" class="yui-button"><span class="first-child docebo_calendar">' . '<button type="button"></button></span></span>' . '<div id="calendar_menu_' . $id . '"><div id="calendar_container_' . $id . '"></div></div>';
     if (defined("IS_AJAX")) {
         if (!isset($GLOBALS['date_inputs'])) {
             $GLOBALS['date_inputs'] = array();
         }
         $GLOBALS['date_inputs'][] = array($id, $date, $date_format);
     } else {
         $script = '<script type="text/javascript">' . 'YAHOO.util.Event.onDOMReady(function() {' . '	YAHOO.dateInput.setCalendar("' . $id . '", "' . $date . '", "' . $date_format . '");' . '});</script>';
         cout($script, 'scripts');
         //script in the scripts page section, this ensure to have it after the YAHOO.dateInput declaration
     }
     return Form::getInputTextfield($css_field, $id, $name, Format::date($iso, 'date'), $alt_name, '30', '');
 }
    function get_courses_filter()
    {
        $out =& $GLOBALS['page'];
        $out->setWorkingZone('content');
        $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';
        $lang =& DoceboLanguage::createInstance('report', 'framework');
        YuiLib::load('datasource');
        Util::get_js(Get::rel_path('lms') . '/admin/modules/report/courses_filter.js', true, true);
        Form::loadDatefieldScript();
        $time_belt = array(0 => $lang->def('_CUSTOM_BELT'), 7 => $lang->def('_LAST_WEEK'), 31 => $lang->def('_LAST_MONTH'), 93 => $lang->def('_LAST_THREE_MONTH'), 186 => $lang->def('_LAST_SIX_MONTH'), 365 => $lang->def('_LAST_YEAR'));
        //back to columns category selection
        if (isset($_POST['undo_filter'])) {
            //go back at the previous step
            Util::jump_to($back_url);
            //...
        }
        require_once $GLOBALS['where_framework'] . '/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);
        }
        //set $_POST data in $_SESSION['report_tempdata']
        if (!isset($_SESSION['report_tempdata']['columns_filter'])) {
            $_SESSION['report_tempdata']['columns_filter'] = array('org_chart_subdivision' => 0, 'all_courses' => true, 'selected_courses' => array(), 'sub_filters' => array(), 'filter_exclusive' => 1, 'showed_columns' => array(), 'order_by' => 'userid', 'order_dir' => 'asc', 'show_suspended' => false, 'custom_fields' => $custom, 'show_classrooms_editions' => false);
        }
        $ref =& $_SESSION['report_tempdata']['columns_filter'];
        //echo print_r($ref,true);
        $selector = new Selector_Course();
        $selection =& $ref['selected_courses'];
        $selector->parseForState($_POST);
        if (isset($_POST['update_tempdata'])) {
            // parse for date fields
            $opt_type = array();
            foreach ($this->courses_filter_definition as $fd) {
                $opt_type[$fd['key']] = $fd['type'];
            }
            if (isset($_POST['courses_filter'])) {
                while (list($ind, $filter_data) = each($_POST['courses_filter'])) {
                    if ($opt_type[$filter_data['option']] == _FILTER_DATE) {
                        $_POST['courses_filter'][$ind]['value'] = Format::dateDb($filter_data['value'], 'date');
                    }
                }
            }
            $temp = array('org_chart_subdivision' => isset($_POST['org_chart_subdivision']) ? 1 : 0, 'all_courses' => $_POST['all_courses'] == 1 ? true : false, 'selected_courses' => $selector->getSelection(), 'sub_filters' => isset($_POST['courses_filter']) ? $_POST['courses_filter'] : array(), 'filter_exclusive' => isset($_POST['filter_exclusive']) ? $_POST['filter_exclusive'] : false, 'showed_columns' => isset($_POST['cols']) ? $_POST['cols'] : array(), 'order_by' => isset($_POST['order_by']) ? $_POST['order_by'] : 'userid', 'order_dir' => isset($_POST['order_dir']) ? $_POST['order_dir'] : 'asc', 'show_suspended' => isset($_POST['show_suspended']) ? $_POST['show_suspended'] > 0 : false, 'custom_fields' => array(), 'show_classrooms_editions' => isset($_POST['show_classrooms_editions']) && $_POST['show_classrooms_editions'] > 0 ? true : false);
            foreach ($custom as $val) {
                $temp['custom_fields'][] = array('id' => $val['id'], 'label' => $val['label'], 'selected' => isset($_POST['custom'][$val['id']]) ? true : false);
            }
            $ref = $temp;
        } else {
            $selector->resetSelection($selection);
            //get users' custom fields
            if (!isset($ref['custom_fields'])) {
                $ref['custom_fields'] = $custom;
            } else {
                $t_arr = array();
                foreach ($custom as $val) {
                    $is_selected = FALSE;
                    foreach ($ref['custom_fields'] as $fieldrow) {
                        if ($fieldrow['id'] == $val['id']) {
                            $is_selected = $fieldrow['selected'];
                            break;
                        }
                    }
                    $t_arr[] = array('id' => $val['id'], 'label' => $val['label'], 'selected' => $is_selected);
                }
                $ref['custom_fields'] = $t_arr;
            }
        }
        //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));
        $lang = $this->lang;
        $temp = count($selection);
        $show_classrooms_editions = $ref['show_classrooms_editions'];
        $box = new ReportBox('course_selector');
        $box->title = $lang->def('_REPORT_COURSE_SELECTION');
        $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 .= $selector->loadCourseSelector(true);
        $box->body .= '</div>';
        $box->footer = $lang->def('_CURRENT_SELECTION') . ':&nbsp;<span id="csel_foot">' . ($ref['all_courses'] ? $lang->def('_ALL') : ($temp != '' ? $temp : '0')) . '</span>';
        cout($box->get());
        cout('<script type="text/javascript">courses_count=' . ($temp == '' ? '0' : $temp) . ';' . 'courses_all="' . $lang->def('_ALL') . '";</script>');
        //example selection options
        require_once _base_ . '/lib/lib.json.php';
        $seldata = $this->courses_filter_definition;
        $filter_cases = array('_FILTER_INTEGER' => _FILTER_INTEGER, '_FILTER_DATE' => _FILTER_DATE);
        $regset = Format::instance();
        $date_token = $regset->date_token;
        $json = new Services_JSON();
        $js_seldata = $json->encode($seldata);
        $js_filter_cases = $json->encode($filter_cases);
        $out->add('<script type="text/javascript">' . "\n" . 'seldata_JSON=' . $js_seldata . ';' . "\n" . 'filter_cases_JSON=\'' . $js_filter_cases . '\';' . "\n" . 'courses_sel_opt_0=\'' . $lang->def('_COURSES_DROPDOWN_NULL_SELECT') . '\';' . "\n" . 'courses_remove_filter=\'' . $lang->def('_RESET') . '\';' . "\n" . 'var course_date_token=\'' . $date_token . '\';' . "\n" . 'YAHOO.util.Event.addListener(window,"load",courses_init);' . "\n" . '</script>', 'page_head');
        //box for course filter conditions
        $temp =& $_SESSION['report_tempdata']['columns_filter']['sub_filters'];
        $inc_counter = count($temp);
        $already = '';
        $script_init = 'YAHOO.util.Event.onDOMReady( function() {' . "\n";
        if (is_array($temp)) {
            foreach ($temp as $key => $value) {
                //create filters html
                $value['value'] = substr($value['value'], 0, 10);
                //make sure that the date format is yyyy-mm-dd
                $index = str_replace('i', '', $key);
                $already .= '<div id="courses_filter_' . $index . '">';
                //generate option selection
                $already .= '<select id="courses_filter_sel_' . $index . '" name="courses_filter_sel[]">';
                $already .= '<option value="0">' . $lang->def('_COURSES_DROPDOWN_NULL_SELECT') . '</option>';
                foreach ($seldata as $selval) {
                    if ($value['option'] == $selval['key']) {
                        $selected = ' selected="selected"';
                    } else {
                        $selected = '';
                    }
                    $already .= '<option value="' . $selval['key'] . '"' . $selected . '>' . $selval['label'] . '</option>';
                }
                $already .= '</select>';
                $already .= '<span id="courses_filter_params_' . $index . '">';
                //generate sign selection
                $signs = array('<', '<=', '=', '>=', '>');
                $already .= '<select name="courses_filter[' . $key . '][sign]">';
                foreach ($signs as $k2 => $v2) {
                    if ($value['sign'] == $v2) {
                        $selected = ' selected="selected"';
                    } else {
                        $selected = '';
                    }
                    $already .= '<option value="' . $v2 . '"' . $selected . '>' . $v2 . '</option>';
                }
                $already .= '</select>';
                //generate value input
                $type = false;
                foreach ($this->courses_filter_definition as $def) {
                    //this should be a switch
                    if ($value['option'] == $def['key']) {
                        $type = $def['type'];
                    }
                }
                $already .= '<input class="align_right" type="text" style="width: ' . ($type == _FILTER_DATE ? '7' : '9') . 'em;" ' . 'name="courses_filter[' . $key . '][value]" value="' . Format::date($value['value'], 'date') . '"' . ' id="courses_filter_' . $index . '_value" />';
                if ($type == _FILTER_DATE) {
                    $_year = substr($value['value'], 0, 4);
                    $_month = substr($value['value'], 5, 2);
                    $_day = substr($value['value'], 8, 2);
                    $script_init .= 'YAHOO.dateInput.setCalendar(' . '"courses_filter_' . $index . '_value", ' . '"' . $_month . '/' . $_day . '/' . $_year . '", ' . '"' . $date_token . '");' . "\n";
                }
                //generate hidden index
                $already .= '<input type="hidden" name="courses_filter[' . $key . '][option]" ' . 'value="' . $value['option'] . '" /></span>';
                //generate remove link
                $already .= '<a href="javascript:courses_removefilter(' . $index . ');">' . $lang->def('_RESET') . '</a>';
                $already .= '</div>';
                $script_init .= 'YAHOO.util.Event.addListener("courses_filter_sel_' . $index . '", "change", courses_create_filter);';
            }
        }
        $script_init .= '} );';
        $already .= '<script type="text/javascript">' . $script_init . '</script>';
        $temp = isset($_SESSION['report_tempdata']['columns_filter']['filter_exclusive']) ? $_SESSION['report_tempdata']['columns_filter']['filter_exclusive'] : 1;
        $selected = ' checked="checked"';
        $box = new ReportBox('course_subfilters');
        $box->title = $lang->def('_REPORT_COURSE_CONDITIONS');
        $box->description = '';
        $box->body = Form::getBreakRow() . '<div id="courses_filter_list">' . $already . '</div>' . '<div class="fc_filter_line filter_corr">' . '<input type="radio" id="filter_exclusive_and" name="filter_exclusive" value="1" ' . ($temp > 0 ? $selected : '') . ' />
				<label for="filter_exclusive_and">' . $lang->def('_FILTER_ALL_CONDS') . '</label>&nbsp;' . '<input type="radio" id="filter_exclusive_or" name="filter_exclusive" value="0" ' . ($temp == 0 ? $selected : '') . ' />
				<label for="filter_exclusive_or">' . $lang->def('_FILTER_ONE_COND') . '</label>' . '</div>' . '<div class="fc_filter_line">' . '<span class="yui-button yui-link-button" id="fc_addfilter">
					<span class="first-child">
						<a href="#" onclick="courses_addfilter();return false;">' . $lang->def('_NEW_FILTER') . '</a>
					</span>
				</span>' . '<span class="yui-button yui-link-button" id="fc_cancfilter">
					<span class="first-child">
						<a href="#" onclick="courses_resetfilters();return false;">' . $lang->def('_FILTER_RESET') . '</a>
					</span>
				</span>' . '</div>' . Form::getHidden('inc_counter', 'inc_counter', $inc_counter) . '</div>';
        cout($box->get());
        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
        $box = new ReportBox('columns_selection');
        $box->title = $lang->def('_SELECT_THE_DATA_COL_NEEDED');
        $box->description = false;
        //Form::openElementSpace()
        $box->body .= Form::getOpenFieldset($lang->def('_USER_CUSTOM_FIELDS'), 'fieldset_course_fields');
        $box->body .= Form::getCheckBox(Lang::t('_LASTNAME', 'standard'), 'col_sel_lastname', 'cols[]', '_TH_LASTNAME', is_showed('_TH_LASTNAME'));
        $box->body .= Form::getCheckBox(Lang::t('_FIRSTNAME', 'standard'), 'col_sel_firstname', 'cols[]', '_TH_FIRSTNAME', is_showed('_TH_FIRSTNAME'));
        $box->body .= Form::getCheckBox(Lang::t('_EMAIL', 'standard'), 'col_sel_email', 'cols[]', '_TH_EMAIL', is_showed('_TH_EMAIL'));
        $box->body .= Form::getCheckBox(Lang::t('_REGISTER_DATE', 'standard'), 'col_sel_register_date', 'cols[]', '_TH_REGISTER_DATE', is_showed('_TH_REGISTER_DATE'));
        $box->body .= Form::getCheckBox(Lang::t('_SUSPENDED', 'standard'), 'col_sel_suspended', 'cols[]', '_TH_SUSPENDED', is_showed('_TH_SUSPENDED'));
        foreach ($custom as $key => $val) {
            $box->body .= Form::getCheckBox($val['label'], 'col_custom_' . $val['id'], 'custom[' . $val['id'] . ']', $val['id'], $ref['custom_fields'][$key]['selected']);
        }
        $box->body .= Form::getCloseFieldset();
        $out->add('<script type="text/javascript">
				function activateClassrooms() {
					var Y = YAHOO.util.Dom;
					var b1 = Y.get("not_classrooms"), b2 = Y.get("use_classrooms");
					var action = b1.style.display == "none" ? "hide" : "show";
					switch (action) {
						case "hide": {
							b1.style.display = "block";
							b2.style.display = "none";
						} break;
						case "show": {
							b1.style.display = "none";
							b2.style.display = "block";
						} break;
					}
				}
			</script>', 'page_head');
        $box->body .= Form::getOpenFieldset($lang->def('_COURSE_FIELDS'), 'fieldset_course_fields') . Form::getCheckBox($lang->def('_CATEGORY'), 'col_sel_category', 'cols[]', '_TH_CAT', is_showed('_TH_CAT')) . Form::getCheckBox($lang->def('_CODE'), 'col_sel_coursecode', 'cols[]', '_TH_CODE', is_showed('_TH_CODE')) . Form::getCheckBox($lang->def('_TH_COURSEPATH'), 'col_sel_coursepath', 'cols[]', '_TH_COURSEPATH', is_showed('_TH_COURSEPATH')) . Form::getCheckBox($lang->def('_STATUS'), 'col_sel_status', 'cols[]', '_TH_COURSESTATUS', is_showed('_TH_COURSESTATUS')) . Form::getCheckBox(Lang::t('_CREDITS', 'standard'), 'col_sel_credits', 'cols[]', '_TH_COURSECREDITS', is_showed('_TH_COURSECREDITS')) . Form::getCloseFieldset() . Form::getOpenFieldset(Form::getInputCheckbox('show_classrooms_editions', 'show_classrooms_editions', 1, $show_classrooms_editions, "onclick=activateClassrooms();") . "&nbsp;&nbsp;" . Lang::t('_CLASSROOM_FIELDS', 'report'), 'fieldset_classroom_fields') . '<div id="not_classrooms" style="display:' . ($show_classrooms_editions ? "none" : "block") . '">' . Lang::t('_ACTIVATE_CLASSROOM_FIELDS', 'report') . '</div>' . '<div id="use_classrooms" style="display:' . ($show_classrooms_editions ? "block" : "none") . '">' . Form::getCheckBox(Lang::t('_NAME', 'standard'), 'col_sel_classroomname', 'cols[]', '_TH_CLASSROOM_CODE', is_showed('_TH_CLASSROOM_CODE', $ref)) . Form::getCheckBox(Lang::t('_CODE', 'standard'), 'col_sel_classroomcode', 'cols[]', '_TH_CLASSROOM_NAME', is_showed('_TH_CLASSROOM_NAME', $ref)) . Form::getCheckBox(Lang::t('_DATE_BEGIN', 'standard'), 'col_sel_classroomdatebegin', 'cols[]', '_TH_CLASSROOM_MIN_DATE', is_showed('_TH_CLASSROOM_MIN_DATE', $ref)) . Form::getCheckBox(Lang::t('_DATE_END', 'standard'), 'col_sel_classroomdateend', 'cols[]', '_TH_CLASSROOM_MAX_DATE', is_showed('_TH_CLASSROOM_MAX_DATE', $ref)) . '</div>' . Form::getCloseFieldset() . Form::getOpenFieldset($lang->def('_COURSE_FIELDS_INFO'), 'fieldset_course_fields') . Form::getCheckBox($lang->def('_TH_USER_INSCRIPTION_DATE'), 'user_inscription_date', 'cols[]', '_TH_USER_INSCRIPTION_DATE', is_showed('_TH_USER_INSCRIPTION_DATE')) . Form::getCheckBox($lang->def('_DATE_FIRST_ACCESS'), 'user_start_date', 'cols[]', '_TH_USER_START_DATE', is_showed('_TH_USER_START_DATE')) . Form::getCheckBox($lang->def('_COMPLETED'), 'user_end_date', 'cols[]', '_TH_USER_END_DATE', is_showed('_TH_USER_END_DATE')) . Form::getCheckBox($lang->def('_DATE_LAST_ACCESS'), 'last_access_date', 'cols[]', '_TH_LAST_ACCESS_DATE', is_showed('_TH_LAST_ACCESS_DATE')) . Form::getCheckBox($lang->def('_LEVEL'), 'user_level', 'cols[]', '_TH_USER_LEVEL', is_showed('_TH_USER_LEVEL')) . Form::getCheckBox($lang->def('_STATUS'), 'user_status', 'cols[]', '_TH_USER_STATUS', is_showed('_TH_USER_STATUS')) . Form::getCheckBox($lang->def('_TH_USER_START_SCORE'), 'user_start_score', 'cols[]', '_TH_USER_START_SCORE', is_showed('_TH_USER_START_SCORE')) . Form::getCheckBox($lang->def('_FINAL_SCORE'), 'user_final_score', 'cols[]', '_TH_USER_FINAL_SCORE', is_showed('_TH_USER_FINAL_SCORE')) . Form::getCheckBox($lang->def('_TH_USER_COURSE_SCORE'), 'user_course_score', 'cols[]', '_TH_USER_COURSE_SCORE', is_showed('_TH_USER_COURSE_SCORE')) . Form::getCheckBox($lang->def('_TH_USER_NUMBER_SESSION'), 'user_number_session', 'cols[]', '_TH_USER_NUMBER_SESSION', is_showed('_TH_USER_NUMBER_SESSION')) . Form::getCheckBox($lang->def('_TOTAL_TIME'), 'user_elapsed_time', 'cols[]', '_TH_USER_ELAPSED_TIME', is_showed('_TH_USER_ELAPSED_TIME')) . Form::getCheckBox($lang->def('_TH_ESTIMATED_TIME'), 'estimated_time', 'cols[]', '_TH_ESTIMATED_TIME', is_showed('_TH_ESTIMATED_TIME')) . Form::getCloseFieldset();
        cout($box->get());
        //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'), 'status' => Lang::t('_STATUS', 'standard'), 'level' => Lang::t('_LEVEL', 'standard'), 'date_subscription' => Lang::t('_DATE_INSCR', 'report'), 'date_first_access' => Lang::t('_DATE_FIRST_ACCESS', 'report'), 'date_last_access' => Lang::t('_DATE_LAST_ACCESS', 'report'), 'date_complete' => Lang::t('_DATE_END', 'standard'));
        $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());
    }
 public function show_coursepathTask()
 {
     $id_path = Get::req('id_path', DOTY_INT, 0);
     if ($id_path <= 0) {
         //...
         return;
     }
     Util::get_js(Get::rel_path('base') . '/lib/lib.elem_selector.js', true, true);
     $res = Get::req('res', DOTY_STRING, "");
     $message = false;
     switch ($res) {
         case 'ok':
             $message = UIFeedback::info(Lang::t(strtoupper($_GET['res']), 'subscription'));
             break;
         case 'err':
             $message = UIFeedback::error(Lang::t(strtoupper($_GET['err']), 'subscription'));
             break;
     }
     Form::loadDatefieldScript();
     //some dialogs use date inputs
     $umodel = new UsermanagementAdm();
     $params = array('back_link' => 'index.php?modname=coursepath&op=pathlist&of_platform=lms', 'id_path' => $id_path, 'message' => $message, 'orgchart_list' => $umodel->getOrgChartDropdownList(), 'is_active_advanced_filter' => false, 'filter_text' => "", 'filter_orgchart' => 0, 'filter_descendants' => false, 'filter_date_valid' => "", 'filter_show' => 0, 'path_name' => $this->model->getCoursepathNameForSubscription($id_path));
     $this->render('show_coursepath', $params);
 }
Example #6
0
 function getClientClassObject()
 {
     $format = Format::instance();
     $date_format = $format->date_token;
     Form::loadDatefieldScript($date_format);
     return 'YAHOO.dynamicFilter.renderTypes.get("' . $this->getFieldType() . '", {format: "' . $date_format . '"})';
     /*
         return '
           {
             type: "'.$this->getFieldType().'",
           
             getValue: function(id_sel, id_filter) {
               var o, id = "date_"+id_filter+"_"+id_sel, $D = YAHOO.util.Dom;
               return YAHOO.lang.JSON.stringify({cond: $D.get(id+"_sel").value, value: $D.get(id).value});
             },
             
             setValue: function(id_sel, id_filter, newValue) {
               if (!newValue) o = {cond: 0, value: ""};
               else o = YAHOO.lang.JSON.parse(newValue);
               var i, s, id = "date_"+id_filter+"_"+id_sel, $D = YAHOO.util.Dom;
               $D.get(id).value = o.value;
               s = $D.get(id+"_sel");
               for (i=0; i<s.options.length; i++) {
                 if (s.options[i].value == o.cond) {
                   s.selectedIndex = i;
                   break;
                 }
               }
             },
             
             render: function(id_sel, id_filter, oEl, id_field) {
               var id = "date_"+id_filter+"_"+id_sel, txt = document.createElement("INPUT"), but = document.createElement("BUTTON");
               txt.id = id;
               txt.className = "filter_value";
               txt.type = "text";
               but.id = "trigger_"+id;
               try{ but.type = "button"; } catch(e) {}
               but.className = "trigger_calendar";
               
               d = document.createElement("DIV"); d.className = "date_container";
               sel = document.createElement("SELECT"); sel.id = id+"_sel";
               sel.options[0] = new Option("<",0);
               sel.options[1] = new Option("<=",1);
               sel.options[2] = new Option("=",2);
               sel.options[3] = new Option(">=",3);
               sel.options[4] = new Option(">",4);
               sel.className = "condition_select";
               
               d.appendChild(sel);
               d.appendChild(document.createTextNode(" "));
               d.appendChild(txt);
               d.appendChild(but);
               oEl.appendChild(d);
               Calendar.setup({
                 inputField  : id,
                 ifFormat    : "'.$format->date_token.'",
                 button      : "trigger_"+id,
                 timeFormat  : '.(substr($format->time_token, 0, 2) == "%I" ? '12' : '24').',
                 showsTime   : true
               });
             }
           }    
         ';
     */
 }