dolibarr 21.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 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';
30require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
31
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 = getDolGlobalString('MAIN_SIZE_SHORTLIST_LIMIT');
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
81
82// BEGIN MODULEBUILDER DRAFT MYOBJECT
83// Draft MyObject
84if ($user->hasRight('bookcal', 'availabilities', 'read') && isModEnabled('bookcal')) {
85 $langs->load("orders");
86 /*$myobjectstatic = new Booking($db);
87
88 $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";
89 $sql .= " FROM ". MAIN_DB_PREFIX . 'bookcal_booking';
90
91 $resql = $db->query($sql);
92 if ($resql) {
93 $total = 0;
94 $num = $db->num_rows($resql);
95
96 print '<table class="noborder centpercent">';
97 print '<tr class="liste_titre">';
98 print '<th colspan="21">'.$langs->trans("Bookings").($num?'<span class="badge marginleftonlyshort">'.$num.'</span>':'').'</th></tr>';
99
100 $var = true;
101 print '
102 <tr>
103 <th colspan="3">id</th>
104 <th colspan="3">ref</th>
105 <th colspan="3">name</th>
106 <th colspan="3">hour</th>
107 <th colspan="3">duration</th>
108 <th colspan="3">description</th>
109 </tr>';
110 if ($num > 0) {
111 $i = 0;
112 while ($i < $num) {
113 $obj = $db->fetch_object($resql);
114 print '<tr class="oddeven">';
115
116 $myobjectstatic->id=$obj->rowid;
117 $myobjectstatic->ref=$obj->ref;
118 $myobjectstatic->firstname = $obj->firstname;
119 $myobjectstatic->lastname = $obj->lastname;
120 $myobjectstatic->start = $obj->start;
121 $myobjectstatic->duration = $obj->duration;
122 $myobjectstatic->description = $obj->description;
123
124
125 print '<td colspan="3" class="nowrap">' . $myobjectstatic->id . "</td>";
126 print '<td colspan="3" class="nowrap">' . $myobjectstatic->ref . "</td>";
127 print '<td colspan="3" class="nowrap">' . $myobjectstatic->firstname . " " . $myobjectstatic->lastname . "</td>";
128 print '<td colspan="3" class="nowrap">' . dol_print_date($myobjectstatic->start, 'dayhourtext') . "</td>";
129 print '<td colspan="3" class="nowrap">' . $myobjectstatic->duration . "</td>";
130 print '<td colspan="3" class="nowrap">' . $myobjectstatic->description . "</td>";
131 $i++;
132 }
133 } else {
134 print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("NoOrder").'</td></tr>';
135 }
136 print "</table><br>";
137
138 $db->free($resql);
139 } else {
140 dol_print_error($db);
141 }*/
142}
143//END MODULEBUILDER DRAFT MYOBJECT */
144
145
146
147print '</div><div class="fichetwothirdright">';
148
149
150/* BEGIN MODULEBUILDER LASTMODIFIED MYOBJECT
151// Last modified myobject
152if (isModEnabled('bookcal')) {
153 $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";
154 $sql .= " FROM ". MAIN_DB_PREFIX . 'bookcal_booking';
155 print "here2";
156 $resql = $db->query($sql);
157 if ($resql)
158 {
159 $num = $db->num_rows($resql);
160 $i = 0;
161
162 print '<table class="noborder centpercent">';
163 print '<tr class="liste_titre">';
164 print '<th colspan="2">';
165 print $langs->trans("BoxTitleLatestModifiedMyObjects", $max);
166 print '</th>';
167 print '<th class="right">'.$langs->trans("DateModificationShort").'</th>';
168 print '</tr>';
169 print $num;
170 if ($num)
171 {
172 while ($i < $num)
173 {
174 $objp = $db->fetch_object($resql);
175
176 $myobjectstatic->id=$objp->rowid;
177 $myobjectstatic->ref=$objp->ref;
178 $myobjectstatic->label=$objp->label;
179 $myobjectstatic->status = $objp->status;
180
181 print '<tr class="oddeven">';
182 print '<td class="nowrap">'.$myobjectstatic->getNomUrl(1).'</td>';
183 print '<td class="right nowrap">';
184 print "</td>";
185 print '<td class="right nowrap">'.dol_print_date($db->jdate($objp->tms), 'day')."</td>";
186 print '</tr>';
187 $i++;
188 }
189
190 $db->free($resql);
191 } else {
192 print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
193 }
194 print "</table><br>";
195 }
196}
197
198*/
199print '</div></div>';
200
201// End of page
202llxFooter();
203$db->close();
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:71
Class to offer components to list and upload files.
Class to manage generation of HTML components Only common components must be here.
llxFooter()
Footer empty.
Definition document.php:107
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_now($mode='auto')
Return date for now.
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.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.