group_add_question.php 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <?php
  2. // $Id: course_add.php,v 1.10 2005/05/30 11:46:48 bmol Exp $
  3. /*
  4. ==============================================================================
  5. Dokeos - elearning and course management software
  6. Copyright (c) 2004 Dokeos S.A.
  7. Copyright (c) 2003 University of Ghent (UGent)
  8. Copyright (c) 2001 Universite catholique de Louvain (UCL)
  9. Copyright (c) Olivier Brouckaert
  10. For a full list of contributors, see "credits.txt".
  11. The full license can be read in "license.txt".
  12. This program is free software; you can redistribute it and/or
  13. modify it under the terms of the GNU General Public License
  14. as published by the Free Software Foundation; either version 2
  15. of the License, or (at your option) any later version.
  16. See the GNU General Public License for more details.
  17. Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
  18. ==============================================================================
  19. */
  20. /**
  21. ==============================================================================
  22. * @package dokeos.admin
  23. ==============================================================================
  24. */
  25. /*
  26. ==============================================================================
  27. INIT SECTION
  28. ==============================================================================
  29. */
  30. $langFile = 'survey';
  31. require_once ('../inc/global.inc.php');
  32. api_protect_admin_script();
  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. require_once (api_get_path(LIBRARY_PATH)."/usermanager.lib.php");
  38. $cidReq=$_GET['cidReq'];
  39. $table_user = Database :: get_main_table(MAIN_USER_TABLE);
  40. //$table_survey = Database :: get_main_table(MAIN_SURVEY_IFA_TABLE);
  41. $tool_name1 = get_lang('AddQuestion1');
  42. $tool_name = get_lang('AddQuestion');
  43. $interbredcrump[] = array ("url" => "survey.php", "name" => get_lang('CreateSurvey'));
  44. $coursePathWeb = api_get_path(WEB_COURSE_PATH);
  45. $coursePathSys = api_get_path(SYS_COURSE_PATH);
  46. $surveyid=$_GET['surveyid'];
  47. $groupid = $_GET['groupid'];
  48. if (isset($_POST['back']))
  49. {
  50. $surveyid=$_POST['surveyid'];
  51. $groupid=$_POST['groupid'];
  52. $cidReq=$_REQUEST['cidReq'];
  53. header("Location:create_new_group.php?surveyid=$surveyid&cidReq=$cidReq");
  54. exit;
  55. }
  56. if(isset($_POST['next']))
  57. {
  58. $cidReq=$_REQUEST['cidReq'];
  59. if($_POST['radiobutton']=="1")
  60. {
  61. $surveyid=$_POST['surveyid'];
  62. $groupid=$_POST['groupid'];
  63. header("Location:select_question_type.php?surveyid=$surveyid&groupid=$groupid&cidReq=$cidReq");
  64. exit;
  65. }
  66. elseif($_POST['radiobutton']=="2")
  67. {
  68. header("Location:question_type.php");
  69. }
  70. else
  71. {
  72. $sid=$_POST['newsurveyid'];
  73. $gid=$_POST['newgroupid'];
  74. header("Location:group_list.php?surveyid=$surveyid&groupid=$groupid&cidReq=$cidReq");
  75. }
  76. }
  77. Display::display_header($tool_name1);
  78. $GName = get_lang('groupname');
  79. api_display_tool_title($tool_name);
  80. $name = surveymanager :: get_groupname($gid);
  81. ?>
  82. <form name="radiobutton" method="post" action="<?php echo $_SERVER['PHP_SELF'];?>?cidReq=<?=$cidReq?>">
  83. <input type="hidden" name="surveyid" value="<?=$surveyid?>">
  84. <input type="hidden" name="groupid" value="<?=$groupid?>">
  85. <!--<input type="hidden" name="cidReq" value="<?=$_REQUEST['cidReq']?>">-->
  86. <table>
  87. <tr>
  88. <td><? api_display_tool_title($GName);?></td>
  89. <td><? api_display_tool_title($name);?></td>
  90. </tr>
  91. <?
  92. if( isset($error_message) )
  93. {
  94. Display::display_error_message($error_message);
  95. }
  96. ?>
  97. <tr>
  98. <td>
  99. <input name="radiobutton" type="radio" value="1" checked><? echo get_lang('CreateNew');?>
  100. </td>
  101. </tr>
  102. <tr>
  103. </tr>
  104. <tr>
  105. </tr>
  106. <tr>
  107. <td>
  108. <strong><? echo get_lang('GetFromDB');?></strong>
  109. </td>
  110. </tr>
  111. <tr>
  112. <td>
  113. <input name="radiobutton" type="radio" value="2"><? echo get_lang('ByQuestion');?>
  114. </td>
  115. </tr>
  116. <tr>
  117. <td>
  118. <input name="radiobutton" type="radio" value="3"><? echo get_lang('ByGroup');?>
  119. </td>
  120. </tr>
  121. <tr>
  122. <td></td>
  123. <td>&nbsp;</td>
  124. </tr>
  125. <tr>
  126. <td>
  127. <input type="submit" name= 'back' value="<? echo get_lang('back');?>">
  128. <input type="submit" name= 'next' value="<? echo get_lang('next');?>"></td>
  129. </tr>
  130. </table>
  131. </form>
  132. <?php
  133. function g_redirect($url,$mode)
  134. /* It redirects to a page specified by "$url".
  135. * $mode can be:
  136. * LOCATION: Redirect via Header "Location".
  137. * REFRESH: Redirect via Header "Refresh".
  138. * META: Redirect via HTML META tag
  139. * JS: Redirect via JavaScript command
  140. */
  141. {
  142. if (strncmp('http:',$url,5) && strncmp('https:',$url,6)) {
  143. $starturl = ($_SERVER["HTTPS"] == 'on' ? 'https' : 'http') . '://'.
  144. (empty($_SERVER['HTTP_HOST'])? $_SERVER['SERVER_NAME'] :
  145. $_SERVER['HTTP_HOST']);
  146. if ($url[0] != '/') $starturl .= dirname($_SERVER['PHP_SELF']).'/';
  147. $url = "$starturl$url";
  148. }
  149. switch($mode) {
  150. case 'LOCATION':
  151. if (headers_sent()) exit("Headers already sent. Can not redirect to $url");
  152. header("Location: $url");
  153. exit;
  154. case 'REFRESH':
  155. if (headers_sent()) exit("Headers already sent. Can not redirect to $url");
  156. header("Refresh: 0; URL=\"$url\"");
  157. exit;
  158. case 'META':
  159. ?><meta http-equiv="refresh" content="0;url=<?=$url?>" /><?
  160. exit;
  161. default: /* -- JavaScript */
  162. ?><script type="text/javascript">
  163. window.location.href='<?=$url?>';
  164. </script><?
  165. }
  166. exit;
  167. }
  168. /*
  169. ==============================================================================
  170. FOOTER
  171. ==============================================================================
  172. */
  173. Display :: display_footer();
  174. ?>