dokeos-exercise
[ class tree: dokeos-exercise ] [ index: dokeos-exercise ] [ all elements ]

Source for file exercise_admin.php

Documentation is available at exercise_admin.php

  1. <?php
  2. /*
  3.     DOKEOS - elearning and course management software
  4.  
  5.     For a full list of contributors, see documentation/credits.html
  6.  
  7.     This program is free software; you can redistribute it and/or
  8.     modify it under the terms of the GNU General Public License
  9.     as published by the Free Software Foundation; either version 2
  10.     of the License, or (at your option) any later version.
  11.     See "documentation/licence.html" more details.
  12.  
  13.     Contact:
  14.         Dokeos
  15.         Rue des Palais 44 Paleizenstraat
  16.         B-1030 Brussels - Belgium
  17.         Tel. +32 (2) 211 34 56
  18. */
  19.  
  20.  
  21. /**
  22. *    Exercise administration
  23. *    This script allows to manage an exercise. It is included from the script admin.php
  24. *    @package dokeos.exercise
  25. *     @author Olivier Brouckaert
  26. *     @version $Id$
  27. */
  28.  
  29.  
  30. // name of the language file that needs to be included
  31. $language_file='exercice';
  32.  
  33.  
  34. include('exercise.class.php');
  35. include('question.class.php');
  36. include('answer.class.php');
  37.  
  38.  
  39.  
  40. include('../inc/global.inc.php');
  41. include('exercise.lib.php');
  42. $this_section=SECTION_COURSES;
  43.  
  44. {
  45.     api_not_allowed(true);
  46. }
  47.  
  48.  
  49. /*********************
  50.  * INIT EXERCISE
  51.  *********************/
  52.  
  53. include_once(api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php');
  54. $objExercise new Exercise();
  55.  
  56.  
  57. /*********************
  58.  * INIT FORM
  59.  *********************/
  60. if(isset($_GET['exerciseId']))
  61. {
  62.     $form new FormValidator('exercise_admin''post'api_get_self().'?exerciseId='.$_GET['exerciseId']);
  63.     $objExercise -> read (intval($_GET['exerciseId']));
  64.     $form -> addElement ('hidden','edit','true');
  65. }else
  66. {
  67.     $form new FormValidator('exercise_admin');
  68.     $form -> addElement ('hidden','edit','false');
  69. }
  70. $objExercise -> createForm ($form);
  71.  
  72.  
  73. /*********************
  74.  * VALIDATE FORM
  75.  *********************/
  76. if($form -> validate())
  77. {
  78.     $objExercise -> processCreation($form);
  79.     if($form -> getSubmitValue('edit'== 'true')
  80.     {
  81.         header('Location:exercice.php?message=ExerciseEdited');
  82.     }
  83.     else
  84.     {
  85.         header('Location:admin.php?message=ExerciseStored&exerciseId='.$objExercise->id);
  86.     }
  87. }
  88. else
  89. {
  90.     /*********************
  91.      * DISPLAY FORM
  92.      *********************/
  93.     $nameTools=get_lang('ExerciseManagement');
  94.     $interbreadcrumb[array ("url"=>"exercice.php""name"=> get_lang('Exercices'));
  95.  
  96.     Display::display_header($nameTools,"Exercise");
  97.  
  98.     $form -> display ();
  99. }
  100.  

Documentation generated on Thu, 12 Jun 2008 13:25:34 -0500 by phpDocumentor 1.4.1