Minor - format code.

1.10.x
Julio Montoya 10 years ago
parent dfdc842b8f
commit dad77a0cfa
  1. 14
      main/exercice/exercise.class.php
  2. 29
      main/exercice/hotspot.class.php
  3. 9
      main/exercice/question.class.php
  4. 2
      main/inc/lib/api.lib.php
  5. 1
      main/inc/lib/document.lib.php

@ -2175,8 +2175,8 @@ class Exercise
$arrques = null;
$arrans = null;
$questionId = intval($questionId);
$exeId = intval($exeId);
$questionId = intval($questionId);
$exeId = intval($exeId);
$TBL_TRACK_ATTEMPT = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$table_ans = Database::get_course_table(TABLE_QUIZ_ANSWER);
@ -2501,6 +2501,7 @@ class Exercise
for ($k = 0; $k < $last; $k++) {
$answer .= $pre_array[$k];
}
// splits weightings that are joined with a comma
$answerWeighting = explode(',', $is_set_switchable[0]);
@ -2511,6 +2512,7 @@ class Exercise
$j = 0;
//initialise answer tags
$user_tags = $correct_tags = $real_text = array();
// the loop will stop at the end of the text
while (1) {
// quits the loop if there are no more blanks (detect '[')
@ -2520,19 +2522,21 @@ class Exercise
$real_text[] = $answer;
break; //no more "blanks", quit the loop
}
// adds the piece of text that is before the blank
//and ends with '[' into a general storage array
// and ends with '[' into a general storage array
$real_text[] = api_substr($temp, 0, $pos +1);
$answer .= api_substr($temp, 0, $pos +1);
//take the string remaining (after the last "[" we found)
$temp = api_substr($temp, $pos +1);
// quit the loop if there are no more blanks, and update $pos to the position of next ']'
if (($pos = api_strpos($temp, ']')) === false) {
// adds the end of the text
$answer .= $temp;
break;
}
if ($from_database) {
$queryfill = "SELECT answer FROM ".$TBL_TRACK_ATTEMPT."
WHERE
@ -2557,7 +2561,9 @@ class Exercise
}
} else {
// This value is the user input, not escaped while correct answer is escaped by fckeditor
$choice[$j] = api_htmlentities(trim($choice[$j]));
}
$user_tags[] = $choice[$j];

@ -49,20 +49,29 @@ class HotSpot extends Question
}
}
/**
* @param FormValidator $form
* @param null $objExercise
* @return bool
*/
public function processCreation($form, $objExercise = null)
{
$file_info = $form -> getSubmitValue('imageUpload');
parent::processCreation ($form, $objExercise);
$file_info = $form->getSubmitValue('imageUpload');
$_course = api_get_course_info();
parent::processCreation($form, $objExercise);
if(!empty($file_info['tmp_name'])) {
$this->uploadPicture($file_info['tmp_name'], $file_info['name']);
global $picturePath;
//fixed width ang height
$documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
$picturePath = $documentPath.'/images';
// fixed width ang height
if (file_exists($picturePath.'/'.$this->picture)) {
list($width,$height) = @getimagesize($picturePath.'/'.$this->picture);
if($width>$height) {
$this->resizePicture('width',545);
if ($width > $height) {
$this->resizePicture('width', 545);
} else {
$this->resizePicture('height',350);
$this->resizePicture('height', 350);
}
$this->save();
} else {
@ -71,11 +80,13 @@ class HotSpot extends Question
}
}
function createAnswersForm ($form) {
function createAnswersForm ($form)
{
// nothing
}
function processAnswersCreation ($form) {
function processAnswersCreation ($form)
{
// nothing
}
}

@ -515,13 +515,18 @@ abstract class Question
$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());
api_item_property_update(
$this->course,
TOOL_DOCUMENT,
$doc_id,
'FolderCreated',
api_get_user_id()
);
}
}
// if the question has got an ID
if ($this->id) {
$extension = pathinfo($PictureName, PATHINFO_EXTENSION);
$this->picture = 'quiz-' . $this->id . '.jpg';
$o_img = new Image($Picture);
$o_img->send_image($picturePath . '/' . $this->picture, -1, 'jpg');

@ -195,9 +195,7 @@ define('LOG_SESSION_CREATE', 'session_created');
define('LOG_SESSION_DELETE', 'session_deleted');
define('LOG_SESSION_ADD_USER_COURSE', 'session_add_user_course');
define('LOG_SESSION_DELETE_USER_COURSE', 'session_delete_user_course');
define('LOG_SESSION_DELETE_USER', 'session_delete_user');
define('LOG_SESSION_ADD_COURSE', 'session_add_course');
define('LOG_SESSION_DELETE_COURSE', 'session_delete_course');

@ -3340,7 +3340,6 @@ class DocumentManager
$resources = Database::store_result($res_doc, 'ASSOC');
$return = '';
if ($lp_id) {
if ($folderId === false) {
$return .= '<div class="lp_resource_element">';

Loading…
Cancel
Save