create_survey.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <?php
  2. /*
  3. DOKEOS - elearning and course management software
  4. For a full list of contributors, see documentation/credits.html
  5. This program is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU General Public License
  7. as published by the Free Software Foundation; either version 2
  8. of the License, or (at your option) any later version.
  9. See "documentation/licence.html" more details.
  10. Contact:
  11. Dokeos
  12. Rue des Palais 44 Paleizenstraat
  13. B-1030 Brussels - Belgium
  14. Tel. +32 (2) 211 34 56
  15. */
  16. /**
  17. * @package dokeos.survey
  18. * @author
  19. * @version $Id: create_survey.php 10603 2007-01-06 17:01:47Z pcool $
  20. */
  21. /*
  22. ==============================================================================
  23. INIT SECTION
  24. ==============================================================================
  25. */
  26. // name of the language file that needs to be included
  27. $language_file = 'admin';
  28. // including the global dokeos file
  29. require_once ('../inc/global.inc.php');
  30. // including additional libraries
  31. /** @todo check if these are all needed */
  32. /** @todo check if the starting / is needed. api_get_path probably ends with an / */
  33. require_once (api_get_path(LIBRARY_PATH).'/fileManage.lib.php');
  34. require_once (api_get_path(CONFIGURATION_PATH) ."/add_course.conf.php");
  35. require_once (api_get_path(LIBRARY_PATH)."/add_course.lib.inc.php");
  36. require_once (api_get_path(LIBRARY_PATH)."/surveymanager.lib.php");
  37. /** @todo replace this with the correct code */
  38. /*
  39. $status = surveymanager::get_status();
  40. api_protect_course_script();
  41. if($status==5)
  42. {
  43. api_protect_admin_script();
  44. }
  45. */
  46. /** @todo this has to be moved to a more appropriate place (after the display_header of the code)*/
  47. if (!api_is_allowed_to_edit())
  48. {
  49. Display :: display_header();
  50. Display :: display_error_message(get_lang('NotAllowedHere'));
  51. Display :: display_footer();
  52. exit;
  53. }
  54. // Database table definitions
  55. /** @todo use database constants for the survey tables */
  56. $table_survey = Database :: get_main_table(MAIN_SURVEY_IFA_TABLE);
  57. $table_course = Database::get_main_table(TABLE_MAIN_COURSE);
  58. $tool_name = get_lang('CreateSurvey');
  59. $interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('AdministrationTools'));
  60. $newsurvey = '0';
  61. if ($_POST['action'] == 'add_survey')
  62. {
  63. $survey = $_POST['survey'];
  64. //$existingsurvey = trim(stripslashes($_POST['existingsurvey']));
  65. if ($survey==0)
  66. {
  67. header("location:create_new_survey.php");
  68. exit;
  69. }
  70. else
  71. {
  72. header("location:create_ex_survey.php");
  73. exit;
  74. }
  75. }
  76. Display::display_header($tool_name);
  77. api_display_tool_title($tool_name);
  78. ?>
  79. <form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">
  80. <input type="hidden" name="action" value="add_survey"/>
  81. <table>
  82. <tr>
  83. <td valign="top"></td>
  84. <td>
  85. <input class="checkbox" checked type="radio" name="survey" id="new_survey" value="<?php echo $newsurvey ?>"> <label for="visibility_open_world"><?php echo get_lang('NewSurvey') ?></label>
  86. <br/>
  87. <input class="checkbox" type="radio" name="survey" id="Existing_survey" value="<?php echo $existingsurvey ?>" > <label for="visibility_open_platform"><?php echo get_lang('CreateFromExistingSurveys'); ?></label><?php SurveyManager::select_survey_list();?>
  88. </td></tr>
  89. <tr>
  90. <td></td>
  91. <td></td>
  92. </tr>
  93. <tr>
  94. <td></td>
  95. </tr>
  96. <tr>
  97. <td>&nbsp;</td>
  98. <td><input type="submit" value="<?php echo get_lang('Ok'); ?>"></td>
  99. </tr>
  100. </table>
  101. </form>
  102. <?php
  103. /*
  104. ==============================================================================
  105. FOOTER
  106. ==============================================================================
  107. */
  108. Display :: display_footer();
  109. ?>