@@ -12,78 +12,78 @@ discard block |
||
| 12 | 12 | **/ |
| 13 | 13 | class HotSpot extends Question |
| 14 | 14 | { |
| 15 | - static $typePicture = 'hotspot.png'; |
|
| 16 | - static $explanationLangVar = 'HotSpot'; |
|
| 17 | - |
|
| 18 | - public function __construct() |
|
| 19 | - { |
|
| 20 | - parent::__construct(); |
|
| 21 | - $this -> type = HOT_SPOT; |
|
| 22 | - } |
|
| 23 | - |
|
| 24 | - public function display() |
|
| 25 | - { |
|
| 26 | - } |
|
| 27 | - |
|
| 28 | - /** |
|
| 29 | - * @param FormValidator $form |
|
| 30 | - * @param int $fck_config |
|
| 31 | - */ |
|
| 32 | - public function createForm (&$form, $fck_config=0) |
|
| 33 | - { |
|
| 34 | - parent::createForm($form, $fck_config); |
|
| 35 | - |
|
| 36 | - if (!isset($_GET['editQuestion'])) { |
|
| 37 | - $form->addElement('file','imageUpload',array('<img src="'.Display::return_icon('hotspot.png', null, null, ICON_SIZE_BIG, false, true).'" />', get_lang('UploadJpgPicture')) ); |
|
| 38 | - |
|
| 39 | - // setting the save button here and not in the question class.php |
|
| 40 | - // Saving a question |
|
| 41 | - $form->addButtonSave(get_lang('GoToQuestion'), 'submitQuestion'); |
|
| 42 | - //$form->addButtonSave(get_lang('GoToQuestion'), 'submitQuestion'); |
|
| 43 | - $form->addRule('imageUpload', get_lang('OnlyImagesAllowed'), 'filetype', array ('jpg', 'jpeg', 'png', 'gif')); |
|
| 44 | - $form->addRule('imageUpload', get_lang('NoImage'), 'uploadedfile'); |
|
| 45 | - } else { |
|
| 46 | - // setting the save button here and not in the question class.php |
|
| 47 | - // Editing a question |
|
| 48 | - $form->addButtonUpdate(get_lang('ModifyExercise'), 'submitQuestion'); |
|
| 49 | - } |
|
| 50 | - } |
|
| 51 | - |
|
| 52 | - /** |
|
| 53 | - * @param FormValidator $form |
|
| 54 | - * @param null $objExercise |
|
| 55 | - * @return bool |
|
| 56 | - */ |
|
| 57 | - public function processCreation($form, $objExercise = null) |
|
| 58 | - { |
|
| 59 | - $file_info = $form->getSubmitValue('imageUpload'); |
|
| 60 | - $_course = api_get_course_info(); |
|
| 61 | - parent::processCreation($form, $objExercise); |
|
| 62 | - |
|
| 63 | - if(!empty($file_info['tmp_name'])) { |
|
| 64 | - $this->uploadPicture($file_info['tmp_name'], $file_info['name']); |
|
| 65 | - $documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; |
|
| 66 | - $picturePath = $documentPath.'/images'; |
|
| 67 | - |
|
| 68 | - // fixed width ang height |
|
| 69 | - if (file_exists($picturePath.'/'.$this->picture)) { |
|
| 70 | - $this->resizePicture('width', 800); |
|
| 71 | - $this->save(); |
|
| 72 | - } else { |
|
| 73 | - return false; |
|
| 74 | - } |
|
| 75 | - } |
|
| 76 | - } |
|
| 77 | - |
|
| 78 | - function createAnswersForm ($form) |
|
| 79 | - { |
|
| 80 | - // nothing |
|
| 81 | - } |
|
| 82 | - |
|
| 83 | - function processAnswersCreation ($form) |
|
| 84 | - { |
|
| 85 | - // nothing |
|
| 86 | - } |
|
| 15 | + static $typePicture = 'hotspot.png'; |
|
| 16 | + static $explanationLangVar = 'HotSpot'; |
|
| 17 | + |
|
| 18 | + public function __construct() |
|
| 19 | + { |
|
| 20 | + parent::__construct(); |
|
| 21 | + $this -> type = HOT_SPOT; |
|
| 22 | + } |
|
| 23 | + |
|
| 24 | + public function display() |
|
| 25 | + { |
|
| 26 | + } |
|
| 27 | + |
|
| 28 | + /** |
|
| 29 | + * @param FormValidator $form |
|
| 30 | + * @param int $fck_config |
|
| 31 | + */ |
|
| 32 | + public function createForm (&$form, $fck_config=0) |
|
| 33 | + { |
|
| 34 | + parent::createForm($form, $fck_config); |
|
| 35 | + |
|
| 36 | + if (!isset($_GET['editQuestion'])) { |
|
| 37 | + $form->addElement('file','imageUpload',array('<img src="'.Display::return_icon('hotspot.png', null, null, ICON_SIZE_BIG, false, true).'" />', get_lang('UploadJpgPicture')) ); |
|
| 38 | + |
|
| 39 | + // setting the save button here and not in the question class.php |
|
| 40 | + // Saving a question |
|
| 41 | + $form->addButtonSave(get_lang('GoToQuestion'), 'submitQuestion'); |
|
| 42 | + //$form->addButtonSave(get_lang('GoToQuestion'), 'submitQuestion'); |
|
| 43 | + $form->addRule('imageUpload', get_lang('OnlyImagesAllowed'), 'filetype', array ('jpg', 'jpeg', 'png', 'gif')); |
|
| 44 | + $form->addRule('imageUpload', get_lang('NoImage'), 'uploadedfile'); |
|
| 45 | + } else { |
|
| 46 | + // setting the save button here and not in the question class.php |
|
| 47 | + // Editing a question |
|
| 48 | + $form->addButtonUpdate(get_lang('ModifyExercise'), 'submitQuestion'); |
|
| 49 | + } |
|
| 50 | + } |
|
| 51 | + |
|
| 52 | + /** |
|
| 53 | + * @param FormValidator $form |
|
| 54 | + * @param null $objExercise |
|
| 55 | + * @return bool |
|
| 56 | + */ |
|
| 57 | + public function processCreation($form, $objExercise = null) |
|
| 58 | + { |
|
| 59 | + $file_info = $form->getSubmitValue('imageUpload'); |
|
| 60 | + $_course = api_get_course_info(); |
|
| 61 | + parent::processCreation($form, $objExercise); |
|
| 62 | + |
|
| 63 | + if(!empty($file_info['tmp_name'])) { |
|
| 64 | + $this->uploadPicture($file_info['tmp_name'], $file_info['name']); |
|
| 65 | + $documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; |
|
| 66 | + $picturePath = $documentPath.'/images'; |
|
| 67 | + |
|
| 68 | + // fixed width ang height |
|
| 69 | + if (file_exists($picturePath.'/'.$this->picture)) { |
|
| 70 | + $this->resizePicture('width', 800); |
|
| 71 | + $this->save(); |
|
| 72 | + } else { |
|
| 73 | + return false; |
|
| 74 | + } |
|
| 75 | + } |
|
| 76 | + } |
|
| 77 | + |
|
| 78 | + function createAnswersForm ($form) |
|
| 79 | + { |
|
| 80 | + // nothing |
|
| 81 | + } |
|
| 82 | + |
|
| 83 | + function processAnswersCreation ($form) |
|
| 84 | + { |
|
| 85 | + // nothing |
|
| 86 | + } |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | /** |
@@ -91,35 +91,35 @@ discard block |
||
| 91 | 91 | */ |
| 92 | 92 | class HotSpotDelineation extends HotSpot |
| 93 | 93 | { |
| 94 | - static $typePicture = 'hotspot-delineation.png'; |
|
| 95 | - static $explanationLangVar = 'HotspotDelineation'; |
|
| 96 | - |
|
| 97 | - function __construct() |
|
| 98 | - { |
|
| 99 | - parent::__construct(); |
|
| 100 | - $this -> type = HOT_SPOT_DELINEATION; |
|
| 101 | - |
|
| 102 | - } |
|
| 103 | - |
|
| 104 | - function createForm (&$form, $fck_config=0) |
|
| 105 | - { |
|
| 106 | - parent::createForm ($form, $fck_config); |
|
| 107 | - } |
|
| 108 | - |
|
| 109 | - function processCreation ($form, $objExercise = null) |
|
| 110 | - { |
|
| 111 | - $file_info = $form -> getSubmitValue('imageUpload'); |
|
| 112 | - parent::processCreation ($form, $objExercise); |
|
| 113 | - } |
|
| 114 | - |
|
| 115 | - function createAnswersForm ($form) |
|
| 116 | - { |
|
| 117 | - parent::createAnswersForm ($form); |
|
| 118 | - } |
|
| 119 | - |
|
| 120 | - function processAnswersCreation ($form) |
|
| 121 | - { |
|
| 122 | - parent::processAnswersCreation ($form); |
|
| 123 | - } |
|
| 94 | + static $typePicture = 'hotspot-delineation.png'; |
|
| 95 | + static $explanationLangVar = 'HotspotDelineation'; |
|
| 96 | + |
|
| 97 | + function __construct() |
|
| 98 | + { |
|
| 99 | + parent::__construct(); |
|
| 100 | + $this -> type = HOT_SPOT_DELINEATION; |
|
| 101 | + |
|
| 102 | + } |
|
| 103 | + |
|
| 104 | + function createForm (&$form, $fck_config=0) |
|
| 105 | + { |
|
| 106 | + parent::createForm ($form, $fck_config); |
|
| 107 | + } |
|
| 108 | + |
|
| 109 | + function processCreation ($form, $objExercise = null) |
|
| 110 | + { |
|
| 111 | + $file_info = $form -> getSubmitValue('imageUpload'); |
|
| 112 | + parent::processCreation ($form, $objExercise); |
|
| 113 | + } |
|
| 114 | + |
|
| 115 | + function createAnswersForm ($form) |
|
| 116 | + { |
|
| 117 | + parent::createAnswersForm ($form); |
|
| 118 | + } |
|
| 119 | + |
|
| 120 | + function processAnswersCreation ($form) |
|
| 121 | + { |
|
| 122 | + parent::processAnswersCreation ($form); |
|
| 123 | + } |
|
| 124 | 124 | } |
| 125 | 125 | |