Removing ALLOWED_TO_INCLUDE constant

skala
Julio Montoya 12 years ago
parent e98ba67a48
commit 7d49277af9
  1. 432
      main/exercice/admin.php
  2. 7
      main/exercice/adminhp.php
  3. 4
      main/exercice/answer_admin.inc.php
  4. 25
      main/exercice/exercice.php
  5. 6
      main/exercice/hotspot_admin.inc.php
  6. 5
      main/exercice/question_admin.inc.php
  7. 4
      main/exercice/question_list_admin.inc.php
  8. 2
      main/inc/lib/events.lib.inc.php

@ -1,53 +1,54 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Exercise administration
* This script allows to manage (create, modify) an exercise and its questions
*
* Following scripts are includes for a best code understanding :
*
* - exercise.class.php : for the creation of an Exercise object
* - question.class.php : for the creation of a Question object
* - answer.class.php : for the creation of an Answer object
* - exercise.lib.php : functions used in the exercise tool
* - exercise_admin.inc.php : management of the exercise
* - question_admin.inc.php : management of a question (statement & answers)
* - statement_admin.inc.php : management of a statement
* - answer_admin.inc.php : management of answers
* - question_list_admin.inc.php : management of the question list
*
* Main variables used in this script :
*
* - $is_allowedToEdit : set to 1 if the user is allowed to manage the exercise
* - $objExercise : exercise object
* - $objQuestion : question object
* - $objAnswer : answer object
* - $aType : array with answer types
* - $exerciseId : the exercise ID
* - $picturePath : the path of question pictures
* - $newQuestion : ask to create a new question
* - $modifyQuestion : ID of the question to modify
* - $editQuestion : ID of the question to edit
* - $submitQuestion : ask to save question modifications
* - $cancelQuestion : ask to cancel question modifications
* - $deleteQuestion : ID of the question to delete
* - $moveUp : ID of the question to move up
* - $moveDown : ID of the question to move down
* - $modifyExercise : ID of the exercise to modify
* - $submitExercise : ask to save exercise modifications
* - $cancelExercise : ask to cancel exercise modifications
* - $modifyAnswers : ID of the question which we want to modify answers for
* - $cancelAnswers : ask to cancel answer modifications
* - $buttonBack : ask to go back to the previous page in answers of type "Fill in blanks"
*
* @package chamilo.exercise
* @author Olivier Brouckaert
* Modified by Hubert Borderiou 21-10-2011 Question by category
*/
* Exercise administration
* This script allows to manage (create, modify) an exercise and its questions
*
* Following scripts are includes for a best code understanding :
*
* - exercise.class.php : for the creation of an Exercise object
* - question.class.php : for the creation of a Question object
* - answer.class.php : for the creation of an Answer object
* - exercise.lib.php : functions used in the exercise tool
* - exercise_admin.inc.php : management of the exercise
* - question_admin.inc.php : management of a question (statement & answers)
* - statement_admin.inc.php : management of a statement
* - answer_admin.inc.php : management of answers
* - question_list_admin.inc.php : management of the question list
*
* Main variables used in this script :
*
* - $is_allowedToEdit : set to 1 if the user is allowed to manage the exercise
* - $objExercise : exercise object
* - $objQuestion : question object
* - $objAnswer : answer object
* - $aType : array with answer types
* - $exerciseId : the exercise ID
* - $picturePath : the path of question pictures
* - $newQuestion : ask to create a new question
* - $modifyQuestion : ID of the question to modify
* - $editQuestion : ID of the question to edit
* - $submitQuestion : ask to save question modifications
* - $cancelQuestion : ask to cancel question modifications
* - $deleteQuestion : ID of the question to delete
* - $moveUp : ID of the question to move up
* - $moveDown : ID of the question to move down
* - $modifyExercise : ID of the exercise to modify
* - $submitExercise : ask to save exercise modifications
* - $cancelExercise : ask to cancel exercise modifications
* - $modifyAnswers : ID of the question which we want to modify answers for
* - $cancelAnswers : ask to cancel answer modifications
* - $buttonBack : ask to go back to the previous page in answers of type "Fill in blanks"
*
* @package chamilo.exercise
* @author Olivier Brouckaert
* Modified by Hubert Borderiou 21-10-2011 Question by category
*/
/**
* Code
*/
use \ChamiloSession as Session;
require_once 'exercise.class.php';
@ -59,63 +60,61 @@ $language_file = 'exercice';
require_once '../inc/global.inc.php';
require_once 'exercise.lib.php';
$current_course_tool = TOOL_QUIZ;
$current_course_tool = TOOL_QUIZ;
$this_section = SECTION_COURSES;
// Access control
api_protect_course_script(true);
$is_allowedToEdit = api_is_allowed_to_edit(null,true);
$is_allowedToEdit = api_is_allowed_to_edit(null, true);
if (!$is_allowedToEdit) {
api_not_allowed(true);
api_not_allowed(true);
}
// Allows script inclusions
define(ALLOWED_TO_INCLUDE,1);
require_once api_get_path(LIBRARY_PATH) . 'fileUpload.lib.php';
require_once api_get_path(LIBRARY_PATH) . 'document.lib.php';
require_once api_get_path(LIBRARY_PATH).'fileUpload.lib.php';
require_once api_get_path(LIBRARY_PATH).'document.lib.php';
/* stripslashes POST data */
if($_SERVER['REQUEST_METHOD'] == 'POST') {
foreach($_POST as $key=>$val) {
if(is_string($val)) {
$_POST[$key]=stripslashes($val);
} elseif(is_array($val)) {
foreach($val as $key2=>$val2) {
$_POST[$key][$key2]=stripslashes($val2);
}
}
$GLOBALS[$key]=$_POST[$key];
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
foreach ($_POST as $key => $val) {
if (is_string($val)) {
$_POST[$key] = stripslashes($val);
} elseif (is_array($val)) {
foreach ($val as $key2 => $val2) {
$_POST[$key][$key2] = stripslashes($val2);
}
}
$GLOBALS[$key] = $_POST[$key];
}
}
// get vars from GET
if ( empty ( $exerciseId ) ) {
if (empty($exerciseId)) {
$exerciseId = intval($_GET['exerciseId']);
}
if ( empty ( $newQuestion ) ) {
if (empty($newQuestion)) {
$newQuestion = $_GET['newQuestion'];
}
if ( empty ( $modifyAnswers ) ) {
if (empty($modifyAnswers)) {
$modifyAnswers = $_GET['modifyAnswers'];
}
if ( empty ( $editQuestion ) ) {
if (empty($editQuestion)) {
$editQuestion = $_GET['editQuestion'];
}
if ( empty ( $modifyQuestion ) ) {
if (empty($modifyQuestion)) {
$modifyQuestion = $_GET['modifyQuestion'];
}
if ( empty ( $deleteQuestion ) ) {
if (empty($deleteQuestion)) {
$deleteQuestion = $_GET['deleteQuestion'];
}
if ( empty ($clone_question) ) {
$clone_question = $_GET['clone_question'];
if (empty($clone_question)) {
$clone_question = $_GET['clone_question'];
}
if ( empty ( $questionId ) ) {
if (empty($questionId)) {
$questionId = $_SESSION['questionId'];
}
if ( empty ( $modifyExercise ) ) {
if (empty($modifyExercise)) {
$modifyExercise = $_GET['modifyExercise'];
}
@ -126,185 +125,186 @@ delete_all_incomplete_attempts(api_get_user_id(), $exerciseId, api_get_course_id
// get from session
$objExercise = $_SESSION['objExercise'];
$objQuestion = $_SESSION['objQuestion'];
$objAnswer = $_SESSION['objAnswer'];
$objAnswer = $_SESSION['objAnswer'];
// document path
$documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
$documentPath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document';
// picture path
$picturePath = $documentPath.'/images';
$picturePath = $documentPath . '/images';
// audio path
$audioPath = $documentPath.'/audio';
$audioPath = $documentPath . '/audio';
// the 5 types of answers
$aType = array(get_lang('UniqueSelect'),get_lang('MultipleSelect'),get_lang('FillBlanks'),get_lang('Matching'),get_lang('FreeAnswer'));
$aType = array(get_lang('UniqueSelect'), get_lang('MultipleSelect'), get_lang('FillBlanks'), get_lang('Matching'), get_lang('FreeAnswer'));
// tables used in the exercise tool
//@todo remove if this declarations are not used
$TBL_EXERCICE_QUESTION = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION);
$TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST);
$TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_QUESTION);
$TBL_REPONSES = Database::get_course_table(TABLE_QUIZ_ANSWER);
$TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT);
$TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST);
$TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_QUESTION);
$TBL_REPONSES = Database::get_course_table(TABLE_QUIZ_ANSWER);
$TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT);
if ($_GET['action'] == 'exportqti2' && !empty($_GET['questionId'])) {
require_once 'export/qti2/qti2_export.php';
$export = export_question($_GET['questionId'],true);
$qid = (int)$_GET['questionId'];
$archive_path = api_get_path(SYS_ARCHIVE_PATH);
$temp_dir_short = uniqid();
$temp_zip_dir = $archive_path."/".$temp_dir_short;
if(!is_dir($temp_zip_dir)) mkdir($temp_zip_dir, api_get_permissions_for_new_directories());
$temp_zip_file = $temp_zip_dir."/".api_get_unique_id().".zip";
$temp_xml_file = $temp_zip_dir."/qti2export_".$qid.'.xml';
file_put_contents($temp_xml_file,$export);
$zip_folder=new PclZip($temp_zip_file);
$zip_folder->add($temp_xml_file, PCLZIP_OPT_REMOVE_ALL_PATH);
$name = 'qti2_export_'.$qid.'.zip';
DocumentManager::file_send_for_download($temp_zip_file,true,$name);
unlink($temp_zip_file);
unlink($temp_xml_file);
rmdir($temp_zip_dir);
//DocumentManager::string_send_for_download($export,true,'qti2export_q'.$_GET['questionId'].'.xml');
exit; //otherwise following clicks may become buggy
require_once 'export/qti2/qti2_export.php';
$export = export_question($_GET['questionId'], true);
$qid = (int) $_GET['questionId'];
$archive_path = api_get_path(SYS_ARCHIVE_PATH);
$temp_dir_short = uniqid();
$temp_zip_dir = $archive_path . "/" . $temp_dir_short;
if (!is_dir($temp_zip_dir))
mkdir($temp_zip_dir, api_get_permissions_for_new_directories());
$temp_zip_file = $temp_zip_dir . "/" . api_get_unique_id() . ".zip";
$temp_xml_file = $temp_zip_dir . "/qti2export_" . $qid . '.xml';
file_put_contents($temp_xml_file, $export);
$zip_folder = new PclZip($temp_zip_file);
$zip_folder->add($temp_xml_file, PCLZIP_OPT_REMOVE_ALL_PATH);
$name = 'qti2_export_' . $qid . '.zip';
DocumentManager::file_send_for_download($temp_zip_file, true, $name);
unlink($temp_zip_file);
unlink($temp_xml_file);
rmdir($temp_zip_dir);
//DocumentManager::string_send_for_download($export,true,'qti2export_q'.$_GET['questionId'].'.xml');
exit; //otherwise following clicks may become buggy
}
// intializes the Exercise object
if (!is_object($objExercise)) {
// construction of the Exercise object
$objExercise = new Exercise();
// construction of the Exercise object
$objExercise = new Exercise();
// creation of a new exercise if wrong or not specified exercise ID
if ($exerciseId) {
$objExercise->read($exerciseId);
}
// saves the object into the session
Session::write('objExercise',$objExercise);
// creation of a new exercise if wrong or not specified exercise ID
if ($exerciseId) {
$objExercise->read($exerciseId);
}
// saves the object into the session
Session::write('objExercise', $objExercise);
}
// doesn't select the exercise ID if we come from the question pool
if(!$fromExercise) {
// gets the right exercise ID, and if 0 creates a new exercise
if(!$exerciseId = $objExercise->selectId()) {
$modifyExercise='yes';
}
if (!$fromExercise) {
// gets the right exercise ID, and if 0 creates a new exercise
if (!$exerciseId = $objExercise->selectId()) {
$modifyExercise = 'yes';
}
}
$nbrQuestions = $objExercise->selectNbrQuestions();
// intializes the Question object
if ($editQuestion || $newQuestion || $modifyQuestion || $modifyAnswers) {
if ($editQuestion || $newQuestion) {
if ($editQuestion || $newQuestion) {
// reads question data
if ($editQuestion) {
// question not found
if (!$objQuestion = Question::read($editQuestion)) {
api_not_allowed();
}
// saves the object into the session
Session::write('objQuestion',$objQuestion);
}
}
// reads question data
if ($editQuestion) {
// question not found
if (!$objQuestion = Question::read($editQuestion)) {
api_not_allowed();
}
// saves the object into the session
Session::write('objQuestion', $objQuestion);
}
}
// checks if the object exists
if(is_object($objQuestion)) {
// gets the question ID
$questionId = $objQuestion->selectId();
}
// checks if the object exists
if (is_object($objQuestion)) {
// gets the question ID
$questionId = $objQuestion->selectId();
}
}
// if cancelling an exercise
if ($cancelExercise) {
// existing exercise
if($exerciseId) {
unset($modifyExercise);
} else {
// existing exercise
if ($exerciseId) {
unset($modifyExercise);
} else {
// new exercise
// goes back to the exercise list
header('Location: exercice.php');
exit();
}
// goes back to the exercise list
header('Location: exercice.php');
exit();
}
}
// if cancelling question creation/modification
if ($cancelQuestion) {
// if we are creating a new question from the question pool
if(!$exerciseId && !$questionId) {
// goes back to the question pool
header('Location: question_pool.php');
exit();
} else {
// goes back to the question viewing
$editQuestion=$modifyQuestion;
unset($newQuestion,$modifyQuestion);
}
// if we are creating a new question from the question pool
if (!$exerciseId && !$questionId) {
// goes back to the question pool
header('Location: question_pool.php');
exit();
} else {
// goes back to the question viewing
$editQuestion = $modifyQuestion;
unset($newQuestion, $modifyQuestion);
}
}
if (isset($clone_question) && !empty($objExercise->id)) {
$old_question_obj = Question::read($clone_question);
$old_question_obj->question = $old_question_obj->question.' - '.get_lang('Copy');
$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_question_obj = Question::read($new_id);
$new_question_obj->addToList($exerciseId);
$new_id = $old_question_obj->duplicate();
$new_question_obj = Question::read($new_id);
$new_question_obj->addToList($exerciseId);
// This should be moved to the duplicate function
$new_answer_obj = new Answer($clone_question);
$new_answer_obj->read();
$new_answer_obj->duplicate($new_id);
// This should be moved to the duplicate function
$new_answer_obj = new Answer($clone_question);
$new_answer_obj->read();
$new_answer_obj->duplicate($new_id);
//Reloading tne $objExercise obj
$objExercise->read($objExercise->id);
header('Location: admin.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id);
exit;
header('Location: admin.php?' . api_get_cidreq() . '&exerciseId=' . $objExercise->id);
exit;
}
// if cancelling answer creation/modification
if ($cancelAnswers) {
// goes back to the question viewing
$editQuestion=$modifyAnswers;
unset($modifyAnswers);
// goes back to the question viewing
$editQuestion = $modifyAnswers;
unset($modifyAnswers);
}
// modifies the query string that is used in the link of tool name
if($editQuestion || $modifyQuestion || $newQuestion || $modifyAnswers) {
$nameTools = get_lang('QuestionManagement');
if ($editQuestion || $modifyQuestion || $newQuestion || $modifyAnswers) {
$nameTools = get_lang('QuestionManagement');
}
if (isset($_SESSION['gradebook'])){
$gradebook= $_SESSION['gradebook'];
if (isset($_SESSION['gradebook'])) {
$gradebook = $_SESSION['gradebook'];
}
if (!empty($gradebook) && $gradebook=='view') {
$interbreadcrumb[]= array (
'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
'name' => get_lang('ToolGradebook')
);
if (!empty($gradebook) && $gradebook == 'view') {
$interbreadcrumb[] = array(
'url' => '../gradebook/' . $_SESSION['gradebook_dest'],
'name' => get_lang('ToolGradebook')
);
}
$interbreadcrumb[] = array("url" => "exercice.php","name" => get_lang('Exercices'));
if (isset($_GET['newQuestion']) || isset($_GET['editQuestion']) ) {
$interbreadcrumb[] = array("url" => "admin.php?exerciseId=".$objExercise->id, "name" => $objExercise->name);
$interbreadcrumb[] = array("url" => "exercice.php", "name" => get_lang('Exercices'));
if (isset($_GET['newQuestion']) || isset($_GET['editQuestion'])) {
$interbreadcrumb[] = array("url" => "admin.php?exerciseId=" . $objExercise->id, "name" => $objExercise->name);
} else {
$interbreadcrumb[] = array("url" => "#", "name" => $objExercise->name);
}
// shows a link to go back to the question pool
if (!$exerciseId && $nameTools != get_lang('ExerciseManagement')){
$interbreadcrumb[]=array("url" => "question_pool.php?fromExercise=$fromExercise","name" => get_lang('QuestionPool'));
if (!$exerciseId && $nameTools != get_lang('ExerciseManagement')) {
$interbreadcrumb[] = array("url" => "question_pool.php?fromExercise=$fromExercise", "name" => get_lang('QuestionPool'));
}
// if the question is duplicated, disable the link of tool name
if ($modifyIn == 'thisExercise') {
if($buttonBack) {
$modifyIn='allExercises';
} else {
$noPHP_SELF=true;
}
if ($buttonBack) {
$modifyIn = 'allExercises';
} else {
$noPHP_SELF = true;
}
}
$htmlHeadXtra[] = '<script type="text/javascript">
@ -437,20 +437,20 @@ function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
// -->
</script>";
Display::display_header($nameTools,'Exercise');
Display::display_header($nameTools, 'Exercise');
$course_id = api_get_course_int_id();
$show_quiz_edition = true;
if (isset($exerciseId) && !empty($exerciseId)) {
$TBL_LP_ITEM = Database::get_course_table(TABLE_LP_ITEM);
$sql = "SELECT max_score FROM $TBL_LP_ITEM
WHERE c_id = $course_id AND item_type = '".TOOL_QUIZ."' AND path ='".Database::escape_string($exerciseId)."'";
$result = Database::query($sql);
if (Database::num_rows($result) > 0) {
Display::display_warning_message(get_lang('EditingExerciseCauseProblemsInLP'));
$show_quiz_edition = false;
}
$TBL_LP_ITEM = Database::get_course_table(TABLE_LP_ITEM);
$sql = "SELECT max_score FROM $TBL_LP_ITEM
WHERE c_id = $course_id AND item_type = '" . TOOL_QUIZ . "' AND path ='" . Database::escape_string($exerciseId) . "'";
$result = Database::query($sql);
if (Database::num_rows($result) > 0) {
Display::display_warning_message(get_lang('EditingExerciseCauseProblemsInLP'));
$show_quiz_edition = false;
}
}
// If we are in a test
@ -458,19 +458,19 @@ $inATest = isset($exerciseId) && $exerciseId > 0;
if ($inATest) {
echo '<div class="actions">';
if (isset($_GET['hotspotadmin']) || isset($_GET['newQuestion']) || isset($_GET['myid']))
echo '<a href="admin.php?exerciseId='.$exerciseId.'">'.Display::return_icon('back.png', get_lang('GoBackToQuestionList'),'',ICON_SIZE_MEDIUM).'</a>';
echo '<a href="admin.php?exerciseId=' . $exerciseId . '">' . Display::return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM) . '</a>';
if (!isset($_GET['hotspotadmin']) && !isset($_GET['newQuestion']) && !isset($_GET['myid']) && !isset($_GET['editQuestion'])) {
echo '<a href="exercice.php?'.api_get_cidReq().'">'.Display::return_icon('back.png', get_lang('BackToExercisesList'),'',ICON_SIZE_MEDIUM).'</a>';
if (!isset($_GET['hotspotadmin']) && !isset($_GET['newQuestion']) && !isset($_GET['myid']) && !isset($_GET['editQuestion'])) {
echo '<a href="exercice.php?' . api_get_cidReq() . '">' . Display::return_icon('back.png', get_lang('BackToExercisesList'), '', ICON_SIZE_MEDIUM) . '</a>';
}
echo '<a href="overview.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id.'&preview=1">'.Display::return_icon('preview_view.png', get_lang('Preview'),'',ICON_SIZE_MEDIUM).'</a>';
echo '<a href="overview.php?' . api_get_cidreq() . '&exerciseId=' . $objExercise->id . '&preview=1">' . Display::return_icon('preview_view.png', get_lang('Preview'), '', ICON_SIZE_MEDIUM) . '</a>';
echo Display::url(Display::return_icon('test_results.png', get_lang('Results'),'',ICON_SIZE_MEDIUM), 'exercise_report.php?'.api_get_cidReq().'&exerciseId='.$objExercise->id);
echo Display::url(Display::return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_MEDIUM), 'exercise_report.php?' . api_get_cidReq() . '&exerciseId=' . $objExercise->id);
if ($show_quiz_edition) {
echo '<a href="exercise_admin.php?'.api_get_cidreq().'&modifyExercise=yes&exerciseId='.$objExercise->id.'">'.Display::return_icon('settings.png', get_lang('ModifyExercise'),'',ICON_SIZE_MEDIUM).'</a>';
echo '<a href="exercise_admin.php?' . api_get_cidreq() . '&modifyExercise=yes&exerciseId=' . $objExercise->id . '">' . Display::return_icon('settings.png', get_lang('ModifyExercise'), '', ICON_SIZE_MEDIUM) . '</a>';
} else {
echo '<a href="">'.Display::return_icon('settings_na.png', get_lang('ModifyExercise'),'',ICON_SIZE_MEDIUM).'</a>';
echo '<a href="">' . Display::return_icon('settings_na.png', get_lang('ModifyExercise'), '', ICON_SIZE_MEDIUM) . '</a>';
}
$maxScoreAllQuestions = 0;
@ -482,31 +482,31 @@ if ($inATest) {
}
}
}
echo '<span style="float:right">'.sprintf(get_lang('XQuestionsWithTotalScoreY'), $objExercise->selectNbrQuestions(), $maxScoreAllQuestions).'</span>';
echo '<span style="float:right">' . sprintf(get_lang('XQuestionsWithTotalScoreY'), $objExercise->selectNbrQuestions(), $maxScoreAllQuestions) . '</span>';
echo '</div>';
} else if (isset($_GET['newQuestion'])) {
// we are in create a new question from question pool not in a test
echo '<div class="actions">';
echo '<a href="admin.php?'.api_get_cidreq().'">.'.Display::return_icon('back.png', get_lang('GoBackToQuestionList'),'',ICON_SIZE_MEDIUM).'</a>';
echo '</div>';
// we are in create a new question from question pool not in a test
echo '<div class="actions">';
echo '<a href="admin.php?' . api_get_cidreq() . '">.' . Display::return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM) . '</a>';
echo '</div>';
} else {
// If we are in question_poolbut not in an test, go back to question create in pool
echo '<div class="actions">';
echo '<a href="question_pool.php">'.Display::return_icon('back.png', get_lang('GoBackToQuestionList'),'',ICON_SIZE_MEDIUM).'</a>';
echo '</div>';
// If we are in question_poolbut not in an test, go back to question create in pool
echo '<div class="actions">';
echo '<a href="question_pool.php">' . Display::return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM) . '</a>';
echo '</div>';
}
if (isset($_GET['message'])) {
if (in_array($_GET['message'], array('ExerciseStored', 'ItemUpdated', 'ItemAdded'))) {
Display::display_confirmation_message(get_lang($_GET['message']));
}
if (in_array($_GET['message'], array('ExerciseStored', 'ItemUpdated', 'ItemAdded'))) {
Display::display_confirmation_message(get_lang($_GET['message']));
}
}
if ($newQuestion || $editQuestion) {
// statement management
$type = Security::remove_XSS($_REQUEST['answerType']);
echo '<input type="hidden" name="Type" value="'.$type.'" />';
require 'question_admin.inc.php';
// statement management
$type = Security::remove_XSS($_REQUEST['answerType']);
echo '<input type="hidden" name="Type" value="' . $type . '" />';
require 'question_admin.inc.php';
}
if (isset($_GET['hotspotadmin'])) {
@ -516,12 +516,12 @@ if (isset($_GET['hotspotadmin'])) {
if (!$objQuestion) {
api_not_allowed();
}
require 'hotspot_admin.inc.php';
require 'hotspot_admin.inc.php';
}
if (!$newQuestion && !$modifyQuestion && !$editQuestion && !isset($_GET['hotspotadmin'])) {
// question list management
require 'question_list_admin.inc.php';
// question list management
require 'question_list_admin.inc.php';
}
Session::write('objExercise', $objExercise);

@ -30,13 +30,10 @@ if (isset($_REQUEST["cancel"])) {
$newName = (!empty($_REQUEST['newName'])?$_REQUEST['newName']:'');
$hotpotatoesName = (!empty($_REQUEST['hotpotatoesName'])?$_REQUEST['hotpotatoesName']:'');
// allows script inclusions
define(ALLOWED_TO_INCLUDE,1);
$is_allowedToEdit=api_is_allowed_to_edit(null,true);
$is_allowedToEdit = api_is_allowed_to_edit(null,true);
// document path
$documentPath=api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
$documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
// picture path
$picturePath=$documentPath.'/images';

@ -13,10 +13,6 @@
*/
use \ChamiloSession as Session;
// ALLOWED_TO_INCLUDE is defined in admin.php
if (!defined('ALLOWED_TO_INCLUDE')) {
exit();
}
if (!is_object($objQuestion)) {
$objQuestion = Question :: read($_GET['modifyAnswers']);
}

@ -128,21 +128,7 @@ if (!empty($gradebook) && $gradebook=='view') {
$interbreadcrumb[] = array ('url' => '../gradebook/' . $_SESSION['gradebook_dest'],'name' => get_lang('ToolGradebook'));
}
if ($show != 'result') {
$nameTools = get_lang('Exercices');
} else {
if ($is_allowedToEdit || $is_tutor) {
$nameTools = get_lang('StudentScore');
$interbreadcrumb[] = array("url" => "exercice.php?gradebook=$gradebook","name" => get_lang('Exercices'));
$objExerciseTmp = new Exercise();
if ($objExerciseTmp->read($exerciseId)) {
$interbreadcrumb[] = array("url" => "admin.php?exerciseId=".$exerciseId, "name" => $objExerciseTmp->name);
}
} else {
$nameTools = get_lang('YourScore');
$interbreadcrumb[] = array ("url" => "exercice.php?gradebook=$gradebook","name" => get_lang('Exercices'));
}
}
$nameTools = get_lang('Exercices');
if ($is_allowedToEdit && !empty ($choice) && $choice == 'exportqti2') {
require_once 'export/qti2/qti2_export.php';
@ -554,7 +540,9 @@ if (!empty($exercise_list)) {
$title = $cut_title;
}
$count = intval(count_exercise_result_not_validated($my_exercise_id, $course_code, $session_id));
/*
* Exercise results counter
* $count = intval(count_exercise_result_not_validated($my_exercise_id, $course_code, $session_id));
$class_tip = '';
if (!empty($count)) {
@ -565,8 +553,9 @@ if (!empty($exercise_list)) {
if ($added_to_lp) {
//$title .= Display::div(get_lang('AddedToLPCannotBeAccessed'), array('class'=> 'lp_content_type_label'));
}
}*/
$class_tip = null;
$url = '<a '.$alt_title.' class="'.$class_tip.'" id="tooltip_'.$row['id'].'" href="overview.php?'.api_get_cidreq().$myorigin.$mylpid.$mylpitemid.'&exerciseId='.$row['id'].'"><img src="../img/quiz.gif" /> '.$title.' </a>';
$item = Display::tag('td', $url.' '.$session_img.$lp_blocked);

@ -8,14 +8,10 @@
*/
/**
* Code
* ALLOWED_TO_INCLUDE is defined in admin.php
* Code
*/
use \ChamiloSession as Session;
if (!defined('ALLOWED_TO_INCLUDE')) {
exit();
}
$modifyAnswers = intval($_GET['hotspotadmin']);
if (!is_object($objQuestion)) {

@ -12,11 +12,6 @@
* Code
*/
// ALLOWED_TO_INCLUDE is defined in admin.php
if(!defined('ALLOWED_TO_INCLUDE')) {
exit();
}
$course_id = api_get_course_int_id();
// INIT QUESTION

@ -16,10 +16,6 @@
* Modified by Hubert Borderiou 21-10-2011 (Question by category)
*/
// ALLOWED_TO_INCLUDE is defined in admin.php
if (!defined('ALLOWED_TO_INCLUDE')) {
exit();
}
// deletes a question from the exercise (not from the data base)
if ($deleteQuestion) {
// if the question exists

@ -1258,8 +1258,6 @@ function count_exercise_result_not_validated($exercise_id, $course_code, $sessio
$session_id = intval($session_id);
$exercise_id = intval($exercise_id);
$status = Database::escape_string($status);
$sql = "SELECT count(e.exe_id) as count FROM $table_track_exercises e LEFT JOIN $table_track_attempt a ON e.exe_id = a.exe_id
WHERE exe_exo_id = $exercise_id AND
exe_cours_id = '$course_code' AND

Loading…
Cancel
Save