|
|
|
@ -441,7 +441,7 @@ abstract class Question |
|
|
|
|
$o_img->send_image($picturePath.'/'.$this->picture, -1, 'jpg'); |
|
|
|
|
$document_id = add_document($this->course, '/images/'.$this->picture, 'file', filesize($picturePath.'/'.$this->picture),$this->picture); |
|
|
|
|
if ($document_id) { |
|
|
|
|
return api_item_property_update($this->course, TOOL_DOCUMENT, $document_id, 'DocumentAdded', api_get_user_id); |
|
|
|
|
return api_item_property_update($this->course, TOOL_DOCUMENT, $document_id, 'DocumentAdded', api_get_user_id()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -552,11 +552,21 @@ abstract class Question |
|
|
|
|
// if the question has got an ID and if the picture exists |
|
|
|
|
if ($this->id && !empty($this->picture)) { |
|
|
|
|
$picture=explode('.',$this->picture); |
|
|
|
|
$Extension=$picture[sizeof($picture)-1]; |
|
|
|
|
$picture='quiz-'.$questionId.'.'.$Extension; |
|
|
|
|
$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); |
|
|
|
|
return @copy($source_path.'/'.$this->picture, $destination_path.'/'.$picture)?true:false; |
|
|
|
|
|
|
|
|
|
$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()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return $result; |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
@ -572,7 +582,6 @@ abstract class Question |
|
|
|
|
*/ |
|
|
|
|
function setTmpPicture($Picture,$PictureName) { |
|
|
|
|
global $picturePath; |
|
|
|
|
|
|
|
|
|
$PictureName = explode('.',$PictureName); |
|
|
|
|
$Extension = $PictureName[sizeof($PictureName)-1]; |
|
|
|
|
|
|
|
|
@ -609,21 +618,14 @@ abstract class Question |
|
|
|
|
if ($this->id) { |
|
|
|
|
if (file_exists($picturePath.'/tmp.jpg')) { |
|
|
|
|
$Extension='jpg'; |
|
|
|
|
} |
|
|
|
|
elseif(file_exists($picturePath.'/tmp.gif')) |
|
|
|
|
{ |
|
|
|
|
} elseif(file_exists($picturePath.'/tmp.gif')) { |
|
|
|
|
$Extension='gif'; |
|
|
|
|
} |
|
|
|
|
elseif(file_exists($picturePath.'/tmp.png')) |
|
|
|
|
{ |
|
|
|
|
} elseif(file_exists($picturePath.'/tmp.png')) { |
|
|
|
|
$Extension='png'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$this->picture='quiz-'.$this->id.'.'.$Extension; |
|
|
|
|
|
|
|
|
|
return @rename($picturePath.'/tmp.'.$Extension,$picturePath.'/'.$this->picture)?true:false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -666,7 +668,7 @@ abstract class Question |
|
|
|
|
Database::query($sql); |
|
|
|
|
$this->saveCategory($category); |
|
|
|
|
if (!empty($exerciseId)) { |
|
|
|
|
api_item_property_update($this->course, TOOL_QUIZ, $id,'QuizQuestionUpdated',api_get_user_id); |
|
|
|
|
api_item_property_update($this->course, TOOL_QUIZ, $id,'QuizQuestionUpdated',api_get_user_id()); |
|
|
|
|
} |
|
|
|
|
if (api_get_setting('search_enabled')=='true') { |
|
|
|
|
if ($exerciseId != 0) { |
|
|
|
@ -721,7 +723,6 @@ abstract class Question |
|
|
|
|
Database::query($sql); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (api_get_setting('search_enabled')=='true') { |
|
|
|
|
if ($exerciseId != 0) { |
|
|
|
|
$this -> search_engine_edit($exerciseId, TRUE); |
|
|
|
@ -1037,7 +1038,7 @@ abstract class Question |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Duplicates the picture |
|
|
|
|
// Duplicates the picture of the hotspot |
|
|
|
|
$this->exportPicture($new_question_id, $course_info); |
|
|
|
|
return $new_question_id; |
|
|
|
|
} |
|
|
|
|