function advanced_parameters() { if(document.getElementById(\'options\').style.display == \'none\') { document.getElementById(\'options\').style.display = \'block\'; document.getElementById(\'img_plus_and_minus\').innerHTML=\' '.get_lang('AdvancedParameters').'\'; } else { document.getElementById(\'options\').style.display = \'none\'; document.getElementById(\'img_plus_and_minus\').innerHTML=\' '.get_lang('AdvancedParameters').'\'; } } function FCKeditor_OnComplete( editorInstance ) { if (document.getElementById ( \'HiddenFCK\' + editorInstance.Name )) { HideFCKEditorByInstanceName (editorInstance.Name); } } function HideFCKEditorByInstanceName ( editorInstanceName ) { if (document.getElementById ( \'HiddenFCK\' + editorInstanceName ).className == "HideFCKEditor" ) { document.getElementById ( \'HiddenFCK\' + editorInstanceName ).className = "media"; } } function show_media() { var my_display = document.getElementById(\'HiddenFCKexerciseDescription\').style.display; if(my_display== \'none\' || my_display == \'\') { document.getElementById(\'HiddenFCKexerciseDescription\').style.display = \'block\'; document.getElementById(\'media_icon\').innerHTML=\' '.get_lang('ExerciseDescription').'\'; } else { document.getElementById(\'HiddenFCKexerciseDescription\').style.display = \'none\'; document.getElementById(\'media_icon\').innerHTML=\' '.get_lang('ExerciseDescription').'\'; } } function timelimit() { if(document.getElementById(\'options2\').style.display == \'none\') { document.getElementById(\'options2\').style.display = \'block\'; } else { document.getElementById(\'options2\').style.display = \'none\'; } } function feedbackselection() { var index = document.exercise_admin.exerciseFeedbackType.selectedIndex; if (index == \'1\') { document.exercise_admin.exerciseType[1].checked=true; document.exercise_admin.exerciseType[0].disabled=true; } else { document.exercise_admin.exerciseType[0].disabled=false; } } function option_time_expired() { if(document.getElementById(\'timercontrol\').style.display == \'none\') { document.getElementById(\'timercontrol\').style.display = \'block\'; } else { document.getElementById(\'timercontrol\').style.display = \'none\'; } } function check_per_page_one() { if (document.getElementById(\'divtimecontrol\').style.display==\'none\') { document.getElementById(\'divtimecontrol\').style.display=\'block\'; document.getElementById(\'divtimecontrol\').display=block; document.getElementById(\'timecontrol\').display=none; } } function check_per_page_all() { if (document.getElementById(\'divtimecontrol\').style.display==\'block\') { document.getElementById(\'divtimecontrol\').style.display=\'none\'; document.getElementById(\'enabletimercontroltotalminutes\').value=\'\'; } } function check_feedback() { document.getElementById(\'result_disabled_0\').checked = true; } function check_results_disabled() { document.getElementById(\'exerciseType_2\').checked = true; } '; $htmlHeadXtra[] = ''; //jQuery $htmlHeadXtra[] = ''; // INIT EXERCISE require_once(api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php'); $objExercise = new Exercise(); //INIT FORM if(isset($_GET['exerciseId'])) { $form = new FormValidator('exercise_admin', 'post', api_get_self().'?'.api_get_cidreq().'&exerciseId='.$_GET['exerciseId']); $objExercise -> read (intval($_GET['exerciseId'])); $form -> addElement ('hidden','edit','true'); } else { $form = new FormValidator('exercise_admin','post',api_get_self().'?'.api_get_cidreq()); $form -> addElement ('hidden','edit','false'); } $objExercise -> createForm ($form); // VALIDATE FORM if ($form->validate()) { $objExercise->processCreation($form); if ($form->getSubmitValue('edit') == 'true') { $message = 'ExerciseEdited'; } else { $message = 'ExerciseAdded'; } header('Location:admin.php?message='.$message.'&exerciseId='.$objExercise->id); exit; } else { // DISPLAY FORM if (isset($_SESSION['gradebook'])) { $gradebook= $_SESSION['gradebook']; } if (!empty($gradebook) && $gradebook=='view') { $interbreadcrumb[]= array ('url' => '../gradebook/'.$_SESSION['gradebook_dest'],'name' => get_lang('ToolGradebook')); } $nameTools=get_lang('ExerciseManagement'); $interbreadcrumb[] = array ("url"=>'exercice.php', 'name'=> get_lang('Exercices')); Display::display_header($nameTools,get_lang('Exercise')); echo '