/** * execute the connection to source */ function connect() { $this->lang = DoceboLanguage::createInstance('ru_report'); // perform the query for data retriving $course_man = new Man_Course(); $this->acl_man = new DoceboACLManager(); $p_dr = new PeopleDataRetriever($GLOBALS['dbConn'], $GLOBALS['prefix_fw']); $re_people = $p_dr->getAllRowsIdst(); $this->_query_result = false; $this->_readed_end = false; $this->row_index = 0; $user_selected = array(); if (!$re_people) { $this->_readed_end = true; return TRUE; } // find some information $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 IN ( " . implode(',', $user_selected) . " ) \r\n\t\t\tAND cu.status = '" . _CUS_END . "' "; $this->_query_result = sql_query($query_course_user); if (!$this->_query_result) { $this->last_error = mysql_error(); return FALSE; } return TRUE; }
/** * execute the connection to source **/ function connect() { $this->lang = DoceboLanguage::createInstance('rg_report'); // perform the query for data retriving $course_man = new Man_Course(); $this->acl_man = new DoceboACLManager(); $p_dr = new PeopleDataRetriever($GLOBALS['dbConn'], $GLOBALS['prefix_fw']); $re_people = $p_dr->getAllRowsIdst(); $this->_readed_end = false; $this->row_index = 0; $user_selected = array(); if (!$re_people) { $this->_readed_end = true; return TRUE; } while (list($idst) = sql_fetch_row($re_people)) { $user_selected[$idst] = $idst; } $this->users_info = $this->acl_man->getUsers($user_selected); $this->id_courses = $course_man->getAllCourses(); $this->num_iscr = array(); $this->num_nobegin = array(); $this->num_itinere = array(); $this->num_end = array(); $this->time_in_course = array(); $effective_user = array(); $query_course_user = "******" . $GLOBALS['prefix_lms'] . "_courseuser AS cu \r\n\t\tWHERE idUser IN ( " . implode(',', $user_selected) . " ) "; $re_course_user = sql_query($query_course_user); while (list($id_u, $id_c, $fisrt_access, $date_complete) = sql_fetch_row($re_course_user)) { if (isset($this->num_iscr[$id_c])) { ++$this->num_iscr[$id_c]; } else { $this->num_iscr[$id_c] = 1; } if ($fisrt_access === NULL) { //never enter if (isset($this->num_nobegin[$id_c])) { ++$this->num_nobegin[$id_c]; } else { $this->num_nobegin[$id_c] = 1; } } elseif ($date_complete === NULL) { //enter if (isset($this->num_itinere[$id_c])) { ++$this->num_itinere[$id_c]; } else { $this->num_itinere[$id_c] = 1; } } else { //complete if (isset($this->num_end[$id_c])) { ++$this->num_end[$id_c]; } else { $this->num_end[$id_c] = 1; } } $effective_user[] = $id_u; } if (!empty($effective_user)) { $query_time = "\r\n\t\t\tSELECT idCourse, SUM(UNIX_TIMESTAMP(lastTime) - UNIX_TIMESTAMP(enterTime)) \r\n\t\t\tFROM " . $GLOBALS['prefix_lms'] . "_tracksession \r\n\t\t\tWHERE idUser IN ( " . implode(',', $effective_user) . " )\r\n\t\t\tGROUP BY idCourse "; $re_time = sql_query($query_time); while (list($id_c, $time_num) = sql_fetch_row($re_time)) { $this->time_in_course[$id_c] = $time_num; } } return TRUE; }
function &getAllUserIdst() { $p_dr = new PeopleDataRetriever($GLOBALS['dbConn'], $GLOBALS['prefix_fw']); $userlevelid = Docebo::user()->getUserLevelId(); if ($userlevelid != ADMIN_GROUP_GODADMIN) { require_once _base_ . '/lib/lib.preference.php'; $adminManager = new AdminPreference(); $p_dr->intersectGroupFilter($adminManager->getAdminTree(Docebo::user()->getIdSt())); } $re_people = $p_dr->getAllRowsIdst(); $user_selected = array(); if (!$re_people) { return $user_selected; } while (list($idst) = sql_fetch_row($re_people)) { $user_selected[$idst] = $idst; } return $user_selected; }