Platform  3.1
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
mcalendar-rep.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
5  * @package FDL
6 */
7 /**
8  * For TEST widget calendar
9  *
10  * @author Anakeen 2005
11  * @version $Id: mcalendar-rep.php,v 1.7 2005/11/24 13:47:51 eric Exp $
12  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
13  * @package FDL
14  * @subpackage
15  */
16 /**
17  */
18 global $_GET;
19 $startp = $_GET["ts"];
20 $endp = $_GET["te"];
21 $lastreq = $_GET["LR"];
22 // sleep(5);
23 $events = array(
24  100 => array(
25  "time" => $startp + (8 * 3600) ,
26  "dura" => 3600,
27  "mode" => 1
28  ) ,
29  1001 => array(
30  "time" => $startp + (34 * 3600) - 1800,
31  "dura" => 3400,
32  "mode" => 1
33  ) ,
34  1002 => array(
35  "time" => $startp + (34 * 3600) - 1800,
36  "dura" => 5 * 3600,
37  "mode" => 1
38  ) ,
39  1003 => array(
40  "time" => $startp + (36 * 3600) - 1800,
41  "dura" => 3600,
42  "mode" => 1
43  ) ,
44  101 => array(
45  "time" => $startp + (34 * 3600) ,
46  "dura" => 1800,
47  "mode" => 1
48  ) ,
49  1011 => array(
50  "time" => $startp + (34 * 3600) + 1800,
51  "dura" => 1800,
52  "mode" => 1
53  ) ,
54  1013 => array(
55  "time" => $startp + (34 * 3600) + 1800 + 2000,
56  "dura" => 6600,
57  "mode" => 1
58  ) ,
59  1012 => array(
60  "time" => $startp + (48 * 3600) ,
61  "dura" => (24 * 3600) - 1,
62  "mode" => 1
63  ) ,
64  102 => array(
65  "time" => $startp + (110 * 3600) ,
66  "dura" => 5400,
67  "mode" => 1
68  ) ,
69  1022 => array(
70  "time" => $startp + (110 * 3600) ,
71  "dura" => 3600,
72  "mode" => 1
73  ) ,
74  1021 => array(
75  "time" => $startp + (110 * 3600) ,
76  "dura" => 0,
77  "mode" => 1
78  ) ,
79  1023 => array(
80  "time" => $startp + (96 * 3600) ,
81  "dura" => (3600 * 20) ,
82  "mode" => 0
83  ) ,
84  103 => array(
85  "time" => $startp + (130 * 3600) ,
86  "dura" => 26 * 3600,
87  "mode" => 1
88  ) ,
89 );
90 // $events = array( 1001 =>array( "time" => $startp + (34*3600) - 1800, "dura" => 3400 ),
91 // 1002 =>array( "time" => $startp + (34*3600) - 1800, "dura" => 5*3600 ),
92 // 1003 =>array( "time" => $startp + (36*3600) - 1800, "dura" => 3600 ),
93 // 101 =>array( "time" => $startp + (34*3600), "dura" => 1800 ),
94 // 1011 =>array( "time" => $startp + (34*3600) + 1800, "dura" => 1800 ),
95 // );
96 // 200 =>array( "time" => $startp + (8*3600), "dura" => 3600 ),
97 // 201 =>array( "time" => $startp + (34*3600), "dura" => 1800 ),
98 // 2011 =>array( "time" => $startp + (34*3600) + 1800, "dura" => 1800 ),
99 // 2012 =>array( "time" => $startp + (48*3600), "dura" => (24*3600)-1 ),
100 // 202 =>array( "time" => $startp + (110*3600), "dura" => 5400),
101 // 2021 =>array( "time" => $startp + (110*3600), "dura" => 0),
102 // 203 =>array( "time" => $startp + (130*3600), "dura" => 26*3600),
103 // 300 =>array( "time" => $startp + (8*3600), "dura" => 3600 ),
104 // 301 =>array( "time" => $startp + (34*3600), "dura" => 1800 ),
105 // 3011 =>array( "time" => $startp + (34*3600) + 1800, "dura" => 1800 ),
106 // 3012 =>array( "time" => $startp + (48*3600), "dura" => (24*3600)-1 ),
107 // 302 =>array( "time" => $startp + (110*3600), "dura" => 5400),
108 // 3021 =>array( "time" => $startp + (110*3600), "dura" => 0),
109 // 303 =>array( "time" => $startp + (130*3600), "dura" => 26*3600),
110 // 400 =>array( "time" => $startp + (8*3600), "dura" => 3600 ),
111 // 401 =>array( "time" => $startp + (34*3600), "dura" => 1800 ),
112 // 4011 =>array( "time" => $startp + (34*3600) + 1800, "dura" => 1800 ),
113 // 4012 =>array( "time" => $startp + (48*3600), "dura" => (24*3600)-1 ),
114 // 402 =>array( "time" => $startp + (110*3600), "dura" => 5400),
115 // 4021 =>array( "time" => $startp + (110*3600), "dura" => 0),
116 // 403 =>array( "time" => $startp + (130*3600), "dura" => 26*3600)
117 header("Content-Type: text/xml");
118 echo '<?xml version="1.0" encoding="UTF-8"?>';
119 
120 echo '<eventdesc>';
121 
122 echo '<menu id="evt_menu">';
123 // echo '<style font="Arial,Helvetica,sans-serif" size="9" fgcolor="#000081" bgcolor="#E9E3FF" afgcolor="" abgcolor="#C2C5F9" tfgcolor="white" tbgcolor="#000081" />';
124 echo ' <item id="evt_menu_title" status="2" type="0">';
125 echo ' <label>Menu evenement</label>';
126 echo ' <description>Menu evenement</description>';
127 echo ' </item>';
128 echo ' <item id="evt_menu_read" status="2" type="1" icon="/what/mcal/Images/defico.png">';
129 echo ' <label>Afficher</label>';
130 echo ' <description>Afficher la description complete</description>';
131 echo ' <action aid="evt_menu_read" amode="0" aevent="0" atarget="event_show" ascript="mcalendar_detail.php?id=%EID%" />';
132 echo ' </item>';
133 echo ' <item id="evt_menu_test" status="2" type="1">';
134 echo ' <label>Test parser</label>';
135 echo ' <description>Menu permettant de tester le parser</description>';
136 echo ' <action aid="evt_menu_read" amode="3" aevent="0" atarget="" ascript="alert(\'test parser %EID%\');" />';
137 echo ' </item>';
138 echo ' <item id="evt_menu_test" status="2" type="1">';
139 echo ' <label>Test JS handler</label>';
140 echo ' <description>Menu permettant de tester le handler JS</description>';
141 echo ' <action aid="evt_menu_read" amode="2" aevent="0" atarget="" ascript="mhandler" />';
142 echo ' </item>';
143 echo ' <item id="evt_menu_delete" status="2" type="1">';
144 echo ' <label>Supprimer</label>';
145 echo ' <description>Suppression de cet evenement</description>';
146 echo ' <action aid="evt_menu_delete" aevent="3" amode="2" atarget="" ascript="mhandler" />';
147 echo ' </item>';
148 echo ' <item id="evt_menu_test2" status="2" type="1">';
149 echo ' <label>Free</label>';
150 echo ' <description>Visiter le site de Free</description>';
151 echo ' <action aid="evt_menu_read" amode="1" aevent="0" atarget="free" ascript="http://www.free.fr" />';
152 echo ' </item>';
153 echo '</menu>';
154 
155 foreach ($events as $k => $v) {
156  echo '<event id="' . $k . '" rid="evc' . $k . '" cid="evc' . $k . '" dmode="' . (isset($v["mode"]) ? $v["mode"] : 1) . '" time="' . $v["time"] . '" duration="' . $v["dura"] . '">';
157  echo '<menuref id="evt_menu" use="' . (isset($v["mode"]) && $v["mode"] == 0 ? 0 : 1) . ',1,1,1,2,1" />';
158  echo '<title>' . getTitle($k) . '</title>';
159  echo '<content>' . getContent($k, $v) . '</content>';
160  echo '</event>';
161 }
162 echo '</eventdesc>';
163 return;
164 
165 function getTitle($x)
166 {
167  return "Event number $x";
168 }
169 function getContent($x, $v)
170 {
171  $color = array(
172  0 => "#eef1ed",
173  1 => "#DCE5FF"
174  );
175  $r = '<styleinfo>';
176  $r.= '<style id="background-color" val="' . (isset($v["mode"]) ? $color[$v["mode"]] : $color[1]) . '"/>';
177  $r.= '<style id="color" val="marron"/>';
178  $r.= '<style id="border" val="1px solid #8B96AA"/>';
179  $r.= '</styleinfo>';
180  $r.= '<chtml>';
181  $r.= '<img style="vertical-align:middle; width:14" src="/what/mcal/Images/defico.png"/>';
182  $r.= '<img style="vertical-align:middle; width:14" src="/what/mcal/Images/defico.png"/>';
183  $r.= '<img style="vertical-align:middle; width:14" src="/what/mcal/Images/defico.png"/>';
184  $r.= '<span style="vertical-align:middle">' . getTitle($x) . ' (' . (isset($v["mode"]) ? $v["mode"] : 1) . ')</span>';
185  $r.= '<div>' . strftime("%H:%M", $v["time"]) . ' - ' . strftime("%H:%M", ($v["time"] + $v["dura"])) . '</div>';
186  $r.= '</chtml>';
187  return $r;
188 }
189 ?>
← centre documentaire © anakeen - published under CC License - Dynacase