agenda_list.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * @package chamilo.calendar
  5. */
  6. /**
  7. * INIT SECTION
  8. */
  9. // name of the language file that needs to be included
  10. $language_file = array('agenda', 'group', 'announcements');
  11. //require_once '../inc/global.inc.php';
  12. require_once 'agenda.lib.php';
  13. require_once 'agenda.inc.php';
  14. $interbreadcrumb[] = array(
  15. 'url' => api_get_path(WEB_CODE_PATH)."calendar/agenda_js.php?".api_get_cidreq(),
  16. 'name' => get_lang('Agenda')
  17. );
  18. $tpl = new Template(get_lang('Events'));
  19. $agenda = new Agenda();
  20. $type = isset($_REQUEST['type']) ? $_REQUEST['type'] : null;
  21. $agenda->type = $type;
  22. $events = $agenda->get_events(
  23. null,
  24. null,
  25. api_get_course_int_id(),
  26. api_get_group_id(),
  27. null,
  28. 'array'
  29. );
  30. $url = api_get_path(WEB_CODE_PATH).'calendar/agenda_list.php?'.api_get_cidreq();
  31. $tpl->assign('url', $url);
  32. $tpl->assign('agenda_events', $events);
  33. $actions = $agenda->displayActions('list');
  34. $tpl->assign('actions', $actions);
  35. $tpl->assign('is_allowed_to_edit', api_is_allowed_to_edit());
  36. if (api_is_allowed_to_edit()) {
  37. if (isset($_GET['action']) && $_GET['action'] == 'change_visibility') {
  38. $courseInfo = api_get_course_info();
  39. $agenda->changeVisibility($_GET['id'], $_GET['visibility'], $courseInfo);
  40. header('Location: '.$url);
  41. exit;
  42. }
  43. }
  44. // Loading Agenda template
  45. $content = $tpl->fetch('default/agenda/event_list.tpl');
  46. $tpl->assign('content', $content);
  47. // Loading main Chamilo 1 col template
  48. $tpl->display_one_col_template();