aboutsummaryrefslogtreecommitdiffstats
path: root/functions/list_icals.php
blob: c2e6ce48cdf060f8adad3595bfc94303f57788b0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
if ($display_ical_list == "yes") {

	// start of <select> tag
	echo "<select name=\"action\" class=\"query_style\" onChange=\"window.location=(this.options[this.selectedIndex].value+'";
	if (isset($query)) echo $query;
	echo "');\">";
	// open file
	$dir_handle = @opendir($calendar_path) or die(error(sprintf($error_path_lang, $calendar_path), $cal_filename));
	
	// Grab all calendars.
	$filelist = availableCalendarNames($username, $password, $ALL_CALENDARS_COMBINED);
	foreach ($filelist as $file) {
		
		// $cal_filename is the filename of the calendar without .ics
		// $cal is a urlencoded version of $cal_filename
		// $cal_displayname is $cal_filename with occurrences of "32" replaced with " "
		$cal_filename_tmp = substr($file,0,-4);
		$cal_tmp = urlencode($cal_filename_tmp);
		$cal_displayname_tmp = str_replace("32", " ", $cal_filename_tmp);
		if ($cal_tmp == $cal) {
			print "<option value=\"$current_view.php?cal=$cal_tmp\" selected>$cal_displayname_tmp $calendar_lang</option>\n";
		} else {
			print "<option value=\"$current_view.php?cal=$cal_tmp\">$cal_displayname_tmp $calendar_lang</option>\n";	
		}
	}			

	// option to open all (non-web) calenders together
	if ($cal == $ALL_CALENDARS_COMBINED) {
		print "<option value=\"$current_view.php?cal=$ALL_CALENDARS_COMBINED&amp;getdate=$getdate\" selected>$all_cal_comb_lang</option>";
	} else {
		print "<option value=\"$current_view.php?cal=$ALL_CALENDARS_COMBINED&amp;getdate=$getdate\">$all_cal_comb_lang</option>";
	}
		
	foreach($list_webcals as $cal_tmp) {
		if ($cal_tmp != '') {
			$cal_displayname_tmp = basename($cal_tmp);
			$cal_displayname_tmp = str_replace("32", " ", $cal_displayname_tmp);
			$cal_displayname_tmp = substr($cal_displayname_tmp,0,-4);
			$cal_encoded_tmp = urlencode($cal_tmp);
			if ($cal_tmp == $cal_httpPrefix || $cal_tmp == $cal_webcalPrefix) {
				print "<option value=\"$current_view.php?cal=$cal_encoded_tmp&amp;getdate=$getdate\" selected>$cal_displayname_tmp Webcal</option>";
			} else {
				print "<option value=\"$current_view.php?cal=$cal_encoded_tmp&amp;getdate=$getdate\">$cal_displayname_tmp Webcal</option>";	
			}		
		}
	}
	
	// finish <select>
	print "</select>";
	
}
?>	

© 2014-2024 Faster IT GmbH | imprint | privacy policy