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