type = HOT_SPOT;
}
function display(){
}
function createForm ($form) {
parent::createForm ($form);
global $text, $class;
if(!isset($_GET['editQuestion'])) {
$renderer = $form->defaultRenderer();
$form->addElement('html', '
'.get_lang('UploadJpgPicture').'
');
$form->addElement('file','imageUpload','*');
// 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.'"');
$renderer->setElementTemplate('','imageUpload');
$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('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']);
list($width,$height) = @getimagesize($file_info['tmp_name']);
if($width>=$height) {
$this->resizePicture('width',550);
} else {
$this->resizePicture('height',350);
}
$this->save();
}
}
function createAnswersForm ($form) {
// nothing
}
function processAnswersCreation ($form) {
// nothing
}
}
endif;
?>