PageRenderTime 59ms CodeModel.GetById 22ms RepoModel.GetById 1ms app.codeStats 0ms

/htdocs/comm/action/index.php

https://github.com/asterix14/dolibarr
PHP | 1014 lines | 770 code | 105 blank | 139 comment | 231 complexity | 5519c94688bc01cc72fd8bc258d4b25a MD5 | raw file
Possible License(s): LGPL-2.0
  1. <?php
  2. /* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2003 Eric Seigne <erics@rycks.com>
  4. * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
  5. * Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
  6. * Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. */
  21. /**
  22. * \file htdocs/comm/action/index.php
  23. * \ingroup agenda
  24. * \brief Home page of calendar events
  25. */
  26. require("../../main.inc.php");
  27. require_once(DOL_DOCUMENT_ROOT."/societe/class/societe.class.php");
  28. require_once(DOL_DOCUMENT_ROOT."/contact/class/contact.class.php");
  29. require_once(DOL_DOCUMENT_ROOT."/comm/action/class/actioncomm.class.php");
  30. require_once(DOL_DOCUMENT_ROOT."/core/lib/date.lib.php");
  31. require_once(DOL_DOCUMENT_ROOT."/core/lib/agenda.lib.php");
  32. if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT."/core/lib/project.lib.php");
  33. $filter=GETPOST("filter");
  34. $filtera = GETPOST("userasked","int")?GETPOST("userasked","int"):GETPOST("filtera","int");
  35. $filtert = GETPOST("usertodo","int")?GETPOST("usertodo","int"):GETPOST("filtert","int");
  36. $filterd = GETPOST("userdone","int")?GETPOST("userdone","int"):GETPOST("filterd","int");
  37. $showbirthday = GETPOST("showbirthday","int");
  38. $sortfield = GETPOST("sortfield");
  39. $sortorder = GETPOST("sortorder");
  40. $page = GETPOST("page","int");
  41. if ($page == -1) { $page = 0 ; }
  42. $limit = $conf->liste_limit;
  43. $offset = $limit * $page ;
  44. if (! $sortorder) $sortorder="ASC";
  45. if (! $sortfield) $sortfield="a.datec";
  46. // Security check
  47. $socid = GETPOST("socid","int",1);
  48. if ($user->societe_id) $socid=$user->societe_id;
  49. $result = restrictedArea($user, 'agenda', 0, '', 'myactions');
  50. $canedit=1;
  51. if (! $user->rights->agenda->myactions->read) accessforbidden();
  52. if (! $user->rights->agenda->allactions->read) $canedit=0;
  53. if (! $user->rights->agenda->allactions->read || $filter =='mine') // If no permission to see all, we show only affected to me
  54. {
  55. $filtera=$user->id;
  56. $filtert=$user->id;
  57. $filterd=$user->id;
  58. }
  59. $action=GETPOST('action','alpha');
  60. //$year=GETPOST("year");
  61. $year=GETPOST("year","int")?GETPOST("year","int"):date("Y");
  62. $month=GETPOST("month","int")?GETPOST("month","int"):date("m");
  63. $week=GETPOST("week","int")?GETPOST("week","int"):date("W");
  64. $day=GETPOST("day","int")?GETPOST("day","int"):0;
  65. $actioncode=GETPOST("actioncode");
  66. $pid=GETPOST("projectid","int")?GETPOST("projectid","int"):0;
  67. $status=GETPOST("status");
  68. $maxprint=GETPOST("maxprint");
  69. if (GETPOST('viewcal')) { $action='show_month'; $day=''; } // View by month
  70. if (GETPOST('viewweek')) { $action='show_week'; $week=($week?$week:date("W")); $day=($day?$day:date("d")); } // View by week
  71. if (GETPOST('viewday')) { $action='show_day'; $day=($day?$day:date("d")); } // View by day
  72. $langs->load("other");
  73. $langs->load("commercial");
  74. if (! isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW=3;
  75. /*
  76. * Actions
  77. */
  78. if (GETPOST("viewlist"))
  79. {
  80. $param='';
  81. foreach($_POST as $key => $val)
  82. {
  83. if ($key=='token') continue;
  84. $param.='&'.$key.'='.urlencode($val);
  85. }
  86. //print $param;
  87. header("Location: ".DOL_URL_ROOT.'/comm/action/listactions.php?'.$param);
  88. exit;
  89. }
  90. if ($action=='delete_action')
  91. {
  92. $event = new ActionComm($db);
  93. $event->fetch($actionid);
  94. $result=$event->delete();
  95. }
  96. /*
  97. * View
  98. */
  99. $help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda';
  100. llxHeader('',$langs->trans("Agenda"),$help_url);
  101. $form=new Form($db);
  102. $companystatic=new Societe($db);
  103. $contactstatic=new Contact($db);
  104. $now=dol_now('tzref');
  105. if (empty($action) || $action=='show_month')
  106. {
  107. $prev = dol_get_prev_month($month, $year);
  108. $prev_year = $prev['year'];
  109. $prev_month = $prev['month'];
  110. $next = dol_get_next_month($month, $year);
  111. $next_year = $next['year'];
  112. $next_month = $next['month'];
  113. $max_day_in_prev_month = date("t",dol_mktime(0,0,0,$prev_month,1,$prev_year)); // Nb of days in previous month
  114. $max_day_in_month = date("t",dol_mktime(0,0,0,$month,1,$year)); // Nb of days in next month
  115. // tmpday is a negative or null cursor to know how many days before the 1 to show on month view (if tmpday=0 we start on monday)
  116. $tmpday = -date("w",dol_mktime(0,0,0,$month,1,$year))+2;
  117. $tmpday+=((isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:1)-1);
  118. if ($tmpday >= 1) $tmpday -= 7;
  119. // Define firstdaytoshow and lastdaytoshow
  120. $firstdaytoshow=dol_mktime(0,0,0,$prev_month,$max_day_in_prev_month+$tmpday,$prev_year);
  121. $next_day=7-($max_day_in_month+1-$tmpday)%7;
  122. if ($next_day < 6) $next_day+=7;
  123. $lastdaytoshow=dol_mktime(0,0,0,$next_month,$next_day,$next_year);
  124. }
  125. if ($action=='show_week')
  126. {
  127. $prev = dol_get_first_day_week($day, $month, $year);
  128. $prev_year = $prev['prev_year'];
  129. $prev_month = $prev['prev_month'];
  130. $prev_day = $prev['prev_day'];
  131. $first_day = $prev['first_day'];
  132. $week = $prev['week'];
  133. $day = (int) $day;
  134. $next = dol_get_next_week($day, $week, $month, $year);
  135. $next_year = $next['year'];
  136. $next_month = $next['month'];
  137. $next_day = $next['day'];
  138. // Define firstdaytoshow and lastdaytoshow
  139. $firstdaytoshow=dol_mktime(0,0,0,$prev_month,$first_day,$prev_year);
  140. $lastdaytoshow=dol_mktime(0,0,0,$next_month,$next_day,$next_year);
  141. $max_day_in_month = date("t",dol_mktime(0,0,0,$month,1,$year));
  142. $tmpday = $first_day;
  143. }
  144. if ($action == 'show_day')
  145. {
  146. $prev = dol_get_prev_day($day, $month, $year);
  147. $prev_year = $prev['year'];
  148. $prev_month = $prev['month'];
  149. $prev_day = $prev['day'];
  150. $next = dol_get_next_day($day, $month, $year);
  151. $next_year = $next['year'];
  152. $next_month = $next['month'];
  153. $next_day = $next['day'];
  154. // Define firstdaytoshow and lastdaytoshow
  155. $firstdaytoshow=dol_mktime(0,0,0,$prev_month,$prev_day,$prev_year);
  156. $lastdaytoshow=dol_mktime(0,0,0,$next_month,$next_day,$next_year);
  157. }
  158. //print 'xx'.$prev_year.'-'.$prev_month.'-'.$prev_day;
  159. //print 'xx'.$next_year.'-'.$next_month.'-'.$next_day;
  160. //print dol_print_date($firstdaytoshow,'day');
  161. //print dol_print_date($lastdaytoshow,'day');
  162. $title=$langs->trans("DoneAndToDoActions");
  163. if ($status == 'done') $title=$langs->trans("DoneActions");
  164. if ($status == 'todo') $title=$langs->trans("ToDoActions");
  165. $param='';
  166. if ($status) $param="&status=".$status;
  167. if ($filter) $param.="&filter=".$filter;
  168. if ($filtera) $param.="&filtera=".$filtera;
  169. if ($filtert) $param.="&filtert=".$filtert;
  170. if ($filterd) $param.="&filterd=".$filterd;
  171. if ($socid) $param.="&socid=".$socid;
  172. if ($showbirthday) $param.="&showbirthday=1";
  173. if ($pid) $param.="&projectid=".$pid;
  174. if ($actioncode) $param.="&actioncode=".$actioncode;
  175. if (GETPOST("type")) $param.="&type=".GETPOST("type");
  176. if ($action == 'show_day' || $action == 'show_week') $param.='&action='.$action;
  177. if ($maxprint) $param.="&maxprint=on";
  178. // Show navigation bar
  179. if (empty($action) || $action=='show_month')
  180. {
  181. $nav ="<a href=\"?year=".$prev_year."&amp;month=".$prev_month."&amp;region=".$region.$param."\">".img_previous($langs->trans("Previous"))."</a>\n";
  182. $nav.=" <span id=\"month_name\">".dol_print_date(dol_mktime(0,0,0,$month,1,$year),"%b %Y");
  183. $nav.=" </span>\n";
  184. $nav.="<a href=\"?year=".$next_year."&amp;month=".$next_month."&amp;region=".$region.$param."\">".img_next($langs->trans("Next"))."</a>\n";
  185. $picto='calendar';
  186. }
  187. if ($action=='show_week')
  188. {
  189. $nav ="<a href=\"?year=".$prev_year."&amp;month=".$prev_month."&amp;day=".$prev_day."&amp;region=".$region.$param."\">".img_previous($langs->trans("Previous"))."</a>\n";
  190. $nav.=" <span id=\"month_name\">".dol_print_date(dol_mktime(0,0,0,$month,1,$year),"%Y").", ".$langs->trans("Week")." ".$week;
  191. $nav.=" </span>\n";
  192. $nav.="<a href=\"?year=".$next_year."&amp;month=".$next_month."&amp;day=".$next_day."&amp;region=".$region.$param."\">".img_next($langs->trans("Next"))."</a>\n";
  193. $picto='calendarweek';
  194. }
  195. if ($action=='show_day')
  196. {
  197. $nav ="<a href=\"?year=".$prev_year."&amp;month=".$prev_month."&amp;day=".$prev_day."&amp;region=".$region.$param."\">".img_previous($langs->trans("Previous"))."</a>\n";
  198. $nav.=" <span id=\"month_name\">".dol_print_date(dol_mktime(0,0,0,$month,$day,$year),"daytextshort");
  199. $nav.=" </span>\n";
  200. $nav.="<a href=\"?year=".$next_year."&amp;month=".$next_month."&amp;day=".$next_day."&amp;region=".$region.$param."\">".img_next($langs->trans("Next"))."</a>\n";
  201. $picto='calendarday';
  202. }
  203. // Must be after the nav definition
  204. $param.='&year='.$year.'&month='.$month.($day?'&day='.$day:'');
  205. //print 'x'.$param;
  206. $head = calendars_prepare_head('');
  207. dol_fiche_head($head, 'card', $langs->trans('Events'), 0, $picto);
  208. print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,$filtera,$filtert,$filterd,$pid,$socid);
  209. dol_fiche_end();
  210. // Add link to show birthdays
  211. $newparam=$param; // newparam is for birthday links
  212. $newparam=preg_replace('/showbirthday=[0-1]/i','showbirthday='.(empty($showbirthday)?1:0),$newparam);
  213. if (! preg_match('/showbirthday=/i',$newparam)) $newparam.='&showbirthday=1';
  214. $link='<a href="'.$_SERVER['PHP_SELF'];
  215. $link.='?'.$newparam;
  216. $link.='">';
  217. if (empty($showbirthday)) $link.=$langs->trans("AgendaShowBirthdayEvents");
  218. else $link.=$langs->trans("AgendaHideBirthdayEvents");
  219. $link.='</a>';
  220. print_fiche_titre($title,$link.' &nbsp; &nbsp; '.$nav, '');
  221. //print '<br>';
  222. //print_fiche_titre($link,'','');
  223. // Get event in an array
  224. $eventarray=array();
  225. $sql = 'SELECT a.id,a.label,';
  226. $sql.= ' a.datep,';
  227. $sql.= ' a.datep2,';
  228. $sql.= ' a.datea,';
  229. $sql.= ' a.datea2,';
  230. $sql.= ' a.percent,';
  231. $sql.= ' a.fk_user_author,a.fk_user_action,a.fk_user_done,';
  232. $sql.= ' a.priority, a.fulldayevent, a.location,';
  233. $sql.= ' a.fk_soc, a.fk_contact,';
  234. $sql.= ' ca.code';
  235. $sql.= ' FROM '.MAIN_DB_PREFIX.'actioncomm as a';
  236. $sql.= ', '.MAIN_DB_PREFIX.'c_actioncomm as ca';
  237. $sql.= ', '.MAIN_DB_PREFIX.'user as u';
  238. $sql.= ' WHERE a.fk_action = ca.id';
  239. $sql.= ' AND a.fk_user_author = u.rowid';
  240. $sql.= ' AND u.entity in (0,'.$conf->entity.')'; // To limit to entity
  241. $sql.= ' AND a.entity = '.$conf->entity;
  242. if ($user->societe_id) $sql.= ' AND a.fk_soc = '.$user->societe_id; // To limit to external user company
  243. if ($actioncode) $sql.=" AND ca.code='".$db->escape($actioncode)."'";
  244. if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid);
  245. if ($action == 'show_day')
  246. {
  247. $sql.= " AND (";
  248. $sql.= " (datep BETWEEN '".$db->idate(dol_mktime(0,0,0,$month,$day,$year))."'";
  249. $sql.= " AND '".$db->idate(dol_mktime(23,59,59,$month,$day,$year))."')";
  250. $sql.= " OR ";
  251. $sql.= " (datep2 BETWEEN '".$db->idate(dol_mktime(0,0,0,$month,$day,$year))."'";
  252. $sql.= " AND '".$db->idate(dol_mktime(23,59,59,$month,$day,$year))."')";
  253. $sql.= " OR ";
  254. $sql.= " (datep < '".$db->idate(dol_mktime(0,0,0,$month,$day,$year))."'";
  255. $sql.= " AND datep2 > '".$db->idate(dol_mktime(23,59,59,$month,$day,$year))."')";
  256. $sql.= ')';
  257. }
  258. else
  259. {
  260. // To limit array
  261. $sql.= " AND (";
  262. $sql.= " (datep BETWEEN '".$db->idate(dol_mktime(0,0,0,$month,1,$year)-(60*60*24*7))."'"; // Start 7 days before
  263. $sql.= " AND '".$db->idate(dol_mktime(23,59,59,$month,28,$year)+(60*60*24*10))."')"; // End 7 days after + 3 to go from 28 to 31
  264. $sql.= " OR ";
  265. $sql.= " (datep2 BETWEEN '".$db->idate(dol_mktime(0,0,0,$month,1,$year)-(60*60*24*7))."'";
  266. $sql.= " AND '".$db->idate(dol_mktime(23,59,59,$month,28,$year)+(60*60*24*10))."')";
  267. $sql.= " OR ";
  268. $sql.= " (datep < '".$db->idate(dol_mktime(0,0,0,$month,1,$year)-(60*60*24*7))."'";
  269. $sql.= " AND datep2 > '".$db->idate(dol_mktime(23,59,59,$month,28,$year)+(60*60*24*10))."')";
  270. $sql.= ')';
  271. }
  272. if ($filtera > 0 || $filtert > 0 || $filterd > 0)
  273. {
  274. $sql.= " AND (";
  275. if ($filtera > 0) $sql.= " a.fk_user_author = ".$filtera;
  276. if ($filtert > 0) $sql.= ($filtera>0?" OR ":"")." a.fk_user_action = ".$filtert;
  277. if ($filterd > 0) $sql.= ($filtera>0||$filtert>0?" OR ":"")." a.fk_user_done = ".$filterd;
  278. $sql.= ")";
  279. }
  280. if ($status == 'done') { $sql.= " AND a.percent = 100"; }
  281. if ($status == 'todo') { $sql.= " AND a.percent < 100"; }
  282. // Sort on date
  283. $sql.= ' ORDER BY datep';
  284. //print $sql;
  285. dol_syslog("comm/action/index.php sql=".$sql, LOG_DEBUG);
  286. $resql=$db->query($sql);
  287. if ($resql)
  288. {
  289. $num = $db->num_rows($resql);
  290. $i=0;
  291. while ($i < $num)
  292. {
  293. $obj = $db->fetch_object($resql);
  294. // Create a new object action
  295. $event=new ActionComm($db);
  296. $event->id=$obj->id;
  297. $event->datep=$db->jdate($obj->datep); // datep and datef are GMT date
  298. $event->datef=$db->jdate($obj->datep2);
  299. $event->type_code=$obj->code;
  300. $event->libelle=$obj->label;
  301. $event->percentage=$obj->percent;
  302. $event->author->id=$obj->fk_user_author;
  303. $event->usertodo->id=$obj->fk_user_action;
  304. $event->userdone->id=$obj->fk_user_done;
  305. $event->priority=$obj->priority;
  306. $event->fulldayevent=$obj->fulldayevent;
  307. $event->location=$obj->location;
  308. $event->societe->id=$obj->fk_soc;
  309. $event->contact->id=$obj->fk_contact;
  310. // Defined date_start_in_calendar and date_end_in_calendar property
  311. // They are date start and end of action but modified to not be outside calendar view.
  312. if ($event->percentage <= 0)
  313. {
  314. $event->date_start_in_calendar=$event->datep;
  315. if ($event->datef != '' && $event->datef >= $event->datep) $event->date_end_in_calendar=$event->datef;
  316. else $event->date_end_in_calendar=$event->datep;
  317. }
  318. else
  319. {
  320. $event->date_start_in_calendar=$event->datep;
  321. if ($event->datef != '' && $event->datef >= $event->datep) $event->date_end_in_calendar=$event->datef;
  322. else $event->date_end_in_calendar=$event->datep;
  323. }
  324. // Define ponctual property
  325. if ($event->date_start_in_calendar == $event->date_end_in_calendar)
  326. {
  327. $event->ponctuel=1;
  328. }
  329. // Check values
  330. if ($event->date_end_in_calendar < $firstdaytoshow ||
  331. $event->date_start_in_calendar > $lastdaytoshow)
  332. {
  333. // This record is out of visible range
  334. }
  335. else
  336. {
  337. if ($event->date_start_in_calendar < $firstdaytoshow) $event->date_start_in_calendar=$firstdaytoshow;
  338. if ($event->date_end_in_calendar > $lastdaytoshow) $event->date_end_in_calendar=$lastdaytoshow;
  339. // Add an entry in actionarray for each day
  340. $daycursor=$event->date_start_in_calendar;
  341. $annee = date('Y',$daycursor);
  342. $mois = date('m',$daycursor);
  343. $jour = date('d',$daycursor);
  344. // Loop on each day covered by action to prepare an index to show on calendar
  345. $loop=true; $j=0;
  346. $daykey=dol_mktime(0,0,0,$mois,$jour,$annee);
  347. do
  348. {
  349. //if ($event->id==408) print 'daykey='.$daykey.' '.$event->datep.' '.$event->datef.'<br>';
  350. $eventarray[$daykey][]=$event;
  351. $j++;
  352. $daykey+=60*60*24;
  353. if ($daykey > $event->date_end_in_calendar) $loop=false;
  354. }
  355. while ($loop);
  356. //print 'Event '.$i.' id='.$event->id.' (start='.dol_print_date($event->datep).'-end='.dol_print_date($event->datef);
  357. //print ' startincalendar='.dol_print_date($event->date_start_in_calendar).'-endincalendar='.dol_print_date($event->date_end_in_calendar).') was added in '.$j.' different index key of array<br>';
  358. }
  359. $i++;
  360. }
  361. }
  362. else
  363. {
  364. dol_print_error($db);
  365. }
  366. if ($showbirthday)
  367. {
  368. // Add events in array
  369. $sql = 'SELECT sp.rowid, sp.name, sp.firstname, sp.birthday';
  370. $sql.= ' FROM '.MAIN_DB_PREFIX.'socpeople as sp';
  371. $sql.= ' WHERE (priv=0 OR (priv=1 AND fk_user_creat='.$user->id.'))';
  372. $sql.= ' AND sp.entity = '.$conf->entity;
  373. if ($action == 'show_day')
  374. {
  375. $sql.= ' AND MONTH(birthday) = '.$month;
  376. $sql.= ' AND DAY(birthday) = '.$day;
  377. }
  378. else
  379. {
  380. $sql.= ' AND MONTH(birthday) = '.$month;
  381. }
  382. $sql.= ' ORDER BY birthday';
  383. dol_syslog("comm/action/index.php sql=".$sql, LOG_DEBUG);
  384. $resql=$db->query($sql);
  385. if ($resql)
  386. {
  387. $num = $db->num_rows($resql);
  388. $i=0;
  389. while ($i < $num)
  390. {
  391. $obj = $db->fetch_object($resql);
  392. $event=new ActionComm($db);
  393. $event->id=$obj->rowid; // We put contact id in action id for birthdays events
  394. $datebirth=dol_stringtotime($obj->birthday,1);
  395. //print 'ee'.$obj->birthday.'-'.$datebirth;
  396. $datearray=dol_getdate($datebirth,true);
  397. $event->datep=dol_mktime(0,0,0,$datearray['mon'],$datearray['mday'],$year,true); // For full day events, date are also GMT but they wont but converted during output
  398. $event->datef=$event->datep;
  399. $event->type_code='BIRTHDAY';
  400. $event->libelle=$langs->trans("Birthday").' '.$obj->firstname.' '.$obj->name;
  401. $event->percentage=100;
  402. $event->fulldayevent=true;
  403. $event->date_start_in_calendar=$event->datep;
  404. $event->date_end_in_calendar=$event->datef;
  405. $event->ponctuel=0;
  406. // Add an entry in actionarray for each day
  407. $daycursor=$event->date_start_in_calendar;
  408. $annee = date('Y',$daycursor);
  409. $mois = date('m',$daycursor);
  410. $jour = date('d',$daycursor);
  411. $loop=true;
  412. $daykey=dol_mktime(0,0,0,$mois,$jour,$annee);
  413. do
  414. {
  415. $eventarray[$daykey][]=$event;
  416. $daykey+=60*60*24;
  417. if ($daykey > $event->date_end_in_calendar) $loop=false;
  418. }
  419. while ($loop);
  420. $i++;
  421. }
  422. }
  423. else
  424. {
  425. dol_print_error($db);
  426. }
  427. }
  428. //Exernal Calendars
  429. $listofextcals=array();
  430. if (empty($conf->global->AGENDA_DISABLE_EXT) && $conf->global->AGENDA_EXT_NB > 0)
  431. {
  432. $i=0;
  433. while($i < $conf->global->AGENDA_EXT_NB)
  434. {
  435. $i++;
  436. $paramkey='AGENDA_EXT_SRC'.$i;
  437. $url=$conf->global->$paramkey;
  438. $paramkey='AGENDA_EXT_NAME'.$i;
  439. $namecal = $conf->global->$paramkey;
  440. $paramkey='AGENDA_EXT_COLOR'.$i;
  441. $colorcal = $conf->global->$paramkey;
  442. if ($url && $namecal) $listofextcals[]=array('src'=>$url,'name'=>$namecal,'color'=>$colorcal);
  443. }
  444. }
  445. if (count($listofextcals))
  446. {
  447. require_once(DOL_DOCUMENT_ROOT."/comm/action/class/ical.class.php");
  448. foreach($listofextcals as $extcal)
  449. {
  450. $url=$extcal['src'];
  451. $namecal = $extcal['name'];
  452. $colorcal = $extcal['color'];
  453. //print "url=".$url." namecal=".$namecal." colorcal=".$colorcal;
  454. $ical=new ical();
  455. $ical->parse($url);
  456. $icalevents=array();
  457. if (is_array($ical->get_event_list())) $icalevents=array_merge($icalevents,$ical->get_event_list());
  458. if (is_array($ical->get_freebusy_list())) $icalevents=array_merge($icalevents,$ical->get_freebusy_list());
  459. if(count($icalevents)>0)
  460. {
  461. foreach($icalevents as $icalevent)
  462. {
  463. // Create a new object action
  464. $event=new ActionComm($db);
  465. $addevent = false;
  466. if($icalevent['DTSTART;VALUE=DATE']) //fullday event
  467. {
  468. // For full day events, date are also GMT but they wont but converted using tz during output
  469. $datestart=dol_stringtotime($icalevent['DTSTART;VALUE=DATE'],1);
  470. $dateend=dol_stringtotime($icalevent['DTEND;VALUE=DATE'],1)-1; // We remove one second to get last second of day
  471. //print 'x'.$datestart.'-'.$dateend;exit;
  472. //print dol_print_date($dateend,'dayhour','gmt');
  473. $event->fulldayevent=true;
  474. $addevent=true;
  475. }
  476. elseif (is_array($icalevent['RRULE'])) //repeatable event
  477. {
  478. $addevent=false; //TODO: a faire
  479. }
  480. elseif(!is_array($icalevent['DTSTART'])) //non-repeatable and not fullday event
  481. {
  482. $datestart=$icalevent['DTSTART'];
  483. $dateend=$icalevent['DTEND'];
  484. $addevent=true;
  485. }
  486. if($addevent)
  487. {
  488. $event->id=$icalevent['UID'];
  489. $event->icalname=$namecal;
  490. $event->icalcolor=$colorcal;
  491. $usertime=0; // We dont modify date because we want to have date into memory datep and datef stored as GMT date. Compensation will be done during output.
  492. $event->datep=$datestart+$usertime;
  493. $event->datef=$dateend+$usertime;
  494. $event->type_code="ICALEVENT";
  495. if($icalevent['SUMMARY']) $event->libelle=$icalevent['SUMMARY'];
  496. elseif($icalevent['DESCRIPTION']) $event->libelle=dol_nl2br($icalevent['DESCRIPTION'],1);
  497. else $event->libelle = $langs->trans("ExtSiteNoLabel");
  498. $event->date_start_in_calendar=$event->datep;
  499. if ($event->datef != '' && $event->datef >= $event->datep) $event->date_end_in_calendar=$event->datef;
  500. else $event->date_end_in_calendar=$event->datep;
  501. // Define ponctual property
  502. if ($event->date_start_in_calendar == $event->date_end_in_calendar)
  503. {
  504. $event->ponctuel=1;
  505. }
  506. // Check values
  507. if ($event->date_end_in_calendar < $firstdaytoshow || $event->date_start_in_calendar > $lastdaytoshow)
  508. {
  509. // This record is out of visible range
  510. }
  511. else
  512. {
  513. if ($event->date_start_in_calendar < $firstdaytoshow) $event->date_start_in_calendar=$firstdaytoshow;
  514. if ($event->date_end_in_calendar > $lastdaytoshow) $event->date_end_in_calendar=$lastdaytoshow;
  515. // Add an entry in actionarray for each day
  516. $daycursor=$event->date_start_in_calendar;
  517. $annee = date('Y',$daycursor);
  518. $mois = date('m',$daycursor);
  519. $jour = date('d',$daycursor);
  520. // Loop on each day covered by action to prepare an index to show on calendar
  521. $loop=true; $j=0;
  522. // daykey must be date that represent day box in calendar so must be a user time
  523. $daykey=dol_mktime(0,0,0,$mois,$jour,$annee);
  524. $daykeygmt=dol_mktime(0,0,0,$mois,$jour,$annee,true,0,false);
  525. do
  526. {
  527. //if ($event->fulldayevent) print dol_print_date($daykeygmt,'dayhour','gmt').'-'.dol_print_date($daykey,'dayhour','gmt').'-'.dol_print_date($event->date_end_in_calendar,'dayhour','gmt').' ';
  528. $eventarray[$daykey][]=$event;
  529. $daykey+=60*60*24; $daykeygmt+=60*60*24; // Add one day
  530. if (($event->fulldayevent ? $daykeygmt : $daykey) > $event->date_end_in_calendar) $loop=false;
  531. }
  532. while ($loop);
  533. }
  534. }
  535. }
  536. }
  537. }
  538. }
  539. $maxnbofchar=18;
  540. $cachethirdparties=array();
  541. $cachecontacts=array();
  542. // Define theme_datacolor array
  543. $color_file = DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/graph-color.php";
  544. if (is_readable($color_file))
  545. {
  546. include_once($color_file);
  547. }
  548. if (! is_array($theme_datacolor)) $theme_datacolor=array(array(120,130,150), array(200,160,180), array(190,190,220));
  549. if (empty($action) || $action == 'show_month') // View by month
  550. {
  551. $newparam=$param; // newparam is for birthday links
  552. $newparam=preg_replace('/action=show_month&?/i','',$newparam);
  553. $newparam=preg_replace('/action=show_week&?/i','',$newparam);
  554. $newparam=preg_replace('/day=[0-9][0-9]&?/i','',$newparam);
  555. $newparam=preg_replace('/month=[0-9][0-9]&?/i','',$newparam);
  556. $newparam=preg_replace('/year=[0-9]+&?/i','',$newparam);
  557. echo '<table width="100%" class="nocellnopadd">';
  558. echo ' <tr class="liste_titre">';
  559. $i=0;
  560. while ($i < 7)
  561. {
  562. echo ' <td align="center">'.$langs->trans("Day".(($i+(isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:1)) % 7))."</td>\n";
  563. $i++;
  564. }
  565. echo " </tr>\n";
  566. // In loops, tmpday contains day nb in current month (can be zero or negative for days of previous month)
  567. //var_dump($eventarray);
  568. //print $tmpday;
  569. for($iter_week = 0; $iter_week < 6 ; $iter_week++)
  570. {
  571. echo " <tr>\n";
  572. for($iter_day = 0; $iter_day < 7; $iter_day++)
  573. {
  574. /* Show days before the beginning of the current month (previous month) */
  575. if($tmpday <= 0)
  576. {
  577. $style='cal_other_month';
  578. echo ' <td class="'.$style.'" width="14%" valign="top" nowrap="nowrap">';
  579. show_day_events ($db, $max_day_in_prev_month + $tmpday, $prev_month, $prev_year, $month, $style, $eventarray, $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW, $maxnbofchar, $newparam);
  580. echo " </td>\n";
  581. }
  582. /* Show days of the current month */
  583. elseif(($tmpday <= $max_day_in_month))
  584. {
  585. $curtime = dol_mktime (0, 0, 0, $month, $tmpday, $year);
  586. $style='cal_current_month';
  587. $today=0;
  588. $todayarray=dol_getdate($now,'fast');
  589. if ($todayarray['mday']==$tmpday && $todayarray['mon']==$month && $todayarray['year']==$year) $today=1;
  590. if ($today) $style='cal_today';
  591. echo ' <td class="'.$style.'" width="14%" valign="top" nowrap="nowrap">';
  592. show_day_events($db, $tmpday, $month, $year, $month, $style, $eventarray, $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW, $maxnbofchar, $newparam);
  593. echo " </td>\n";
  594. }
  595. /* Show days after the current month (next month) */
  596. else
  597. {
  598. $style='cal_other_month';
  599. echo ' <td class="'.$style.'" width="14%" valign="top" nowrap="nowrap">';
  600. show_day_events($db, $tmpday - $max_day_in_month, $next_month, $next_year, $month, $style, $eventarray, $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW, $maxnbofchar, $newparam);
  601. echo "</td>\n";
  602. }
  603. $tmpday++;
  604. }
  605. echo " </tr>\n";
  606. }
  607. echo "</table>\n";
  608. }
  609. elseif ($action == 'show_week') // View by week
  610. {
  611. $newparam=$param; // newparam is for birthday links
  612. $newparam=preg_replace('/action=show_month&?/i','',$newparam);
  613. $newparam=preg_replace('/action=show_week&?/i','',$newparam);
  614. $newparam=preg_replace('/day=[0-9][0-9]&?/i','',$newparam);
  615. $newparam=preg_replace('/month=[0-9][0-9]&?/i','',$newparam);
  616. $newparam=preg_replace('/year=[0-9]+&?/i','',$newparam);
  617. echo '<table width="100%" class="nocellnopadd">';
  618. echo ' <tr class="liste_titre">';
  619. $i=0;
  620. while ($i < 7)
  621. {
  622. echo ' <td align="center">'.$langs->trans("Day".(($i+(isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:1)) % 7))."</td>\n";
  623. $i++;
  624. }
  625. echo " </tr>\n";
  626. // In loops, tmpday contains day nb in current month (can be zero or negative for days of previous month)
  627. //var_dump($eventarray);
  628. //print $tmpday;
  629. echo " <tr>\n";
  630. for($iter_day = 0; $iter_day < 7; $iter_day++)
  631. {
  632. if(($tmpday <= $max_day_in_month))
  633. {
  634. // Show days of the current week
  635. $curtime = dol_mktime (0, 0, 0, $month, $tmpday, $year);
  636. $style='cal_current_month';
  637. $today=0;
  638. $todayarray=dol_getdate($now,'fast');
  639. if ($todayarray['mday']==$tmpday && $todayarray['mon']==$month && $todayarray['year']==$year) $today=1;
  640. if ($today) $style='cal_today';
  641. echo ' <td class="'.$style.'" width="14%" valign="top" nowrap="nowrap">';
  642. show_day_events($db, $tmpday, $month, $year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300);
  643. echo " </td>\n";
  644. }
  645. else
  646. {
  647. $style='cal_current_month';
  648. echo ' <td class="'.$style.'" width="14%" valign="top" nowrap="nowrap">';
  649. show_day_events($db, $tmpday - $max_day_in_month, $next_month, $next_year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300);
  650. echo "</td>\n";
  651. }
  652. $tmpday++;
  653. }
  654. echo " </tr>\n";
  655. echo "</table>\n";
  656. }
  657. else // View by day
  658. {
  659. $newparam=$param; // newparam is for birthday links
  660. $newparam=preg_replace('/action=show_month&?/i','',$newparam);
  661. $newparam=preg_replace('/action=show_week&?/i','',$newparam);
  662. $newparam=preg_replace('/day=[0-9][0-9]&?/i','',$newparam);
  663. $newparam=preg_replace('/month=[0-9][0-9]&?/i','',$newparam);
  664. $newparam=preg_replace('/year=[0-9]+&?/i','',$newparam);
  665. // Code to show just one day
  666. $style='cal_current_month';
  667. $today=0;
  668. $todayarray=dol_getdate($now,'fast');
  669. if ($todayarray['mday']==$day && $todayarray['mon']==$month && $todayarray['year']==$year) $today=1;
  670. if ($today) $style='cal_today';
  671. $timestamp=dol_mktime(12,0,0,$month,$day,$year);
  672. $arraytimestamp=adodb_getdate(dol_mktime(12,0,0,$month,$day,$year));
  673. echo '<table width="100%" class="nocellnopadd">';
  674. echo ' <tr class="liste_titre">';
  675. echo ' <td align="center">'.$langs->trans("Day".$arraytimestamp['wday'])."</td>\n";
  676. echo " </tr>\n";
  677. echo " <tr>\n";
  678. echo ' <td class="'.$style.'" width="14%" valign="top" nowrap="nowrap">';
  679. $maxnbofchar=80;
  680. show_day_events ($db, $day, $month, $year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300);
  681. echo "</td>\n";
  682. echo " </tr>\n";
  683. echo '</table>';
  684. }
  685. $db->close();
  686. /* TODO Export
  687. print '
  688. <a href="" id="actionagenda_ical_link"><img src="'.DOL_URL_ROOT.'/theme/common/ical.gif" border="0"/></a>
  689. <a href="" id="actionagenda_vcal_link"><img src="'.DOL_URL_ROOT.'/theme/common/vcal.gif" border="0"/></a>
  690. <a href="" id="actionagenda_rss_link"><img src="'.DOL_URL_ROOT.'/theme/common/rss.gif" border="0"/></a>
  691. <script>
  692. $("#actionagenda_rss_link").attr("href","/public/agenda/agendaexport.php?format=rss&type=ActionAgenda&exportkey=dolibarr&token="+getToken()+"&status="+getStatus()+"&userasked="+getUserasked()+"&usertodo="+getUsertodo()+"&userdone="+getUserdone()+"&year="+getYear()+"&month="+getMonth()+"&day="+getDay()+"&showbirthday="+getShowbirthday()+"&action="+getAction()+"&projectid="+getProjectid()+"");
  693. $("#actionagenda_ical_link").attr("href","/public/agenda/agendaexport.php?format=ical&type=ActionAgenda&exportkey=dolibarr&token="+getToken()+"&status="+getStatus()+"&userasked="+getUserasked()+"&usertodo="+getUsertodo()+"&userdone="+getUserdone()+"&year="+getYear()+"&month="+getMonth()+"&day="+getDay()+"&showbirthday="+getShowbirthday()+"&action="+getAction()+"&projectid="+getProjectid()+"");
  694. $("#actionagenda_vcal_link").attr("href","/public/agenda/agendaexport.php?format=vcal&type=ActionAgenda&exportkey=dolibarr&token="+getToken()+"&status="+getStatus()+"&userasked="+getUserasked()+"&usertodo="+getUsertodo()+"&userdone="+getUserdone()+"&year="+getYear()+"&month="+getMonth()+"&day="+getDay()+"&showbirthday="+getShowbirthday()+"&action="+getAction()+"&projectid="+getProjectid()+"");
  695. </script>
  696. ';
  697. */
  698. llxFooter();
  699. /**
  700. * Show event of a particular day
  701. * @param $db Database handler
  702. * @param $day Day
  703. * @param $month Month
  704. * @param $year Year
  705. * @param $monthshown Current month shown in calendar view
  706. * @param $style Style to use for this day
  707. * @param $eventarray Array of events
  708. * @param $maxPrint Nb of actions to show each day on month view (0 means non limit)
  709. * @param $maxnbofchar Nb of characters to show for event line
  710. * @param $newparam Parameters on current URL
  711. * @param $showinfo Add extended information (used by day view)
  712. * @param $minheight Minimum height for each event. 60px by default.
  713. */
  714. function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventarray, $maxPrint=0, $maxnbofchar=16, $newparam='', $showinfo=0, $minheight=60)
  715. {
  716. global $user, $conf, $langs;
  717. global $filter, $filtera, $filtert, $filterd, $status;
  718. global $theme_datacolor;
  719. global $cachethirdparties, $cachecontacts;
  720. if ($_GET["maxprint"] == 'on') $maxPrint=0; // Force to remove limits
  721. print '<div id="dayevent_'.sprintf("%04d",$year).sprintf("%02d",$month).sprintf("%02d",$day).'" class="dayevent">'."\n";
  722. $curtime = dol_mktime (0, 0, 0, $month, $day, $year);
  723. print '<table class="nobordernopadding" width="100%">';
  724. print '<tr style="background: #EEEEEE"><td align="left" nowrap="nowrap">';
  725. print '<a href="'.DOL_URL_ROOT.'/comm/action/index.php?';
  726. print 'action=show_day&day='.str_pad($day, 2, "0", STR_PAD_LEFT).'&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$year;
  727. print $newparam;
  728. //.'&month='.$month.'&year='.$year;
  729. print '">';
  730. if ($showinfo) print dol_print_date($curtime,'daytext');
  731. else print dol_print_date($curtime,'%d');
  732. print '</a>';
  733. print '</td><td align="right" nowrap="nowrap">';
  734. if ($user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create)
  735. {
  736. //$param='month='.$monthshown.'&year='.$year;
  737. $hourminsec='100000';
  738. print '<a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&datep='.sprintf("%04d%02d%02d",$year,$month,$day).$hourminsec.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam?'?'.$newparam:'')).'">';
  739. print img_picto($langs->trans("NewAction"),'edit_add.png');
  740. print '</a>';
  741. }
  742. print '</td></tr>';
  743. print '<tr height="'.$minheight.'"><td valign="top" colspan="2" nowrap="nowrap">';
  744. //$curtime = dol_mktime (0, 0, 0, $month, $day, $year);
  745. $i=0;
  746. foreach ($eventarray as $daykey => $notused)
  747. {
  748. $annee = date('Y',$daykey);
  749. $mois = date('m',$daykey);
  750. $jour = date('d',$daykey);
  751. if ($day==$jour && $month==$mois && $year==$annee)
  752. {
  753. foreach ($eventarray[$daykey] as $index => $event)
  754. {
  755. if ($i < $maxPrint || $maxPrint == 0)
  756. {
  757. $ponct=($event->date_start_in_calendar == $event->date_end_in_calendar);
  758. // Show rect of event
  759. $colorindex=0;
  760. if ($event->author->id == $user->id || $event->usertodo->id == $user->id || $event->userdone->id == $user->id) $colorindex=1;
  761. if ($event->type_code == 'BIRTHDAY') $colorindex=2;
  762. if ($event->type_code == 'ICALEVENT') $color=$event->icalcolor;
  763. else $color=sprintf("%02x%02x%02x",$theme_datacolor[$colorindex][0],$theme_datacolor[$colorindex][1],$theme_datacolor[$colorindex][2]);
  764. //print "x".$color;
  765. print '<div id="event_'.sprintf("%04d",$annee).sprintf("%02d",$mois).sprintf("%02d",$jour).'_'.$i.'" class="event">';
  766. print '<table class="cal_event" style="background: #'.$color.'; -moz-border-radius:4px; " width="100%"><tr>';
  767. print '<td nowrap="nowrap">';
  768. if ($event->type_code == 'BIRTHDAY') // It's a birthday
  769. {
  770. print $event->getNomUrl(1,$maxnbofchar,'cal_event','birthday','contact');
  771. }
  772. if ($event->type_code != 'BIRTHDAY')
  773. {
  774. // Picto
  775. if (empty($event->fulldayevent))
  776. {
  777. //print $event->getNomUrl(2).' ';
  778. }
  779. // Date
  780. if (empty($event->fulldayevent))
  781. {
  782. //print '<strong>';
  783. $daterange='';
  784. // Show hours (start ... end)
  785. $tmpyearstart = date('Y',$event->date_start_in_calendar);
  786. $tmpmonthstart = date('m',$event->date_start_in_calendar);
  787. $tmpdaystart = date('d',$event->date_start_in_calendar);
  788. $tmpyearend = date('Y',$event->date_end_in_calendar);
  789. $tmpmonthend = date('m',$event->date_end_in_calendar);
  790. $tmpdayend = date('d',$event->date_end_in_calendar);
  791. // Hour start
  792. if ($tmpyearstart == $annee && $tmpmonthstart == $mois && $tmpdaystart == $jour)
  793. {
  794. $daterange.=dol_print_date($event->date_start_in_calendar,'%H:%M');
  795. if ($event->date_end_in_calendar && $event->date_start_in_calendar != $event->date_end_in_calendar)
  796. {
  797. if ($tmpyearstart == $tmpyearend && $tmpmonthstart == $tmpmonthend && $tmpdaystart == $tmpdayend)
  798. $daterange.='-';
  799. //else
  800. //print '...';
  801. }
  802. }
  803. if ($event->date_end_in_calendar && $event->date_start_in_calendar != $event->date_end_in_calendar)
  804. {
  805. if ($tmpyearstart != $tmpyearend || $tmpmonthstart != $tmpmonthend || $tmpdaystart != $tmpdayend)
  806. {
  807. $daterange.='...';
  808. }
  809. }
  810. // Hour end
  811. if ($event->date_end_in_calendar && $event->date_start_in_calendar != $event->date_end_in_calendar)
  812. {
  813. if ($tmpyearend == $annee && $tmpmonthend == $mois && $tmpdayend == $jour)
  814. $daterange.=dol_print_date($event->date_end_in_calendar,'%H:%M');
  815. }
  816. //print $daterange;
  817. if ($event->type_code != 'ICALEVENT')
  818. {
  819. $savlabel=$event->libelle;
  820. $event->libelle=$daterange;
  821. print $event->getNomUrl(0);
  822. $event->libelle=$savlabel;
  823. }
  824. else
  825. {
  826. print $daterange;
  827. }
  828. //print '</strong> ';
  829. print "<br>\n";
  830. }
  831. else
  832. {
  833. if ($showinfo)
  834. {
  835. print $langs->trans("EventOnFullDay")."<br>\n";
  836. }
  837. }
  838. // Show title
  839. if ($event->type_code == 'ICALEVENT') print dol_trunc($event->libelle,$maxnbofchar);
  840. else print $event->getNomUrl(0,$maxnbofchar,'cal_event');
  841. if ($event->type_code == 'ICALEVENT') print '<br>('.dol_trunc($event->icalname,$maxnbofchar).')';
  842. // If action related to company / contact
  843. $linerelatedto='';$length=16;
  844. if (! empty($event->societe->id) && ! empty($event->contact->id)) $length=round($length/2);
  845. if (! empty($event->societe->id) && $event->societe->id > 0)
  846. {
  847. if (! is_object($cachethirdparties[$event->societe->id]))
  848. {
  849. $thirdparty=new Societe($db);
  850. $thirdparty->fetch($event->societe->id);
  851. $cachethirdparties[$event->societe->id]=$thirdparty;
  852. }
  853. else $thirdparty=$cachethirdparties[$event->societe->id];
  854. $linerelatedto.=$thirdparty->getNomUrl(1,'',$length);
  855. }
  856. if (! empty($event->contact->id) && $event->contact->id > 0)
  857. {
  858. if (! is_object($cachecontacts[$event->contact->id]))
  859. {
  860. $contact=new Contact($db);
  861. $contact->fetch($event->contact->id);
  862. $cachecontacts[$event->contact->id]=$contact;
  863. }
  864. else $contact=$cachecontacts[$event->contact->id];
  865. if ($linerelatedto) $linerelatedto.=' / ';
  866. $linerelatedto.=$contact->getNomUrl(1,'',$length);
  867. }
  868. if ($linerelatedto) print '<br>'.$linerelatedto;
  869. }
  870. // Show location
  871. if ($showinfo)
  872. {
  873. if ($event->location)
  874. {
  875. print '<br>';
  876. print $langs->trans("Location").': '.$event->location;
  877. }
  878. }
  879. print '</td>';
  880. // Status - Percent
  881. print '<td align="right" nowrap="nowrap">';
  882. if ($event->type_code != 'BIRTHDAY' && $event->type_code != 'ICALEVENT') print $event->getLibStatut(3,1);
  883. else print '&nbsp;';
  884. print '</td></tr></table>';
  885. print '</div>';
  886. $i++;
  887. }
  888. else
  889. {
  890. print '<a href="'.DOL_URL_ROOT.'/comm/action/index.php?maxprint=on&month='.$monthshown.'&year='.$year;
  891. print ($status?'&status='.$status:'').($filter?'&filter='.$filter:'');
  892. print ($filtera?'&filtera='.$filtera:'').($filtert?'&filtert='.$filtert:'').($filterd?'&filterd='.$filterd:'');
  893. print '">'.img_picto("all","1downarrow_selected.png").' ...';
  894. print ' +'.(count($eventarray[$daykey])-$maxPrint);
  895. print '</a>';
  896. break;
  897. //$ok=false; // To avoid to show twice the link
  898. }
  899. }
  900. break;
  901. }
  902. }
  903. if (! $i) print '&nbsp;';
  904. print '</td></tr>';
  905. print '</table>';
  906. print '</div>'."\n";
  907. }
  908. ?>