1<?php
2/**
3 * @license    http://www.cecill.info/licences/Licence_CeCILL-B_V1-fr.html
4 * @author     Francois Merciol <dokuplugin@merciol.fr>
5 *
6 * Plugin Schedule: manage events per wiki @groups
7
8 $df_ : 31/12/2000
9 $ds_ : 20001231
10 $dn_ : 978217200
11 $dt_ : array ("Y" => 2000, "m" => 12, "d" => "31)
12*/
13
14if (!defined ('DOKU_INC'))
15    define ('DOKU_INC', realpath (dirname (__FILE__).'/../../../').'/');
16global $conf;
17require_once (DOKU_INC.'inc/init.php');
18if (!$conf['lang'])
19    $conf['lang'] = 'fr';
20require_once (DOKU_INC.'inc/common.php');
21require_once (DOKU_INC.'inc/auth.php');
22
23// ============================================================
24if (isset ($_SERVER['REMOTE_USER']))
25    $INFO['userinfo'] = $auth->getUserData ($auth->cleanUser ($_SERVER['REMOTE_USER']));
26$schdplug =& plugin_load ('syntax', 'schedule_block');
27$scheduleRoot = new scheduleRoot ($schdplug);
28ob_start ();
29switch ($_REQUEST ['schd']['action']) {
30    // schedule Table
31case 'changeDate':
32    global $conf;
33    $dn_showDay = mktime (0, 0, 0, date ("n"), date ("j"), date("Y"));
34    $ds_showDay = trim ($scheduleRoot->df2ds ($_REQUEST['schd']['date']));
35    if (preg_match ("#(?<Y>[0-9][0-9][0-9][0-9])(?<m>[0-9][0-9])(?<d>[0-9][0-9])#", $ds_showDay, $dt_showDay))
36        $dn_showDay = mktime (0, 0, 0, $dt_showDay["m"], $dt_showDay["d"], $dt_showDay["Y"]);
37    $schedules = new schedules ($scheduleRoot, $_REQUEST['schd']['ns']);
38    $schedules->load ();
39    $schedules->printScheduleCalendar ($_REQUEST['schd']['mapId'], $dn_showDay);
40    break;
41
42    // schedule Root Admin
43case 'moveSchedules':
44    $scheduleRoot->manageAction ($_REQUEST['schd']);
45    $scheduleRoot->printForm ();
46    break;
47
48default :
49    ptnl ('No Ajax Function !');
50}
51$text = ob_get_contents ();
52ob_end_clean ();
53foreach ($scheduleRoot->message as $type => $msg)
54    $text = '<div class="'.$type.'">'.$msg.'</div>'.$text;
55ptln ($text);
56
57// ============================================================
58