dolibarr  18.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
28 require '../main.inc.php';
29 require_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');
42 if (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 
65 llxHeader("", $langs->trans("BookCalArea"));
66 
67 print load_fiche_titre($langs->trans("BookCalArea"), '', 'bookcal.png@bookcal');
68 
69 print '<div class="fichecenter"><div class="fichethirdleft">';
70 
71 
72 // BEGIN MODULEBUILDER DRAFT MYOBJECT
73 // Draft MyObject
74 if ($user->hasRight('bookcal', 'availabilities', 'read') && isModEnabled('bookcal')) {
75  $langs->load("orders");
76 
77  $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";
78  $sql .= " FROM ". MAIN_DB_PREFIX . 'bookcal_booking';
79 
80  $resql = $db->query($sql);
81  if ($resql) {
82  $total = 0;
83  $num = $db->num_rows($resql);
84 
85  print '<table class="noborder centpercent">';
86  print '<tr class="liste_titre">';
87  print '<th colspan="21">'.$langs->trans("Bookings").($num?'<span class="badge marginleftonlyshort">'.$num.'</span>':'').'</th></tr>';
88 
89  $var = true;
90  print '
91  <tr>
92  <th colspan="3">id</th>
93  <th colspan="3">ref</th>
94  <th colspan="3">name</th>
95  <th colspan="3">date</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->date = $obj->start;
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">' . $myobjectstatic->start . "</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 
138 print '</div><div class="fichetwothirdright">';
139 
140 
141 $NBMAX = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
142 $max = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
143 
144 /* BEGIN MODULEBUILDER LASTMODIFIED MYOBJECT
145 // Last modified myobject
146 if (isModEnabled('bookcal')) {
147  $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";
148  $sql .= " FROM ". MAIN_DB_PREFIX . 'bookcal_booking';
149  print "here2";
150  $resql = $db->query($sql);
151  if ($resql)
152  {
153  $num = $db->num_rows($resql);
154  $i = 0;
155 
156  print '<table class="noborder centpercent">';
157  print '<tr class="liste_titre">';
158  print '<th colspan="2">';
159  print $langs->trans("BoxTitleLatestModifiedMyObjects", $max);
160  print '</th>';
161  print '<th class="right">'.$langs->trans("DateModificationShort").'</th>';
162  print '</tr>';
163  print $num;
164  if ($num)
165  {
166  while ($i < $num)
167  {
168  $objp = $db->fetch_object($resql);
169 
170  $myobjectstatic->id=$objp->rowid;
171  $myobjectstatic->ref=$objp->ref;
172  $myobjectstatic->label=$objp->label;
173  $myobjectstatic->status = $objp->status;
174 
175  print '<tr class="oddeven">';
176  print '<td class="nowrap">'.$myobjectstatic->getNomUrl(1).'</td>';
177  print '<td class="right nowrap">';
178  print "</td>";
179  print '<td class="right nowrap">'.dol_print_date($db->jdate($objp->tms), 'day')."</td>";
180  print '</tr>';
181  $i++;
182  }
183 
184  $db->free($resql);
185  } else {
186  print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
187  }
188  print "</table><br>";
189  }
190 }
191 
192 */
193 print '</div></div>';
194 
195 // End of page
196 llxFooter();
197 $db->close();
llxFooter
llxFooter()
Empty footer.
Definition: wrapper.php:70
load_fiche_titre
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
Definition: functions.lib.php:5477
GETPOST
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Definition: functions.lib.php:609
dol_print_error
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
Definition: functions.lib.php:5107
$form
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
llxHeader
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:56
FormFile
Class to offer components to list and upload files.
Definition: html.formfile.class.php:36
$sql
if(isModEnabled('facture') && $user->hasRight('facture', 'lire')) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') && $user->hasRight('don', 'lire')) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $sql
Social contributions to pay.
Definition: index.php:746
isModEnabled
isModEnabled($module)
Is Dolibarr module enabled.
Definition: functions.lib.php:207
Form
Class to manage generation of HTML components Only common components must be here.
Definition: html.form.class.php:53
dol_now
dol_now($mode='auto')
Return date for now.
Definition: functions.lib.php:3056