Add api_get_cidreq(), fix URLs

pull/2487/head
jmontoyaa 8 years ago
parent 451ac8f030
commit 2cd1e948b2
  1. 6
      main/exercise/admin.php
  2. 2
      main/exercise/exercise.class.php
  3. 19
      main/exercise/exercise.php
  4. 2
      main/exercise/exercise_reminder.php
  5. 2
      main/exercise/exercise_result.php
  6. 2
      main/exercise/exercise_submit.php
  7. 4
      main/exercise/exercise_submit_modal.php
  8. 3
      main/exercise/hotspot_admin.inc.php
  9. 2
      main/exercise/overview.php
  10. 2
      main/exercise/question_list_admin.inc.php

@ -205,7 +205,7 @@ if ($editQuestion || $newQuestion || $modifyQuestion || $modifyAnswers) {
if ($editQuestion) {
// question not found
if (!$objQuestion = Question::read($editQuestion)) {
api_not_allowed();
api_not_allowed(true);
}
// saves the object into the session
Session::write('objQuestion', $objQuestion);
@ -250,7 +250,7 @@ if (!empty($clone_question) && !empty($objExercise->id)) {
$old_question_obj = Question::read($clone_question);
$old_question_obj->question = $old_question_obj->question.' - '.get_lang('Copy');
$new_id = $old_question_obj->duplicate();
$new_id = $old_question_obj->duplicate(api_get_course_info());
$new_question_obj = Question::read($new_id);
$new_question_obj->addToList($exerciseId);
@ -285,7 +285,7 @@ if (api_is_in_gradebook()) {
);
}
$interbreadcrumb[] = array("url" => "exercise.php", "name" => get_lang('Exercises'));
$interbreadcrumb[] = array("url" => "exercise.php?".api_get_cidreq(), "name" => get_lang('Exercises'));
if (isset($_GET['newQuestion']) || isset($_GET['editQuestion'])) {
$interbreadcrumb[] = [
"url" => "admin.php?exerciseId=".$objExercise->id.'&'.api_get_cidreq(),

@ -5855,8 +5855,6 @@ class Exercise
'<table width="730" height="136" border="0" cellpadding="3" cellspacing="3">';
$msg .= $open_question_list;
$msg .= '</table><br />';
$msg1 = str_replace("#exercise#", $this->exercise, $msg);
$msg = str_replace("#firstName#", $user_info['firstname'], $msg1);
$msg1 = str_replace("#lastName#", $user_info['lastname'], $msg);

@ -586,7 +586,6 @@ $tableRows = [];
if (!empty($exerciseList)) {
if ($origin != 'learnpath') {
//avoid sending empty parameters
$myorigin = (empty($origin) ? '' : '&origin='.$origin);
$mylpid = (empty($learnpath_id) ? '' : '&learnpath_id='.$learnpath_id);
$mylpitemid = (empty($learnpath_item_id) ? '' : '&learnpath_item_id='.$learnpath_item_id);
$i = 1;
@ -725,7 +724,7 @@ if (!empty($exerciseList)) {
$class_tip = 'link_tooltip';
}
$url = $move.'<a '.$alt_title.' class="'.$class_tip.'" id="tooltip_'.$row['id'].'" href="overview.php?'.api_get_cidreq().$myorigin.$mylpid.$mylpitemid.'&exerciseId='.$row['id'].'">
$url = $move.'<a '.$alt_title.' class="'.$class_tip.'" id="tooltip_'.$row['id'].'" href="overview.php?'.api_get_cidreq().$mylpid.$mylpitemid.'&exerciseId='.$row['id'].'">
'.Display::return_icon('quiz.png', $row['title']).'
'.$title.' </a>';
@ -873,7 +872,14 @@ if (!empty($exerciseList)) {
$actions .= '<a href="exercise_report.php?'.api_get_cidreq().'&exerciseId='.$row['id'].'">'.
Display::return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL).'</a>';
$actions .= Display::url(Display::return_icon('cd.gif', get_lang('CopyExercise')), '', array('onclick' => "javascript:if(!confirm('".addslashes(api_htmlentities(get_lang('AreYouSureToCopy'), ENT_QUOTES, $charset))." ".addslashes($row['title'])."?"."')) return false;", 'href' => 'exercise.php?'.api_get_cidreq().'&choice=copy_exercise&sec_token='.$token.'&exerciseId='.$row['id']));
$actions .= Display::url(
Display::return_icon('cd.gif', get_lang('CopyExercise')),
'',
array(
'onclick' => "javascript:if(!confirm('".addslashes(api_htmlentities(get_lang('AreYouSureToCopy'), ENT_QUOTES, $charset))." ".addslashes($row['title'])."?"."')) return false;",
'href' => 'exercise.php?'.api_get_cidreq().'&choice=copy_exercise&sec_token='.$token.'&exerciseId='.$row['id']
)
);
}
// Delete
@ -887,7 +893,10 @@ if (!empty($exerciseList)) {
ICON_SIZE_SMALL
),
'',
array('onclick' => "javascript:if(!confirm('".addslashes(api_htmlentities(get_lang('AreYouSureToDeleteJS'), ENT_QUOTES, $charset))." ".addslashes($row['title'])."?"."')) return false;", 'href' => 'exercise.php?'.api_get_cidreq().'&choice=delete&sec_token='.$token.'&exerciseId='.$row['id'])
array(
'onclick' => "javascript:if(!confirm('".addslashes(api_htmlentities(get_lang('AreYouSureToDeleteJS'), ENT_QUOTES, $charset))." ".addslashes($row['title'])."?"."')) return false;",
'href' => 'exercise.php?'.api_get_cidreq().'&choice=delete&sec_token='.$token.'&exerciseId='.$row['id']
)
);
} else {
$actions .= Display::return_icon(
@ -945,7 +954,7 @@ if (!empty($exerciseList)) {
continue;
}
$url = '<a '.$alt_title.' href="overview.php?'.api_get_cidreq().$myorigin.$mylpid.$mylpitemid.'&exerciseId='.$row['id'].'">'.
$url = '<a '.$alt_title.' href="overview.php?'.api_get_cidreq().$mylpid.$mylpitemid.'&exerciseId='.$row['id'].'">'.
$cut_title.'</a>';
// Link of the exercise.

@ -217,7 +217,7 @@ foreach ($question_list as $questionId) {
$label_attributes['for'] = $check_id;
$label_attributes['class'] = "checkbox";
$checkbox = Display::input('checkbox', 'remind_list['.$questionId.']', '', $attributes);
$url = 'exercise_submit.php?exerciseId='.$objExercise->id.'&num='.$counter.'&reminder=1';
$url = 'exercise_submit.php?exerciseId='.$objExercise->id.'&num='.$counter.'&reminder=1&'.api_get_cidreq();
$counter++;
if ($objExercise->type == ONE_PER_PAGE) {

@ -47,7 +47,7 @@ if (empty($objExercise)) {
$objExercise = new Exercise();
$exercise_stat_info = $objExercise->get_stat_track_exercise_info_by_exe_id($exe_id);
if (!empty($exercise_stat_info) && isset($exercise_stat_info['exe_exo_id'])) {
header("Location: overview.php?exerciseId=".$exercise_stat_info['exe_exo_id']);
header("Location: overview.php?exerciseId=".$exercise_stat_info['exe_exo_id'].'&'.api_get_cidreq());
exit;
}
api_not_allowed();

@ -1254,7 +1254,7 @@ if (!empty($error)) {
}
</script>';
echo '<form id="exercise_form" method="post" action="'.api_get_self().'?'.api_get_cidreq().'&reminder='.$reminder.'&autocomplete=off&&exerciseId='.$exerciseId.'" name="frm_exercise" '.$onsubmit.'>
echo '<form id="exercise_form" method="post" action="'.api_get_self().'?'.api_get_cidreq().'&reminder='.$reminder.'&autocomplete=off&exerciseId='.$exerciseId.'" name="frm_exercise" '.$onsubmit.'>
<input type="hidden" name="formSent" value="1" />
<input type="hidden" name="exerciseId" value="'.$exerciseId.'" />
<input type="hidden" name="num" value="'.$current_question.'" id="num_current_id" />

@ -110,7 +110,7 @@ if (empty($choice_value)) {
// IMPORTANT
//this is the real redirect function
//echo 'window.location.href = "exercise_submit_modal.php?learnpath_id='.$learnpath_id.'&learnpath_item_id='.$learnpath_item_id.'&hotspotcoord="+ hotspotcoord + "&hotspot="+ hotspot + "&choice="+ choice_js + "&exerciseId='.$exerciseId.'&num='.$questionNum.'&exerciseType='.$exerciseType.'&origin='.$origin.'&gradebook='.$gradebook.'";';
echo ' url = "exercise_submit_modal.php?learnpath_id='.$learnpath_id.'&learnpath_item_id='.$learnpath_item_id.'&hotspotcoord="+ hotspotcoord + "&hotspot="+ hotspot + "&choice="+ choice_js + "&exerciseId='.$exerciseId.'&num='.$questionNum.'&exerciseType='.$exerciseType.'&origin='.$origin.'&gradebook='.$gradebook.'";';
echo ' url = "exercise_submit_modal.php?learnpath_id='.$learnpath_id.'&learnpath_item_id='.$learnpath_item_id.'&hotspotcoord="+ hotspotcoord + "&hotspot="+ hotspot + "&choice="+ choice_js + "&exerciseId='.$exerciseId.'&num='.$questionNum.'&exerciseType='.$exerciseType.'&'.api_get_cidreq().'&gradebook='.$gradebook.'";';
echo "$('#global-modal .modal-body').load(url);";
echo '</script>';
exit;
@ -599,7 +599,7 @@ if ($links != '') {
} else {
$questionNum++;
echo '<script>
self.parent.window.location.href = "exercise_submit.php?exerciseId='.$exerciseId.'&num='.$questionNum.'&exerciseType='.$exerciseType.'&origin='.$origin.'";
self.parent.window.location.href = "exercise_submit.php?exerciseId='.$exerciseId.'&num='.$questionNum.'&exerciseType='.$exerciseType.'&'.api_get_cidreq().'";
//self.parent.tb_remove();
</script>';
}

@ -576,8 +576,7 @@ if ($modifyAnswers) {
echo Display::return_message($msgErr, 'normal'); //main API
}
$hotspot_admin_url = api_get_path(WEB_CODE_PATH).'exercise/admin.php?'.api_get_cidreq().'&hotspotadmin='
.$modifyAnswers.'&exerciseId='.$exerciseId.'&'.api_get_cidreq();
$hotspot_admin_url = api_get_path(WEB_CODE_PATH).'exercise/admin.php?'.api_get_cidreq().'&hotspotadmin='.$modifyAnswers.'&exerciseId='.$exerciseId;
?>
<form method="post" action="<?php echo $hotspot_admin_url; ?>" class="form-horizontal" id="frm_exercise"
name="frm_exercise">

@ -78,7 +78,7 @@ $edit_link = '';
if ($is_allowed_to_edit && $objExercise->sessionId == $sessionId) {
$edit_link = Display::url(
Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL),
api_get_path(WEB_CODE_PATH).'exercise/admin.php?'.api_get_cidreq().'&id_session='.api_get_session_id().'&exerciseId='.$objExercise->id
api_get_path(WEB_CODE_PATH).'exercise/admin.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id
);
}
$iconExercise = Display::return_icon('test-quiz.png', null, array(), ICON_SIZE_MEDIUM);

@ -246,7 +246,7 @@ if (!$inATest) {
[],
ICON_SIZE_TINY
),
api_get_self().'?'.api_get_cidreq()
api_get_self().'?'.api_get_cidreq().'&'
.http_build_query([
'exerciseId' => $exerciseId,
'deleteQuestion' => $id

Loading…
Cancel
Save