dolibarr 20.0.0
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 *
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';
29require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
30
31// Load translation files required by the page
32$langs->loadLangs(array("agenda"));
33
34$action = GETPOST('action', 'aZ09');
35
36
37// Security check
38// if (! $user->hasRight('bookcal', 'myobject', 'read')) {
39// accessforbidden();
40// }
41$socid = GETPOSTINT('socid');
42if (isset($user->socid) && $user->socid > 0) {
43 $action = '';
44 $socid = $user->socid;
45}
46
47$now = dol_now();
48$NBMAX = getDolGlobalString('MAIN_SIZE_SHORTLIST_LIMIT');
49$max = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT', 5);
50
51
52/*
53 * Actions
54 */
55
56// None
57
58
59/*
60 * View
61 */
62
63$form = new Form($db);
64$formfile = new FormFile($db);
65
66llxHeader("", $langs->trans("BookCalArea"));
67
68print load_fiche_titre($langs->trans("BookCalArea"), '', 'fa-calendar-check');
69
70print '<div class="fichecenter"><div class="fichethirdleft">';
71
72
73// BEGIN MODULEBUILDER DRAFT MYOBJECT
74// Draft MyObject
75if ($user->hasRight('bookcal', 'availabilities', 'read') && isModEnabled('bookcal')) {
76 $langs->load("orders");
77 /*$myobjectstatic = new Booking($db);
78
79 $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";
80 $sql .= " FROM ". MAIN_DB_PREFIX . 'bookcal_booking';
81
82 $resql = $db->query($sql);
83 if ($resql) {
84 $total = 0;
85 $num = $db->num_rows($resql);
86
87 print '<table class="noborder centpercent">';
88 print '<tr class="liste_titre">';
89 print '<th colspan="21">'.$langs->trans("Bookings").($num?'<span class="badge marginleftonlyshort">'.$num.'</span>':'').'</th></tr>';
90
91 $var = true;
92 print '
93 <tr>
94 <th colspan="3">id</th>
95 <th colspan="3">ref</th>
96 <th colspan="3">name</th>
97 <th colspan="3">hour</th>
98 <th colspan="3">duration</th>
99 <th colspan="3">description</th>
100 </tr>';
101 if ($num > 0) {
102 $i = 0;
103 while ($i < $num) {
104 $obj = $db->fetch_object($resql);
105 print '<tr class="oddeven">';
106
107 $myobjectstatic->id=$obj->rowid;
108 $myobjectstatic->ref=$obj->ref;
109 $myobjectstatic->firstname = $obj->firstname;
110 $myobjectstatic->lastname = $obj->lastname;
111 $myobjectstatic->start = $obj->start;
112 $myobjectstatic->duration = $obj->duration;
113 $myobjectstatic->description = $obj->description;
114
115
116 print '<td colspan="3" class="nowrap">' . $myobjectstatic->id . "</td>";
117 print '<td colspan="3" class="nowrap">' . $myobjectstatic->ref . "</td>";
118 print '<td colspan="3" class="nowrap">' . $myobjectstatic->firstname . " " . $myobjectstatic->lastname . "</td>";
119 print '<td colspan="3" class="nowrap">' . dol_print_date($myobjectstatic->start, 'dayhourtext') . "</td>";
120 print '<td colspan="3" class="nowrap">' . $myobjectstatic->duration . "</td>";
121 print '<td colspan="3" class="nowrap">' . $myobjectstatic->description . "</td>";
122 $i++;
123 }
124 } else {
125 print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("NoOrder").'</td></tr>';
126 }
127 print "</table><br>";
128
129 $db->free($resql);
130 } else {
131 dol_print_error($db);
132 }*/
133}
134//END MODULEBUILDER DRAFT MYOBJECT */
135
136
137
138print '</div><div class="fichetwothirdright">';
139
140
141/* BEGIN MODULEBUILDER LASTMODIFIED MYOBJECT
142// Last modified myobject
143if (isModEnabled('bookcal')) {
144 $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";
145 $sql .= " FROM ". MAIN_DB_PREFIX . 'bookcal_booking';
146 print "here2";
147 $resql = $db->query($sql);
148 if ($resql)
149 {
150 $num = $db->num_rows($resql);
151 $i = 0;
152
153 print '<table class="noborder centpercent">';
154 print '<tr class="liste_titre">';
155 print '<th colspan="2">';
156 print $langs->trans("BoxTitleLatestModifiedMyObjects", $max);
157 print '</th>';
158 print '<th class="right">'.$langs->trans("DateModificationShort").'</th>';
159 print '</tr>';
160 print $num;
161 if ($num)
162 {
163 while ($i < $num)
164 {
165 $objp = $db->fetch_object($resql);
166
167 $myobjectstatic->id=$objp->rowid;
168 $myobjectstatic->ref=$objp->ref;
169 $myobjectstatic->label=$objp->label;
170 $myobjectstatic->status = $objp->status;
171
172 print '<tr class="oddeven">';
173 print '<td class="nowrap">'.$myobjectstatic->getNomUrl(1).'</td>';
174 print '<td class="right nowrap">';
175 print "</td>";
176 print '<td class="right nowrap">'.dol_print_date($db->jdate($objp->tms), 'day')."</td>";
177 print '</tr>';
178 $i++;
179 }
180
181 $db->free($resql);
182 } else {
183 print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
184 }
185 print "</table><br>";
186 }
187}
188
189*/
190print '</div></div>';
191
192// End of page
193llxFooter();
194$db->close();
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 offer components to list and upload files.
Class to manage generation of HTML components Only common components must be here.
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 dolibarr global constant string value.