Minor - format code

1.9.x
Julio Montoya 12 years ago
parent 3d572a4f56
commit 32146f580d
  1. 2
      main/admin/session_list.php
  2. 19
      main/exercice/exercise_result.php
  3. 12
      main/exercice/exercise_show.php
  4. 12
      main/exercice/exercise_submit.php
  5. 43
      main/inc/ajax/exercise.ajax.php

@ -163,3 +163,5 @@ echo '<a href="'.api_get_path(WEB_CODE_PATH).'admin/session_category_list.php">'
echo '</div>'; echo '</div>';
echo Display::grid_html('sessions'); echo Display::grid_html('sessions');
Display::display_footer(); Display::display_footer();

@ -30,12 +30,12 @@ require_once '../inc/global.inc.php';
require_once 'exercise.lib.php'; require_once 'exercise.lib.php';
if ($_GET['origin']=='learnpath') { if ($_GET['origin']=='learnpath') {
require_once '../newscorm/learnpath.class.php'; require_once '../newscorm/learnpath.class.php';
require_once '../newscorm/learnpathItem.class.php'; require_once '../newscorm/learnpathItem.class.php';
require_once '../newscorm/scorm.class.php'; require_once '../newscorm/scorm.class.php';
require_once '../newscorm/scormItem.class.php'; require_once '../newscorm/scormItem.class.php';
require_once '../newscorm/aicc.class.php'; require_once '../newscorm/aicc.class.php';
require_once '../newscorm/aiccItem.class.php'; require_once '../newscorm/aiccItem.class.php';
} }
require_once api_get_path(LIBRARY_PATH).'exercise_show_functions.lib.php'; require_once api_get_path(LIBRARY_PATH).'exercise_show_functions.lib.php';
require_once api_get_path(LIBRARY_PATH).'mail.lib.inc.php'; require_once api_get_path(LIBRARY_PATH).'mail.lib.inc.php';
@ -133,10 +133,11 @@ if ($objExercise->selectAttempts() > 0) {
Display :: display_normal_message(get_lang('Saved').'<br />',false); Display :: display_normal_message(get_lang('Saved').'<br />',false);
//Display questions // Display questions
display_question_list_by_attempt($objExercise, $exe_id, true); display_question_list_by_attempt($objExercise, $exe_id, true);
//If is not valid //If is not valid
$session_control_key = get_session_time_control_key($objExercise->id, $learnpath_id, $learnpath_item_id); $session_control_key = get_session_time_control_key($objExercise->id, $learnpath_id, $learnpath_item_id);
if (isset($session_control_key) && !exercise_time_control_is_valid($objExercise->id, $learnpath_id, $learnpath_item_id)) { if (isset($session_control_key) && !exercise_time_control_is_valid($objExercise->id, $learnpath_id, $learnpath_item_id)) {
$TBL_TRACK_ATTEMPT = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); $TBL_TRACK_ATTEMPT = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
@ -163,7 +164,7 @@ if ($origin != 'learnpath') {
$lp_mode = $_SESSION['lp_mode']; $lp_mode = $_SESSION['lp_mode'];
$url = '../newscorm/lp_controller.php?cidReq='.api_get_course_id().'&action=view&lp_id='.$learnpath_id.'&lp_item_id='.$learnpath_item_id.'&exeId='.$exercise_stat_info['exe_id'].'&fb_type='.$objExercise->feedback_type; $url = '../newscorm/lp_controller.php?cidReq='.api_get_course_id().'&action=view&lp_id='.$learnpath_id.'&lp_item_id='.$learnpath_item_id.'&exeId='.$exercise_stat_info['exe_id'].'&fb_type='.$objExercise->feedback_type;
$href = ($lp_mode == 'fullscreen')?' window.opener.location.href="'.$url.'" ':' top.location.href="'.$url.'"'; $href = ($lp_mode == 'fullscreen')?' window.opener.location.href="'.$url.'" ':' top.location.href="'.$url.'"';
if (api_is_allowed_to_session_edit()) { if (api_is_allowed_to_session_edit()) {
Session::erase('objExercise'); Session::erase('objExercise');
Session::erase('exe_id'); Session::erase('exe_id');
@ -172,4 +173,4 @@ if ($origin != 'learnpath') {
echo "<script>window.parent.API.void_save_asset('$total_score', '$total_weight', 0, 'completed');</script>"; echo "<script>window.parent.API.void_save_asset('$total_score', '$total_weight', 0, 'completed');</script>";
echo '<script type="text/javascript">'.$href.'</script>'; echo '<script type="text/javascript">'.$href.'</script>';
echo '</body></html>'; echo '</body></html>';
} }

@ -61,7 +61,7 @@ if ( empty ( $action ) ) { $action = $_REQUEST['action']; }
$id = intval($_REQUEST['id']); //exe id $id = intval($_REQUEST['id']); //exe id
if (empty($id)) { if (empty($id)) {
api_not_allowed(true); api_not_allowed(true);
} }
if (api_is_course_session_coach(api_get_user_id(), api_get_course_id(), api_get_session_id())) { if (api_is_course_session_coach(api_get_user_id(), api_get_course_id(), api_get_session_id())) {
@ -70,7 +70,7 @@ if (api_is_course_session_coach(api_get_user_id(), api_get_course_id(), api_get_
} }
} }
$is_allowedToEdit = api_is_allowed_to_edit(null,true) || $is_courseTutor || api_is_session_admin() || api_is_drh(); $is_allowedToEdit = api_is_allowed_to_edit(null, true) || $is_courseTutor || api_is_session_admin() || api_is_drh();
//Getting results from the exe_id. This variable also contain all the information about the exercise //Getting results from the exe_id. This variable also contain all the information about the exercise
$track_exercise_info = get_exercise_track_exercise_info($id); $track_exercise_info = get_exercise_track_exercise_info($id);
@ -428,12 +428,12 @@ foreach ($questionList as $questionId) {
</tr></table>'; </tr></table>';
if ($answerType!= HOT_SPOT_DELINEATION) { if ($answerType!= HOT_SPOT_DELINEATION) {
$item_list=explode('@@',$destination); $item_list = explode('@@',$destination);
//print_R($item_list);
$try = $item_list[0]; $try = $item_list[0];
$lp = $item_list[1]; $lp = $item_list[1];
$destinationid= $item_list[2]; $destinationid = $item_list[2];
$url=$item_list[3]; $url = $item_list[3];
$table_resume=''; $table_resume='';
} else { } else {
if ($next==0) { if ($next==0) {

@ -215,7 +215,6 @@ if ($objExercise->selectAttempts() > 0) {
if ($debug) { error_log("4. Setting the exe_id: $exe_id");} ; if ($debug) { error_log("4. Setting the exe_id: $exe_id");} ;
//5. Getting user exercise info (if the user took the exam before) - generating exe_id //5. Getting user exercise info (if the user took the exam before) - generating exe_id
//var_dump($learnpath_id.' - '.$learnpath_item_id.' - '.$learnpath_item_view_id);
$exercise_stat_info = $objExercise->get_stat_track_exercise_info($learnpath_id, $learnpath_item_id, $learnpath_item_view_id); $exercise_stat_info = $objExercise->get_stat_track_exercise_info($learnpath_id, $learnpath_item_id, $learnpath_item_view_id);
$clock_expired_time = null; $clock_expired_time = null;
@ -875,16 +874,16 @@ if (!empty($error)) {
} }
function save_now_all(validate) { function save_now_all(validate) {
//1. Input choice // 1. Input choice.
var my_choice = $(\'*[name*="choice"]\').serialize(); var my_choice = $(\'*[name*="choice"]\').serialize();
//2. Reminder // 2. Reminder.
var remind_list = $(\'*[name*="remind_list"]\').serialize(); var remind_list = $(\'*[name*="remind_list"]\').serialize();
//3. Hotspots // 3. Hotspots.
var hotspot = $(\'*[name*="hotspot"]\').serialize(); var hotspot = $(\'*[name*="hotspot"]\').serialize();
//Question list // Question list.
var question_list = ['.implode(',', $questionList).']; var question_list = ['.implode(',', $questionList).'];
var free_answers = {}; var free_answers = {};
@ -901,7 +900,8 @@ if (!empty($error)) {
} }
} }
}); });
//lok+(fgt)= data base
// lok+(fgt)= data base
free_answers = $.param(free_answers); free_answers = $.param(free_answers);
$("#save_all_reponse").html("'.addslashes(Display::return_icon('loading1.gif')).'"); $("#save_all_reponse").html("'.addslashes(Display::return_icon('loading1.gif')).'");

@ -39,7 +39,9 @@ switch ($action) {
} }
// get index row - i.e. user click to sort $sord = $_GET['sord']; // get index row - i.e. user click to sort $sord = $_GET['sord'];
// get the direction // get the direction
if (!$sidx) $sidx = 1; if (!$sidx) {
$sidx = 1;
}
$track_exercise = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $track_exercise = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$user_table = Database::get_main_table(TABLE_MAIN_USER); $user_table = Database::get_main_table(TABLE_MAIN_USER);
@ -178,19 +180,19 @@ switch ($action) {
} }
break; break;
case 'add_question_to_reminder': case 'add_question_to_reminder':
$objExercise = $_SESSION['objExercise']; $objExercise = $_SESSION['objExercise'];
if (empty($objExercise)) { if (empty($objExercise)) {
echo 0; echo 0;
exit; exit;
} else { } else {
$objExercise->edit_question_to_remind($_REQUEST['exe_id'], $_REQUEST['question_id'], $_REQUEST['action']); $objExercise->edit_question_to_remind($_REQUEST['exe_id'], $_REQUEST['question_id'], $_REQUEST['action']);
} }
break; break;
case 'save_exercise_by_now': case 'save_exercise_by_now':
$course_info = api_get_course_info($course_code); $course_info = api_get_course_info($course_code);
$course_id = $course_info['real_id']; $course_id = $course_info['real_id'];
//Use have permissions? // Use have permissions?
if (api_is_allowed_to_session_edit()) { if (api_is_allowed_to_session_edit()) {
//"all" or "simple" strings means that there's one or all questions exercise type //"all" or "simple" strings means that there's one or all questions exercise type
@ -212,20 +214,22 @@ switch ($action) {
//Attempt id //Attempt id
$exe_id = $_REQUEST['exe_id']; $exe_id = $_REQUEST['exe_id'];
if ($debug) error_log("exe_id = $exe_id "); if ($debug) {
if ($debug) error_log("type = $type "); error_log("exe_id = $exe_id ");
if ($debug) error_log("choice = ".print_r($choice, 1)." "); error_log("type = $type ");
if ($debug) error_log("hot_spot_coordinates = ".print_r($hot_spot_coordinates,1)); error_log("choice = ".print_r($choice, 1)." ");
if ($debug) error_log("remind_list = ".print_r($remind_list, 1)); error_log("hot_spot_coordinates = ".print_r($hot_spot_coordinates, 1));
error_log("remind_list = ".print_r($remind_list, 1));
}
//Exercise information // Exercise information.
$objExercise = isset($_SESSION['objExercise']) ? $_SESSION['objExercise'] : null; $objExercise = isset($_SESSION['objExercise']) ? $_SESSION['objExercise'] : null;
//Question info // Question info.
$question_id = intval($_REQUEST['question_id']); $question_id = intval($_REQUEST['question_id']);
$question_list = $_SESSION['questionList']; $question_list = $_SESSION['questionList'];
//If exercise or question is not set then exit // If exercise or question is not set then exit.
if (empty($question_list) || empty($objExercise)) { if (empty($question_list) || empty($objExercise)) {
echo 'error'; echo 'error';
exit; exit;
@ -274,7 +278,6 @@ switch ($action) {
} }
} }
//No exe id? Can't save answer. //No exe id? Can't save answer.
if (empty($exe_id)) { if (empty($exe_id)) {
//Fires an error //Fires an error
@ -296,7 +299,7 @@ switch ($action) {
unset($objQuestionTmp); unset($objQuestionTmp);
//Looping the question list // Looping the question list
foreach ($question_list as $my_question_id) { foreach ($question_list as $my_question_id) {
if ($debug) error_log("Saving question_id = $my_question_id "); if ($debug) error_log("Saving question_id = $my_question_id ");

Loading…
Cancel
Save