You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
101 lines
2.3 KiB
101 lines
2.3 KiB
<?php
|
|
/*
|
|
DOKEOS - elearning and course management software
|
|
|
|
For a full list of contributors, see documentation/credits.html
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU General Public License
|
|
as published by the Free Software Foundation; either version 2
|
|
of the License, or (at your option) any later version.
|
|
See "documentation/licence.html" more details.
|
|
|
|
Contact:
|
|
Dokeos
|
|
Rue des Palais 44 Paleizenstraat
|
|
B-1030 Brussels - Belgium
|
|
Tel. +32 (2) 211 34 56
|
|
*/
|
|
|
|
|
|
/**
|
|
* Exercise administration
|
|
* This script allows to manage an exercise. It is included from the script admin.php
|
|
* @package dokeos.exercise
|
|
* @author Olivier Brouckaert
|
|
* @version $Id: admin.php 10680 2007-01-11 21:26:23Z pcool $
|
|
*/
|
|
|
|
|
|
// name of the language file that needs to be included
|
|
$language_file='exercice';
|
|
|
|
|
|
include('exercise.class.php');
|
|
include('question.class.php');
|
|
include('answer.class.php');
|
|
|
|
|
|
|
|
include('../inc/global.inc.php');
|
|
include('exercise.lib.php');
|
|
$this_section=SECTION_COURSES;
|
|
include_once(api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php');
|
|
|
|
if(!api_is_allowed_to_edit())
|
|
{
|
|
api_not_allowed();
|
|
}
|
|
|
|
|
|
/*********************
|
|
* INIT EXERCISE
|
|
*********************/
|
|
|
|
$objExercise = new Exercise();
|
|
|
|
|
|
/*********************
|
|
* INIT FORM
|
|
*********************/
|
|
if(isset($_GET['exerciseId']))
|
|
{
|
|
$form = new FormValidator('exercise_admin', 'post', $_SERVER['PHP_SELF'].'?exerciseId='.$_GET['exerciseId']);
|
|
$objExercise -> read (intval($_GET['exerciseId']));
|
|
$form -> addElement ('hidden','edit','true');
|
|
}else
|
|
{
|
|
$form = new FormValidator('exercise_admin');
|
|
$form -> addElement ('hidden','edit','false');
|
|
}
|
|
$objExercise -> createForm ($form);
|
|
|
|
|
|
/*********************
|
|
* VALIDATE FORM
|
|
*********************/
|
|
if($form -> validate())
|
|
{
|
|
$objExercise -> processCreation($form);
|
|
if($form -> getSubmitValue('edit') == 'true')
|
|
{
|
|
header('Location:exercice.php');
|
|
}
|
|
else
|
|
{
|
|
header('Location:admin.php?exerciseId='.$objExercise->id);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
/*********************
|
|
* DISPLAY FORM
|
|
*********************/
|
|
$nameTools=get_lang('ExerciseManagement');
|
|
$interbreadcrumb[] = array ("url"=>"exercice.php", "name"=> get_lang('Exercices'));
|
|
|
|
Display::display_header($nameTools,"Exercise");
|
|
|
|
$form -> display ();
|
|
}
|
|
|
|
|