@@ -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 |
@@ -29,18 +29,18 @@ discard block |
||
29 | 29 | * @param FormValidator $form |
30 | 30 | * @param int $fck_config |
31 | 31 | */ |
32 | - public function createForm (&$form, $fck_config=0) |
|
32 | + public function createForm(&$form, $fck_config = 0) |
|
33 | 33 | { |
34 | 34 | parent::createForm($form, $fck_config); |
35 | 35 | |
36 | 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')) ); |
|
37 | + $form->addElement('file', 'imageUpload', array('<img src="'.Display::return_icon('hotspot.png', null, null, ICON_SIZE_BIG, false, true).'" />', get_lang('UploadJpgPicture'))); |
|
38 | 38 | |
39 | 39 | // setting the save button here and not in the question class.php |
40 | 40 | // Saving a question |
41 | 41 | $form->addButtonSave(get_lang('GoToQuestion'), 'submitQuestion'); |
42 | 42 | //$form->addButtonSave(get_lang('GoToQuestion'), 'submitQuestion'); |
43 | - $form->addRule('imageUpload', get_lang('OnlyImagesAllowed'), 'filetype', array ('jpg', 'jpeg', 'png', 'gif')); |
|
43 | + $form->addRule('imageUpload', get_lang('OnlyImagesAllowed'), 'filetype', array('jpg', 'jpeg', 'png', 'gif')); |
|
44 | 44 | $form->addRule('imageUpload', get_lang('NoImage'), 'uploadedfile'); |
45 | 45 | } else { |
46 | 46 | // setting the save button here and not in the question class.php |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | $_course = api_get_course_info(); |
61 | 61 | parent::processCreation($form, $objExercise); |
62 | 62 | |
63 | - if(!empty($file_info['tmp_name'])) { |
|
63 | + if (!empty($file_info['tmp_name'])) { |
|
64 | 64 | $this->uploadPicture($file_info['tmp_name'], $file_info['name']); |
65 | 65 | $documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; |
66 | 66 | $picturePath = $documentPath.'/images'; |
@@ -75,12 +75,12 @@ discard block |
||
75 | 75 | } |
76 | 76 | } |
77 | 77 | |
78 | - function createAnswersForm ($form) |
|
78 | + function createAnswersForm($form) |
|
79 | 79 | { |
80 | 80 | // nothing |
81 | 81 | } |
82 | 82 | |
83 | - function processAnswersCreation ($form) |
|
83 | + function processAnswersCreation($form) |
|
84 | 84 | { |
85 | 85 | // nothing |
86 | 86 | } |
@@ -101,25 +101,25 @@ discard block |
||
101 | 101 | |
102 | 102 | } |
103 | 103 | |
104 | - function createForm (&$form, $fck_config=0) |
|
104 | + function createForm(&$form, $fck_config = 0) |
|
105 | 105 | { |
106 | - parent::createForm ($form, $fck_config); |
|
106 | + parent::createForm($form, $fck_config); |
|
107 | 107 | } |
108 | 108 | |
109 | - function processCreation ($form, $objExercise = null) |
|
109 | + function processCreation($form, $objExercise = null) |
|
110 | 110 | { |
111 | 111 | $file_info = $form -> getSubmitValue('imageUpload'); |
112 | - parent::processCreation ($form, $objExercise); |
|
112 | + parent::processCreation($form, $objExercise); |
|
113 | 113 | } |
114 | 114 | |
115 | - function createAnswersForm ($form) |
|
115 | + function createAnswersForm($form) |
|
116 | 116 | { |
117 | - parent::createAnswersForm ($form); |
|
117 | + parent::createAnswersForm($form); |
|
118 | 118 | } |
119 | 119 | |
120 | - function processAnswersCreation ($form) |
|
120 | + function processAnswersCreation($form) |
|
121 | 121 | { |
122 | - parent::processAnswersCreation ($form); |
|
122 | + parent::processAnswersCreation($form); |
|
123 | 123 | } |
124 | 124 | } |
125 | 125 |