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 */
8if (!defined ('DOKU_INC'))
9    define ('DOKU_INC', realpath (dirname (__FILE__).'/../../../').'/');
10if (!defined ('DOKU_PLUGIN'))
11    define ('DOKU_PLUGIN', DOKU_INC.'lib/plugins/');
12
13// ============================================================
14// event class
15class schedule {
16    var $id;			// event id
17    var $member;		// event owner
18    var $from;			// event begining date
19    var $to;			// event ending date
20    var $at;			// event begining hour
21    var $what;			// event type
22    var $where;			// event place insee code or city name
23    var $lon;			// event place latitude
24    var $lat;			// event place longitude
25    var $addr;			// event place addresse
26    var $audience;		// event expected audience
27    var $shared;		// shared event
28    var $title;			// event page title
29    var $lead;			// event lead
30    var $posterURL;		// event poster URL
31    var $paperURL;		// event paper URL
32    var $remark;		// event remark
33    var $rate;			// event rate
34
35    var $repeatFlag;	// event repeat or not
36    var $repeat;		// event step of repeat
37    var $repeatType;	// event type of repeat
38    var $repeatGrouped;	// repeat event grouped on top
39    var $weekDays;		// event array days concern by the repeating week
40    var $weekRank;		// event week concern by the repeating month
41    var $dayInWeek;		// event day in the week concern by the repeating month
42    var $dayRank;		// event day in the month concern by the repeating month
43
44    var $requestMembers;	// all members proposed during the request
45}
46
47// ============================================================
48// sort event by event date, then creation date
49function cmpSchedule ($a, $b) {
50    if ($a->from == $b->from) {
51        if ($a->at == $b->at)
52            return ($a->id < $b->id) ? -1 : 1;
53        return ($a->at < $b->at) ? -1 : 1;
54    }
55    return ($a->from < $b->from) ? -1 : 1;
56}
57// sort info bubbles by date
58function cmpScheduleInDay ($a, $b) {
59    if ($a['at'] == $b['at'])
60        return ($a['id'] < $b['id']) ? -1 : 1;
61    return ($a['at'] < $b['at']) ? -1 : 1;
62}
63
64// ============================================================
65