From 717d833bdcdde81dac288a7fe317c11aa3c2995d Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Mon, 27 Dec 2010 17:26:20 +0100 Subject: [PATCH 1/3] Fixing time limits with UTC in exercises --- main/exercice/exercice.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/main/exercice/exercice.php b/main/exercice/exercice.php index 6ff1aa0f07..fef1993a57 100755 --- a/main/exercice/exercice.php +++ b/main/exercice/exercice.php @@ -755,21 +755,21 @@ if ($show == 'test') { //validacion when belongs to a session $session_img = api_get_session_image($row['session_id'], $_user['status']); - $time_limits = false; + $time_limits = false; if ($row['start_time'] != '0000-00-00 00:00:00' && $row['end_time'] != '0000-00-00 00:00:00') { $time_limits = true; - } - + } if ($time_limits) { // check if start time - $start_time = api_strtotime($row['start_time']); - $end_time = api_strtotime($row['end_time']); - $now = time(); + $start_time = api_strtotime($row['start_time'],'UTC'); + $end_time = api_strtotime($row['end_time'],'UTC'); + $now = time(); $is_actived_time = false; if ($now > $start_time && $end_time > $now ) { $is_actived_time = true; } } + // prof only if ($is_allowedToEdit) { @@ -843,6 +843,7 @@ if ($show == 'test') { echo ''.$row['title'].''; } else { echo $row['title']; + echo '

cant do exam

'; } } else { echo ''.$row['title'].''; From 1e938ab086d3aec9f08fc5a9360007218d9fd394 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Mon, 27 Dec 2010 17:27:39 +0100 Subject: [PATCH 2/3] Hiding LP for students if the time limit is not correct #1618 --- main/newscorm/learnpathList.class.php | 8 +++---- main/newscorm/lp_list.php | 34 +++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/main/newscorm/learnpathList.class.php b/main/newscorm/learnpathList.class.php index 2c0f97a3af..49268a8d2b 100755 --- a/main/newscorm/learnpathList.class.php +++ b/main/newscorm/learnpathList.class.php @@ -75,24 +75,24 @@ class learnpathList { $vis = api_get_item_visibility(api_get_course_info($course_code), 'learnpath', $row['id'], $session_id); if (!empty($row['created_on']) && $row['created_on'] != '0000-00-00 00:00:00') { - $row['created_on'] = api_get_local_time($row['created_on']); + $row['created_on'] = $row['created_on']; } else { $row['created_on'] = ''; } if (!empty($row['modified_on']) && $row['modified_on'] != '0000-00-00 00:00:00') { - $row['modified_on'] = api_get_local_time($row['modified_on']); + $row['modified_on'] = $row['modified_on']; } else { $row['modified_on'] = ''; } if (!empty($row['publicated_on']) && $row['publicated_on'] != '0000-00-00 00:00:00') { - $row['publicated_on'] = api_get_local_time($row['publicated_on']); + $row['publicated_on'] = $row['publicated_on']; } else { $row['publicated_on'] = ''; } if (!empty($row['expired_on']) && $row['expired_on'] != '0000-00-00 00:00:00') { - $row['expired_on'] = api_get_local_time($row['expired_on']); + $row['expired_on'] = $row['expired_on']; } else { $row['expired_on'] = ''; } diff --git a/main/newscorm/lp_list.php b/main/newscorm/lp_list.php index fe1f97b4f5..b6d32d4d64 100755 --- a/main/newscorm/lp_list.php +++ b/main/newscorm/lp_list.php @@ -165,6 +165,7 @@ if (is_array($flat_list)) { $current = 0; $autolunch_exists = false; foreach ($flat_list as $id => $details) { + // Validacion when belongs to a session $session_img = api_get_session_image($details['lp_session'], $_user['status']); @@ -176,7 +177,37 @@ if (is_array($flat_list)) { // Check if the learnpath is visible for student. if (!$is_allowed_to_edit && !learnpath::is_lp_visible_for_student($id, api_get_user_id())) { continue; + } + + if (!$is_allowed_to_edit) { + $time_limits = false; + if ($details['expired_on'] != '' && $details['expired_on'] != '0000-00-00 00:00:00') { + $time_limits = true; + } + + if (empty($details['created_on']) && empty($details['modified_on']) ) { + //This is an old LP (from a migration) so we do nothing + $time_limits = false; + } + + if ($time_limits) { + // check if start time + $start_time = api_strtotime($details['publicated_on'],'UTC'); + $end_time = api_strtotime($details['expired_on'],'UTC'); + $now = time(); + $is_actived_time = false; + + if ($now > $start_time && $end_time > $now ) { + $is_actived_time = true; + } + + if (!$is_actived_time) { + continue; + } + } + } + $counter++; if (($counter % 2) == 0) { $oddclass = 'row_odd'; } else { $oddclass = 'row_even'; } @@ -222,6 +253,9 @@ if (is_array($flat_list)) { } else { $dsp_progress = ''.learnpath::get_db_progress($id, api_get_user_id(), 'both','',false, api_get_session_id()).''; } + + // + if ($is_allowed_to_edit) { From 05cce79c196fb848bb964569421eafdea80cbc6d Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Tue, 28 Dec 2010 13:55:26 +0100 Subject: [PATCH 3/3] Adding new question types see BT#1913, BT#1913, BT#1914, BT#1915 --- main/exercice/admin.php | 20 +- main/exercice/exercice.php | 12 +- main/exercice/exercise.class.php | 10 +- main/exercice/exercise.lib.php | 57 +-- main/exercice/exercise_show.php | 2 +- .../multiple_answer_combination.class.php | 13 +- .../multiple_answer_true_false.class.php | 219 +++++++++ main/exercice/question.class.php | 35 +- .../unique_answer_no_option.class.php | 437 ++++++++++++++++++ 9 files changed, 743 insertions(+), 62 deletions(-) create mode 100755 main/exercice/multiple_answer_true_false.class.php create mode 100755 main/exercice/unique_answer_no_option.class.php diff --git a/main/exercice/admin.php b/main/exercice/admin.php index b4b4709007..ab76986926 100755 --- a/main/exercice/admin.php +++ b/main/exercice/admin.php @@ -290,6 +290,24 @@ $htmlHeadXtra[] = ''; //jQuery $htmlHeadXtra[] = ''; //jQuery +$htmlHeadXtra[] = ''; + $htmlHeadXtra[] = "