|
@@ -22,7 +22,7 @@ abstract class Question
|
|
|
public $type;
|
|
|
public $level;
|
|
|
public $picture;
|
|
|
- public $exerciseList; // array with the list of exercises which this question is in
|
|
|
+ public $exerciseList; // array with the list of exercises which this question is in
|
|
|
public $category_list;
|
|
|
public $parent_id;
|
|
|
public $category;
|
|
@@ -47,8 +47,8 @@ abstract class Question
|
|
|
'multiple_answer_combination_true_false.class.php',
|
|
|
'MultipleAnswerCombinationTrueFalse'
|
|
|
),
|
|
|
- GLOBAL_MULTIPLE_ANSWER => array('global_multiple_answer.class.php' , 'GlobalMultipleAnswer'),
|
|
|
- CALCULATED_ANSWER => array('calculated_answer.class.php' , 'CalculatedAnswer'),
|
|
|
+ GLOBAL_MULTIPLE_ANSWER => array('global_multiple_answer.class.php', 'GlobalMultipleAnswer'),
|
|
|
+ CALCULATED_ANSWER => array('calculated_answer.class.php', 'CalculatedAnswer'),
|
|
|
UNIQUE_ANSWER_IMAGE => ['UniqueAnswerImage.php', 'UniqueAnswerImage'],
|
|
|
DRAGGABLE => ['Draggable.php', 'Draggable'],
|
|
|
MATCHING_DRAGGABLE => ['MatchingDraggable.php', 'MatchingDraggable'],
|
|
@@ -108,7 +108,7 @@ abstract class Question
|
|
|
$id = intval($id);
|
|
|
|
|
|
if (!empty($course_id)) {
|
|
|
- $course_info = api_get_course_info_by_id($course_id);
|
|
|
+ $course_info = api_get_course_info_by_id($course_id);
|
|
|
} else {
|
|
|
$course_info = api_get_course_info();
|
|
|
}
|
|
@@ -266,7 +266,7 @@ abstract class Question
|
|
|
public function selectPicturePath()
|
|
|
{
|
|
|
if (!empty($this->picture)) {
|
|
|
- return api_get_path(WEB_COURSE_PATH).$this->course['path'].'/document/images/'.$this->getPictureFilename();
|
|
|
+ return api_get_path(WEB_COURSE_PATH).$this->course['directory'].'/document/images/'.$this->getPictureFilename();
|
|
|
}
|
|
|
|
|
|
return '';
|
|
@@ -360,7 +360,7 @@ abstract class Question
|
|
|
*/
|
|
|
public function updateTitle($title)
|
|
|
{
|
|
|
- $this->question=$title;
|
|
|
+ $this->question = $title;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -459,7 +459,7 @@ abstract class Question
|
|
|
// DO nothing
|
|
|
} else {
|
|
|
$sql = "INSERT INTO $TBL_QUESTION_REL_CATEGORY (c_id, question_id, category_id)
|
|
|
- VALUES (" . api_get_course_int_id() . ", $question_id, $category_id)";
|
|
|
+ VALUES (".api_get_course_int_id().", $question_id, $category_id)";
|
|
|
Database::query($sql);
|
|
|
}
|
|
|
}
|
|
@@ -485,7 +485,7 @@ abstract class Question
|
|
|
$sql = "SELECT count(*) AS nb FROM $table
|
|
|
WHERE
|
|
|
question_id = $question_id AND
|
|
|
- c_id=" . api_get_course_int_id();
|
|
|
+ c_id=".api_get_course_int_id();
|
|
|
$res = Database::query($sql);
|
|
|
$row = Database::fetch_array($res);
|
|
|
if ($row['nb'] > 0) {
|
|
@@ -493,11 +493,11 @@ abstract class Question
|
|
|
SET category_id = $category_id
|
|
|
WHERE
|
|
|
question_id = $question_id AND
|
|
|
- c_id = " . api_get_course_int_id();
|
|
|
+ c_id = ".api_get_course_int_id();
|
|
|
Database::query($sql);
|
|
|
} else {
|
|
|
$sql = "INSERT INTO $table (c_id, question_id, category_id)
|
|
|
- VALUES (" . api_get_course_int_id().", $question_id, $category_id)";
|
|
|
+ VALUES (".api_get_course_int_id().", $question_id, $category_id)";
|
|
|
Database::query($sql);
|
|
|
}
|
|
|
}
|
|
@@ -515,7 +515,7 @@ abstract class Question
|
|
|
$sql = "DELETE FROM $table
|
|
|
WHERE
|
|
|
question_id = $question_id AND
|
|
|
- c_id = " . api_get_course_int_id();
|
|
|
+ c_id = ".api_get_course_int_id();
|
|
|
Database::query($sql);
|
|
|
}
|
|
|
|
|
@@ -568,58 +568,61 @@ abstract class Question
|
|
|
) {
|
|
|
// removes old answers
|
|
|
$sql = "DELETE FROM $TBL_REPONSES
|
|
|
- WHERE c_id = $course_id AND question_id = " . intval($this->id);
|
|
|
+ WHERE c_id = $course_id AND question_id = ".intval($this->id);
|
|
|
Database::query($sql);
|
|
|
}
|
|
|
|
|
|
- $this->type=$type;
|
|
|
+ $this->type = $type;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Get default hot spot folder in documents
|
|
|
+ * @return string
|
|
|
+ */
|
|
|
+ public function getHotSpotFolderInCourse()
|
|
|
+ {
|
|
|
+ if (empty($this->course) || empty($this->course['directory'])) {
|
|
|
+ // Stop everything if course is not set.
|
|
|
+ api_not_allowed();
|
|
|
+ }
|
|
|
+
|
|
|
+ $pictureAbsolutePath = api_get_path(SYS_COURSE_PATH).$this->course['directory'].'/document/images/';
|
|
|
+ $picturePath = basename($pictureAbsolutePath);
|
|
|
+
|
|
|
+ if (!is_dir($picturePath)) {
|
|
|
+ create_unexisting_directory(
|
|
|
+ $this->course,
|
|
|
+ api_get_user_id(),
|
|
|
+ 0,
|
|
|
+ 0,
|
|
|
+ 0,
|
|
|
+ dirname($pictureAbsolutePath),
|
|
|
+ '/'.$picturePath,
|
|
|
+ $picturePath
|
|
|
+ );
|
|
|
}
|
|
|
+
|
|
|
+ return $pictureAbsolutePath;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* adds a picture to the question
|
|
|
*
|
|
|
- * @param string $Picture - temporary path of the picture to upload
|
|
|
- * @param string $PictureName - Name of the picture
|
|
|
- * @param string $picturePath
|
|
|
+ * @param string $picture - temporary path of the picture to upload
|
|
|
*
|
|
|
* @return boolean - true if uploaded, otherwise false
|
|
|
*
|
|
|
* @author Olivier Brouckaert
|
|
|
*/
|
|
|
- public function uploadPicture($Picture, $PictureName, $picturePath = null)
|
|
|
+ public function uploadPicture($picture)
|
|
|
{
|
|
|
- if (empty($picturePath)) {
|
|
|
- global $picturePath;
|
|
|
- }
|
|
|
-
|
|
|
- if (!file_exists($picturePath)) {
|
|
|
- if (mkdir($picturePath, api_get_permissions_for_new_directories())) {
|
|
|
- // document path
|
|
|
- $documentPath = api_get_path(SYS_COURSE_PATH).$this->course['path'].'/document';
|
|
|
- $path = str_replace($documentPath, '', $picturePath);
|
|
|
- $title_path = basename($picturePath);
|
|
|
- $doc_id = add_document(
|
|
|
- $this->course,
|
|
|
- $path,
|
|
|
- 'folder',
|
|
|
- 0,
|
|
|
- $title_path
|
|
|
- );
|
|
|
- api_item_property_update(
|
|
|
- $this->course,
|
|
|
- TOOL_DOCUMENT,
|
|
|
- $doc_id,
|
|
|
- 'FolderCreated',
|
|
|
- api_get_user_id()
|
|
|
- );
|
|
|
- }
|
|
|
- }
|
|
|
+ $picturePath = $this->getHotSpotFolderInCourse();
|
|
|
|
|
|
// if the question has got an ID
|
|
|
if ($this->id) {
|
|
|
$pictureFilename = self::generatePictureName();
|
|
|
- $img = new Image($Picture);
|
|
|
+ $img = new Image($picture);
|
|
|
$img->send_image($picturePath.'/'.$pictureFilename, -1, 'jpg');
|
|
|
$document_id = add_document(
|
|
|
$this->course,
|
|
@@ -628,16 +631,25 @@ abstract class Question
|
|
|
filesize($picturePath.'/'.$pictureFilename),
|
|
|
$pictureFilename
|
|
|
);
|
|
|
- $this->picture = $document_id;
|
|
|
|
|
|
if ($document_id) {
|
|
|
- return api_item_property_update(
|
|
|
+ $this->picture = $document_id;
|
|
|
+
|
|
|
+ if (!file_exists($picturePath.'/'.$pictureFilename)) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ api_item_property_update(
|
|
|
$this->course,
|
|
|
TOOL_DOCUMENT,
|
|
|
$document_id,
|
|
|
'DocumentAdded',
|
|
|
api_get_user_id()
|
|
|
);
|
|
|
+
|
|
|
+ $this->resizePicture('width', 800);
|
|
|
+
|
|
|
+ return true;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -668,14 +680,14 @@ abstract class Question
|
|
|
*
|
|
|
* @author Toon Keppens
|
|
|
*/
|
|
|
- public function resizePicture($Dimension, $Max)
|
|
|
+ private function resizePicture($Dimension, $Max)
|
|
|
{
|
|
|
- global $picturePath;
|
|
|
+ $picturePath = $this->getHotSpotFolderInCourse();
|
|
|
|
|
|
// if the question has an ID
|
|
|
if ($this->id) {
|
|
|
// Get dimensions from current image.
|
|
|
- $my_image = new Image($picturePath . '/' . $this->picture);
|
|
|
+ $my_image = new Image($picturePath.'/'.$this->picture);
|
|
|
|
|
|
$current_image_size = $my_image->get_image_size();
|
|
|
$current_width = $current_image_size['width'];
|
|
@@ -716,7 +728,7 @@ abstract class Question
|
|
|
}
|
|
|
|
|
|
$my_image->resize($new_width, $new_height);
|
|
|
- $result = $my_image->send_image($picturePath . '/' . $this->picture);
|
|
|
+ $result = $my_image->send_image($picturePath.'/'.$this->picture);
|
|
|
|
|
|
if ($result) {
|
|
|
return true;
|
|
@@ -734,14 +746,14 @@ abstract class Question
|
|
|
*/
|
|
|
public function removePicture()
|
|
|
{
|
|
|
- global $picturePath;
|
|
|
+ $picturePath = $this->getHotSpotFolderInCourse();
|
|
|
|
|
|
// if the question has got an ID and if the picture exists
|
|
|
if ($this->id) {
|
|
|
$picture = $this->picture;
|
|
|
$this->picture = '';
|
|
|
|
|
|
- return @unlink($picturePath . '/' . $picture) ? true : false;
|
|
|
+ return @unlink($picturePath.'/'.$picture) ? true : false;
|
|
|
}
|
|
|
|
|
|
return false;
|
|
@@ -758,43 +770,56 @@ abstract class Question
|
|
|
{
|
|
|
$course_id = $course_info['real_id'];
|
|
|
$TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_QUESTION);
|
|
|
- $destination_path = api_get_path(SYS_COURSE_PATH) . $course_info['path'] . '/document/images';
|
|
|
- $source_path = api_get_path(SYS_COURSE_PATH) . $this->course['path'] . '/document/images';
|
|
|
+ $destination_path = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/document/images';
|
|
|
+ $source_path = api_get_path(SYS_COURSE_PATH).$this->course['path'].'/document/images';
|
|
|
|
|
|
// if the question has got an ID and if the picture exists
|
|
|
- if ($this->id && !empty($this->picture)) {
|
|
|
+ if (!$this->id || empty($this->picture)) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (file_exists($source_path.'/'.$this->picture)) {
|
|
|
+ // for backward compatibility
|
|
|
$picture = explode('.', $this->picture);
|
|
|
$extension = $picture[sizeof($picture) - 1];
|
|
|
- $picture = 'quiz-' . $questionId . '.' . $extension;
|
|
|
- $result = @copy($source_path . '/' . $this->picture, $destination_path . '/' . $picture) ? true : false;
|
|
|
- // If copy was correct then add to the database
|
|
|
- if ($result) {
|
|
|
- $sql = "UPDATE $TBL_QUESTIONS SET
|
|
|
- picture = '" . Database::escape_string($picture) . "'
|
|
|
- WHERE c_id = $course_id AND id='" . intval($questionId) . "'";
|
|
|
- Database::query($sql);
|
|
|
+ $picture = 'quiz-'.$questionId.'.'.$extension;
|
|
|
+ $result = @copy($source_path.'/'.$this->picture, $destination_path.'/'.$picture);
|
|
|
+ } else {
|
|
|
+ $imageInfo = DocumentManager::get_document_data_by_id($this->picture, $course_info['code']);
|
|
|
+ $picture = $this->generatePictureName();
|
|
|
|
|
|
- $document_id = add_document(
|
|
|
- $course_info,
|
|
|
- '/images/' . $picture,
|
|
|
- 'file',
|
|
|
- filesize($destination_path . '/' . $picture),
|
|
|
- $picture
|
|
|
- );
|
|
|
- if ($document_id) {
|
|
|
- return api_item_property_update(
|
|
|
- $course_info,
|
|
|
- TOOL_DOCUMENT,
|
|
|
- $document_id,
|
|
|
- 'DocumentAdded',
|
|
|
- api_get_user_id()
|
|
|
- );
|
|
|
- }
|
|
|
- }
|
|
|
+ $result = @copy($imageInfo['absolute_path'], $destination_path.'/'.$picture);
|
|
|
+ }
|
|
|
|
|
|
- return $result;
|
|
|
+ // If copy was correct then add to the database
|
|
|
+ if (!$result) {
|
|
|
+ return false;
|
|
|
}
|
|
|
- return false;
|
|
|
+
|
|
|
+ $sql = "UPDATE $TBL_QUESTIONS SET
|
|
|
+ picture = '".Database::escape_string($picture)."'
|
|
|
+ WHERE c_id = $course_id AND id='".intval($questionId)."'";
|
|
|
+ Database::query($sql);
|
|
|
+
|
|
|
+ $document_id = add_document(
|
|
|
+ $course_info,
|
|
|
+ '/images/'.$picture,
|
|
|
+ 'file',
|
|
|
+ filesize($destination_path.'/'.$picture),
|
|
|
+ $picture
|
|
|
+ );
|
|
|
+
|
|
|
+ if (!$document_id) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ return api_item_property_update(
|
|
|
+ $course_info,
|
|
|
+ TOOL_DOCUMENT,
|
|
|
+ $document_id,
|
|
|
+ 'DocumentAdded',
|
|
|
+ api_get_user_id()
|
|
|
+ );
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -803,17 +828,17 @@ abstract class Question
|
|
|
* For example, if we first show a confirmation box.
|
|
|
*
|
|
|
* @author Olivier Brouckaert
|
|
|
- * @param string $Picture - temporary path of the picture to move
|
|
|
- * @param string $PictureName - Name of the picture
|
|
|
+ * @param string $picture - temporary path of the picture to move
|
|
|
+ * @param string $pictureName - Name of the picture
|
|
|
*/
|
|
|
- public function setTmpPicture($Picture, $PictureName)
|
|
|
+ public function setTmpPicture($picture, $pictureName)
|
|
|
{
|
|
|
- global $picturePath;
|
|
|
- $PictureName = explode('.', $PictureName);
|
|
|
- $Extension = $PictureName[sizeof($PictureName) - 1];
|
|
|
+ $picturePath = $this->getHotSpotFolderInCourse();
|
|
|
+ $pictureName = explode('.', $pictureName);
|
|
|
+ $Extension = $pictureName[sizeof($pictureName) - 1];
|
|
|
|
|
|
// saves the picture into a temporary file
|
|
|
- @move_uploaded_file($Picture, $picturePath . '/tmp.' . $Extension);
|
|
|
+ @move_uploaded_file($picture, $picturePath.'/tmp.'.$Extension);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -904,12 +929,12 @@ abstract class Question
|
|
|
$TBL_EXERCISE_QUESTION as test_question
|
|
|
WHERE
|
|
|
question.id = test_question.question_id AND
|
|
|
- test_question.exercice_id = " . intval($exerciseId) . " AND
|
|
|
+ test_question.exercice_id = ".intval($exerciseId)." AND
|
|
|
question.c_id = $c_id AND
|
|
|
test_question.c_id = $c_id ";
|
|
|
$result = Database::query($sql);
|
|
|
$current_position = Database::result($result, 0, 0);
|
|
|
- $this->updatePosition($current_position+1);
|
|
|
+ $this->updatePosition($current_position + 1);
|
|
|
$position = $this->position;
|
|
|
|
|
|
$params = [
|
|
@@ -1017,7 +1042,7 @@ abstract class Question
|
|
|
$rmQs = false
|
|
|
) {
|
|
|
// update search engine and its values table if enabled
|
|
|
- if (api_get_setting('search_enabled')=='true' && extension_loaded('xapian')) {
|
|
|
+ if (api_get_setting('search_enabled') == 'true' && extension_loaded('xapian')) {
|
|
|
$course_id = api_get_course_id();
|
|
|
// get search_did
|
|
|
$tbl_se_ref = Database::get_main_table(TABLE_MAIN_SEARCH_ENGINE_REF);
|
|
@@ -1035,8 +1060,8 @@ abstract class Question
|
|
|
$res = Database::query($sql);
|
|
|
|
|
|
if (Database::num_rows($res) > 0 || $addQs) {
|
|
|
- require_once(api_get_path(LIBRARY_PATH) . 'search/ChamiloIndexer.class.php');
|
|
|
- require_once(api_get_path(LIBRARY_PATH) . 'search/IndexableChunk.class.php');
|
|
|
+ require_once(api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php');
|
|
|
+ require_once(api_get_path(LIBRARY_PATH).'search/IndexableChunk.class.php');
|
|
|
|
|
|
$di = new ChamiloIndexer();
|
|
|
if ($addQs) {
|
|
@@ -1049,7 +1074,7 @@ abstract class Question
|
|
|
|
|
|
// retrieve others exercise ids
|
|
|
$se_ref = Database::fetch_array($res);
|
|
|
- $se_doc = $di->get_document((int)$se_ref['search_did']);
|
|
|
+ $se_doc = $di->get_document((int) $se_ref['search_did']);
|
|
|
if ($se_doc !== false) {
|
|
|
if (($se_doc_data = $di->get_document_data($se_doc)) !== FALSE) {
|
|
|
$se_doc_data = unserialize($se_doc_data);
|
|
@@ -1087,16 +1112,16 @@ abstract class Question
|
|
|
SE_DATA => array(
|
|
|
'type' => SE_DOCTYPE_EXERCISE_QUESTION,
|
|
|
'exercise_ids' => $question_exercises,
|
|
|
- 'question_id' => (int)$this->id
|
|
|
+ 'question_id' => (int) $this->id
|
|
|
),
|
|
|
- SE_USER => (int)api_get_user_id(),
|
|
|
+ SE_USER => (int) api_get_user_id(),
|
|
|
);
|
|
|
$ic_slide->xapian_data = serialize($xapian_data);
|
|
|
$ic_slide->addValue("content", $this->description);
|
|
|
|
|
|
//TODO: index answers, see also form validation on question_admin.inc.php
|
|
|
|
|
|
- $di->remove_document((int)$se_ref['search_did']);
|
|
|
+ $di->remove_document((int) $se_ref['search_did']);
|
|
|
$di->addChunk($ic_slide);
|
|
|
|
|
|
//index and return search engine document id
|
|
@@ -1175,7 +1200,7 @@ abstract class Question
|
|
|
$count = $new_exercise->selectNbrQuestions();
|
|
|
$count++;
|
|
|
$sql = "INSERT INTO $exerciseRelQuestionTable (c_id, question_id, exercice_id, question_order)
|
|
|
- VALUES ({$this->course['real_id']}, " . intval($id) . ", " . intval($exerciseId) . ", '$count')";
|
|
|
+ VALUES ({$this->course['real_id']}, ".intval($id).", ".intval($exerciseId).", '$count')";
|
|
|
Database::query($sql);
|
|
|
|
|
|
// we do not want to reindex if we had just saved adnd indexed the question
|
|
@@ -1212,17 +1237,17 @@ abstract class Question
|
|
|
FROM $TBL_EXERCISE_QUESTION
|
|
|
WHERE
|
|
|
c_id = $course_id
|
|
|
- AND question_id = " . intval($id) . "
|
|
|
+ AND question_id = ".intval($id)."
|
|
|
AND exercice_id = " . intval($exerciseId);
|
|
|
$res = Database::query($sql);
|
|
|
- if (Database::num_rows($res)>0) {
|
|
|
+ if (Database::num_rows($res) > 0) {
|
|
|
$row = Database::fetch_array($res);
|
|
|
if (!empty($row['question_order'])) {
|
|
|
$sql = "UPDATE $TBL_EXERCISE_QUESTION
|
|
|
SET question_order = question_order-1
|
|
|
WHERE
|
|
|
c_id = $course_id
|
|
|
- AND exercice_id = " . intval($exerciseId) . "
|
|
|
+ AND exercice_id = ".intval($exerciseId)."
|
|
|
AND question_order > " . $row['question_order'];
|
|
|
Database::query($sql);
|
|
|
}
|
|
@@ -1231,7 +1256,7 @@ abstract class Question
|
|
|
$sql = "DELETE FROM $TBL_EXERCISE_QUESTION
|
|
|
WHERE
|
|
|
c_id = $course_id
|
|
|
- AND question_id = " . intval($id) . "
|
|
|
+ AND question_id = ".intval($id)."
|
|
|
AND exercice_id = " . intval($exerciseId);
|
|
|
Database::query($sql);
|
|
|
|
|
@@ -1272,7 +1297,7 @@ abstract class Question
|
|
|
SET question_order = question_order-1
|
|
|
WHERE
|
|
|
c_id= $course_id
|
|
|
- AND exercice_id = " . intval($row['exercice_id']) . "
|
|
|
+ AND exercice_id = ".intval($row['exercice_id'])."
|
|
|
AND question_order > " . $row['question_order'];
|
|
|
Database::query($sql);
|
|
|
}
|
|
@@ -1280,22 +1305,22 @@ abstract class Question
|
|
|
}
|
|
|
|
|
|
$sql = "DELETE FROM $TBL_EXERCISE_QUESTION
|
|
|
- WHERE c_id = $course_id AND question_id = " . $id;
|
|
|
+ WHERE c_id = $course_id AND question_id = ".$id;
|
|
|
Database::query($sql);
|
|
|
|
|
|
$sql = "DELETE FROM $TBL_QUESTIONS
|
|
|
- WHERE c_id = $course_id AND id = " . $id;
|
|
|
+ WHERE c_id = $course_id AND id = ".$id;
|
|
|
Database::query($sql);
|
|
|
|
|
|
$sql = "DELETE FROM $TBL_REPONSES
|
|
|
- WHERE c_id = $course_id AND question_id = " . $id;
|
|
|
+ WHERE c_id = $course_id AND question_id = ".$id;
|
|
|
Database::query($sql);
|
|
|
|
|
|
// remove the category of this question in the question_rel_category table
|
|
|
$sql = "DELETE FROM $TBL_QUIZ_QUESTION_REL_CATEGORY
|
|
|
WHERE
|
|
|
c_id = $course_id AND
|
|
|
- question_id = " . $id;
|
|
|
+ question_id = ".$id;
|
|
|
Database::query($sql);
|
|
|
|
|
|
api_item_property_update(
|
|
@@ -1464,7 +1489,7 @@ abstract class Question
|
|
|
if (class_exists($class_name)) {
|
|
|
return new $class_name();
|
|
|
} else {
|
|
|
- echo 'Can\'t instanciate class ' . $class_name . ' of type ' . $type;
|
|
|
+ echo 'Can\'t instanciate class '.$class_name.' of type '.$type;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1648,7 +1673,7 @@ abstract class Question
|
|
|
|
|
|
if ($feedback_type == 1) {
|
|
|
//2. but if it is a feedback DIRECT we only show the UNIQUE_ANSWER type that is currently available
|
|
|
- $question_type_custom_list = array (
|
|
|
+ $question_type_custom_list = array(
|
|
|
UNIQUE_ANSWER => self::$questionTypes[UNIQUE_ANSWER],
|
|
|
HOT_SPOT_DELINEATION => self::$questionTypes[HOT_SPOT_DELINEATION]
|
|
|
);
|
|
@@ -1664,14 +1689,14 @@ abstract class Question
|
|
|
require_once $a_type[0];
|
|
|
// get the picture of the type and the langvar which describes it
|
|
|
$img = $explanation = '';
|
|
|
- eval('$img = ' . $a_type[1] . '::$typePicture;');
|
|
|
- eval('$explanation = get_lang(' . $a_type[1] . '::$explanationLangVar);');
|
|
|
+ eval('$img = '.$a_type[1].'::$typePicture;');
|
|
|
+ eval('$explanation = get_lang('.$a_type[1].'::$explanationLangVar);');
|
|
|
echo '<li>';
|
|
|
echo '<div class="icon-image">';
|
|
|
|
|
|
|
|
|
- $icon = '<a href="admin.php?' . api_get_cidreq() . '&newQuestion=yes&answerType=' . $i . '">' .
|
|
|
- Display::return_icon($img, $explanation, null, ICON_SIZE_BIG) . '</a>';
|
|
|
+ $icon = '<a href="admin.php?'.api_get_cidreq().'&newQuestion=yes&answerType='.$i.'">'.
|
|
|
+ Display::return_icon($img, $explanation, null, ICON_SIZE_BIG).'</a>';
|
|
|
|
|
|
if ($objExercise->force_edit_exercise_in_lp === false) {
|
|
|
if ($objExercise->exercise_was_added_in_lp == true) {
|
|
@@ -1692,9 +1717,9 @@ abstract class Question
|
|
|
echo Display::return_icon('database_na.png', get_lang('GetExistingQuestion'), null, ICON_SIZE_BIG);
|
|
|
} else {
|
|
|
if ($feedback_type == 1) {
|
|
|
- echo $url = "<a href=\"question_pool.php?" . api_get_cidreq() . "&type=1&fromExercise=$exerciseId\">";
|
|
|
+ echo $url = "<a href=\"question_pool.php?".api_get_cidreq()."&type=1&fromExercise=$exerciseId\">";
|
|
|
} else {
|
|
|
- echo $url = '<a href="question_pool.php?' . api_get_cidreq() . '&fromExercise=' . $exerciseId . '">';
|
|
|
+ echo $url = '<a href="question_pool.php?'.api_get_cidreq().'&fromExercise='.$exerciseId.'">';
|
|
|
}
|
|
|
echo Display::return_icon('database.png', get_lang('GetExistingQuestion'), null, ICON_SIZE_BIG);
|
|
|
}
|
|
@@ -1827,7 +1852,7 @@ abstract class Question
|
|
|
$header .= $this->show_media_content();
|
|
|
}
|
|
|
|
|
|
- $header .= Display::page_subheader2($counter_label . ". " . $question_title);
|
|
|
+ $header .= Display::page_subheader2($counter_label.". ".$question_title);
|
|
|
$header .= Display::div(
|
|
|
"<div class=\"rib rib-$class\"><h3>$score_label</h3></div> <h4>{$score['result']}</h4>",
|
|
|
array('class' => 'ribbon')
|
|
@@ -1918,8 +1943,8 @@ abstract class Question
|
|
|
require_once $tabQuestionList[$type][0];
|
|
|
|
|
|
$img = $explanation = null;
|
|
|
- eval('$img = ' . $tabQuestionList[$type][1] . '::$typePicture;');
|
|
|
- eval('$explanation = get_lang(' . $tabQuestionList[$type][1] . '::$explanationLangVar);');
|
|
|
+ eval('$img = '.$tabQuestionList[$type][1].'::$typePicture;');
|
|
|
+ eval('$explanation = get_lang('.$tabQuestionList[$type][1].'::$explanationLangVar);');
|
|
|
return array($img, $explanation);
|
|
|
}
|
|
|
|