agenda.lib.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564
  1. <?php
  2. /* Copyright (C) 2008-2014 Laurent Destailleur <eldy@users.sourceforge.net>
  3. * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
  4. * Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. * or see http://www.gnu.org/
  19. */
  20. /**
  21. * \file htdocs/core/lib/agenda.lib.php
  22. * \brief Set of function for the agenda module
  23. */
  24. /**
  25. * Show filter form in agenda view
  26. *
  27. * @param Object $form Form object
  28. * @param int $canedit Can edit filter fields
  29. * @param int $status Status
  30. * @param int $year Year
  31. * @param int $month Month
  32. * @param int $day Day
  33. * @param int $showbirthday Show birthday
  34. * @param string $filtera Filter on create by user
  35. * @param string $filtert Filter on assigned to user
  36. * @param string $filterd Filter of done by user
  37. * @param int $pid Product id
  38. * @param int $socid Third party id
  39. * @param string $action Action string
  40. * @param array $showextcals Array with list of external calendars (used to show links to select calendar), or -1 to show no legend
  41. * @param string|array $actioncode Preselected value(s) of actioncode for filter on event type
  42. * @param int $usergroupid Id of group to filter on users
  43. * @param string $excludetype A type to exclude ('systemauto', 'system', '')
  44. * @param int $resourceid Preselected value of resource for filter on resource
  45. * @return void
  46. */
  47. function print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, $filtera, $filtert, $filterd, $pid, $socid, $action, $showextcals=array(), $actioncode='', $usergroupid='', $excludetype='', $resourceid=0)
  48. {
  49. global $conf, $user, $langs, $db, $hookmanager;
  50. global $begin_h, $end_h, $begin_d, $end_d;
  51. $langs->load("companies");
  52. // Filters
  53. print '<form name="listactionsfilter" class="listactionsfilter" action="' . $_SERVER["PHP_SELF"] . '" method="get">';
  54. print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
  55. print '<input type="hidden" name="year" value="' . $year . '">';
  56. print '<input type="hidden" name="month" value="' . $month . '">';
  57. print '<input type="hidden" name="day" value="' . $day . '">';
  58. print '<input type="hidden" name="action" value="' . $action . '">';
  59. print '<input type="hidden" name="showbirthday" value="' . $showbirthday . '">';
  60. print '<div class="fichecenter">';
  61. if (! empty($conf->browser->phone)) print '<div class="fichehalfleft">';
  62. else print '<table class="nobordernopadding" width="100%"><tr><td class="borderright">';
  63. print '<table class="nobordernopadding centpercent">';
  64. if ($canedit)
  65. {
  66. print '<tr>';
  67. print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
  68. print $langs->trans("ActionsToDoBy").' &nbsp; ';
  69. print '</td><td style="padding-bottom: 2px; padding-right: 4px;">';
  70. print $form->select_dolusers($filtert, 'filtert', 1, '', ! $canedit, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
  71. if (empty($conf->dol_optimize_smallscreen)) print ' &nbsp; '.$langs->trans("or") . ' '.$langs->trans("ToUserOfGroup").' &nbsp; ';
  72. print $form->select_dolgroups($usergroupid, 'usergroup', 1, '', ! $canedit);
  73. print '</td></tr>';
  74. if ($conf->resource->enabled)
  75. {
  76. include_once DOL_DOCUMENT_ROOT . '/resource/class/html.formresource.class.php';
  77. $formresource=new FormResource($db);
  78. // Resource
  79. print '<tr>';
  80. print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
  81. print $langs->trans("Resource");
  82. print ' &nbsp;</td><td class="nowrap maxwidthonsmartphone" style="padding-bottom: 2px; padding-right: 4px;">';
  83. print $formresource->select_resource_list($resourceid, "resourceid", '', 1, 0, 0, null, '', 2);
  84. print '</td></tr>';
  85. }
  86. include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
  87. $formactions=new FormActions($db);
  88. // Type
  89. print '<tr>';
  90. print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
  91. print $langs->trans("Type");
  92. print ' &nbsp;</td><td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
  93. $multiselect=0;
  94. if (! empty($conf->global->MAIN_ENABLE_MULTISELECT_TYPE)) // We use an option here because it adds bugs when used on agenda page "peruser" and "list"
  95. {
  96. $multiselect=(!empty($conf->global->AGENDA_USE_EVENT_TYPE));
  97. }
  98. print $formactions->select_type_actions($actioncode, "actioncode", $excludetype, (empty($conf->global->AGENDA_USE_EVENT_TYPE)?1:-1), 0, $multiselect);
  99. print '</td></tr>';
  100. }
  101. if (! empty($conf->societe->enabled) && $user->rights->societe->lire)
  102. {
  103. print '<tr>';
  104. print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
  105. print $langs->trans("ThirdParty").' &nbsp; ';
  106. print '</td><td class="nowrap" style="padding-bottom: 2px;">';
  107. print $form->select_company($socid, 'socid', '', 'SelectThirdParty', 0, 0, null, 0);
  108. print '</td></tr>';
  109. }
  110. if (! empty($conf->projet->enabled) && $user->rights->projet->lire)
  111. {
  112. require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
  113. $formproject=new FormProjets($db);
  114. print '<tr>';
  115. print '<td class="nowrap" style="padding-bottom: 2px;">';
  116. print $langs->trans("Project").' &nbsp; ';
  117. print '</td><td class="nowrap" style="padding-bottom: 2px;">';
  118. $formproject->select_projects($socid?$socid:-1, $pid, 'projectid', 0);
  119. print '</td></tr>';
  120. }
  121. if ($canedit && ! preg_match('/listaction/', $_SERVER["PHP_SELF"]))
  122. {
  123. // Status
  124. print '<tr>';
  125. print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
  126. print $langs->trans("Status");
  127. print ' &nbsp;</td><td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
  128. $formactions->form_select_status_action('formaction',$status,1,'status',1,2);
  129. print '</td></tr>';
  130. }
  131. if ($canedit && $action == 'show_peruser')
  132. {
  133. // Filter on hours
  134. print '<tr>';
  135. print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">'.$langs->trans("VisibleTimeRange").'</td>';
  136. print "<td class='nowrap'>";
  137. print '<div class="ui-grid-a"><div class="ui-block-a">';
  138. print '<input type="number" class="short" name="begin_h" value="'.$begin_h.'" min="0" max="23">';
  139. if (empty($conf->dol_use_jmobile)) print ' - ';
  140. else print '</div><div class="ui-block-b">';
  141. print '<input type="number" class="short" name="end_h" value="'.$end_h.'" min="1" max="24">';
  142. if (empty($conf->dol_use_jmobile)) print ' '.$langs->trans("H");
  143. print '</div></div>';
  144. print '</td></tr>';
  145. // Filter on days
  146. print '<tr>';
  147. print '<td class="nowrap">'.$langs->trans("VisibleDaysRange").'</td>';
  148. print "<td class='nowrap'>";
  149. print '<div class="ui-grid-a"><div class="ui-block-a">';
  150. print '<input type="number" class="short" name="begin_d" value="'.$begin_d.'" min="1" max="7">';
  151. if (empty($conf->dol_use_jmobile)) print ' - ';
  152. else print '</div><div class="ui-block-b">';
  153. print '<input type="number" class="short" name="end_d" value="'.$end_d.'" min="1" max="7">';
  154. print '</div></div>';
  155. print '</td></tr>';
  156. }
  157. // Hooks
  158. $parameters = array('canedit'=>$canedit, 'pid'=>$pid, 'socid'=>$socid);
  159. $reshook = $hookmanager->executeHooks('searchAgendaFrom', $parameters, $object, $action); // Note that $action and $object may have been
  160. print '</table>';
  161. if (! empty($conf->browser->phone)) print '</div>';
  162. else print '</td>';
  163. if (! empty($conf->browser->phone)) print '<div class="fichehalfright">';
  164. else print '<td align="center" valign="middle" class="nowrap">';
  165. print '<table class="centpercent"><tr><td align="center">';
  166. print '<div class="formleftzone">';
  167. print '<input type="submit" class="button" style="min-width:120px" name="refresh" value="' . $langs->trans("Refresh") . '">';
  168. print '</div>';
  169. print '</td></tr>';
  170. print '</table>';
  171. if (! empty($conf->browser->phone)) print '</div>';
  172. else print '</td></tr></table>';
  173. print '</div>'; // Close fichecenter
  174. print '<div style="clear:both"></div>';
  175. print '</form>';
  176. }
  177. /**
  178. * Show actions to do array
  179. *
  180. * @param int $max Max nb of records
  181. * @return void
  182. */
  183. function show_array_actions_to_do($max=5)
  184. {
  185. global $langs, $conf, $user, $db, $bc, $socid;
  186. $now=dol_now();
  187. include_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
  188. include_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php';
  189. $sql = "SELECT a.id, a.label, a.datep as dp, a.datep2 as dp2, a.fk_user_author, a.percent,";
  190. $sql.= " c.code, c.libelle as type_label,";
  191. $sql.= " s.nom as sname, s.rowid, s.client";
  192. $sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a LEFT JOIN ";
  193. $sql.= " ".MAIN_DB_PREFIX."c_actioncomm as c ON c.id = a.fk_action";
  194. $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
  195. if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
  196. $sql.= " WHERE a.entity = ".$conf->entity;
  197. $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now)."'))";
  198. if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
  199. if ($socid) $sql.= " AND s.rowid = ".$socid;
  200. $sql.= " ORDER BY a.datep DESC, a.id DESC";
  201. $sql.= $db->plimit($max, 0);
  202. $resql=$db->query($sql);
  203. if ($resql)
  204. {
  205. $num = $db->num_rows($resql);
  206. print '<table class="noborder" width="100%">';
  207. print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("LastActionsToDo",$max).'</th>';
  208. print '<th colspan="2" align="right"><a class="commonlink" href="'.DOL_URL_ROOT.'/comm/action/listactions.php?status=todo">'.$langs->trans("FullList").'</a></th>';
  209. print '</tr>';
  210. $var = true;
  211. $i = 0;
  212. $staticaction=new ActionComm($db);
  213. $customerstatic=new Client($db);
  214. while ($i < $num)
  215. {
  216. $obj = $db->fetch_object($resql);
  217. print '<tr class="oddeven">';
  218. $staticaction->type_code=$obj->code;
  219. $staticaction->label=($obj->label?$obj->label:$obj->type_label);
  220. $staticaction->id=$obj->id;
  221. print '<td>'.$staticaction->getNomUrl(1,34).'</td>';
  222. // print '<td>'.dol_trunc($obj->label,22).'</td>';
  223. print '<td>';
  224. if ($obj->rowid > 0)
  225. {
  226. $customerstatic->id=$obj->rowid;
  227. $customerstatic->name=$obj->sname;
  228. $customerstatic->client=$obj->client;
  229. print $customerstatic->getNomUrl(1,'',16);
  230. }
  231. print '</td>';
  232. $datep=$db->jdate($obj->dp);
  233. $datep2=$db->jdate($obj->dp2);
  234. // Date
  235. print '<td width="100" align="right">'.dol_print_date($datep,'day').'&nbsp;';
  236. $late=0;
  237. if ($obj->percent == 0 && $datep && $datep < time()) $late=1;
  238. if ($obj->percent == 0 && ! $datep && $datep2 && $datep2 < time()) $late=1;
  239. if ($obj->percent > 0 && $obj->percent < 100 && $datep2 && $datep2 < time()) $late=1;
  240. if ($obj->percent > 0 && $obj->percent < 100 && ! $datep2 && $datep && $datep < time()) $late=1;
  241. if ($late) print img_warning($langs->trans("Late"));
  242. print "</td>";
  243. // Statut
  244. print "<td align=\"right\" width=\"14\">".$staticaction->LibStatut($obj->percent,3)."</td>\n";
  245. print "</tr>\n";
  246. $i++;
  247. }
  248. print "</table><br>";
  249. $db->free($resql);
  250. }
  251. else
  252. {
  253. dol_print_error($db);
  254. }
  255. }
  256. /**
  257. * Show last actions array
  258. *
  259. * @param int $max Max nb of records
  260. * @return void
  261. */
  262. function show_array_last_actions_done($max=5)
  263. {
  264. global $langs, $conf, $user, $db, $bc, $socid;
  265. $now=dol_now();
  266. $sql = "SELECT a.id, a.percent, a.datep as da, a.datep2 as da2, a.fk_user_author, a.label,";
  267. $sql.= " c.code, c.libelle,";
  268. $sql.= " s.rowid, s.nom as sname, s.client";
  269. $sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a LEFT JOIN ";
  270. $sql.= " ".MAIN_DB_PREFIX."c_actioncomm as c ON c.id = a.fk_action ";
  271. $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
  272. if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
  273. $sql.= " WHERE a.entity = ".$conf->entity;
  274. $sql.= " AND (a.percent >= 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))";
  275. if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
  276. if ($socid) $sql.= " AND s.rowid = ".$socid;
  277. $sql .= " ORDER BY a.datep2 DESC";
  278. $sql .= $db->plimit($max, 0);
  279. $resql=$db->query($sql);
  280. if ($resql)
  281. {
  282. $num = $db->num_rows($resql);
  283. print '<table class="noborder" width="100%">';
  284. print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("LastDoneTasks",$max).'</th>';
  285. print '<th colspan="2" align="right"><a class="commonlink" href="'.DOL_URL_ROOT.'/comm/action/listactions.php?status=done">'.$langs->trans("FullList").'</a></th>';
  286. print '</tr>';
  287. $var = true;
  288. $i = 0;
  289. $staticaction=new ActionComm($db);
  290. $customerstatic=new Societe($db);
  291. while ($i < $num)
  292. {
  293. $obj = $db->fetch_object($resql);
  294. print '<tr class="oddeven">';
  295. $staticaction->type_code=$obj->code;
  296. $staticaction->libelle=$obj->label;
  297. $staticaction->id=$obj->id;
  298. print '<td>'.$staticaction->getNomUrl(1,34).'</td>';
  299. //print '<td>'.dol_trunc($obj->label,24).'</td>';
  300. print '<td>';
  301. if ($obj->rowid > 0)
  302. {
  303. $customerstatic->id=$obj->rowid;
  304. $customerstatic->name=$obj->sname;
  305. $customerstatic->client=$obj->client;
  306. print $customerstatic->getNomUrl(1,'',24);
  307. }
  308. print '</td>';
  309. // Date
  310. print '<td width="100" align="right">'.dol_print_date($db->jdate($obj->da2),'day');
  311. print "</td>";
  312. // Statut
  313. print "<td align=\"right\" width=\"14\">".$staticaction->LibStatut($obj->percent,3)."</td>\n";
  314. print "</tr>\n";
  315. $i++;
  316. }
  317. // TODO Ajouter rappel pour "il y a des contrats a mettre en service"
  318. // TODO Ajouter rappel pour "il y a des contrats qui arrivent a expiration"
  319. print "</table><br>";
  320. $db->free($resql);
  321. }
  322. else
  323. {
  324. dol_print_error($db);
  325. }
  326. }
  327. /**
  328. * Prepare array with list of tabs
  329. *
  330. * @return array Array of tabs to show
  331. */
  332. function agenda_prepare_head()
  333. {
  334. global $langs, $conf, $user;
  335. $h = 0;
  336. $head = array();
  337. $head[$h][0] = DOL_URL_ROOT."/admin/agenda_other.php";
  338. $head[$h][1] = $langs->trans("Miscellaneous");
  339. $head[$h][2] = 'other';
  340. $h++;
  341. $head[$h][0] = DOL_URL_ROOT."/admin/agenda.php";
  342. $head[$h][1] = $langs->trans("AutoActions");
  343. $head[$h][2] = 'autoactions';
  344. $h++;
  345. if ($conf->global->MAIN_FEATURES_LEVEL > 0)
  346. {
  347. $head[$h][0] = DOL_URL_ROOT."/admin/agenda_reminder.php";
  348. $head[$h][1] = $langs->trans("Reminders");
  349. $head[$h][2] = 'reminders';
  350. $h++;
  351. }
  352. $head[$h][0] = DOL_URL_ROOT."/admin/agenda_xcal.php";
  353. $head[$h][1] = $langs->trans("ExportCal");
  354. $head[$h][2] = 'xcal';
  355. $h++;
  356. $head[$h][0] = DOL_URL_ROOT."/admin/agenda_extsites.php";
  357. $head[$h][1] = $langs->trans("ExtSites");
  358. $head[$h][2] = 'extsites';
  359. $h++;
  360. complete_head_from_modules($conf,$langs,null,$head,$h,'agenda_admin');
  361. $head[$h][0] = DOL_URL_ROOT."/admin/agenda_extrafields.php";
  362. $head[$h][1] = $langs->trans("ExtraFields");
  363. $head[$h][2] = 'attributes';
  364. $h++;
  365. complete_head_from_modules($conf,$langs,null,$head,$h,'agenda_admin','remove');
  366. return $head;
  367. }
  368. /**
  369. * Prepare array with list of tabs
  370. *
  371. * @param object $object Object related to tabs
  372. * @return array Array of tabs to show
  373. */
  374. function actions_prepare_head($object)
  375. {
  376. global $db, $langs, $conf, $user;
  377. $h = 0;
  378. $head = array();
  379. $head[$h][0] = DOL_URL_ROOT.'/comm/action/card.php?id='.$object->id;
  380. $head[$h][1] = $langs->trans("CardAction");
  381. $head[$h][2] = 'card';
  382. $h++;
  383. // Tab to link resources
  384. if ($conf->resource->enabled)
  385. {
  386. include_once DOL_DOCUMENT_ROOT.'/resource/class/dolresource.class.php';
  387. $resource=new DolResource($db);
  388. $head[$h][0] = DOL_URL_ROOT.'/resource/element_resource.php?element=action&element_id='.$object->id;
  389. $listofresourcelinked = $resource->getElementResources($object->element, $object->id);
  390. $nbResources=count($listofresourcelinked);
  391. $head[$h][1] = $langs->trans("Resources");
  392. if ($nbResources > 0) $head[$h][1].= ' <span class="badge">'.($nbResources).'</span>';
  393. $head[$h][2] = 'resources';
  394. $h++;
  395. }
  396. // Attached files
  397. require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
  398. require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
  399. $upload_dir = $conf->agenda->dir_output . "/" . $object->id;
  400. $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$'));
  401. $nbLinks=Link::count($db, $object->element, $object->id);
  402. $head[$h][0] = DOL_URL_ROOT.'/comm/action/document.php?id='.$object->id;
  403. $head[$h][1] = $langs->trans("Documents");
  404. if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
  405. $head[$h][2] = 'documents';
  406. $h++;
  407. $head[$h][0] = DOL_URL_ROOT.'/comm/action/info.php?id='.$object->id;
  408. $head[$h][1] = $langs->trans('Info');
  409. $head[$h][2] = 'info';
  410. $h++;
  411. complete_head_from_modules($conf,$langs,$object,$head,$h,'action');
  412. complete_head_from_modules($conf,$langs,$object,$head,$h,'action','remove');
  413. return $head;
  414. }
  415. /**
  416. * Define head array for tabs of agenda setup pages
  417. *
  418. * @param string $param Parameters to add to url
  419. * @return array Array of head
  420. */
  421. function calendars_prepare_head($param)
  422. {
  423. global $langs, $conf, $user;
  424. $h = 0;
  425. $head = array();
  426. $head[$h][0] = DOL_URL_ROOT.'/comm/action/listactions.php'.($param?'?'.$param:'');
  427. $head[$h][1] = $langs->trans("ViewList");
  428. $head[$h][2] = 'cardlist';
  429. $h++;
  430. $head[$h][0] = DOL_URL_ROOT.'/comm/action/index.php?action=show_day'.($param?'&'.$param:'');
  431. $head[$h][1] = $langs->trans("ViewDay");
  432. $head[$h][2] = 'cardday';
  433. $h++;
  434. $head[$h][0] = DOL_URL_ROOT.'/comm/action/index.php?action=show_week'.($param?'&'.$param:'');
  435. $head[$h][1] = $langs->trans("ViewWeek");
  436. $head[$h][2] = 'cardweek';
  437. $h++;
  438. $head[$h][0] = DOL_URL_ROOT.'/comm/action/index.php?action=show_month'.($param?'&'.$param:'');
  439. $head[$h][1] = $langs->trans("ViewCal");
  440. $head[$h][2] = 'cardmonth';
  441. $h++;
  442. //if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
  443. if (! empty($conf->global->AGENDA_SHOW_PERTYPE))
  444. {
  445. $head[$h][0] = DOL_URL_ROOT.'/comm/action/pertype.php'.($param?'?'.$param:'');
  446. $head[$h][1] = $langs->trans("ViewPerType");
  447. $head[$h][2] = 'cardpertype';
  448. $h++;
  449. }
  450. $head[$h][0] = DOL_URL_ROOT.'/comm/action/peruser.php'.($param?'?'.$param:'');
  451. $head[$h][1] = $langs->trans("ViewPerUser");
  452. $head[$h][2] = 'cardperuser';
  453. $h++;
  454. $object=new stdClass();
  455. // Show more tabs from modules
  456. // Entries must be declared in modules descriptor with line
  457. // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
  458. // $this->tabs = array('entity:-tabname); to remove a tab
  459. complete_head_from_modules($conf,$langs,$object,$head,$h,'agenda');
  460. complete_head_from_modules($conf,$langs,$object,$head,$h,'agenda','remove');
  461. return $head;
  462. }