dolibarr 20.0.5
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 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 */
18
25// Load Dolibarr environment
26require '../../main.inc.php';
27require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
28require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
29require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
30require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php';
31require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
32if (isModEnabled('project')) {
33 require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
34 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
35}
36
37// Load translation files required by the page
38$langs->load("commercial");
39
40$id = GETPOSTINT('id');
41
42// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
43$hookmanager->initHooks(array('actioncard', 'globalcard'));
44
45// Security check
46if ($user->socid > 0) {
47 $action = '';
48 $socid = $user->socid;
49}
50
51$result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions|allactions', 'fk_soc', 'id');
52if ($user->socid && $socid) {
53 $result = restrictedArea($user, 'societe', $socid);
54}
55
56$object = new ActionComm($db);
57$object->fetch($id);
58
59$usercancreate = $user->hasRight('agenda', 'allactions', 'create') || (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->hasRight('agenda', 'myactions', 'create'));
60
61
62/*
63 * View
64 */
65
66$form = new Form($db);
67
68$help_url = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda|DE:Modul_Terminplanung';
69llxHeader('', $langs->trans("Agenda"), $help_url);
70
71$object->info($object->id);
72
73$head = actions_prepare_head($object);
74print dol_get_fiche_head($head, 'info', $langs->trans("Action"), -1, 'action');
75
76// Link to other agenda views
77$linkback = '<a href="'.DOL_URL_ROOT.'/comm/action/list.php?mode=show_list&restore_lastsearch_values=1">';
78$linkback .= img_picto($langs->trans("BackToList"), 'object_calendarlist', 'class="pictoactionview pictofixedwidth"');
79$linkback .= '<span class="hideonsmartphone">'.$langs->trans("BackToList").'</span>';
80$linkback .= '</a>';
81$linkback .= '</li>';
82$linkback .= '<li class="noborder litext">';
83$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').'">';
84$linkback .= img_picto($langs->trans("ViewCal"), 'object_calendar', 'class="pictoactionview pictofixedwidth"');
85$linkback .= '<span class="hideonsmartphone">'.$langs->trans("ViewCal").'</span>';
86$linkback .= '</a>';
87$linkback .= '</li>';
88$linkback .= '<li class="noborder litext">';
89$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').'">';
90$linkback .= img_picto($langs->trans("ViewWeek"), 'object_calendarweek', 'class="pictoactionview pictofixedwidth"');
91$linkback .= '<span class="hideonsmartphone">'.$langs->trans("ViewWeek").'</span>';
92$linkback .= '</a>';
93$linkback .= '</li>';
94$linkback .= '<li class="noborder litext">';
95$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').'">';
96$linkback .= img_picto($langs->trans("ViewDay"), 'object_calendarday', 'class="pictoactionview pictofixedwidth"');
97$linkback .= '<span class="hideonsmartphone">'.$langs->trans("ViewDay").'</span>';
98$linkback .= '</a>';
99$linkback .= '</li>';
100$linkback .= '<li class="noborder litext">';
101$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').'">';
102$linkback .= img_picto($langs->trans("ViewPerUser"), 'object_calendarperuser', 'class="pictoactionview pictofixedwidth"');
103$linkback .= '<span class="hideonsmartphone">'.$langs->trans("ViewPerUser").'</span>';
104$linkback .= '</a>';
105
106// Add more views from hooks
107$parameters = array();
108$reshook = $hookmanager->executeHooks('addCalendarView', $parameters, $object, $action);
109if (empty($reshook)) {
110 $linkback .= $hookmanager->resPrint;
111} elseif ($reshook > 1) {
112 $linkback = $hookmanager->resPrint;
113}
114
115$morehtmlref = '<div class="refidno">';
116// Project
117if (isModEnabled('project')) {
118 $langs->load("projects");
119 //$morehtmlref .= '<br>';
120 if (0) {
121 $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"');
122 if ($action != 'classify') {
123 $morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> ';
124 }
125 $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
126 } else {
127 if (!empty($object->fk_project)) {
128 $proj = new Project($db);
129 $proj->fetch($object->fk_project);
130 $morehtmlref .= $proj->getNomUrl(1);
131 if ($proj->title) {
132 $morehtmlref .= '<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).'</span>';
133 }
134 }
135 }
136}
137$morehtmlref .= '</div>';
138
139dol_banner_tab($object, 'id', $linkback, ($user->socid ? 0 : 1), 'id', 'ref', $morehtmlref);
140
141print '<div class="underbanner clearboth"></div>';
142
143print '<br>';
144
145print '<table width="100%"><tr><td>';
146dol_print_object_info($object);
147print '</td></tr></table>';
148
149print dol_get_fiche_end();
150
151// End of page
152llxFooter();
153$db->close();
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:58
actions_prepare_head($object)
Prepare array with list of tabs.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Definition wrapper.php:55
llxFooter()
Empty footer.
Definition wrapper.php:69
Class to manage agenda events (actions)
Class to manage generation of HTML components Only common components must be here.
Class to manage projects.
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)
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)
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)
Output date in a string format according to outputlangs (or langs if not defined).
newToken()
Return the value of token currently saved into session with name 'newtoken'.
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.