id; } else { $objQuestion = Question :: getInstance($_REQUEST['answerType']); $action = api_get_self()."?modifyQuestion=".$modifyQuestion."&newQuestion=".$newQuestion; } if(is_object($objQuestion)) { /********************* * FORM STYLES *********************/ // if you have a better way to improve the display, please inform me e.marguin@elixir-interactive.com $styles = ' '; echo $styles; /********************* * INIT FORM *********************/ $form = new FormValidator('question_admin_form','post',$action); /********************* * FORM CREATION *********************/ $objQuestion -> createForm ($form,array('Height'=>150)); $objQuestion -> createAnswersForm ($form); $form->addElement('style_submit_button','submitQuestion',get_lang('CreateModif'), 'class="save"'); $renderer = $form->defaultRenderer(); $renderer->setElementTemplate('
{label}
{element}
','submitQuestion'); /********************** * FORM VALIDATION **********************/ if(isset($_POST['submitQuestion']) && $form->validate()) { // question $objQuestion -> processCreation($form,$objExercise); // answers $objQuestion -> processAnswersCreation($form,$nb_answers); // TODO: maybe here is the better place to index this tool, including answers text // redirect if($objQuestion -> type != HOT_SPOT) echo ''; else echo ''; } else { /****************** * FORM DISPLAY ******************/ echo '

'.$questionName.'

'; if(!empty($pictureName)){ echo ''; } if(!empty($msgErr)) { Display::display_normal_message($msgErr); //main API } // display the form $form->display(); } } ?>