dolibarr 24.0.0-beta
bookcalindex.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
5 * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
6 * Copyright (C) 2024-2026 Frédéric France <frederic.france@free.fr>
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 3 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 <https://www.gnu.org/licenses/>.
20 */
21
28// Load Dolibarr environment
29require '../main.inc.php';
38require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
39
40// Load translation files required by the page
41$langs->loadLangs(array("agenda"));
42
43$action = GETPOST('action', 'aZ09');
44
45
46// Security check
47// if (! $user->hasRight('bookcal', 'myobject', 'read')) {
48// accessforbidden();
49// }
50$socid = GETPOSTINT('socid');
51if (!empty($user->socid) && $user->socid > 0) {
52 $action = '';
53 $socid = $user->socid;
54}
55
56$now = dol_now();
57$NBMAX = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT, 5');
58$max = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT', 5);
59
60
61/*
62 * Actions
63 */
64
65// None
66
67
68/*
69 * View
70 */
71
72$form = new Form($db);
73$formfile = new FormFile($db);
74
75llxHeader("", $langs->trans("BookcalBookingTitle"), '', '', 0, 0, '', '', '', 'mod-bookcal page-index');
76
77print load_fiche_titre($langs->trans("BookcalBookingTitle"), '', 'fa-calendar-check');
78
79print '<div class="fichecenter"><div class="fichethirdleft">';
80
81print '<span class="opacitymedium">';
82print $langs->trans("BookCalInitHelp");
83print '</span>';
84
85// BEGIN MODULEBUILDER DRAFT MYOBJECT
86// Draft MyObject
87if ($user->hasRight('bookcal', 'availabilities', 'read') && isModEnabled('bookcal')) {
88 $langs->load("orders");
89 /*$myobjectstatic = new Booking($db);
90
91 $sql = "SELECT rowid, `ref`, fk_soc, fk_project, description, note_public, note_private, date_creation, tms, fk_user_creat, fk_user_modif, last_main_doc, import_key, model_pdf, status, firstname, lastname, email, `start`, duration";
92 $sql .= " FROM ". MAIN_DB_PREFIX . 'bookcal_booking';
93
94 $resql = $db->query($sql);
95 if ($resql) {
96 $total = 0;
97 $num = $db->num_rows($resql);
98
99 print '<table class="noborder centpercent">';
100 print '<tr class="liste_titre">';
101 print '<th colspan="21">'.$langs->trans("Bookings").($num?'<span class="badge marginleftonlyshort">'.$num.'</span>':'').'</th></tr>';
102
103 $var = true;
104 print '
105 <tr>
106 <th colspan="3">id</th>
107 <th colspan="3">ref</th>
108 <th colspan="3">name</th>
109 <th colspan="3">hour</th>
110 <th colspan="3">duration</th>
111 <th colspan="3">description</th>
112 </tr>';
113 if ($num > 0) {
114 $i = 0;
115 while ($i < $num) {
116 $obj = $db->fetch_object($resql);
117 print '<tr class="oddeven">';
118
119 $myobjectstatic->id=$obj->rowid;
120 $myobjectstatic->ref=$obj->ref;
121 $myobjectstatic->firstname = $obj->firstname;
122 $myobjectstatic->lastname = $obj->lastname;
123 $myobjectstatic->start = $obj->start;
124 $myobjectstatic->duration = $obj->duration;
125 $myobjectstatic->description = $obj->description;
126
127
128 print '<td colspan="3" class="nowrap">' . $myobjectstatic->id . "</td>";
129 print '<td colspan="3" class="nowrap">' . $myobjectstatic->ref . "</td>";
130 print '<td colspan="3" class="nowrap">' . $myobjectstatic->firstname . " " . $myobjectstatic->lastname . "</td>";
131 print '<td colspan="3" class="nowrap">' . dol_print_date($myobjectstatic->start, 'dayhourtext') . "</td>";
132 print '<td colspan="3" class="nowrap">' . $myobjectstatic->duration . "</td>";
133 print '<td colspan="3" class="nowrap">' . $myobjectstatic->description . "</td>";
134 $i++;
135 }
136 } else {
137 print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("NoOrder").'</td></tr>';
138 }
139 print "</table><br>";
140
141 $db->free($resql);
142 } else {
143 dol_print_error($db);
144 }*/
145}
146//END MODULEBUILDER DRAFT MYOBJECT */
147
148
149
150print '</div><div class="fichetwothirdright">';
151
152
153/* BEGIN MODULEBUILDER LASTMODIFIED MYOBJECT
154// Last modified myobject
155if (isModEnabled('bookcal')) {
156 $sql = "SELECT rowid, `ref`, fk_soc, fk_project, description, note_public, note_private, date_creation, tms, fk_user_creat, fk_user_modif, last_main_doc, import_key, model_pdf, status, firstname, lastname, email, `start`, duration";
157 $sql .= " FROM ". MAIN_DB_PREFIX . 'bookcal_booking';
158 print "here2";
159 $resql = $db->query($sql);
160 if ($resql)
161 {
162 $num = $db->num_rows($resql);
163 $i = 0;
164
165 print '<table class="noborder centpercent">';
166 print '<tr class="liste_titre">';
167 print '<th colspan="2">';
168 print $langs->trans("BoxTitleLatestModifiedMyObjects", $max);
169 print '</th>';
170 print '<th class="right">'.$langs->trans("DateModificationShort").'</th>';
171 print '</tr>';
172 print $num;
173 if ($num)
174 {
175 while ($i < $num)
176 {
177 $objp = $db->fetch_object($resql);
178
179 $myobjectstatic->id=$objp->rowid;
180 $myobjectstatic->ref=$objp->ref;
181 $myobjectstatic->label=$objp->label;
182 $myobjectstatic->status = $objp->status;
183
184 print '<tr class="oddeven">';
185 print '<td class="nowrap">'.$myobjectstatic->getNomUrl(1).'</td>';
186 print '<td class="right nowrap">';
187 print "</td>";
188 print '<td class="right nowrap">'.dol_print_date($db->jdate($objp->tms), 'day')."</td>";
189 print '</tr>';
190 $i++;
191 }
192
193 $db->free($resql);
194 } else {
195 print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
196 }
197 print "</table><br>";
198 }
199}
200
201*/
202print '</div></div>';
203
204// End of page
205llxFooter();
206$db->close();
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 offer components to list and upload files.
Class to manage generation of HTML components Only common components must be here.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
dol_now($mode='gmt')
Return date for now.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
isModEnabled($module)
Is Dolibarr module enabled.