tiki-action_calendar.php 2.55 KB
Newer Older
1
<?php
2
// (c) Copyright 2002-2011 by authors of the Tiki Wiki CMS Groupware Project
changi67's avatar
changi67 committed
3 4 5 6
// 
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$
7 8 9

include 'tiki-setup.php';
include 'lib/calendar/tikicalendarlib.php';
10 11
$access->check_feature('feature_action_calendar');
$access->check_permission('tiki_p_view_tiki_calendar');
12 13 14

$headerlib->add_cssfile('css/calendar.css',20);

15 16 17
$myurl = 'tiki-action_calendar.php';
include_once("tiki-calendar_setup.php");

18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
$tikiItems = $tikicalendarlib->getTikiItems(true);
$smarty->assign('tikiItems', $tikiItems);

// Register selected tikiItems in session vars if a refresh is requested
//   If no refresh is requested, either keep existing session values if they exists, either view all tikiItems by default
//   If a refresh has been requested without tikicals, view no tikiItem
if ( empty($_REQUEST['refresh']) ) {
	if ( ! array_key_exists('CalendarViewTikiCals', $_SESSION) ) {
		$_SESSION['CalendarViewTikiCals'] = array_keys($tikiItems);
	}
} elseif ( !empty($_REQUEST['tikicals']) and is_array($_REQUEST['tikicals']) ) {
	$_SESSION['CalendarViewTikiCals'] = $_REQUEST['tikicals'];
} else {
	unset($_SESSION['CalendarViewTikiCals']);
}
$smarty->assign('tikicals', $_SESSION['CalendarViewTikiCals']);

$tc_infos = $tikicalendarlib->getCalendar($_SESSION['CalendarViewTikiCals'], $viewstart, $viewend);
foreach ( $tc_infos as $tc_key => $tc_val ) {
	$smarty->assign($tc_key, $tc_val);
}

$hrows = array();
$hours = array();
42
if ($calendarViewMode['casedefault'] == 'day') {
43 44 45 46 47 48
	$hours = array(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23);
	foreach ($tc_infos['cell'][0]["{$tc_infos['weekdays'][0]}"]['items'] as $dayitems) {
		$rawhour = intval(substr($dayitems['time'],0,2));
		$dayitems['mins'] = substr($dayitems['time'],2);
		$hrows["$rawhour"][] = $dayitems;
	}
49 50
} else {
	$smarty->assign('currMonth', $focusdate);
51
}
52 53 54 55
$smarty->assign('daysnames', $daysnames);
$smarty->assign('daysnames_abr', $daysnames_abr);
$viewdays = array(0,1,2,3,4,5,6);
$smarty->assign('viewdays', $viewdays);
56 57 58 59 60
$smarty->assign('hrows', $hrows);
$smarty->assign('hours', $hours);

$smarty->assign('var', '');
$smarty->assign('daformat2', $tikilib->get_long_date_format());
61
$smarty->assign('myurl', $myurl);
62
$smarty->assign('metatag_robots', 'NOINDEX, NOFOLLOW');
63
$smarty->assign('calendarViewMode',$calendarViewMode['casedefault']);
64
$smarty->assign('calendar_type', 'tiki_actions');
65 66 67

$smarty->assign('mid', 'tiki-action_calendar.tpl');
$smarty->display("tiki.tpl");