diff --git a/main/document/create_document.php b/main/document/create_document.php
index 7cc7d662a2..e0e60cddbd 100755
--- a/main/document/create_document.php
+++ b/main/document/create_document.php
@@ -22,12 +22,11 @@ var hide_bar = function() {
}
$(document).ready(function() {
- $(".scrollbar-macosx").scrollbar();
+ $(".scrollbar-light").scrollbar();
if ($(window).width() <= 785 ) {
hide_bar();
- }
-
+ }
$("#hide_bar_template").click(function() {
@@ -445,7 +444,7 @@ if ($form->validate()) {
$values = $form->exportValues();
$readonly = isset($values['readonly']) ? 1 : 0;
$values['title'] = trim($values['title']);
-
+
if (!empty($values['dirValue'])) {
$dir = $values['dirValue'];
}
@@ -617,9 +616,9 @@ if ($form->validate()) {
$actionsLeft = ''.
Display::return_icon('back.png',get_lang('Back').' '.get_lang('To').' '.get_lang('DocumentsOverview'),'',ICON_SIZE_MEDIUM).'';
}
-
+
echo $toolbar = Display::toolbarAction('actions-documents', array(0 => $actionsLeft, 1 => ''));
-
+
if ($is_certificate_mode) {
$all_information_by_create_certificate = DocumentManager::get_all_info_to_certificate(api_get_user_id(), api_get_course_id());
@@ -636,7 +635,7 @@ if ($form->validate()) {
diff --git a/main/document/edit_document.php b/main/document/edit_document.php
index c0dddca45f..ade0fefaac 100755
--- a/main/document/edit_document.php
+++ b/main/document/edit_document.php
@@ -38,7 +38,7 @@ var hide_bar = function() {
}
$(document).ready(function() {
- $(".scrollbar-macosx").scrollbar();
+ $(".scrollbar-light").scrollbar();
if ($(window).width() <= 785 ) {
hide_bar();
@@ -537,7 +537,7 @@ if ($owner_id == api_get_user_id() ||
diff --git a/main/exercice/exercise.class.php b/main/exercice/exercise.class.php
index 1a0b93bb88..18a011ac3e 100755
--- a/main/exercice/exercise.class.php
+++ b/main/exercice/exercise.class.php
@@ -132,6 +132,7 @@ class Exercise
$id = intval($id);
if (empty($this->course_id)) {
+
return false;
}
$sql = "SELECT * FROM $TBL_EXERCISES WHERE c_id = ".$this->course_id." AND id = ".$id;
@@ -5797,10 +5798,10 @@ class Exercise
*/
private function setMediaList($questionList)
{
- $mediaList= array();
+ $mediaList = array();
if (!empty($questionList)) {
foreach ($questionList as $questionId) {
- $objQuestionTmp = Question::read($questionId);
+ $objQuestionTmp = Question::read($questionId, $this->course_id);
// If a media question exists
if (isset($objQuestionTmp->parent_id) && $objQuestionTmp->parent_id != 0) {
diff --git a/main/gradebook/lib/GradebookUtils.php b/main/gradebook/lib/GradebookUtils.php
index f2adf79988..5999b65407 100644
--- a/main/gradebook/lib/GradebookUtils.php
+++ b/main/gradebook/lib/GradebookUtils.php
@@ -369,11 +369,12 @@ class GradebookUtils
/**
* Checks if a resource is in the unique gradebook of a given course
- * @param string Course code
- * @param int Resource type (use constants defined in linkfactory.class.php)
- * @param int Resource ID in the corresponding tool
- * @param int Session ID (optional - 0 if not defined)
- * @return int false on error or array of resource
+ * @param string $course_code Course code
+ * @param int $resource_type Resource type (use constants defined in linkfactory.class.php)
+ * @param int $resource_id Resource ID in the corresponding tool
+ * @param int $session_id Session ID (optional - 0 if not defined)
+ *
+ * @return array false on error or array of resource
*/
public static function is_resource_in_course_gradebook($course_code, $resource_type, $resource_id, $session_id = 0)
{
@@ -390,6 +391,7 @@ class GradebookUtils
return false;
}
$row = Database::fetch_array($res, 'ASSOC');
+
return $row;
}
@@ -769,7 +771,7 @@ class GradebookUtils
$row = Database::fetch_array($res);
$category_id = $row['id'];
}
-
+
return $category_id;
}
diff --git a/main/gradebook/lib/be/category.class.php b/main/gradebook/lib/be/category.class.php
index 4a9cec84cd..4d20dad52c 100755
--- a/main/gradebook/lib/be/category.class.php
+++ b/main/gradebook/lib/be/category.class.php
@@ -897,6 +897,8 @@ class Category implements GradebookItem
if (!empty($cats)) {
/** @var Category $cat */
foreach ($cats as $cat) {
+ $cat->set_session_id($session_id);
+ $cat->set_course_code($course_code);
$cat->setStudentList($this->getStudentList());
$score = $cat->calc_score(
$stud_id,
@@ -2299,5 +2301,4 @@ class Category implements GradebookItem
{
$this->studentList = $list;
}
-
}
diff --git a/main/gradebook/lib/be/exerciselink.class.php b/main/gradebook/lib/be/exerciselink.class.php
index ad5f0aa551..aeea7bcc5d 100755
--- a/main/gradebook/lib/be/exerciselink.class.php
+++ b/main/gradebook/lib/be/exerciselink.class.php
@@ -173,7 +173,8 @@ class ExerciseLink extends AbstractLink
exe_exo_id = ".(int)$this->get_ref_id();
$result = Database::query($sql);
$number=Database::fetch_row($result);
- return ($number[0] != 0);
+
+ return $number[0] != 0;
}
/**
@@ -192,7 +193,7 @@ class ExerciseLink extends AbstractLink
/* the following query should be similar (in conditions) to the one used
in exercice/exercice.php, look for note-query-exe-results marker*/
- $session_id = api_get_session_id();
+ $session_id = $this->get_session_id();
$courseId = $this->getCourseId();
$exercise = new Exercise($courseId);
$exercise->read($this->get_ref_id());
@@ -207,8 +208,8 @@ class ExerciseLink extends AbstractLink
orig_lp_item_id = 0 AND
status <> 'incomplete' AND
session_id = $session_id AND
- c_id = $courseId
- ";
+ c_id = $courseId
+ ";
} else {
$lpId = null;
if (!empty($exercise->lpList)) {
@@ -223,8 +224,8 @@ class ExerciseLink extends AbstractLink
orig_lp_id = $lpId AND
status <> 'incomplete' AND
session_id = $session_id AND
- c_id = $courseId
- ";
+ c_id = $courseId
+ ";
}
if (!empty($stud_id) && $type != 'ranking') {
diff --git a/main/gradebook/lib/fe/resulttable.class.php b/main/gradebook/lib/fe/resulttable.class.php
index 45952de2ef..1ee6993a88 100755
--- a/main/gradebook/lib/fe/resulttable.class.php
+++ b/main/gradebook/lib/fe/resulttable.class.php
@@ -166,7 +166,7 @@ class ResultTable extends SortableTable
if ($doc_url != null) {
$edit_column .= ' ';
- $edit_column .= Display::return_icon('link.gif', get_lang('OpenDocument').'';
+ $edit_column .= Display::return_icon('link.gif', get_lang('OpenDocument')).'';
}
}
diff --git a/main/inc/lib/api.lib.php b/main/inc/lib/api.lib.php
index 9b8186736c..74b3f46a0e 100644
--- a/main/inc/lib/api.lib.php
+++ b/main/inc/lib/api.lib.php
@@ -8046,6 +8046,15 @@ function api_mail_html(
// Send the mail message.
if (!$mail->Send()) {
error_log('ERROR: mail not sent to '.$recipient_name.' ('.$recipient_email.') because of '.$mail->ErrorInfo.'
');
+ if ($mail->SMTPDebug) {
+ error_log(
+ "Connection details :: " .
+ "Protocol: " . $mail->Mailer . ' :: ' .
+ "Host/Port: " . $mail->Host . ':' . $mail->Port . ' :: ' .
+ "Authent/Open: " . ($mail->SMTPAuth?'Authent':'Open') . ' :: ' .
+ ($mail->SMTPAuth?" User/Pass: " . $mail->Username . ':' . $mail->Password:'')
+ );
+ }
return 0;
}
diff --git a/main/inc/lib/pear/Pager/Sliding.php b/main/inc/lib/pear/Pager/Sliding.php
index 9dbbdbe101..d6014180fe 100755
--- a/main/inc/lib/pear/Pager/Sliding.php
+++ b/main/inc/lib/pear/Pager/Sliding.php
@@ -49,8 +49,6 @@
*/
class Pager_Sliding extends Pager_Common
{
- // {{{ Pager_Sliding()
-
/**
* Constructor
*
@@ -58,7 +56,7 @@ class Pager_Sliding extends Pager_Common
*
* @access public
*/
- function Pager_Sliding($options = array())
+ public function __construct($options = array())
{
//set default Pager_Sliding options
$this->_delta = 2;
diff --git a/main/inc/lib/sessionmanager.lib.php b/main/inc/lib/sessionmanager.lib.php
index e61b57ecc7..5e1ebc8430 100755
--- a/main/inc/lib/sessionmanager.lib.php
+++ b/main/inc/lib/sessionmanager.lib.php
@@ -1255,9 +1255,7 @@ class SessionManager
$result = Database::query($sql);
$session = Database::fetch_assoc($result);
- //We are not using this becaouse the range its to small and no other date match the condition of this function
- //$clicks = Tracking::get_total_clicks($info['user_id'], $courseId, $sessionId, $info['login_course_date'], $info['logout_course_date']);
- #building array to display
+ // building array to display
$return[] = array(
'user_id' => $info['user_id'],
'logindate' => $info['login_course_date'],
diff --git a/main/inc/lib/tracking.lib.php b/main/inc/lib/tracking.lib.php
index 084f723009..bd57320546 100755
--- a/main/inc/lib/tracking.lib.php
+++ b/main/inc/lib/tracking.lib.php
@@ -1419,7 +1419,6 @@ class Tracking
}
$sql .= $condition_user;
-
$rs = Database::query($sql);
$row = Database::fetch_array($rs);
@@ -2761,7 +2760,7 @@ class Tracking
*/
public static function get_time_spent_in_lp($student_id, $course_code, $lp_ids = array(), $session_id = null)
{
- $course = CourseManager :: get_course_information($course_code);
+ $course = api_get_course_info($course_code);
$student_id = intval($student_id);
$total_time = 0;
diff --git a/main/inc/lib/usergroup.lib.php b/main/inc/lib/usergroup.lib.php
index 8f322b6059..cbbf9bb591 100755
--- a/main/inc/lib/usergroup.lib.php
+++ b/main/inc/lib/usergroup.lib.php
@@ -971,7 +971,8 @@ class UserGroup extends Model
if ($picture) {
$params = array(
'id' => $id,
- 'picture' => $picture
+ 'picture' => $picture,
+ 'group_type' => $params['group_type']
);
$this->update($params);
}
diff --git a/main/inc/local.inc.php b/main/inc/local.inc.php
index e61c1be983..efcd190562 100755
--- a/main/inc/local.inc.php
+++ b/main/inc/local.inc.php
@@ -839,8 +839,69 @@ if (isset($uidReset) && $uidReset) {
$is_allowedCreateCourse = isset($_SESSION['is_allowedCreateCourse']) ? $_SESSION['is_allowedCreateCourse'] : false;
}
-/* COURSE INIT */
+if (!isset($_SESSION['login_as'])) {
+ $save_course_access = true;
+ $_course = Session::read('_course');
+ if ($_course && isset($_course['real_id'])) {
+ // The value $_dont_save_user_course_access should be added before the call of global.inc.php see the main/inc/chat.ajax.php file
+ // Disables the updates in the TRACK_E_COURSE_ACCESS table
+ if (isset($_dont_save_user_course_access) && $_dont_save_user_course_access == true) {
+ $save_course_access = false;
+ }
+
+ if ($save_course_access) {
+ $course_tracking_table = Database:: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
+
+ /*
+ * When $_configuration['session_lifetime'] is too big 100 hours (in order to let users take exercises with no problems)
+ * the function Tracking::get_time_spent_on_the_course() returns big values (200h) due the condition:
+ * login_course_date > now() - INTERVAL $session_lifetime SECOND
+ *
+ */
+ /*
+ if (isset($_configuration['session_lifetime'])) {
+ $session_lifetime = $_configuration['session_lifetime'];
+ } else {
+ $session_lifetime = 3600; // 1 hour
+ }*/
+
+ $session_lifetime = 3600; // 1 hour
+ $time = api_get_utc_datetime();
+ if (isset($_user['user_id']) && !empty($_user['user_id'])) {
+
+ //We select the last record for the current course in the course tracking table
+ //But only if the login date is < than now + max_life_time
+ $sql = "SELECT course_access_id
+ FROM $course_tracking_table
+ WHERE
+ user_id = ".intval($_user['user_id'])." AND
+ c_id = ".$_course['real_id']." AND
+ session_id = ".api_get_session_id()." AND
+ login_course_date > '$time' - INTERVAL $session_lifetime SECOND
+ ORDER BY login_course_date DESC LIMIT 0,1";
+ $result = Database::query($sql);
+ if (Database::num_rows($result) > 0) {
+ $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)." AND
+ session_id = ".api_get_session_id();
+ Database::query($sql);
+ } else {
+ $ip = api_get_real_ip();
+ $sql = "INSERT INTO $course_tracking_table (c_id, user_ip, user_id, login_course_date, logout_course_date, counter, session_id)
+ VALUES('".$_course['real_id']."', '".$ip."', '".$_user['user_id']."', '$time', '$time', '1','".api_get_session_id()."')";
+ Database::query($sql);
+ }
+ }
+ }
+ }
+}
+
+/* COURSE INIT */
if (isset($cidReset) && $cidReset) {
// Course session data refresh requested or empty data
if ($cidReq) {
@@ -948,7 +1009,6 @@ if (isset($cidReset) && $cidReset) {
$_cid = -1; // Set default values
$_course = -1;
} else {
-
$_cid = $_SESSION['_cid'];
$_course = $_SESSION['_course'];
@@ -979,65 +1039,6 @@ if (isset($cidReset) && $cidReset) {
Session::write('_gid', $_gid);
}
}
-
- if (!isset($_SESSION['login_as'])) {
- $save_course_access = true;
-
- //The value $_dont_save_user_course_access should be added before the call of global.inc.php see the main/inc/chat.ajax.php file
- //Disables the updates in the TRACK_E_COURSE_ACCESS table
- if (isset($_dont_save_user_course_access) && $_dont_save_user_course_access == true) {
- $save_course_access = false;
- }
-
- if ($save_course_access) {
- $course_tracking_table = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
-
- /*
- * When $_configuration['session_lifetime'] is too big 100 hours (in order to let users take exercises with no problems)
- * the function Tracking::get_time_spent_on_the_course() returns big values (200h) due the condition:
- * login_course_date > now() - INTERVAL $session_lifetime SECOND
- *
- */
- /*
- if (isset($_configuration['session_lifetime'])) {
- $session_lifetime = $_configuration['session_lifetime'];
- } else {
- $session_lifetime = 3600; // 1 hour
- }*/
-
- $session_lifetime = 3600; // 1 hour
-
- $course_code = $_course['sysCode'];
- $time = api_get_utc_datetime();
-
- if (isset($_user['user_id']) && !empty($_user['user_id'])) {
-
- //We select the last record for the current course in the course tracking table
- //But only if the login date is < than now + max_life_time
- $sql = "SELECT course_access_id
- FROM $course_tracking_table
- WHERE
- user_id = ".intval($_user['user_id'])." AND
- c_id = ".$_course['real_id']." AND
- session_id = ".api_get_session_id()." AND
- login_course_date > '$time' - INTERVAL $session_lifetime SECOND
- ORDER BY login_course_date DESC LIMIT 0,1";
- $result = Database::query($sql);
- if (Database::num_rows($result) > 0) {
- $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)." AND session_id = ".api_get_session_id();
- Database::query($sql);
- } else {
- $ip = api_get_real_ip();
- $sql="INSERT INTO $course_tracking_table (c_id, user_ip, user_id, login_course_date, logout_course_date, counter, session_id)" .
- "VALUES('".$_course['real_id']."', '".$ip."', '".$_user['user_id']."', '$time', '$time', '1','".api_get_session_id()."')";
- Database::query($sql);
- }
- }
- }
- }
}
}
@@ -1053,12 +1054,12 @@ $is_courseTutor = false; //course teacher - some rights
$is_courseMember = false; //course student
$is_courseCoach = false; //course coach
*/
-//Course - User permissions
-$is_sessionAdmin = false;
-$is_courseCoach = false; //course coach
-$is_courseAdmin = false;
-$is_courseTutor = false;
-$is_courseMember = false;
+// Course - User permissions
+$is_sessionAdmin = false;
+$is_courseCoach = false; //course coach
+$is_courseAdmin = false;
+$is_courseTutor = false;
+$is_courseMember = false;
if ((isset($uidReset) && $uidReset) || (isset($cidReset) && $cidReset)) {
if (isset($_cid) && $_cid) {
diff --git a/main/mySpace/myStudents.php b/main/mySpace/myStudents.php
index 2f69fbcb7c..69cb3917ab 100755
--- a/main/mySpace/myStudents.php
+++ b/main/mySpace/myStudents.php
@@ -35,6 +35,10 @@ function show_image(image,width,height) {
$export = isset($_GET['export']) ? $_GET['export'] : false;
$sessionId = isset($_GET['id_session']) ? intval($_GET['id_session']) : 0;
$origin = isset($_GET['origin']) ? Security::remove_XSS($_GET['origin']) : '';
+$course_code = isset($_GET['course']) ? Security :: remove_XSS($_GET['course']) : null;
+
+// time spent on the course
+$courseInfo = api_get_course_info($course_code);
if (empty($sessionId)) {
$sessionId = api_get_session_id();
@@ -54,29 +58,24 @@ if (isset ($_GET['from']) && $_GET['from'] == 'myspace') {
}
$nameTools = get_lang('StudentDetails');
-
-$get_course_code = isset($_GET['course']) ? Security :: remove_XSS($_GET['course']) : '';
-
$em = Database::getManager();
if (isset($_GET['details'])) {
if ($origin == 'user_course') {
- $course_info = CourseManager :: get_course_information($get_course_code);
if (empty ($cidReq)) {
$interbreadcrumb[] = array (
- "url" => api_get_path(WEB_COURSE_PATH) . $course_info['directory'],
- 'name' => $course_info['title']
+ "url" => api_get_path(WEB_COURSE_PATH) . $courseInfo['directory'],
+ 'name' => $courseInfo['title']
);
}
$interbreadcrumb[] = array (
- "url" => "../user/user.php?cidReq=" . $get_course_code,
+ "url" => "../user/user.php?cidReq=" . $course_code,
"name" => get_lang("Users")
);
} else
if ($origin == 'tracking_course') {
- $course_info = CourseManager :: get_course_information($get_course_code);
$interbreadcrumb[] = array (
- "url" => "../tracking/courseLog.php?cidReq=".$get_course_code.'&id_session=' . api_get_session_id(),
+ "url" => "../tracking/courseLog.php?cidReq=".$course_code.'&id_session=' . api_get_session_id(),
"name" => get_lang("Tracking")
);
} else
@@ -171,19 +170,16 @@ $check = Security::check_token('get');
if ($check) {
switch ($_GET['action']) {
case 'reset_lp':
- $course = isset($_GET['course']) ? $_GET['course'] : "";
$lp_id = isset($_GET['lp_id']) ? intval($_GET['lp_id']) : "";
if (api_is_allowed_to_edit() &&
- !empty($course) &&
!empty($lp_id) &&
!empty($student_id)
) {
- $course_info = api_get_course_info($course);
Event::delete_student_lp_events(
$student_id,
$lp_id,
- $course_info,
+ $courseInfo,
$sessionId
);
@@ -256,13 +252,14 @@ while ($row = Database :: fetch_array($rs)) {
}
}
+
// Get the list of sessions where the user is subscribed as student
$sql = 'SELECT session_id, c_id
FROM '.Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER).'
WHERE user_id=' . intval($user_info['user_id']);
$rs = Database::query($sql);
$tmp_sessions = array();
-while ($row = Database :: fetch_array($rs)) {
+while ($row = Database :: fetch_array($rs, 'ASSOC')) {
$tmp_sessions[] = $row['session_id'];
if ($drh_can_access_all_courses) {
if (in_array($row['session_id'], $tmp_sessions)) {
@@ -276,6 +273,8 @@ while ($row = Database :: fetch_array($rs)) {
}
}
}
+
+
$isDrhOfCourse = CourseManager::isUserSubscribedInCourseAsDrh(
api_get_user_id(),
api_get_course_info()
@@ -355,7 +354,6 @@ if (!empty($student_id)) {
// get average of score and average of progress by student
$avg_student_progress = $avg_student_score = 0;
- $course_code = isset($_GET['course']) ? Security :: remove_XSS($_GET['course']) : null;
if (CourseManager :: is_user_subscribed_in_course($user_info['user_id'], $course_code, true)) {
@@ -377,9 +375,6 @@ if (!empty($student_id)) {
$avg_student_progress = round($avg_student_progress, 2);
- // time spent on the course
- $courseInfo = api_get_course_info($course_code);
-
$time_spent_on_the_course = 0;
if (!empty($courseInfo)) {
$time_spent_on_the_course = api_time_to_hms(
@@ -438,39 +433,35 @@ if (!empty($student_id)) {
$avg_student_score
);
- //Show title
- $info_course = CourseManager :: get_course_information($course_code);
$coachs_name = '';
$session_name = '';
- $nb_login = Tracking :: count_login_per_student($user_info['user_id'], $info_course['real_id']);
+ //$nb_login = Tracking :: count_login_per_student($user_info['user_id'], $courseInfo['real_id']);
//get coach and session_name if there is one and if session_mode is activated
- if ($sessionId > 0) {
+ /*if ($sessionId > 0) {
$session_info = api_get_session_info($sessionId);
$session_coach_id = $session_info['session_admin_id'];
- $course_coachs = api_get_coachs_from_course($sessionId, $info_course['real_id']);
- $nb_login = '';
+ $course_coachs = api_get_coachs_from_course($sessionId, $courseInfo['real_id']);
+ // $nb_login = '';
if (!empty($course_coachs)) {
$info_tutor_name = array();
foreach ($course_coachs as $course_coach) {
$info_tutor_name[] = api_get_person_name($course_coach['firstname'], $course_coach['lastname']);
}
- $info_course['tutor_name'] = implode(",",$info_tutor_name);
+ $courseInfo['tutor_name'] = implode(",", $info_tutor_name);
} elseif ($session_coach_id != 0) {
$session_coach_id = intval($session_info['id_coach']);
$coach_info = api_get_user_info($session_coach_id);
- $info_course['tutor_name'] = $coach_info['complete_name'];
+ $courseInfo['tutor_name'] = $coach_info['complete_name'];
}
- $coachs_name = $info_course['tutor_name'];
+ $coachs_name = $courseInfo['tutor_name'];
$session_name = $session_info['name'];
- } // end
+ } // end*/
- $info_course = CourseManager :: get_course_information($get_course_code);
$table_title = Display::return_icon('user.png', get_lang('User'), array(), ICON_SIZE_SMALL).$user_info['complete_name'];
echo Display::page_subheader($table_title);
$userPicture = UserManager::getUserPicture($user_info['user_id']);
-
$userGroupManager = new UserGroup();
$userGroups = $userGroupManager->getUserGroupListByUser($user_info['user_id'], UserGroup::NORMAL_CLASS);
?>
@@ -573,14 +564,21 @@ if (!empty($student_id)) {
echo get_lang('Score').' ';
Display :: display_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array ('align' => 'absmiddle', 'hspace' => '3px')); ?>
- |
+
+ |
'.get_lang('CountToolAccess').' | ';
echo ' '.$nb_login.' | ';
echo '';
- }
+ }*/
} ?>
@@ -604,56 +602,51 @@ if (!empty($student_id)) {
$courses) {
+ $session_name = '';
+ $access_start_date = '';
+ $access_end_date = '';
+ $date_session = '';
+ $title = Display::return_icon('course.png', get_lang('Courses'), array(), ICON_SIZE_SMALL).' '.get_lang('Courses');
- foreach ($courses_in_session as $key => $courses) {
- $sessionId = $key;
$session_info = api_get_session_info($sessionId);
- $session_name = '';
if ($session_info) {
$session_name = $session_info['name'];
- }
- $access_start_date = '';
+ if (!empty($session_info['access_start_date']) && $session_info['access_start_date'] != '0000-00-00') {
+ $access_start_date = api_format_date($session_info['access_start_date'], DATE_FORMAT_SHORT);
+ }
- if (!empty($session_info['access_start_date']) && $session_info['access_start_date'] != '0000-00-00') {
- $access_start_date = api_format_date($session_info['access_start_date'], DATE_FORMAT_SHORT);
- }
+ if (!empty($session_info['access_end_date']) && $session_info['access_end_date'] != '0000-00-00') {
+ $access_end_date = api_format_date($session_info['access_end_date'], DATE_FORMAT_SHORT);
+ }
- $access_end_date = '';
- if (!empty($session_info['access_end_date']) && $session_info['access_end_date'] != '0000-00-00') {
- $access_end_date = api_format_date($session_info['access_end_date'], DATE_FORMAT_SHORT);
- }
- $date_session = '';
- if (!empty($access_start_date) && !empty($access_end_date)) {
- $date_session = get_lang('From') . ' ' . $access_start_date . ' ' . get_lang('Until') . ' ' . $access_end_date;
- }
- $title = '';
- if (empty($sessionId)) {
- $title = Display::return_icon('course.png', get_lang('Courses'), array(), ICON_SIZE_SMALL).' '.get_lang('Courses');
- } else {
+ if (!empty($access_start_date) && !empty($access_end_date)) {
+ $date_session = get_lang('From') . ' ' . $access_start_date . ' ' . get_lang('Until') . ' ' . $access_end_date;
+ }
$title = Display::return_icon('session.png', get_lang('Session'), array(), ICON_SIZE_SMALL).' '.$session_name.($date_session?' ('.$date_session.')':'');
}
@@ -676,62 +669,61 @@ if (!empty($student_id)) {
if (!empty($courses)) {
foreach ($courses as $courseId) {
- $courseInfo = api_get_course_info_by_id($courseId);
- $courseId = $courseInfo['real_id'];
- $course_code = $courseInfo['code'];
-
- if (CourseManager :: is_user_subscribed_in_course($student_id, $course_code, true)) {
- $course_info = CourseManager :: get_course_information($course_code);
+ $courseInfoItem = api_get_course_info_by_id($courseId);
+ $courseId = $courseInfoItem['real_id'];
+ $courseCodeItem = $courseInfoItem['code'];
+ if (CourseManager :: is_user_subscribed_in_course($student_id, $courseCodeItem, true)) {
$time_spent_on_course = api_time_to_hms(
Tracking :: get_time_spent_on_the_course($user_info['user_id'], $courseId, $sessionId)
);
// get average of faults in attendances by student
- $results_faults_avg = $attendance->get_faults_average_by_course($student_id, $course_code, $sessionId);
+ $results_faults_avg = $attendance->get_faults_average_by_course($student_id, $courseCodeItem, $sessionId);
if (!empty($results_faults_avg['total'])) {
if (api_is_drh()) {
- $attendances_faults_avg = ''.$results_faults_avg['faults'].'/'.$results_faults_avg['total'].' ('.$results_faults_avg['porcent'].'%)';
+ $attendances_faults_avg =
+ ''.
+ $results_faults_avg['faults'].'/'.$results_faults_avg['total'].' ('.$results_faults_avg['porcent'].'%)';
} else {
- $attendances_faults_avg = $results_faults_avg['faults'].'/'.$results_faults_avg['total'].' ('.$results_faults_avg['porcent'].'%)';
+ $attendances_faults_avg =
+ $results_faults_avg['faults'].'/'.
+ $results_faults_avg['total'].
+ ' ('.$results_faults_avg['porcent'].'%)'
+ ;
}
} else {
$attendances_faults_avg = '0/0 (0%)';
}
// Get evaluations by student
- $cats = Category::load(null, null, $course_code, null, null, $sessionId);
+ $cats = Category::load(null, null, $courseCodeItem, null, null, $sessionId);
$scoretotal = array();
if (isset($cats) && isset($cats[0])) {
if (!empty($sessionId)) {
- $scoretotal= $cats[0]->calc_score($student_id, null, $course_code, $sessionId);
+ $scoretotal= $cats[0]->calc_score($student_id, null, $courseCodeItem, $sessionId);
} else {
- $scoretotal= $cats[0]->calc_score($student_id, null, $course_code);
+ $scoretotal= $cats[0]->calc_score($student_id, null, $courseCodeItem);
}
}
$scoretotal_display = '0/0 (0%)';
if (!empty($scoretotal)) {
- $scoretotal_display = round(
- $scoretotal[0],
- 1
- ).'/'.
- round(
- $scoretotal[1],
- 1
- ).' ('.
- round(($scoretotal[0] / $scoretotal[1]) * 100, 2).' %)';
+ $scoretotal_display =
+ round($scoretotal[0], 1 ).'/'.
+ round($scoretotal[1], 1).
+ ' ('.round(($scoretotal[0] / $scoretotal[1]) * 100, 2).' %)';
}
- $progress = Tracking::get_avg_student_progress($user_info['user_id'], $course_code, null, $sessionId);
- $score = Tracking :: get_avg_student_score($user_info['user_id'], $course_code, null, $sessionId);
+ $progress = Tracking::get_avg_student_progress($user_info['user_id'], $courseCodeItem, null, $sessionId);
+ $score = Tracking :: get_avg_student_score($user_info['user_id'], $courseCodeItem, null, $sessionId);
$progress = empty($progress) ? '0%' : $progress.'%';
$score = empty($score) ? '0%' : $score.'%';
$csv_content[] = array(
$session_name,
- $course_info['title'],
+ $courseInfoItem['title'],
$time_spent_on_course,
$progress,
$score,
@@ -740,7 +732,8 @@ if (!empty($student_id)) {
);
echo '
- '.$course_info['title'].' |
+ '.
+ $courseInfoItem['title'].' |
'.$time_spent_on_course .' |
'.$progress.' |
'.$score.' |
@@ -748,10 +741,10 @@ if (!empty($student_id)) {
'.$scoretotal_display.' | ';
if (isset($_GET['id_coach']) && intval($_GET['id_coach']) != 0) {
- echo '
+ echo ' |
'.Display::return_icon('2rightarrow.png', get_lang('Details')).' | ';
} else {
- echo '
+ echo ' |
'.Display::return_icon('2rightarrow.png', get_lang('Details')).' | ';
}
echo '
';
@@ -781,25 +774,29 @@ if (!empty($student_id)) {
get_lang('LastConnexion')
);
- $query = $em
- ->createQuery('
+ if (empty($sessionId)) {
+ $query = $em->createQuery('
SELECT lp FROM ChamiloCourseBundle:CLp lp
- WHERE lp.sessionId = :session AND lp.cId = :course
+ WHERE lp.sessionId = 0 AND lp.cId = :course
ORDER BY lp.displayOrder ASC
');
- if (empty($sessionId)) {
$query->setParameters([
- 'session' => 0,
- 'course' => $info_course['real_id']
+ 'course' => $courseInfo['real_id']
]);
} else {
+ $query = $em->createQuery('
+ SELECT lp FROM ChamiloCourseBundle:CLp lp
+ WHERE lp.cId = :course
+ ORDER BY lp.displayOrder ASC
+ ');
$query->setParameters([
- 'session' => $sessionId,
- 'course' => $info_course['real_id']
+ 'course' => $courseInfo['real_id']
]);
}
+
$rs_lp = $query->getResult();
+
if (count($rs_lp) > 0) {
?>
@@ -807,22 +804,54 @@ if (!empty($student_id)) {
- |
- |
+
+ 'absmiddle', 'hspace' => '3px')); ?> |
- 'absmiddle', 'hspace' => '3px')
+ );
+ ?>
+ |
+
+ 'absmiddle', 'hspace' => '3px')); ?> |
+ Display:: display_icon(
+ 'info3.gif',
+ get_lang('AverageIsCalculatedBasedInAllAttempts'),
+ array('align' => 'absmiddle', 'hspace' => '3px')
+ );
+ ?>
+
'absmiddle', 'hspace' => '3px')); ?> |
+ Display::display_icon(
+ 'info3.gif',
+ get_lang('AverageIsCalculatedBasedInTheLatestAttempts'),
+ array('align' => 'absmiddle', 'hspace' => '3px')
+ );
+ ?>
+
'absmiddle','hspace' => '3px')); ?> |
+ Display:: display_icon(
+ 'info3.gif',
+ get_lang('LPProgressScore'),
+ array('align' => 'absmiddle', 'hspace' => '3px')
+ );
+ ?>
+
'absmiddle','hspace' => '3px')); ?> |
+ Display:: display_icon(
+ 'info3.gif',
+ get_lang('LastTimeTheCourseWasUsed'),
+ array('align' => 'absmiddle', 'hspace' => '3px')
+ );
+ ?>
+
'.get_lang('Details').'';
if (api_is_allowed_to_edit()) {
@@ -900,8 +929,11 @@ if (!empty($student_id)) {
true
);
- if ($i % 2 == 0) $css_class = "row_even";
- else $css_class = "row_odd";
+ if ($i % 2 == 0) {
+ $css_class = "row_even";
+ } else {
+ $css_class = "row_odd";
+ }
$i++;
@@ -925,6 +957,7 @@ if (!empty($student_id)) {
$score = $score.'%';
}
}
+
echo Display::tag('td', $score);
if (!is_null($score_latest)) {
@@ -951,7 +984,7 @@ if (!empty($student_id)) {
$from ='&from=myspace';
}
$link = Display::url(
- Display::return_icon('2rightarrow.png'),
+ Display::return_icon('2rightarrow.png', get_lang('Details')),
'lp_tracking.php?cidReq='.Security::remove_XSS($_GET['course']).'&course='.Security::remove_XSS($_GET['course']).$from.'&origin='.$origin.'&lp_id='.$learnpath->getId().'&student_id='.$user_info['user_id'].'&id_session='.$sessionId
);
echo Display::tag('td', $link);
@@ -961,7 +994,7 @@ if (!empty($student_id)) {
echo '';
if ($any_result === true) {
echo '';
- echo Display::return_icon('clean.png',get_lang('Clean'),'',ICON_SIZE_SMALL).'';
+ echo Display::return_icon('clean.png', get_lang('Clean'),'',ICON_SIZE_SMALL).'';
echo '';
}
echo ' | ';
@@ -970,8 +1003,6 @@ if (!empty($student_id)) {
$data_learnpath[$i][] = $lp_name;
$data_learnpath[$i][] = $progress . '%';
}
- } else {
- //echo '
'.get_lang('NoLearnpath').' |
';
}
?>
@@ -1006,7 +1037,7 @@ if (!empty($student_id)) {
$t_quiz = Database :: get_course_table(TABLE_QUIZ_TEST);
$sql = "SELECT quiz.title, id FROM " . $t_quiz . " AS quiz
WHERE
- quiz.c_id = ".$info_course['real_id']." AND
+ quiz.c_id = ".$courseInfo['real_id']." AND
(quiz.session_id = $sessionId OR quiz.session_id = 0) AND
active IN (0, 1)
ORDER BY quiz.title ASC ";
@@ -1016,11 +1047,33 @@ if (!empty($student_id)) {
if (Database :: num_rows($result_exercices) > 0) {
while ($exercices = Database :: fetch_array($result_exercices)) {
$exercise_id = intval($exercices['id']);
- $count_attempts = Tracking::count_student_exercise_attempts($student_id, $courseInfo['real_id'], $exercise_id, 0, 0, $sessionId, 2);
- $score_percentage = Tracking::get_avg_student_exercise_score($student_id, $course_code, $exercise_id, $sessionId, 1, 0);
+ $count_attempts = Tracking::count_student_exercise_attempts(
+ $student_id,
+ $courseInfo['real_id'],
+ $exercise_id,
+ 0,
+ 0,
+ $sessionId,
+ 2
+ );
+ $score_percentage = Tracking::get_avg_student_exercise_score(
+ $student_id,
+ $course_code,
+ $exercise_id,
+ $sessionId,
+ 1,
+ 0
+ );
if (!isset($score_percentage) && $count_attempts > 0) {
- $scores_lp = Tracking::get_avg_student_exercise_score($student_id, $course_code, $exercise_id, $sessionId, 2, 1);
+ $scores_lp = Tracking::get_avg_student_exercise_score(
+ $student_id,
+ $course_code,
+ $exercise_id,
+ $sessionId,
+ 2,
+ 1
+ );
$score_percentage = $scores_lp[0];
$lp_name = $scores_lp[1];
} else {
@@ -1059,11 +1112,11 @@ if (!empty($student_id)) {
$sql = 'SELECT exe_id FROM ' . $tbl_stats_exercices . '
WHERE
- exe_exo_id ="'.$exercise_id.'" AND
- exe_user_id ="'.$student_id.'" AND
- c_id = '.$courseInfo['real_id'].' AND
- session_id ="'.$sessionId.'" AND
- status = ""
+ exe_exo_id = "'.$exercise_id.'" AND
+ exe_user_id ="'.$student_id.'" AND
+ c_id = '.$courseInfo['real_id'].' AND
+ session_id ="'.$sessionId.'" AND
+ status = ""
ORDER BY exe_date DESC
LIMIT 1';
$result_last_attempt = Database::query($sql);
@@ -1105,13 +1158,13 @@ if (!empty($student_id)) {
, Ghent University
- * @version February 2007
- */
- public static function get_complete_survey_structure($survey_id, $shared = 0)
- {
- $structure = SurveyManager::get_survey($survey_id, $shared);
- $structure['questions'] = SurveyManager::get_questions($survey_id);
- }
-
/***
* SURVEY QUESTION FUNCTIONS
*/
@@ -1073,7 +1054,6 @@ class SurveyManager
}
}
$additional = array();
-
$course_id = api_get_course_int_id();
if (!$empty_answer) {
@@ -1633,17 +1613,17 @@ class SurveyManager
* @author Patrick Cool , Ghent University
* @version February 2007
*/
- static function get_people_who_filled_survey($survey_id, $all_user_info = false, $course_id = null)
+ public static function get_people_who_filled_survey($survey_id, $all_user_info = false, $course_id = null)
{
// Database table definition
- $table_survey_answer = Database :: get_course_table(TABLE_SURVEY_ANSWER);
- $table_user = Database :: get_main_table(TABLE_MAIN_USER);
+ $table_survey_answer = Database:: get_course_table(TABLE_SURVEY_ANSWER);
+ $table_user = Database:: get_main_table(TABLE_MAIN_USER);
// Variable initialisation
$return = array();
if (empty($course_id)) {
- $course_id = api_get_course_int_id();
+ $course_id = api_get_course_int_id();
} else {
$course_id = intval($course_id);
}
@@ -1675,7 +1655,7 @@ class SurveyManager
return $return;
}
- static function survey_generation_hash_available()
+ public static function survey_generation_hash_available()
{
if (extension_loaded('mcrypt')) {
return true;
@@ -1683,13 +1663,13 @@ class SurveyManager
return false;
}
- static function generate_survey_hash($survey_id, $course_id, $session_id, $group_id)
+ public static function generate_survey_hash($survey_id, $course_id, $session_id, $group_id)
{
$hash = hash('sha512', api_get_security_key().'_'.$course_id.'_'.$session_id.'_'.$group_id.'_'.$survey_id);
return $hash;
}
- static function validate_survey_hash($survey_id, $course_id, $session_id, $group_id, $hash)
+ public static function validate_survey_hash($survey_id, $course_id, $session_id, $group_id, $hash)
{
$survey_generated_hash = self::generate_survey_hash($survey_id, $course_id, $session_id, $group_id);
if ($survey_generated_hash == $hash) {
@@ -1698,7 +1678,7 @@ class SurveyManager
return false;
}
- static function generate_survey_link($survey_id, $course_id, $session_id, $group_id)
+ public static function generate_survey_link($survey_id, $course_id, $session_id, $group_id)
{
$code = self::generate_survey_hash($survey_id, $course_id, $session_id, $group_id);
return api_get_path(WEB_CODE_PATH).'survey/link.php?h='.$code.'&i='.$survey_id.'&c='.intval($course_id).'&s='.intval($session_id).'&g='.$group_id;
@@ -3230,7 +3210,7 @@ class SurveyUtil
* @param boolean Whether to display user fields or not
* @return string One line of the csv file
*/
- static function export_complete_report_row_xls(
+ public static function export_complete_report_row_xls(
$survey_data,
$possible_options,
$answers_of_user,
@@ -3301,7 +3281,7 @@ class SurveyUtil
* @author Patrick Cool , Ghent University
* @version February 2007
*/
- static function display_comparative_report()
+ public static function display_comparative_report()
{
// Allowed question types for comparative report
$allowed_question_types = array(
@@ -3351,7 +3331,7 @@ class SurveyUtil
echo get_lang('SelectYAxis').': ';
echo '