|
|
|
|
@ -31,25 +31,24 @@ class HotSpot extends Question { |
|
|
|
|
|
|
|
|
|
function display() { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function createForm (&$form, $fck_config=0) { |
|
|
|
|
parent::createForm ($form, $fck_config); |
|
|
|
|
global $text, $class; |
|
|
|
|
if(!isset($_GET['editQuestion'])) { |
|
|
|
|
$renderer = $form->defaultRenderer(); |
|
|
|
|
$renderer = $form->defaultRenderer(); |
|
|
|
|
$form->addElement('file','imageUpload',array('<img src="../img/hotspots.png" />', get_lang('UploadJpgPicture')) ); |
|
|
|
|
|
|
|
|
|
// setting the save button here and not in the question class.php |
|
|
|
|
// Saving a question |
|
|
|
|
$form->addElement('style_submit_button','submitQuestion',get_lang('GoToQuestion'), 'class="'.$class.'"'); |
|
|
|
|
$form->addElement('style_submit_button','submitQuestion',get_lang('GoToQuestion'), 'class="'.$this->submitClass.'"'); |
|
|
|
|
$form->addRule('imageUpload', get_lang('OnlyImagesAllowed'), 'filetype', array ('jpg', 'jpeg', 'png', 'gif')); |
|
|
|
|
$form->addRule('imageUpload', get_lang('NoImage'), 'uploadedfile'); |
|
|
|
|
} else { |
|
|
|
|
// setting the save button here and not in the question class.php |
|
|
|
|
// Editing a question |
|
|
|
|
$form->addElement('style_submit_button','submitQuestion',get_lang('ModifyExercise'), 'class="'.$class.'"'); |
|
|
|
|
$form->addElement('style_submit_button','submitQuestion',get_lang('ModifyExercise'), 'class="'.$this->submitClass.'"'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function processCreation ($form, $objExercise = null) { |
|
|
|
|
@ -58,18 +57,18 @@ class HotSpot extends Question { |
|
|
|
|
if(!empty($file_info['tmp_name'])) { |
|
|
|
|
$this->uploadPicture($file_info['tmp_name'], $file_info['name']); |
|
|
|
|
global $picturePath; |
|
|
|
|
//fixed width ang height |
|
|
|
|
if (file_exists($picturePath.'/'.$this->picture)) { |
|
|
|
|
//fixed width ang height |
|
|
|
|
if (file_exists($picturePath.'/'.$this->picture)) { |
|
|
|
|
list($width,$height) = @getimagesize($picturePath.'/'.$this->picture); |
|
|
|
|
if($width>$height) { |
|
|
|
|
$this->resizePicture('width',545); |
|
|
|
|
} else { |
|
|
|
|
$this->resizePicture('height',350); |
|
|
|
|
} |
|
|
|
|
$this->save(); |
|
|
|
|
$this->save(); |
|
|
|
|
} else { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -95,16 +94,16 @@ class HotSpotDelineation extends HotSpot { |
|
|
|
|
$this -> type = HOT_SPOT_DELINEATION; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function createForm (&$form, $fck_config=0) { |
|
|
|
|
parent::createForm ($form, $fck_config); |
|
|
|
|
parent::createForm ($form, $fck_config); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function processCreation ($form, $objExercise = null) { |
|
|
|
|
$file_info = $form -> getSubmitValue('imageUpload'); |
|
|
|
|
parent::processCreation ($form, $objExercise); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function createAnswersForm ($form) { |
|
|
|
|
parent::createAnswersForm ($form); |
|
|
|
|
} |
|
|
|
|
@ -112,4 +111,4 @@ class HotSpotDelineation extends HotSpot { |
|
|
|
|
function processAnswersCreation ($form) { |
|
|
|
|
parent::processAnswersCreation ($form); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|