group_list.php 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <?php
  2. /*
  3. ==============================================================================
  4. Dokeos - elearning and course management software
  5. Copyright (c) 2004 Dokeos S.A.
  6. Copyright (c) 2003 University of Ghent (UGent)
  7. Copyright (c) 2001 Universite catholique de Louvain (UCL)
  8. Copyright (c) Olivier Brouckaert
  9. For a full list of contributors, see "credits.txt".
  10. The full license can be read in "license.txt".
  11. This program is free software; you can redistribute it and/or
  12. modify it under the terms of the GNU General Public License
  13. as published by the Free Software Foundation; either version 2
  14. of the License, or (at your option) any later version.
  15. See the GNU General Public License for more details.
  16. Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
  17. ==============================================================================
  18. */
  19. /**
  20. ==============================================================================
  21. @author Bart Mollet
  22. * @package dokeos.admin
  23. ==============================================================================
  24. */
  25. /*
  26. ==============================================================================
  27. INIT SECTION
  28. ==============================================================================
  29. */
  30. $langFile = 'survey';
  31. //$newsurveyid=11;
  32. require ('../inc/global.inc.php');
  33. require_once (api_get_path(LIBRARY_PATH)."/surveymanager.lib.php");
  34. $status = surveymanager::get_status();
  35. if($status==5)
  36. {
  37. api_protect_admin_script();
  38. }
  39. //api_protect_admin_script();
  40. require_once (api_get_path(LIBRARY_PATH)."/course.lib.php");
  41. $cidReq = $_REQUEST['cidReq'];
  42. $curr_dbname = $_REQUEST['curr_dbname'];
  43. $table_survey = Database :: get_course_table('survey');
  44. $table_group = Database :: get_course_table('survey_group');
  45. $table_question = Database :: get_course_table('questions');
  46. $interbredcrump[] = array ("url" => "survey_list.php", "name" => get_lang('Survey'));
  47. $tool_name = get_lang('GroupList');
  48. //Display :: display_header($tool_name);
  49. //api_display_tool_title($tool_name);
  50. Display :: display_header($tool_name);
  51. api_display_tool_title($tool_name);
  52. if(isset($_REQUEST['pls']))
  53. {
  54. $pls=$_REQUEST['pls'];
  55. if($pls==1)
  56. {
  57. $error_message=$error_message=get_lang("PleaseSelectAChoice");
  58. Display::display_error_message($error_message);
  59. }
  60. }
  61. $nameTools=get_lang('GroupList');
  62. $surveyid=$_GET['surveyid'];
  63. $sid = $_REQUEST['sid'];
  64. $groupid = $_REQUEST['newgroupid'];
  65. $db_name = $_REQUEST['db_name'];
  66. $table_group = Database :: get_course_table('survey_group');
  67. $sql = "SELECT * FROM $db_name.survey_group where survey_id='$sid'";
  68. $parameters = array ();
  69. $parameters['surveyid']=$surveyid;
  70. $parameters['sid']=$sid;
  71. $parameters['newgroupid']=$groupid;
  72. $parameters['cidReq']=$cidReq;
  73. $parameters['db_name']=$db_name;
  74. $res = api_sql_query($sql,__FILE__,__LINE__);
  75. if (mysql_num_rows($res) > 0)
  76. {
  77. $surveys = array ();
  78. ?>
  79. <form method="POST" action="question_list_new.php?cidReq=<?=$cidReq?>">
  80. <input type="hidden" name="action" value="add_survey">
  81. <input type="hidden" name="surveyid" value="<?=$surveyid?>">
  82. <input type="hidden" name="sid" value="<?=$sid?>">
  83. <input type="hidden" name="groupid" value="<?=$groupid?>">
  84. <input type="hidden" name="db_name" value="<?=$db_name?>">
  85. <input type="hidden" name="curr_dbname" value="<?=$curr_dbname;?>">
  86. <?
  87. $gnames = array();
  88. while ($obj = mysql_fetch_object($res))
  89. {
  90. $gid=$obj->group_id;
  91. $gname = $obj->groupname;
  92. if ($gid!=$groupid&&$gname!='Imported Group')
  93. {
  94. $survey = array ();
  95. $survey[] = '<input type="checkbox" name="course[]" value="'.$obj->group_id.'"/>';
  96. if(@in_array($obj->groupname,$gnames))
  97. {continue;}
  98. $survey[] = $obj->groupname;
  99. $gnames[] = $obj->groupname;
  100. $gid=$obj->group_id;
  101. $sid=surveymanager::get_surveyid($db_name,$gid);
  102. $idd=surveymanager::get_author($db_name,$sid);
  103. $author=surveymanager::get_survey_author($idd);
  104. $surveyname=surveymanager::get_surveyname($db_name,$sid);
  105. $NoOfQuestion=surveymanager::no_of_question($db_name,$gid);
  106. $survey[] = $NoOfQuestion;
  107. $survey[] = $surveyname;
  108. $survey[] = $author;
  109. $surveys[] = $survey;
  110. }
  111. }
  112. $table_header[] = array (' ', false);
  113. //$table_header[] = array (get_lang('SNo'), true);
  114. $table_header[] = array (get_lang('QuesGroup'), true);
  115. $table_header[] = array (get_lang('NoOfQuestions'), true);
  116. $table_header[] = array (get_lang('SurveyName1'), true);
  117. $table_header[] = array (get_lang('author'), true);
  118. //echo '<form method="post" action="course_list.php">';
  119. Display :: display_sortable_table($table_header, $surveys, array (), array (), $parameters);
  120. ?>
  121. <table>
  122. <tr>
  123. <td><input type="submit" name="back1" value="<? echo get_lang('back');?>"></td>
  124. <td><input type="submit" name="view" value="<? echo get_lang('ViewQues');?>"></td>
  125. <td><input type="submit" name="import" value="<? echo get_lang('Import');?>"></td>
  126. </tr>
  127. </table>
  128. </form>
  129. <? }
  130. else
  131. {
  132. echo get_lang('NoSearchResults');
  133. }
  134. /*
  135. ==============================================================================
  136. FOOTER
  137. ==============================================================================
  138. */
  139. Display :: display_footer();
  140. ?>