Exemplo n.º 1
0
 function Report_User($id_report, $report_name = false)
 {
     parent::Report($id_report, $report_name);
     $this->lang =& DoceboLanguage::createInstance('report', 'framework');
     $this->usestandardtitle_rows = false;
     $this->_set_columns_category(_RU_CATEGORY_COURSES, $this->lang->def('_RU_CAT_COURSES'), 'get_courses_filter', 'show_report_courses', '_get_courses_query');
     //$this->_set_columns_category(_RU_CATEGORY_GENERAL, $this->lang->def('_RU_CAT_GENERAL'), 'get_general_filter', 'show_report_general');
     //$this->_set_columns_category(_RU_CATEGORY_COMPETENCES, $this->lang->def('_RU_CAT_COMPETENCES'), 'get_competences_filter', 'show_report_competences', '_get_competences_query');
     $this->_set_columns_category(_RU_CATEGORY_DELAY, $this->lang->def('_RU_CAT_DELAY'), 'get_delay_filter', 'show_report_delay', '_get_delay_query');
     $this->_set_columns_category(_RU_CATEGORY_LO, $this->lang->def('_RU_CAT_LO'), 'get_LO_filter', 'show_report_LO', '_get_LO_query');
     $this->_set_columns_category(_RU_CATEGORY_COMMUNICATIONS, $this->lang->def('_RU_CAT_COMMUNICATIONS'), 'get_communications_filter', 'show_report_communications', '_get_communications_query');
     $this->_set_columns_category(_RU_CATEGORY_GAMES, $this->lang->def('_RU_CAT_GAMES'), 'get_games_filter', 'show_report_games', '_get_games_query');
     $this->status_c = array(CST_PREPARATION => Lang::t('_CST_PREPARATION', 'course'), CST_AVAILABLE => Lang::t('_CST_AVAILABLE', 'course'), CST_EFFECTIVE => Lang::t('_CST_CONFIRMED', 'course'), CST_CONCLUDED => Lang::t('_CST_CONCLUDED', 'course'), CST_CANCELLED => Lang::t('_CST_CANCELLED', 'course'));
     $csub = new CourseSubscribe_Manager();
     $this->status_u = $csub->getUserStatus();
     $this->courses_filter_definition = array(array('key' => _COURSES_FILTER_SESSION_NUMBER, 'label' => $this->lang->def('_COURSES_FILTER_SESSION_NUMBER'), 'type' => _FILTER_INTEGER), array('key' => _COURSES_FILTER_SCORE_INIT, 'label' => $this->lang->def('_COURSES_FILTER_SCORE_INIT'), 'type' => _FILTER_INTEGER), array('key' => _COURSES_FILTER_SCORE_END, 'label' => $this->lang->def('_FINAL_SCORE'), 'type' => _FILTER_INTEGER), array('key' => _COURSES_FILTER_SCORE_COURSE, 'label' => $this->lang->def('_COURSES_FILTER_SCORE_COURSE'), 'type' => _FILTER_INTEGER), array('key' => _COURSES_FILTER_INSCRIPTION_DATE, 'label' => $this->lang->def('_COURSES_FILTER_INSCRIPTION_DATE'), 'type' => _FILTER_DATE), array('key' => _COURSES_FILTER_FIRSTACCESS_DATE, 'label' => $this->lang->def('_DATE_FIRST_ACCESS'), 'type' => _FILTER_DATE), array('key' => _COURSES_FILTER_END_DATE, 'label' => $this->lang->def('_COURSES_FILTER_END_DATE'), 'type' => _FILTER_DATE), array('key' => _COURSES_FILTER_LASTACCESS_DATE, 'label' => $this->lang->def('_DATE_LAST_ACCESS'), 'type' => _FILTER_DATE));
     $this->LO_columns = array(array('key' => 'userid', 'select' => false, 'group' => 'user', 'label' => Lang::t('_USERID', 'standard')), array('key' => 'user_name', 'select' => true, 'group' => 'user', 'label' => Lang::t('_FULLNAME', 'standard')), array('key' => 'email', 'select' => true, 'group' => 'user', 'label' => Lang::t('_EMAIL', 'standard')), array('key' => 'suspended', 'select' => true, 'group' => 'user', 'label' => Lang::t('_SUSPENDED', 'standard')), array('key' => '_CUSTOM_FIELDS_', 'select' => false, 'group' => 'user', 'label' => false), array('key' => 'course_code', 'select' => false, 'group' => 'course', 'label' => $this->lang->def('_CODE')), array('key' => 'course_name', 'select' => true, 'group' => 'course', 'label' => $this->lang->def('_COURSE_NAME')), array('key' => 'course_status', 'select' => true, 'group' => 'course', 'label' => $this->lang->def('_STATUS')), array('key' => 'lo_type', 'select' => true, 'group' => 'lo', 'label' => $this->lang->def('_LO_COL_TYPE')), array('key' => 'lo_name', 'select' => true, 'group' => 'lo', 'label' => $this->lang->def('_TITLE')), array('key' => 'lo_milestone', 'select' => true, 'group' => 'lo', 'label' => $this->lang->def('_LO_COL_MILESTONE')), array('key' => 'firstAttempt', 'select' => true, 'group' => 'lo', 'label' => $this->lang->def('_LO_COL_FIRSTATT')), array('key' => 'lastAttempt', 'select' => true, 'group' => 'lo', 'label' => $this->lang->def('_LO_COL_LASTATT')), array('key' => 'lo_status', 'select' => true, 'group' => 'lo', 'label' => $this->lang->def('_STATUS')), array('key' => 'lo_score', 'select' => true, 'group' => 'lo', 'label' => $this->lang->def('_SCORE')));
     $this->delay_columns = array(array('key' => 'userid', 'label' => Lang::t('_USERNAME', 'standard'), 'select' => false), array('key' => 'lastname', 'label' => Lang::t('_LASTNAME', 'standard'), 'select' => true), array('key' => 'firstname', 'label' => Lang::t('_FIRSTNAME', 'standard'), 'select' => true), array('key' => 'email', 'label' => Lang::t('_EMAIL', 'standard'), 'select' => true), array('key' => 'level', 'label' => Lang::t('_LEVEL', 'standard'), 'select' => true), array('key' => 'status', 'label' => Lang::t('_STATUS', 'standard'), 'select' => true), array('key' => 'date_subscription', 'label' => Lang::t('_DATE_INSCR', 'report'), 'select' => true), array('key' => 'date_first_access', 'label' => Lang::t('_DATE_FIRST_ACCESS', 'standard'), 'select' => true), array('key' => 'date_last_access', 'label' => Lang::t('_DATE_LAST_ACCESS', 'standard'), 'select' => true), array('key' => 'date_complete', 'label' => Lang::t('_DATE_END', 'standard'), 'select' => true));
 }
Exemplo n.º 2
0
 /**
  * retrive the user statistic in the lms
  */
 function getUserCourseStat($id_user)
 {
     require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
     $stats = array();
     $c_lang =& DoceboLanguage::CreateInstance('course', 'lms');
     $lang =& DoceboLanguage::createInstance('course', 'lms');
     $id_courses = array();
     $query_course_user = "******" . $GLOBALS['prefix_lms'] . "_courseuser AS cu\r\n\t\t\tJOIN " . $GLOBALS['prefix_lms'] . "_course AS c\r\n\t\tWHERE cu.idCourse = c.idCourse\r\n\t\t\tAND cu.idUser = '******'";
     $re_course_user = sql_query($query_course_user);
     while (list($id_c, $code, $name, $status, $status_user, $date_inscr, $date_first_access, $date_complete) = sql_fetch_row($re_course_user)) {
         $id_courses[] = $id_c;
         $stats[$id_c]['course_name'] = $name;
         $stats[$id_c]['course_code'] = $code;
         $course_status = array(CST_PREPARATION => $c_lang->def('_CST_PREPARATION', 'course', 'lms'), CST_AVAILABLE => $c_lang->def('_CST_AVAILABLE', 'course', 'lms'), CST_EFFECTIVE => $c_lang->def('_CST_CONFIRMED', 'course', 'lms'), CST_CONCLUDED => $c_lang->def('_CST_CONCLUDED', 'course', 'lms'), CST_CANCELLED => $c_lang->def('_CST_CANCELLED', 'course', 'lms'));
         $stats[$id_c]['course_status'] = $course_status[$status];
         $cman = new CourseSubscribe_Manager();
         $arr_status = $cman->getUserStatus();
         $stats[$id_c]['user_status'] = isset($arr_status[$status_user]) ? $arr_status[$status_user] : "";
         $stats[$id_c]['date_inscr'] = $date_inscr;
         $stats[$id_c]['date_first_access'] = $date_first_access;
         $stats[$id_c]['date_complete'] = $date_complete;
         $stats[$id_c]['score_init'] = '';
         $stats[$id_c]['score_final'] = '';
         $stats[$id_c]['access_count'] = '';
         $stats[$id_c]['access_time'] = '';
         $stats[$id_c]['access_last'] = '';
         $stats[$id_c]['point_do'] = '';
     }
     //recover start and final score
     require_once $GLOBALS['where_lms'] . '/lib/lib.orgchart.php';
     $org_man = new OrganizationManagement(false);
     require_once $GLOBALS['where_lms'] . '/lib/lib.coursereport.php';
     $rep_man = new CourseReportManager();
     $score_course = $rep_man->getUserFinalScore(array($id_user));
     $score_start = $org_man->getStartObjectScore(array($id_user), $id_courses);
     $score_final = $org_man->getFinalObjectScore(array($id_user), $id_courses);
     while (list(, $id_c) = each($id_courses)) {
         if (isset($stats[$id_c])) {
             $stats[$id_c]['score_init'] = isset($score_start[$id_c][$id_user]) && $score_start[$id_c][$id_user]['max_score'] ? $score_start[$id_c][$id_user]['score'] . ' / ' . $score_start[$id_c][$id_user]['max_score'] : '';
             $stats[$id_c]['score_final'] = isset($score_final[$id_c][$id_user]) && $score_final[$id_c][$id_user]['max_score'] ? $score_final[$id_c][$id_user]['score'] . ' / ' . $score_final[$id_c][$id_user]['max_score'] : '';
         }
         $point_do = isset($score_course[$id_user][$id_c]) ? $score_course[$id_user][$id_c]['score'] : '';
         $point_max = isset($score_course[$id_user][$id_c]) ? $score_course[$id_user][$id_c]['max_score'] : '';
         $stats[$id_c]['point_do'] = $point_do !== '' ? number_format($point_do, 2) . ' / ' . number_format($point_max, 2) : '';
     }
     $query = "\r\n\t\tSELECT idCourse, COUNT(*), SUM(UNIX_TIMESTAMP(lastTime) - UNIX_TIMESTAMP(enterTime)), MAX(lastTime)\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_tracksession\r\n\t\tWHERE idUser = '******'\r\n\t\tGROUP BY idCourse ";
     $re_time = sql_query($query);
     while (list($id_c, $session_num, $time_num, $last_num) = sql_fetch_row($re_time)) {
         if (isset($stats[$id_c])) {
             $stats[$id_c]['access_count'] = $session_num;
             $stats[$id_c]['access_time'] = $time_num;
             $stats[$id_c]['access_last'] = $last_num;
         }
     }
     return $stats;
 }
Exemplo n.º 3
0
 public function getUserStatusList()
 {
     require_once _lms_ . '/lib/lib.subscribe.php';
     $subscribe_man = new CourseSubscribe_Manager();
     return $subscribe_man->getUserStatus();
 }
Exemplo n.º 4
0
function modstatus()
{
    funAccess('statuser', 'OP');
    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();
    $idUser = (int) $_GET['idUser'];
    //$idItem = (int)$_GET['idItem'];
    $user_info = $aclManager->getUser($idUser, FALSE);
    $out->setWorkingZone('content');
    $out->add(getTitleArea($lang->def('_STATUS') . $user_info[ACL_INFO_FIRSTNAME] . ' ' . $user_info[ACL_INFO_LASTNAME], 'stats'));
    $out->add('<div class="std_block">' . getBackUi('index.php?modname=stats&amp;op=statuser&amp;idUser='******'_BACK')));
    $query = "\r\n\tSELECT status\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_courseuser\r\n\tWHERE idUser = '******'\r\n\t\tAND idCourse = '" . (int) $_SESSION['idCourse'] . "'";
    list($status) = sql_fetch_row(sql_query($query));
    $out->add($form->openForm('modstatus', 'index.php?modname=stats&amp;op=upstatus'));
    $out->add($form->getHidden('idUser', 'idUser', $idUser));
    $cs = new CourseSubscribe_Manager();
    $arr_status = $cs->getUserStatus();
    $out->add($form->getDropdown($lang->def('_STATUS'), 'status', 'status', $arr_status, $status));
    $out->add($form->getButton('gofilter', 'gofilter', $lang->def('_SAVE')));
    $out->add($form->closeForm());
    $out->add('</div>');
}
 public function export_csvTask()
 {
     //check permissions
     if (!$this->permissions['view']) {
         Util::jump_to('index.php?r=coursestats/show');
     }
     require_once _base_ . '/lib/lib.download.php';
     $id_course = isset($_SESSION['idCourse']) && $_SESSION['idCourse'] > 0 ? $_SESSION['idCourse'] : false;
     if ((int) $id_course <= 0) {
         //...
         return;
     }
     $separator = ',';
     $delimiter = '"';
     $line_end = "\r\n";
     $output = "";
     $lo_list = $this->model->getCourseLOs($id_course);
     $lo_total = count($lo_list);
     $head = array();
     $head[] = $this->_formatCsvValue(Lang::t('_USERNAME', 'standard'), $delimiter);
     $head[] = $this->_formatCsvValue(Lang::t('_FULLNAME', 'standard'), $delimiter);
     $head[] = $this->_formatCsvValue(Lang::t('_LEVEL', 'standard'), $delimiter);
     $head[] = $this->_formatCsvValue(Lang::t('_STATUS', 'standard'), $delimiter);
     foreach ($lo_list as $id_lo => $lo_info) {
         $head[] = $this->_formatCsvValue($lo_info->title, $delimiter);
     }
     $head[] = $this->_formatCsvValue(Lang::t('_COMPLETED', 'course'), $delimiter);
     $output .= implode($separator, $head) . $line_end;
     $records = $this->model->getCourseStatsList(false, $id_course, false);
     if (!empty($records)) {
         $acl_man = Docebo::user()->getAclManager();
         require_once _lms_ . '/lib/lib.subscribe.php';
         $cman = new CourseSubscribe_Manager();
         $arr_status = $cman->getUserStatus();
         $arr_level = $cman->getUserLevel();
         if (is_array($records)) {
             foreach ($records as $record) {
                 $row = array();
                 $row[] = $acl_man->relativeId($record->userid);
                 $row[] = $record->firstname . ' ' . $record->lastname;
                 $row[] = isset($arr_level[$record->level]) ? $arr_level[$record->level] : "";
                 $row[] = isset($arr_status[$record->status]) ? $arr_status[$record->status] : "";
                 $num_completed = 0;
                 foreach ($lo_list as $id_lo => $lo_info) {
                     $_lo_status = isset($record->lo_status[$id_lo]) ? $record->lo_status[$id_lo] : "";
                     $row[] = $_lo_status;
                     if ($_lo_status == 'completed' || $_lo_status == 'passed') {
                         $num_completed++;
                     }
                 }
                 $row[] = $num_completed . ' / ' . $lo_total;
                 //format row and produce a string text to add to CSV file
                 $csv_row = array();
                 foreach ($row as $row_data) {
                     $csv_row[] = $this->_formatCsvValue($row_data, $delimiter);
                 }
                 $output .= implode($separator, $csv_row) . $line_end;
             }
         }
     }
     sendStrAsFile($output, 'coursestats_export_' . date("Ymd") . '.csv');
 }