agenda_js.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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');
  11. // use anonymous mode when accessing this course tool
  12. $use_anonymous = true;
  13. require_once '../inc/global.inc.php';
  14. $htmlHeadXtra[] = api_get_jquery_ui_js();
  15. $htmlHeadXtra[] = api_get_js('qtip2/jquery.qtip.min.js');
  16. $htmlHeadXtra[] = api_get_js('fullcalendar/fullcalendar.min.js');
  17. $htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH).'javascript/fullcalendar/fullcalendar.css');
  18. $htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH).'javascript/qtip2/jquery.qtip.min.css');
  19. $tpl = new Template();
  20. $type = isset($_REQUEST['type']) && in_array($_REQUEST['type'], array('personal', 'course', 'admin')) ? $_REQUEST['type'] : 'personal';
  21. if (api_is_platform_admin() && $type == 'admin') {
  22. $type = 'admin';
  23. }
  24. //if (api_get_course_id() != -1 && $type == 'course') {
  25. if (isset($_REQUEST['cidReq']) && !empty($_REQUEST['cidReq'])) {
  26. $type = 'course';
  27. }
  28. $can_add_events = 0;
  29. if (api_is_platform_admin() && $type == 'admin') {
  30. $can_add_events = 1;
  31. }
  32. if (api_is_allowed_to_edit() && $type == 'course') {
  33. $can_add_events = 1;
  34. }
  35. if (!api_is_anonymous() && $type == 'personal') {
  36. $can_add_events = 1;
  37. }
  38. //Setting translations
  39. $day_short = api_get_week_days_short();
  40. $days = api_get_week_days_long();
  41. $months = api_get_months_long();
  42. $months_short = api_get_months_short();
  43. $tpl->assign('month_names', json_encode($months));
  44. $tpl->assign('month_names_short', json_encode($months_short));
  45. $tpl->assign('day_names', json_encode($days));
  46. $tpl->assign('day_names_short', json_encode($day_short));
  47. $tpl->assign('button_text', json_encode(array('today'=>get_lang('Today'), 'month'=>get_lang('Month'), 'week'=>get_lang('Week'), 'day'=>get_lang('Day'))));
  48. $tpl->assign('type', $type);
  49. $tpl->assign('can_add_events', $can_add_events);
  50. $agenda_ajax_url = api_get_path(WEB_AJAX_PATH).'agenda.ajax.php?type='.$type.'&';
  51. $tpl->assign('web_agenda_ajax_url', $agenda_ajax_url);
  52. $content = $tpl->fetch('default/agenda/month.tpl');
  53. $tpl->assign('content', $content);
  54. $template_file = $tpl->get_template('layout/layout_1_col.tpl');
  55. $tpl->display($template_file);