hotspot.class.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <?php
  2. /*
  3. DOKEOS - elearning and course management software
  4. For a full list of contributors, see documentation/credits.html
  5. This program is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU General Public License
  7. as published by the Free Software Foundation; either version 2
  8. of the License, or (at your option) any later version.
  9. See "documentation/licence.html" more details.
  10. Contact:
  11. Dokeos
  12. Rue des Palais 44 Paleizenstraat
  13. B-1030 Brussels - Belgium
  14. Tel. +32 (2) 211 34 56
  15. */
  16. /**
  17. * File containing the HotSpot class.
  18. * @package dokeos.exercise
  19. * @author Eric Marguin
  20. * @version $Id: admin.php 10680 2007-01-11 21:26:23Z pcool $
  21. */
  22. if(!class_exists('HotSpot')):
  23. /**
  24. CLASS HotSpot
  25. *
  26. * This class allows to instantiate an object of type HotSpot (MULTIPLE CHOICE, UNIQUE ANSWER),
  27. * extending the class question
  28. *
  29. * @author Eric Marguin
  30. * @package dokeos.exercise
  31. **/
  32. class HotSpot extends Question {
  33. static $typePicture = 'hotspot.gif';
  34. static $explanationLangVar = 'Hotspot';
  35. function HotSpot(){
  36. parent::question();
  37. $this -> type = HOT_SPOT;
  38. }
  39. function display(){
  40. }
  41. function createForm ($form) {
  42. parent::createForm ($form);
  43. if(!isset($_GET['editQuestion']))
  44. {
  45. $form->addElement('file','imageUpload',get_lang('UploadJpgPicture'));
  46. $form->addRule('imageUpload', get_lang('OnlyJPG'), 'mimetype',array('image/jpeg','image/pjpeg','image/gif','image/png'));
  47. $form->addRule('imageUpload', get_lang('NoImage'), 'uploadedfile');
  48. }
  49. }
  50. function processCreation ($form, $objExercise) {
  51. $file_info = $form -> getSubmitValue('imageUpload');
  52. parent::processCreation ($form, $objExercise);
  53. if(!empty($file_info['tmp_name']))
  54. {
  55. $this->uploadPicture($file_info['tmp_name'], $file_info['name']);
  56. list($width,$height) = getimagesize($file_info['tmp_name']);
  57. if($width>=$height)
  58. $this->resizePicture('width',720);
  59. else
  60. $this->resizePicture('height',540);
  61. $this->save();
  62. }
  63. }
  64. function createAnswersForm ($form) {
  65. // nothing
  66. }
  67. function processAnswersCreation ($form) {
  68. // nothing
  69. }
  70. }
  71. endif;
  72. ?>