skala
Julio Montoya 15 years ago
commit 08ab4ff913
  1. 2
      main/auth/my_progress.php
  2. 2
      main/exercice/exercice_submit.php
  3. 10
      main/exercice/exercise.class.php
  4. 9
      main/exercice/exercise_result.php
  5. 389
      main/inc/lib/tracking.lib.php
  6. 30
      main/inc/local.inc.php
  7. 24
      main/mySpace/index.php
  8. 69
      main/mySpace/myStudents.php
  9. 13
      main/mySpace/myspace.lib.php
  10. 4
      main/tracking/courseLog.php
  11. 3
      main/tracking/exams.php

@ -316,7 +316,7 @@ if (!empty($course_in_session)) {
<td align='center' width=180px >";
if (!empty($last_connection_in_lp)) {
echo $last_connection_in_lp;
echo api_get_utc_datetime($last_connection_in_lp);
} else {
echo '-';
}

@ -652,7 +652,7 @@ if (!empty ($error)) {
</tr>
</table></form>';
}
if ($_configuration['live_exercise_tracking'] && $objExercise->feedbacktype != EXERCISE_FEEDBACK_TYPE_DIRECT) {
if ($objExercise->type == ONE_PER_PAGE) {
if (empty($exercise_stat_info)) {
$objExercise->save_stat_track_exercise_info($clock_expired_time, $safe_lp_id, $safe_lp_item_id, $safe_lp_item_view_id, $questionList);
}

@ -24,7 +24,7 @@ class Exercise {
public $exercise;
public $description;
public $sound;
public $type;
public $type; //ALL_ON_ONE_PAGE or ONE_PER_PAGE
public $random;
public $random_answers;
public $active;
@ -47,7 +47,7 @@ class Exercise {
$this->exercise = '';
$this->description = '';
$this->sound = '';
$this->type = 1;
$this->type = ALL_ON_ONE_PAGE;
$this->random = 0;
$this->random_answers = 0;
$this->active = 1;
@ -112,9 +112,9 @@ class Exercise {
//load questions only for exercises of type 'one question per page'
//this is needed only is there is no questions
//
// @todo not sure were in the code this is used
// @todo not sure were in the code this is used somebody mess with the exercise
global $_configuration, $questionList;
if ($this->type == 2 && $_configuration['live_exercise_tracking'] && $_SERVER['REQUEST_METHOD'] != 'POST' && defined('QUESTION_LIST_ALREADY_LOGGED')) {
if ($this->type == ONE_PER_PAGE && $_configuration['live_exercise_tracking'] && $_SERVER['REQUEST_METHOD'] != 'POST' && defined('QUESTION_LIST_ALREADY_LOGGED')) {
//if(empty($_SESSION['questionList']))
$this->questionList = $questionList;
}
@ -1407,7 +1407,7 @@ class Exercise {
public function save_stat_track_exercise_info($clock_expired_time = 0, $safe_lp_id = 0, $safe_lp_item_id = 0, $safe_lp_item_view_id = 0, $questionList = array()) {
$track_exercises = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
error_log('save_stat_track_exercise_info');
if (empty($safe_lp_id)) {
$safe_lp_id = 0;
}

@ -335,11 +335,10 @@ if (api_is_course_admin() && $origin != 'learnpath') {
$exerciseTitle=text_filter($exerciseTitle);
//show exercise title
?>
<?php if($origin != 'learnpath') {?>
<h2><?php echo Display::return_icon('quiz_big.png', get_lang('Result')).' '; echo $exerciseTitle; ?> : <?php echo get_lang("Result"); ?></h2>
<?php echo $exerciseDescription; ?>
<?php } ?>
if($origin != 'learnpath') {?>
<h2><?php echo Display::return_icon('quiz_big.png', get_lang('Result')).' '; echo $exerciseTitle; ?> : <?php echo get_lang("Result"); ?></h2>
<?php echo $exerciseDescription; ?>
<?php } ?>
<form method="get" action="exercice.php?<?php echo api_get_cidreq() ?>">
<input type="hidden" name="origin" value="<?php echo $origin; ?>" />

@ -336,7 +336,7 @@ class Tracking {
$session_id = intval($session_id);
$condition_session = " AND session_id = $session_id ";
}
$sql = "SELECT count(id) FROM $tbl_course_quiz WHERE active <> -1 $condition_quiz $condition_session";
$sql = "SELECT count(id) FROM $tbl_course_quiz WHERE active <> -1 $condition_quiz ";
$count_quiz = Database::fetch_row(Database::query($sql));
$quiz_avg_total_score = 0;
@ -349,17 +349,17 @@ class Tracking {
}
$sql = "SELECT SUM(exe_result/exe_weighting*100) as avg_score, COUNT(*) as num_attempts
FROM $tbl_stats_exercise
WHERE exe_exo_id IN (SELECT id FROM $tbl_course_quiz WHERE active <> -1 $condition_quiz $condition_session)
WHERE exe_exo_id IN (SELECT id FROM $tbl_course_quiz WHERE active <> -1 $condition_quiz)
$condition_user
AND orig_lp_id = 0
AND exe_cours_id = '$course_code'
AND orig_lp_item_id = 0
AND orig_lp_item_id = 0 $condition_session
ORDER BY exe_date DESC";
$res = Database::query($sql);
$row = Database::fetch_array($res);
$quiz_avg_score = 0;
if (!empty($row['avg_score'])) {
$quiz_avg_score = round($row['avg_score'],2);
$quiz_avg_score = round($row['avg_score'],1);
}
if(!empty($row['num_attempts'])) {
$quiz_avg_score = $quiz_avg_score / $row['num_attempts'];
@ -511,60 +511,66 @@ class Tracking {
*/
public static function get_avg_student_score($student_id, $course_code, $lp_ids=array(), $session_id = null, $return_array = false) {
// get global tables names
$course_table = Database :: get_main_table(TABLE_MAIN_COURSE);
$course_user_table = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
$table_session_course_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$tbl_stats_exercices = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$tbl_stats_attempts = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
// get global tables names
$course_table = Database :: get_main_table(TABLE_MAIN_COURSE);
$course_user_table = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
$table_session_course_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$tbl_stats_exercices = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$tbl_stats_attempts = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$course = CourseManager :: get_course_information($course_code);
$course = CourseManager :: get_course_information($course_code);
if (!empty($course['db_name'])) {
if (!empty($course['db_name'])) {
// get course tables names
$tbl_quiz_questions = Database :: get_course_table(TABLE_QUIZ_QUESTION,$course['db_name']);
$lp_table = Database :: get_course_table(TABLE_LP_MAIN,$course['db_name']);
$lp_item_table = Database :: get_course_table(TABLE_LP_ITEM,$course['db_name']);
$lp_view_table = Database :: get_course_table(TABLE_LP_VIEW,$course['db_name']);
$lp_item_view_table = Database :: get_course_table(TABLE_LP_ITEM_VIEW,$course['db_name']);
$tbl_quiz_questions = Database :: get_course_table(TABLE_QUIZ_QUESTION,$course['db_name']);
$lp_table = Database :: get_course_table(TABLE_LP_MAIN,$course['db_name']);
$lp_item_table = Database :: get_course_table(TABLE_LP_ITEM,$course['db_name']);
$lp_view_table = Database :: get_course_table(TABLE_LP_VIEW,$course['db_name']);
$lp_item_view_table = Database :: get_course_table(TABLE_LP_ITEM_VIEW,$course['db_name']);
// Compose a filter based on optional learning paths list given
// Compose a filter based on optional learning paths list given
$condition_lp = "";
if(count($lp_ids) > 0) {
$condition_lp =" WHERE id IN(".implode(',',$lp_ids).") ";
}
$condition_lp = "";
if(count($lp_ids) > 0) {
$condition_lp =" AND id IN(".implode(',',$lp_ids).") ";
}
// Compose a filter based on optional session id
$condition_session = "";
if (isset($session_id)) {
$session_id = intval($session_id);
if (count($lp_ids) > 0) {
$condition_session = " AND session_id = $session_id ";
} else {
$condition_session = " WHERE session_id = $session_id ";
}
}
// Compose a filter based on optional session id
$condition_session = "";
if (isset($session_id)) {
$session_id = intval($session_id);
if (count($lp_ids) > 0) {
$condition_session = " AND session_id = $session_id ";
} else {
$condition_session = " WHERE session_id = $session_id ";
}
}
// Check the real number of LPs corresponding to the filter in the
// database (and if no list was given, get them all)
//$res_row_lp = Database::query("SELECT DISTINCT(id) FROM $lp_table $condition_lp $condition_session");
$res_row_lp = Database::query("SELECT DISTINCT(id) FROM $lp_table $condition_lp");
$count_row_lp = Database::num_rows($res_row_lp);
$lp_list = array();
while ($row_lp = Database::fetch_array($res_row_lp)) {
$lp_list[] = $row_lp[0];
}
if (empty($session_id)) {
$sql = "SELECT DISTINCT(id) FROM $lp_table WHERE session_id = 0 $condition_lp ";
} else {
$sql = "SELECT DISTINCT(id) FROM $lp_table WHERE 1 $condition_lp ";
}
$res_row_lp = Database::query($sql);
$count_row_lp = Database::num_rows($res_row_lp);
$lp_list = array();
while ($row_lp = Database::fetch_array($res_row_lp)) {
$lp_list[] = $row_lp[0];
}
// Init local variables that will be used through the calculation
$lp_scorm_score_total = 0;
$lp_scorm_result_score_total = 0;
// Init local variables that will be used through the calculation
$lp_scorm_score_total = 0;
$lp_scorm_result_score_total = 0;
$lp_scorm_loop=0;
$lp_count = 0;
$progress = 0;
$lp_scorm_loop=0;
$lp_count = 0;
$progress = 0;
// prepare filter on users
// prepare filter on users
$condition_user1 = "";
if (is_array($student_id)) {
array_walk($student_id,'intval');
@ -572,168 +578,157 @@ class Tracking {
} else {
$condition_user1 =" AND user_id = '$student_id' ";
}
//var_dump($student_id);
if ($count_row_lp>0 && !empty($student_id)) {
// Getting the total count of LP
//$sql = "SELECT count(id) as count FROM $lp_table WHERE session_id = ".$session_id;
$sql = "SELECT count(id) as count FROM $lp_table ";
$my_res = Database::query($sql);
$my_row = Database::fetch_array($my_res);
$count_views = $my_row['count'];
$rs_last_lp_view_id = Database::query($sql);
// Get all views through learning paths filter
$sql = "SELECT MAX(view_count) as vc, id, progress, lp_id, user_id ".
"FROM $lp_view_table ".
"WHERE lp_id IN (".implode(',',$lp_list).") ".
"$condition_user1 AND session_id= $session_id GROUP BY lp_id,user_id";
$rs_last_lp_view_id = Database::query($sql);
$global_count_item = 0;
$real_count_views = 0 ;
$global_result = 0;
if (Database::num_rows($rs_last_lp_view_id) > 0) {
// Cycle through each line of the results (grouped by lp_id, user_id)
while ($row_lp_view = Database::fetch_array($rs_last_lp_view_id)) {
$lp_view_id = $row_lp_view['id'];
$progress = $row_lp_view['progress'];
$lp_id = $row_lp_view['lp_id'];
$user_id = $row_lp_view['user_id'];
// For the currently analysed view, get the score and
// max_score of each item if it is a sco or a TOOL_QUIZ
$sql_max_score = "SELECT lp_iv.score as score,lp_i.max_score, lp_i.path, lp_i.item_type , lp_i.id as iid".
" FROM $lp_item_view_table as lp_iv ".
" INNER JOIN $lp_item_table as lp_i ".
" ON lp_i.id = lp_iv.lp_item_id ".
" AND (lp_i.item_type='sco' ".
" OR lp_i.item_type='".TOOL_QUIZ."') ".
" WHERE lp_view_id='$lp_view_id'";
//echo $sql_max_score; echo '<br />';
$res_max_score = Database::query($sql_max_score);
$count_total_loop = 0;
$num_rows_max_score = Database::num_rows($res_max_score);
// Go through each scorable element of this view
$count_items = 0;
$lp_partial_total = 0;
$score_of_scorm_calculate = 0;
while ($row_max_score = Database::fetch_array($res_max_score)) {
$max_score = $row_max_score['max_score'];
$score = $row_max_score['score'];
//var_dump($student_id);
if ($count_row_lp>0 && !empty($student_id)) {
// Get all views through learning paths filter
$sql = "SELECT MAX(view_count) as vc, id, progress, lp_id, user_id ".
"FROM $lp_view_table ".
"WHERE lp_id IN (".implode(',',$lp_list).") ".
"$condition_user1 AND session_id= $session_id GROUP BY lp_id,user_id";
//var_dump( $sql );
$rs_last_lp_view_id = Database::query($sql);
$global_count_item = 0;
$global_result = 0;
if (Database::num_rows($rs_last_lp_view_id) > 0) {
// Cycle through each line of the results (grouped by lp_id, user_id)
while ($row_lp_view = Database::fetch_array($rs_last_lp_view_id)) {
$lp_view_id = $row_lp_view['id'];
$progress = $row_lp_view['progress'];
$lp_id = $row_lp_view['lp_id'];
$user_id = $row_lp_view['user_id'];
// For the currently analysed view, get the score and
// max_score of each item if it is a sco or a TOOL_QUIZ
$sql_max_score = "SELECT lp_iv.score as score,lp_i.max_score, lp_i.path, lp_i.item_type , lp_i.id as iid".
" FROM $lp_item_view_table as lp_iv ".
" INNER JOIN $lp_item_table as lp_i ".
" ON lp_i.id = lp_iv.lp_item_id ".
" AND (lp_i.item_type='sco' ".
" OR lp_i.item_type='".TOOL_QUIZ."') ".
" WHERE lp_view_id='$lp_view_id'";
//echo $sql_max_score; echo '<br />';
$res_max_score = Database::query($sql_max_score);
$count_total_loop = 0;
$num_rows_max_score = Database::num_rows($res_max_score);
// Go through each scorable element of this view
$count_items = 0;
$lp_partial_total = 0;
$score_of_scorm_calculate = 0;
while ($row_max_score = Database::fetch_array($res_max_score,'ASSOC')) {
$max_score = $row_max_score['max_score'];
$score = $row_max_score['score'];
if ($row_max_score['item_type'] == 'sco') {
// Check if it is sco (easier to get max_score)
//when there's no max score, we assume 100 as the max score, as the SCORM 1.2 says that the value should always be between 0 and 100.
if ($max_score==0) {
$max_score = 100;
}
$lp_scorm_result_score_total += ($score/$max_score);
$lp_partial_total += ($score/$max_score);
$current_value = $score/$max_score;
//when there's no max score, we assume 100 as the max score, as the SCORM 1.2 says that the value should always be between 0 and 100.
if ($max_score==0) {
$max_score = 100;
}
$lp_scorm_result_score_total += $score/$max_score;
$lp_partial_total += $score/$max_score;
$current_value = $score/$max_score;
} else {
// Case of a TOOL_QUIZ element
$item_id = $row_max_score['iid'];
$item_path = $row_max_score['path'];
// Case of a TOOL_QUIZ element
$item_id = $row_max_score['iid'];
$item_path = $row_max_score['path'];
// Get last attempt to this exercise through
// the current lp for the current user
$sql_last_attempt = "SELECT exe_id FROM $tbl_stats_exercices ".
" WHERE exe_exo_id = '$item_path' ".
" AND exe_user_id = '$user_id' ".
// " AND orig_lp_id = '$lp_id' ". //lp_id is already defined by the item_id
" AND orig_lp_item_id = '$item_id' ".
" AND exe_cours_id = '$course_code' ".
" ORDER BY exe_date DESC limit 1";
$result_last_attempt = Database::query($sql_last_attempt);
$num = Database :: num_rows($result_last_attempt);
if ($num > 0 ) {
" WHERE exe_exo_id = '$item_path' ".
" AND exe_user_id = '$user_id' ".
// " AND orig_lp_id = '$lp_id' ". //lp_id is already defined by the item_id
" AND orig_lp_item_id = '$item_id' ".
" AND exe_cours_id = '$course_code' AND session_id = $session_id".
" ORDER BY exe_date DESC limit 1";
$result_last_attempt = Database::query($sql_last_attempt);
$num = Database :: num_rows($result_last_attempt);
if ($num > 0 ) {
$id_last_attempt = Database :: result($result_last_attempt, 0, 0);
// Within the last attempt number tracking, get the sum of
// the max_scores of all questions that it was
// made of (we need to make this call dynamic
// because of random questions selection)
$sql = "SELECT SUM(t.ponderation) as maxscore ".
" FROM ( SELECT distinct question_id, marks, ponderation ".
" FROM $tbl_stats_attempts AS at " .
" INNER JOIN $tbl_quiz_questions AS q ".
" ON (q.id = at.question_id) ".
" WHERE exe_id ='$id_last_attempt' ) AS t";
$res_max_score_bis = Database::query($sql);
$row_max_score_bis = Database :: fetch_array($res_max_score_bis);
if (!empty($row_max_score_bis['maxscore'])) {
$max_score = $row_max_score_bis['maxscore'];
}
$lp_scorm_result_score_total += ($score/$max_score);
$lp_partial_total += ($score/$max_score);
//echo '<br>'; echo $lp_scorm_result_score_total.' - '."$score/$max_score"; echo '<br>';
//echo $lp_scorm_result_score_total;
//var_dump($score,$max_score);
$current_value = $score/$max_score;
} else {
//$lp_scorm_result_score_total += 0;
}
}
$count_items++;
} //end while
$global_count_item +=$count_items;
//echo 'lp_view '.$lp_view_id.' - $count_items '.$count_items.' lp partiual '.$lp_partial_total.'- <br />';
$score_of_scorm_calculate += $count_items?round((($lp_partial_total/$count_items)*100),2):0;
$global_result += $score_of_scorm_calculate;
$real_count_views++;
} // end while
/*echo '<br>$lp_scorm_result_score_total:'.($global_result); echo '<br>';
echo ("lp score :".($score_of_scorm_calculate));
echo '<br>'; */
}
if ($real_count_views == 1) {
$count_views = 1;
}
// Within the last attempt number tracking, get the sum of
// the max_scores of all questions that it was
// made of (we need to make this call dynamic
// because of random questions selection)
$sql = "SELECT SUM(t.ponderation) as maxscore ".
" FROM ( SELECT distinct question_id, marks, ponderation ".
" FROM $tbl_stats_attempts AS at " .
" INNER JOIN $tbl_quiz_questions AS q ".
" ON (q.id = at.question_id) ".
" WHERE exe_id ='$id_last_attempt' ) AS t";
$res_max_score_bis = Database::query($sql);
$row_max_score_bis = Database :: fetch_array($res_max_score_bis);
if (!empty($row_max_score_bis['maxscore'])) {
$max_score = $row_max_score_bis['maxscore'];
}
$lp_scorm_result_score_total += ($score/$max_score);
$lp_partial_total += ($score/$max_score);
//echo '<br>'; echo $lp_scorm_result_score_total.' - '."$score/$max_score"; echo '<br>';
//echo $lp_scorm_result_score_total;
//var_dump($score,$max_score);
$current_value = $score/$max_score;
} else {
//$lp_scorm_result_score_total += 0;
}
}
$count_items++;
} //end while
$global_count_item +=$count_items;
//echo 'lp_view '.$lp_view_id.' - $count_items '.$count_items.' lp partiual '.$lp_partial_total.' <br />';
$score_of_scorm_calculate += $count_items?(($lp_partial_total/$count_items)*100):0;
// var_dump($score_of_scorm_calculate);
$global_result += $score_of_scorm_calculate;
} // end while
/*echo '<br>$lp_scorm_result_score_total:'.($global_result); echo '<br>';
echo ("lp score :".($score_of_scorm_calculate));
echo '<br>';*/
}
$lp_with_quiz = 0;
$total_lp = 0;
$lp_with_quiz = 0;
$total_lp = 0;
//var_dump($lp_list);
foreach($lp_list as $lp_id) {
//check if LP have a score
$sql = "SELECT count(id) as count FROM $lp_item_table
WHERE item_type = 'quiz' AND lp_id = ".$lp_id." ";
$result_have_quiz = Database::query($sql);
if (Database::num_rows($result_have_quiz) > 0 ) {
$row = Database::fetch_array($result_have_quiz,'ASSOC');
if (is_numeric($row['count']) && $row['count'] != 0) {
$lp_with_quiz ++;
}
}
$total_lp ++;
}
//var_dump($lp_with_quiz);
if ($lp_with_quiz != 0 ) {
if (!$return_array) {
$score_of_scorm_calculate = round(($global_result/$lp_with_quiz),2);
return $score_of_scorm_calculate;
} else {
return array($global_result, $lp_with_quiz);
}
} else {
return '-';
}
foreach($lp_list as $lp_id) {
//check if LP have a score
$sql = "SELECT count(id) as count FROM $lp_item_table
WHERE item_type = 'quiz' AND lp_id = ".$lp_id." ";
$result_have_quiz = Database::query($sql);
if (Database::num_rows($result_have_quiz) > 0 ) {
$row = Database::fetch_array($result_have_quiz,'ASSOC');
if (is_numeric($row['count']) && $row['count'] != 0) {
$lp_with_quiz ++;
}
}
$total_lp ++;
}
//var_dump($lp_with_quiz);
if ($lp_with_quiz != 0 ) {
if (!$return_array) {
//var_dump($global_result,$lp_with_quiz );
$score_of_scorm_calculate = round(($global_result/$lp_with_quiz),2);
return $score_of_scorm_calculate;
} else {
return array($global_result, $lp_with_quiz);
}
} else {
return '-';
}
}
}
return null;
}
}
}
return null;
}
/**

@ -777,10 +777,6 @@ if (isset($uidReset) && $uidReset) { // session data refresh requested
/* COURSE INIT */
if (isset($cidReset) && $cidReset) { // course session data refresh requested or empty data
if (api_get_session_id()) {
api_session_unregister('id_session');
}
if ($cidReq) {
$course_table = Database::get_main_table(TABLE_MAIN_COURSE);
@ -890,11 +886,10 @@ if (isset($cidReset) && $cidReset) { // course session data refresh requested or
//We select the last record for the current course in the course tracking table
// But only if the login date is < thant now + max_life_time
$sql="SELECT course_access_id FROM $course_tracking_table
WHERE user_id=".intval($_user ['user_id'])."
AND course_code='$course_code'
WHERE user_id=".intval($_user ['user_id'])."
AND course_code='$course_code' AND session_id = ".api_get_session_id()."
AND login_course_date > now() - INTERVAL $session_lifetime SECOND
ORDER BY login_course_date DESC LIMIT 0,1";
$result=Database::query($sql);
@ -903,16 +898,12 @@ if (isset($cidReset) && $cidReset) { // course session data refresh requested or
$i_course_access_id = Database::result($result,0,0);
//We update the course tracking table
$sql="UPDATE $course_tracking_table " .
"SET logout_course_date = '$time', " .
"counter = counter+1 " .
"WHERE course_access_id=".intval($i_course_access_id);
$sql="UPDATE $course_tracking_table SET logout_course_date = '$time', counter = counter+1 ".
"WHERE course_access_id=".intval($i_course_access_id)." AND session_id = ".api_get_session_id();
Database::query($sql);
} else {
$sql="INSERT INTO $course_tracking_table
(course_code, user_id, login_course_date, logout_course_date, counter)" .
"VALUES('".$course_code."', '".$_user['user_id']."', '$time', '$time', '1')";
$sql="INSERT INTO $course_tracking_table (course_code, user_id, login_course_date, logout_course_date, counter, session_id)" .
"VALUES('".$course_code."', '".$_user['user_id']."', '$time', '$time', '1','".api_get_session_id()."')";
Database::query($sql);
}
}
@ -1184,4 +1175,11 @@ if (isset($_cid)) {
$time = api_get_datetime();
$sql="UPDATE $tbl_course SET last_visit= '$time' WHERE code='$_cid'";
Database::query($sql);
}
//Deleting session id
if (isset($cidReset) && $cidReset) {
if (api_get_session_id()) {
api_session_unregister('id_session');
}
}

@ -63,9 +63,7 @@ $tbl_admin = Database :: get_main_table(TABLE_MAIN_ADMIN);
$tbl_track_cours_access = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
/*
* FUNCTIONS
*/
/* * FUNCTIONS */
function count_teacher_courses() {
global $nb_teacher_courses;
@ -108,9 +106,7 @@ function rsort_sessions($a, $b) {
}
}
/*
* MAIN CODE
*/
/* * MAIN CODE */
$is_coach = api_is_coach();
$is_platform_admin = api_is_platform_admin();
@ -162,10 +158,9 @@ if (api_is_allowed_to_create_course() && $_GET['display'] != 'yourstudents') {
} else {
if (!empty($session_id)) {
$session_name = api_get_session_name($session_id);
$title = ucfirst($session_name);
$title = get_lang('Session').' '.$session_name;
}
$menu_items[] = '<a href="'.api_get_self().'?view=teacher">'.get_lang('TeacherInterface').'</a>';
$menu_items[] = '<a href="'.api_get_self().'?view=teacher">'.get_lang('TeacherInterface').'</a>';
}
}
}
@ -178,13 +173,11 @@ if ($is_coach && $_GET['display'] != 'yourstudents') {
$menu_items[] = get_lang('CoachInterface');
$title = get_lang('YourStatistics');
} else {
$menu_items[] = '<a href="'.api_get_self().'?view=coach">'.get_lang('CoachInterface').'</a>';
$menu_items[] = '<a href="'.api_get_self().'?view=coach">'.get_lang('CoachInterface').'</a>';
}
}
if ($is_platform_admin && $_GET['display'] != 'yourstudents') {
if ($nb_teacher_courses == 0 && $nb_sessions == 0) {
$view = 'admin';
}
@ -210,8 +203,7 @@ if ($is_drh || $_GET['display'] == 'yourstudents') {
// Actions menu
$nb_menu_items = count($menu_items);
if ($nb_teacher_courses > 0 ) {
if ($nb_teacher_courses > 0 ) {
echo '<div class="actions" style ="font-size:10pt;">';
if (empty($session_id)) {
if ($nb_menu_items > 1) {
@ -239,7 +231,7 @@ if ($nb_teacher_courses > 0 ) {
}
echo '<h2>'.get_lang('Session').' '.$title.'</h2>';
echo '<h2>'.$title.'</h2>';
if (($is_drh && $view == 'drh') || $_GET['display'] == 'yourstudents') {
// get data for human resources manager
@ -457,7 +449,7 @@ if ($view == 'coach') {
$csv_content[] = array(get_lang('NbStudentPerSession', '').';'.$nb_students_per_session);
$csv_content[] = array(get_lang('NbCoursesPerSession', '').';'.$nb_courses_per_session);
$csv_content[] = array();
} else {
} else {
// html part
echo '
<div class="report_section">

@ -507,20 +507,11 @@ if ($timezone !== null) {
<td align="left"><?php echo $time_spent_on_the_course ?></td>
</tr>
<tr>
<td align="right">
<?php
echo get_lang('Progress');
Display :: display_icon('info3.gif', get_lang('ScormAndLPProgressTotalAverage'), array ('align' => 'absmiddle', 'hspace' => '3px'));
?>
</td>
<td align="right"><?php echo get_lang('Progress'); Display :: display_icon('info3.gif', get_lang('ScormAndLPProgressTotalAverage'), array ('align' => 'absmiddle', 'hspace' => '3px'));?></td>
<td align="left"><?php echo $avg_student_progress.'%' ?></td>
</tr>
<tr>
<td align="right">
<?php
echo get_lang('Score');
Display :: display_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array ('align' => 'absmiddle', 'hspace' => '3px'));
?>
<td align="right"><?php echo get_lang('Score'); Display :: display_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array ('align' => 'absmiddle', 'hspace' => '3px')); ?>
</td>
<td align="left"><?php if (is_numeric($avg_student_score)) { echo $avg_student_score.'%';} else { echo $avg_student_score ;} ?></td>
</tr>
@ -548,31 +539,31 @@ if ($timezone !== null) {
?>
<br />
<!-- line about learnpaths -->
<table class="data_table">
<tr>
<th>
<?php echo get_lang('Learnpaths');?>
</th>
<th>
<?php echo get_lang('Time'); Display :: display_icon('info3.gif', get_lang('TotalTimeByCourse'), array ('align' => 'absmiddle', 'hspace' => '3px')); ?>
</th>
<th>
<?php echo get_lang('Score'); Display :: display_icon('info3.gif', get_lang('LPTestScore'), array ( 'align' => 'absmiddle', 'hspace' => '3px')); ?>
</th>
<th>
<?php echo get_lang('Progress'); Display :: display_icon('info3.gif', get_lang('LPProgressScore'), array ('align' => 'absmiddle','hspace' => '3px')); ?>
</th>
<th>
<?php echo get_lang('LastConnexion'); Display :: display_icon('info3.gif', get_lang('LastTimeTheCourseWasUsed'), array ('align' => 'absmiddle','hspace' => '3px')); ?>
</th>
<?php
echo '<th>'.get_lang('Details').'</th>';
if (api_is_course_admin()) {
echo '<th>'.get_lang('ResetLP').'</th>';
}
?>
</tr>
<!-- line about learnpaths -->
<table class="data_table">
<tr>
<th>
<?php echo get_lang('Learnpaths');?>
</th>
<th>
<?php echo get_lang('Time'); Display :: display_icon('info3.gif', get_lang('TotalTimeByCourse'), array ('align' => 'absmiddle', 'hspace' => '3px')); ?>
</th>
<th>
<?php echo get_lang('Score'); Display :: display_icon('info3.gif', get_lang('LPTestScore'), array ( 'align' => 'absmiddle', 'hspace' => '3px')); ?>
</th>
<th>
<?php echo get_lang('Progress'); Display :: display_icon('info3.gif', get_lang('LPProgressScore'), array ('align' => 'absmiddle','hspace' => '3px')); ?>
</th>
<th>
<?php echo get_lang('LastConnexion'); Display :: display_icon('info3.gif', get_lang('LastTimeTheCourseWasUsed'), array ('align' => 'absmiddle','hspace' => '3px')); ?>
</th>
<?php
echo '<th>'.get_lang('Details').'</th>';
if (api_is_course_admin()) {
echo '<th>'.get_lang('ResetLP').'</th>';
}
?>
</tr>
<?php
$headerLearnpath = array (
get_lang('Learnpath'),
@ -597,7 +588,11 @@ if ($timezone !== null) {
//
//$sql_lp = " SELECT lp.name, lp.id FROM $t_lp lp WHERE lp.session_id = $session_id ORDER BY lp.display_order";
$sql_lp = " SELECT lp.name, lp.id FROM $t_lp lp ORDER BY lp.display_order";
if (empty($session_id)) {
$sql_lp = " SELECT lp.name, lp.id FROM $t_lp lp WHERE session_id = 0 ORDER BY lp.display_order";
} else {
$sql_lp = " SELECT lp.name, lp.id FROM $t_lp lp ORDER BY lp.display_order";
}
$rs_lp = Database::query($sql_lp);
$token = Security::get_token();

@ -1272,12 +1272,13 @@ class MySpace {
if (count($users) > 0) {
$nb_students_in_course = count($users);
$avg_assignments_in_course = Tracking::count_student_assignments($users, $course_code, $session_id);
$avg_messages_in_course = Tracking::count_student_messages($users, $course_code, $session_id);
$avg_progress_in_course = Tracking::get_avg_student_progress($users, $course_code, array(), $session_id);
$avg_score_in_course = Tracking :: get_avg_student_score($users, $course_code, array(), $session_id);
$avg_score_in_exercise = Tracking::get_avg_student_exercise_score($users, $course_code, 0, $session_id);
$avg_time_spent_in_course = Tracking::get_time_spent_on_the_course($users, $course_code, $session_id);
$avg_assignments_in_course = Tracking::count_student_assignments($users, $course_code, $session_id);
$avg_messages_in_course = Tracking::count_student_messages($users, $course_code, $session_id);
$avg_progress_in_course = Tracking::get_avg_student_progress($users, $course_code, array(), $session_id);
$avg_score_in_course = Tracking::get_avg_student_score($users, $course_code, array(), $session_id);
$avg_score_in_exercise = Tracking::get_avg_student_exercise_score($users, $course_code, 0, $session_id);
$avg_time_spent_in_course = Tracking::get_time_spent_on_the_course($users, $course_code, $session_id);
$avg_progress_in_course = round($avg_progress_in_course / $nb_students_in_course, 2);
if (is_numeric($avg_score_in_course)) {

@ -156,7 +156,9 @@ if ($_GET['studentlist'] == 'false') {
echo ' | <a href="exams.php?'.api_get_cidreq().'">'.get_lang('ExamTracking').'</a>&nbsp;';
} elseif($_GET['studentlist'] == '' || $_GET['studentlist'] == 'true') {
echo '&nbsp;<a href="javascript: window.back();" ">'.Display::return_icon('back.png', get_lang('Back')).get_lang('Back').'</a>';
if (!empty($_GET['from'])) {
echo '&nbsp;<a href="javascript: window.back();" ">'.Display::return_icon('back.png', get_lang('Back')).get_lang('Back').'</a>';
}
/*
echo get_lang('StudentsTracking').' | ';

@ -8,6 +8,9 @@ require_once api_get_path(LIBRARY_PATH).'course.lib.php';
require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
require_once api_get_path(LIBRARY_PATH).'pear/Spreadsheet_Excel_Writer/Writer.php';
$this_section = SECTION_TRACKING;
$is_allowedToTrack = $is_courseAdmin || $is_platformAdmin || $is_courseCoach || $is_sessionAdmin;
if(!$is_allowedToTrack) {

Loading…
Cancel
Save