add_teachers_to_session.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * @package chamilo.admin
  5. */
  6. // resetting the course id
  7. $cidReset = true;
  8. // including some necessary files
  9. //require_once '../inc/global.inc.php';
  10. // setting the section (for the tabs)
  11. $this_section = SECTION_PLATFORM_ADMIN;
  12. // setting breadcrumbs
  13. //$interbreadcrumb[] = array('url' => 'index.php','name' => get_lang('PlatformAdmin'));
  14. $interbreadcrumb[] = array('url' => 'session_list.php','name' => get_lang('SessionList'));
  15. // Setting the name of the tool
  16. $tool_name = get_lang('EnrollTrainersFromExistingSessions');
  17. $form_sent = 0;
  18. $errorMsg = '';
  19. $id = intval($_GET['id']);
  20. SessionManager::protectSession($id);
  21. $htmlResult = null;
  22. if (isset($_POST['form_sent']) && $_POST['form_sent']) {
  23. $form_sent = $_POST['form_sent'];
  24. if ($form_sent == 1 && isset($_POST['sessions']) && isset($_POST['courses'])) {
  25. $sessions = $_POST['sessions'];
  26. $courses = $_POST['courses'];
  27. $htmlResult = SessionManager::copyCoachesFromSessionToCourse($sessions, $courses);
  28. }
  29. }
  30. $session_list = SessionManager::get_sessions_list(array(), array('name'));
  31. $sessionList = array();
  32. foreach ($session_list as $session) {
  33. $sessionList[$session['id']] = $session['name'];
  34. }
  35. $courseList = CourseManager::get_courses_list(0, 0, 'title');
  36. $courseOptions = array();
  37. foreach ($courseList as $course) {
  38. $courseOptions[$course['id']] = $course['title'];
  39. }
  40. Display::display_header($tool_name);
  41. ?>
  42. <form name="formulaire" method="post" action="<?php echo api_get_self().'?id='.$id; ?>">
  43. <?php echo '<legend>'.$tool_name.' </legend>';
  44. echo $htmlResult;
  45. echo Display::input('hidden', 'form_sent', '1');
  46. ?>
  47. <table border="0" cellpadding="5" cellspacing="0" width="100%">
  48. <tr>
  49. <td align="center">
  50. <b><?php echo get_lang('Sessions') ?> :</b>
  51. </td>
  52. <td></td>
  53. <td align="center">
  54. <b><?php echo get_lang('Courses') ?> :</b>
  55. </td>
  56. </tr>
  57. <tr>
  58. <td align="center">
  59. <?php
  60. echo Display::select(
  61. 'sessions[]',
  62. $sessionList,
  63. '',
  64. array('style'=>'width:360px', 'multiple'=>'multiple','id'=>'sessions', 'size'=>'15px'),
  65. false
  66. );
  67. ?>
  68. </td>
  69. <td align="center">
  70. </td>
  71. <td align="center">
  72. <?php
  73. echo Display::select(
  74. 'courses[]',
  75. $courseOptions,
  76. '',
  77. array('style'=>'width:360px', 'id'=>'courses', 'size'=>'15px'),
  78. false
  79. );
  80. ?>
  81. </td>
  82. </tr>
  83. <tr>
  84. <td colspan="3" align="center">
  85. <br />
  86. <?php
  87. echo '<button class="btn btn-success" type="submit">'.
  88. get_lang('SubscribeTeachersToSession').'</button>';
  89. ?>
  90. </td>
  91. </tr>
  92. </table>
  93. </form>
  94. <?php
  95. Display::display_footer();