assign_tickets.php 2.7 KB

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