diff --git a/main/calendar/agenda.lib.php b/main/calendar/agenda.lib.php index be8ed113d2..0e7f8f346d 100644 --- a/main/calendar/agenda.lib.php +++ b/main/calendar/agenda.lib.php @@ -360,6 +360,7 @@ class Agenda { } break; case 'admin': + case 'platform': $sql = " SELECT * FROM ".$this->tbl_global_agenda." WHERE id=".$id; $result = Database::query($sql); if (Database::num_rows($result)) { diff --git a/main/calendar/ical_export.php b/main/calendar/ical_export.php index 1d8674a35b..ba54dae50e 100644 --- a/main/calendar/ical_export.php +++ b/main/calendar/ical_export.php @@ -44,8 +44,11 @@ $agenda = new Agenda(); $agenda->type = $type; //course,admin or personal if (isset($_GET['course_id'])) { $course_info = api_get_course_info_by_id($_GET['course_id']); - $agenda->set_course($course_info); + if (!empty($course_info)) { + $agenda->set_course($course_info); + } } + $event = $agenda->get_event($id); if (!empty($event)) { @@ -75,10 +78,11 @@ if (!empty($event)) { $event['start_date'] = api_get_local_time($event['start_date']); $event['end_date'] = api_get_local_time($event['end_date']); - //var_dump($event); + switch($type) { case 'personal': + case 'platform': $vevent->setProperty( 'summary', api_convert_encoding($event['title'],'UTF-8', $charset)); if(empty($event['start_date'])){header('location:'.Security::remove_XSS($_SERVER['HTTP_REFERER']));} list($y,$m,$d,$h,$M,$s) = preg_split('/[\s:-]/',$event['start_date']); diff --git a/main/inc/lib/template.lib.php b/main/inc/lib/template.lib.php index 070a23f16d..95a416b8c3 100644 --- a/main/inc/lib/template.lib.php +++ b/main/inc/lib/template.lib.php @@ -25,6 +25,7 @@ class Template extends Smarty { var $menu_navigation = array(); var $show_learnpath = false; var $plugin = null; + var $course_id = null; function __construct($title = '', $show_header = true, $show_footer = true, $show_learnpath = false) { parent::__construct(); @@ -71,6 +72,10 @@ class Template extends Smarty { $this->set_header_parameters(); $this->set_footer_parameters(); + //Setting course id + $course_id = api_get_course_int_id(); + $this->course_id = $course_id; + $this->assign('style', $this->style); //Chamilo plugins @@ -188,8 +193,8 @@ class Template extends Smarty { } $this->assign('show_toolbar', $show_toolbar); - //Only if course is available - if (api_get_cidreq()) { + //Only if course is available + if (!empty($this->course_id)) { if (api_get_setting('show_toolshortcuts') != 'false') { //Course toolbar $course_tool = CourseHome::show_navigation_tool_shortcuts(); diff --git a/main/template/default/agenda/month.tpl b/main/template/default/agenda/month.tpl index 5d00514602..d608bf8217 100644 --- a/main/template/default/agenda/month.tpl +++ b/main/template/default/agenda/month.tpl @@ -268,8 +268,8 @@ $(document).ready(function() { $("#dialog-form").dialog({ buttons: { - '{"ExportiCalConfidential"|get_lang}' : function() { - url = "ical_export.php?id=" + calEvent.id+'&course_id='+calEvent.course_id+"&class=confidential"; + '{"ExportiCalConfidential"|get_lang}' : function() { + url = "ical_export.php?id=" + calEvent.id+'&course_id='+calEvent.course_id+"&class=confidential"; window.location.href = url; },