choose_language.php 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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: choose_language.php 10705 2007-01-12 22:40:01Z pcool $
  20. * @todo check if this file is used
  21. */
  22. // name of the language file that needs to be included
  23. $language_file='survey';
  24. // including the global dokeos file
  25. require_once ('../inc/global.inc.php');
  26. // including additional libraries
  27. /** @todo check if these are all needed */
  28. /** @todo check if the starting / is needed. api_get_path probably ends with an / */
  29. require_once (api_get_path(LIBRARY_PATH).'/fileManage.lib.php');
  30. require_once (api_get_path(CONFIGURATION_PATH) ."/add_course.conf.php");
  31. require_once (api_get_path(LIBRARY_PATH)."/add_course.lib.inc.php");
  32. require_once (api_get_path(LIBRARY_PATH)."/course.lib.php");
  33. require_once (api_get_path(LIBRARY_PATH)."/groupmanager.lib.php");
  34. require_once (api_get_path(LIBRARY_PATH)."/surveymanager.lib.php");
  35. require_once (api_get_path(LIBRARY_PATH)."/usermanager.lib.php");
  36. // Database table definitions
  37. /** @todo use database constants for the survey tables */
  38. $table_survey = Database :: get_course_table(TABLE_SURVEY);
  39. // breadcrumbs
  40. // $_GET and $_POST
  41. /** @todo replace $_REQUEST with $_GET or $_POST */
  42. $surveyid = $_REQUEST['surveyid'];
  43. $uid = $_REQUEST['uid'];
  44. $uid1 = $_REQUEST['uid1'];
  45. $db_name = $_REQUEST['db_name'];
  46. $temp = $_REQUEST['temp'];
  47. $mail = $_REQUEST['mail'];
  48. /** @todo is this needed? Session probably started in global.inc.php */
  49. session_start();
  50. /** @todo is this needed? */
  51. $_SESSION["user_language_choice"]='english';
  52. if(isset($_GET['next'])){
  53. $lang = $_REQUEST['lang'];
  54. $code_survey = $_REQUEST['code_survey'];
  55. $sql = 'SELECT survey.survey_id
  56. FROM '.$db_name.'.survey as survey
  57. WHERE survey.code="'.addslashes($code_survey).'"
  58. AND survey.lang="'.addslashes($lang).'"';
  59. $rs = api_sql_query($sql, __FILE__, __LINE__);
  60. $surveyid = mysql_result($rs,0,'survey_id');
  61. header('Location:template1.php?'.$_SERVER['QUERY_STRING'].'&surveyid='.$surveyid);
  62. }
  63. /** @todo use correct database calls */
  64. $sql_sname = " SELECT survey2.* FROM $db_name.survey as survey1
  65. INNER JOIN $db_name.survey as survey2
  66. ON survey1.code = survey2.code
  67. WHERE survey1.survey_id='$surveyid'";
  68. $res_sname = api_sql_query($sql_sname,__FILE__,__LINE__);
  69. $code_survey = mysql_result($res_sname, 0, 'code');
  70. mysql_data_seek($res_sname,0);
  71. $surveyname = '';
  72. while($obj_sname = mysql_fetch_object($res_sname))
  73. {
  74. $surveyname .= $obj_sname->title.'<br>';
  75. }
  76. mysql_data_seek($res_sname,0);
  77. Display::display_header($tool_name);
  78. api_display_tool_title($surveyname);
  79. api_display_tool_title($tool_name);
  80. if($error_message)
  81. {
  82. Display::display_error_message($error_message);
  83. }
  84. ?>
  85. <link href="../css/survey_white.css" rel="stylesheet" type="text/css">
  86. <table width="727" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#F6F5F5">
  87. <tr>
  88. <td width="23" height="21">&nbsp;</td>
  89. <td height="21">&nbsp;</td>
  90. <td width="20" height="21">&nbsp;</td>
  91. </tr>
  92. <tr>
  93. <td>&nbsp;</td>
  94. <td valign="top">
  95. <table width="100%" height="132" border="0" cellpadding="0" cellspacing="0" bgcolor="#F6F5F5">
  96. <form method="GET" action="<?php echo $_SERVER['PHP_SELF'] ?>">
  97. <input type="hidden" name="uid" value="<?php echo $uid;?>">
  98. <input type="hidden" name="db_name" value="<?php echo $db_name;?>">
  99. <input type="hidden" name="temp" value="<?php echo $temp;?>">
  100. <input type="hidden" name="email" value="<?php echo $email;?>">
  101. <input type="hidden" name="mail" value="<?php echo $mail;?>">
  102. <input type="hidden" name="uid1" value="<?php echo $uid1;?>">
  103. <input type="hidden" name="code_survey" value="<?php echo $code_survey;?>">
  104. Select in which language you want to see this survey :
  105. <select name="lang">
  106. <?php
  107. while($survey = mysql_fetch_object($res_sname)){
  108. echo '<option value="'.$survey->lang.'">'.$survey->lang.'</option>';
  109. }
  110. ?>
  111. </select>
  112. <br /><br />
  113. <input type="submit" name="next" value="<?php echo get_lang('Next') ?>" />
  114. </form>
  115. </table>
  116. </td>
  117. <td>&nbsp;</td>
  118. </tr>
  119. <tr>
  120. <td>&nbsp;</td>
  121. <td>&nbsp;</td>
  122. <td>&nbsp;</td>
  123. </tr>
  124. </table>
  125. <?php
  126. // Display the footer
  127. Display::display_footer();
  128. ?>