Displaying Classroom Scores in User profile

Post Reply
scubatricky
FormaLms User
Posts: 69
Joined: Wed Oct 21, 2020 11:43 pm

Displaying Classroom Scores in User profile

Post by scubatricky »

any plans to revise this code:

public function credits() {
require_once(_lms_.'/lib/lib.course.php');
// $str = '<h2 class="heading">' . Lang::t ( '_CREDITS', 'catalogue' ) . '</h2>' . '<div class="content">';
$str = '';
$period_start = '';
$period_end = '';

// extract checking period
$year = date ( "Y" );
$p_list = array ();
$p_selected = Get::pReq( 'credits_period', DOTY_INT, 0 );
$p_res = sql_query ( "SELECT * FROM " . $GLOBALS ['prefix_lms'] . "_time_period ORDER BY end_date DESC, start_date DESC" );
if (sql_num_rows ( $p_res ) > 0) {
while ( $obj = sql_fetch_object ( $p_res ) ) {
if ($p_selected == 0)
$p_selected = $obj->id_period;
$p_list [$obj->id_period] = Format::date ( $obj->start_date, 'date' ) . ' - ' . Format::date ( $obj->end_date, 'date' );
if ($p_selected == $obj->id_period) {
$period_start = $obj->start_date;
$period_end = $obj->end_date;
}
}
}

if (count ( $p_list ) <= 0)
$p_list ['0'] = Lang::t ( '_NO_PERIODS', 'catalogue' );
if (! array_key_exists ( $p_selected, $p_list ))
$p_selected = 0;
if ($p_selected == 0)
$p_selected = false;

// extract courses which have been completed in the considered period and the credits associated
$course_type_trans = getCourseTypes ();
$query = "SELECT c.idCourse, c.name, c.course_type, c.credits, cu.status " . " FROM " . $GLOBALS ['prefix_lms'] . "_course as c " . " JOIN " . $GLOBALS ['prefix_lms'] . "_courseuser as cu " . " ON (cu.idCourse = c.idCourse) WHERE cu.idUser=" . ( int ) getLogUserId () . " AND c.course_type IN ('" . implode ( "', '", array_keys ( $course_type_trans ) ) . "') " . " AND cu.status = '" . _CUS_END . "' " . ($period_start != '' ? " AND cu.date_complete > '" . $period_start . "' " : "") . ($period_end != '' ? " AND cu.date_complete < '" . $period_end . "' " : "") . " ORDER BY c.name";
$res = sql_query ( $query );

$course_data = array ();
while ( $obj = sql_fetch_object ( $res ) ) {
switch ($obj->course_type) {
case 'elearning' :
$course_data ['elearning'] [$obj->idCourse] = $obj;
break;
case 'classroom' :
break;
case 'blended' :
$course_data ['blended'] [$obj->idCourse] = $obj;
break;
}
}


At present, the user popup for User Statistics only displays the date when a course (classroom) was checked as attended. Not the date on which the course took place. Therefore if a course took place on a Saturday, but the LMS is not amended with attendance until the Monday, the date displayed is 2 day incorrect.

Is this in the bug revision list, or should I edit my code and keep a copy?

Thanks in advance.
scubatricky
FormaLms User
Posts: 69
Joined: Wed Oct 21, 2020 11:43 pm

Re: Displaying Classroom Scores in User profile

Post by scubatricky »

Sorry, this is in ProfileLMSController.

I can pull the required stats via SQL into a report, but it seems weird that they're not displayed here also.
Post Reply