dolibarr 24.0.0-beta
info.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2004-2023 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
5 * Copyright (C) 2025-2026 MDW <mdeweerd@users.noreply.github.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
27// Load Dolibarr environment
28require '../../main.inc.php';
36require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
37require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
38require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
39require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php';
40require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
41if (isModEnabled('project')) {
42 require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
43 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
44}
45
46// Load translation files required by the page
47$langs->load("commercial");
48
49$id = GETPOSTINT('id');
50$socid = 0;
51
52// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
53$hookmanager->initHooks(array('actioncard', 'globalcard'));
54
55// Security check
56if ($user->socid > 0) {
57 $action = '';
58 $socid = $user->socid;
59}
60
61$result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions|allactions', 'fk_soc', 'id');
62if ($user->socid && $socid) {
63 $result = restrictedArea($user, 'societe', $socid);
64}
65
67$object->fetch($id);
68
69$usercancreate = $user->hasRight('agenda', 'allactions', 'create') || (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->hasRight('agenda', 'myactions', 'create'));
70
71
72/*
73 * View
74 */
75
76$form = new Form($db);
77
78$help_url = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda|DE:Modul_Terminplanung';
79llxHeader('', $langs->trans("Agenda"), $help_url);
80
81$object->info($object->id);
82
83$head = actions_prepare_head($object);
84print dol_get_fiche_head($head, 'info', $langs->trans("Action"), -1, 'action');
85
86// Link to other agenda views
87$linkback = '<a href="'.DOL_URL_ROOT.'/comm/action/list.php?mode=show_list&restore_lastsearch_values=1">';
88$linkback .= img_picto($langs->trans("BackToList"), 'object_calendarlist', 'class="pictoactionview pictofixedwidth"');
89$linkback .= '<span class="hideonsmartphone">'.$langs->trans("BackToList").'</span>';
90$linkback .= '</a>';
91$linkback .= '</li>';
92$linkback .= '<li class="noborder litext">';
93$linkback .= '<a href="'.DOL_URL_ROOT.'/comm/action/index.php?mode=show_month&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').'">';
94$linkback .= img_picto($langs->trans("ViewCal"), 'object_calendar', 'class="pictoactionview pictofixedwidth"');
95$linkback .= '<span class="hideonsmartphone">'.$langs->trans("ViewCal").'</span>';
96$linkback .= '</a>';
97$linkback .= '</li>';
98$linkback .= '<li class="noborder litext">';
99$linkback .= '<a href="'.DOL_URL_ROOT.'/comm/action/index.php?mode=show_week&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').'">';
100$linkback .= img_picto($langs->trans("ViewWeek"), 'object_calendarweek', 'class="pictoactionview pictofixedwidth"');
101$linkback .= '<span class="hideonsmartphone">'.$langs->trans("ViewWeek").'</span>';
102$linkback .= '</a>';
103$linkback .= '</li>';
104$linkback .= '<li class="noborder litext">';
105$linkback .= '<a href="'.DOL_URL_ROOT.'/comm/action/index.php?mode=show_day&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').'">';
106$linkback .= img_picto($langs->trans("ViewDay"), 'object_calendarday', 'class="pictoactionview pictofixedwidth"');
107$linkback .= '<span class="hideonsmartphone">'.$langs->trans("ViewDay").'</span>';
108$linkback .= '</a>';
109$linkback .= '</li>';
110$linkback .= '<li class="noborder litext">';
111$linkback .= '<a href="'.DOL_URL_ROOT.'/comm/action/peruser.php?mode=show_peruser&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').'">';
112$linkback .= img_picto($langs->trans("ViewPerUser"), 'object_calendarperuser', 'class="pictoactionview pictofixedwidth"');
113$linkback .= '<span class="hideonsmartphone">'.$langs->trans("ViewPerUser").'</span>';
114$linkback .= '</a>';
115
116// Add more views from hooks
117$parameters = array();
118$reshook = $hookmanager->executeHooks('addCalendarView', $parameters, $object, $action);
119if (empty($reshook)) {
120 $linkback .= $hookmanager->resPrint;
121} elseif ($reshook > 1) {
122 $linkback = $hookmanager->resPrint;
123}
124
125$morehtmlref = '<div class="refidno">';
126// Project
127if (isModEnabled('project')) {
128 $langs->load("projects");
129 //$morehtmlref .= '<br>';
130 if (0) { // @phpstan-ignore-line
131 $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"');
132 if ($action != 'classify') {
133 $morehtmlref .= '<a class="editfielda" href="'.dolBuildUrl($_SERVER['PHP_SELF'], ['action' => 'classify', 'id' => $object->id], true).'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> ';
134 }
135 $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, (string) $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
136 } else {
137 if (!empty($object->fk_project)) {
138 $proj = new Project($db);
139 $proj->fetch($object->fk_project);
140 $morehtmlref .= $proj->getNomUrl(1);
141 if ($proj->title) {
142 $morehtmlref .= '<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).'</span>';
143 }
144 }
145 }
146}
147$morehtmlref .= '</div>';
148
149dol_banner_tab($object, 'id', $linkback, ($user->socid ? 0 : 1), 'id', 'ref', $morehtmlref);
150
151print '<div class="underbanner clearboth"></div>';
152
153print '<br>';
154
155print '<table width="100%"><tr><td>';
156dol_print_object_info($object);
157print '</td></tr></table>';
158
159print dol_get_fiche_end();
160
161// End of page
162llxFooter();
163$db->close();
$id
Support class for third parties, contacts, members, users or resources.
Definition account.php:47
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
actions_prepare_head($object)
Prepare array with list of tabs.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:73
Class to manage agenda events (actions)
Class to manage generation of HTML components Only common components must be here.
Class to manage projects.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
dol_print_object_info($object, $usetable=0)
Show information on an object TODO Move this into html.formother.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
isModEnabled($module)
Is Dolibarr module enabled.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.