assign_tickets.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * @package chamilo.plugin.ticket
  5. */
  6. $cidReset = true;
  7. require_once __DIR__.'/../inc/global.inc.php';
  8. api_protect_course_script();
  9. if (!api_is_allowed_to_edit()) {
  10. api_not_allowed(true);
  11. }
  12. $course_info = api_get_course_info();
  13. $course_code = $course_info['code'];
  14. echo '<form action="tutor.php" name="assign" id ="assign">';
  15. echo '<div id="confirmation"></div>';
  16. $id = (int) $_GET['id'];
  17. $tblWeeklyReport = Database::get_main_table('rp_reporte_semanas');
  18. $sql = "SELECT * FROM $tblWeeklyReport WHERE id = $id";
  19. $sql_tasks = "SELECT id AS colid, title as coltitle
  20. FROM ".Database::get_course_table(TABLE_STUDENT_PUBLICATION)."
  21. WHERE parent_id = 0
  22. AND id NOT IN (
  23. SELECT work_id
  24. FROM $tblWeeklyReport
  25. WHERE
  26. course_code = '$course_code' AND
  27. id != $id
  28. )";
  29. $sql_forum = "SELECT thread_id AS colid, thread_title AS coltitle
  30. FROM ".Database::get_course_table(TABLE_FORUM_THREAD)."
  31. WHERE thread_id NOT IN (
  32. SELECT forum_id
  33. FROM $tblWeeklyReport
  34. WHERE
  35. course_code = '$course_code' AND
  36. id != $id
  37. )";
  38. $rs = Database::fetch_object(Database::query($sql));
  39. $result_tareas = Database::query($sql_tasks);
  40. $result_forum = Database::query($sql_forum);
  41. echo '<div class="row">
  42. <input type="hidden" id="rs_id" name ="rs_id" value="'.$id.'">
  43. <div class="formw">'.get_lang('Please select tasks').'</div>
  44. </div>';
  45. echo '<div class="row"><div class="formw"><select name ="work_id" id="work_id">';
  46. echo '<option value="0"'.(($row['colid'] == $rs->work_id) ? "selected" : "").'>'.get_lang('Please select').'</option>';
  47. while ($row = Database::fetch_assoc($result_tasks)) {
  48. echo '<option value="'.$row['colid'].'"'.(($row['colid'] == $rs->work_id) ? "selected" : "").'>'.
  49. $row['coltitle'].'</option>';
  50. }
  51. echo '</select></div><div>';
  52. echo '<div class="row">
  53. <div class="formw">'.get_lang('Please selectThread').'</div>
  54. </div>';
  55. echo '<div class="row"><div class="formw"><select name ="forum_id" id="forum_id">';
  56. echo '<option value="0"'.(($row['colid'] == $rs->work_id) ? "forum_id" : "").'>'.get_lang('Please select').'</option>';
  57. while ($row = Database::fetch_assoc($result_forum)) {
  58. echo '<option value="'.$row['colid'].'"'.(($row['colid'] == $rs->forum_id) ? "selected" : "").'>'.
  59. $row['coltitle'].'</option>';
  60. }
  61. echo '</select></div><div>';
  62. echo '<div class="row">
  63. <div class="formw">
  64. <button class="save" name="edit" type="button" value="'.get_lang('Edit').'" onClick="save('.$id.');">'.
  65. get_lang('Edit').'</button>
  66. </div>
  67. </div>';
  68. echo '</form>';