123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- <?php
- if(!class_exists('HotSpot')):
- class HotSpot extends Question {
- static $typePicture = 'hotspot.gif';
- static $explanationLangVar = 'Hotspot';
- function HotSpot() {
- parent::question();
- $this -> type = HOT_SPOT;
- }
- function display() {
- }
-
- function createForm ($form) {
- parent::createForm ($form);
- global $text, $class;
- if(!isset($_GET['editQuestion'])) {
- $renderer = $form->defaultRenderer();
- $form->addElement('html', '<div class="row"><div class="label"></div><div class="formw">'.get_lang('UploadJpgPicture').'</div></div>');
- $form->addElement('file','imageUpload','<span class="form_required">*</span><img src="../img/hotspots.png" />');
-
-
- $form->addElement('style_submit_button','submitQuestion',get_lang('GoToQuestion'), 'class="'.$class.'"');
- $renderer->setElementTemplate('<div class="row"><div class="label" style="margin-top:-30px;">{label}</div><div class="formw" >{element}</div></div>','imageUpload');
- $form->addRule('imageUpload', get_lang('OnlyImagesAllowed'), 'filetype', array ('jpg', 'jpeg', 'png', 'gif'));
- $form->addRule('imageUpload', get_lang('NoImage'), 'uploadedfile');
- } else {
-
-
- $form->addElement('style_submit_button','submitQuestion',get_lang('langModifyExercise'), 'class="'.$class.'"');
- }
-
- }
- function processCreation ($form, $objExercise) {
- $file_info = $form -> getSubmitValue('imageUpload');
- parent::processCreation ($form, $objExercise);
- if(!empty($file_info['tmp_name'])) {
- $this->uploadPicture($file_info['tmp_name'], $file_info['name']);
- global $picturePath;
-
- 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();
- } else {
- return false;
- }
- }
- }
- function createAnswersForm ($form) {
-
- }
- function processAnswersCreation ($form) {
-
- }
- }
- endif;
- ?>
|