assign_tickets.php 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. *
  5. * @package chamilo.plugin.ticket
  6. */
  7. require_once __DIR__.'/../inc/global.inc.php';
  8. api_protect_course_script();
  9. if (!api_is_allowed_to_edit()) {
  10. api_not_allowed();
  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 = intval($_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('PleaseSelectTasks').'</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('PleaseSelect').'</option>';
  47. while ($row = Database::fetch_assoc($result_tasks)) {
  48. echo '<option value="'.$row['colid'].'"'.(($row['colid'] == $rs->work_id) ? "selected" : "").'>'.$row['coltitle'].'</option>';
  49. }
  50. echo '</select></div><div>';
  51. echo '<div class="row">
  52. <div class="formw">' . get_lang('PleaseSelectThread').'</div>
  53. </div>';
  54. echo '<div class="row"><div class="formw"><select name ="forum_id" id="forum_id">';
  55. echo '<option value="0"'.(($row['colid'] == $rs->work_id) ? "forum_id" : "").'>'.get_lang('PleaseSelect').'</option>';
  56. while ($row = Database::fetch_assoc($result_forum)) {
  57. echo '<option value="'.$row['colid'].'"'.(($row['colid'] == $rs->forum_id) ? "selected" : "").'>'.$row['coltitle'].'</option>';
  58. }
  59. echo '</select></div><div>';
  60. echo '<div class="row">
  61. <div class="formw">
  62. <button class="save" name="edit" type="button" value="' . get_lang('Edit').'" onClick="save('."$id".');">'.
  63. get_lang('Edit').'</button>
  64. </div>
  65. </div>';
  66. echo '</form>';