dolibarr  x.y.z
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 
30 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
31 
32 // Load translation files required by the page
33 $langs->loadLangs(array("bookcal@bookcal"));
34 
35 $action = GETPOST('action', 'aZ09');
36 
37 
38 // Security check
39 // if (! $user->rights->bookcal->myobject->read) {
40 // accessforbidden();
41 // }
42 $socid = GETPOST('socid', 'int');
43 if (isset($user->socid) && $user->socid > 0) {
44  $action = '';
45  $socid = $user->socid;
46 }
47 
48 $max = 5;
49 $now = dol_now();
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 
66 llxHeader("", $langs->trans("BookCalArea"));
67 
68 print load_fiche_titre($langs->trans("BookCalArea"), '', 'bookcal.png@bookcal');
69 
70 print '<div class="fichecenter"><div class="fichethirdleft">';
71 
72 
73 // BEGIN MODULEBUILDER DRAFT MYOBJECT
74 // Draft MyObject
75 if ($user->rights->bookcal->availabilities->read && !empty($conf->bookcal->enabled)) {
76  $langs->load("orders");
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">date</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->date = $obj->start;
110  $myobjectstatic->firstname = $obj->firstname;
111  $myobjectstatic->lastname = $obj->lastname;
112  $myobjectstatic->start = $obj->start;
113  $myobjectstatic->duration = $obj->duration;
114  $myobjectstatic->description = $obj->description;
115 
116 
117  print '<td colspan="3" class="nowrap">' . $myobjectstatic->id . "</td>";
118  print '<td colspan="3" class="nowrap">' . $myobjectstatic->ref . "</td>";
119  print '<td colspan="3" class="nowrap">' . $myobjectstatic->firstname . " " . $myobjectstatic->lastname . "</td>";
120  print '<td colspan="3" class="nowrap">' . $myobjectstatic->start . "</td>";
121  print '<td colspan="3" class="nowrap">' . $myobjectstatic->duration . "</td>";
122  print '<td colspan="3" class="nowrap">' . $myobjectstatic->description . "</td>";
123  $i++;
124  }
125  } else {
126  print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("NoOrder").'</td></tr>';
127  }
128  print "</table><br>";
129 
130  $db->free($resql);
131  } else {
132  dol_print_error($db);
133  }
134 }
135 //END MODULEBUILDER DRAFT MYOBJECT */
136 
137 
138 
139 print '</div><div class="fichetwothirdright">';
140 
141 
142 $NBMAX = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
143 $max = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
144 
145 /* BEGIN MODULEBUILDER LASTMODIFIED MYOBJECT
146 // Last modified myobject
147 if (! empty($conf->bookcal->enabled))
148 {
149  $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";
150  $sql .= " FROM ". MAIN_DB_PREFIX . 'bookcal_booking';
151  print "here2";
152  $resql = $db->query($sql);
153  if ($resql)
154  {
155  $num = $db->num_rows($resql);
156  $i = 0;
157 
158  print '<table class="noborder centpercent">';
159  print '<tr class="liste_titre">';
160  print '<th colspan="2">';
161  print $langs->trans("BoxTitleLatestModifiedMyObjects", $max);
162  print '</th>';
163  print '<th class="right">'.$langs->trans("DateModificationShort").'</th>';
164  print '</tr>';
165  print $num;
166  if ($num)
167  {
168  while ($i < $num)
169  {
170  $objp = $db->fetch_object($resql);
171 
172  $myobjectstatic->id=$objp->rowid;
173  $myobjectstatic->ref=$objp->ref;
174  $myobjectstatic->label=$objp->label;
175  $myobjectstatic->status = $objp->status;
176 
177  print '<tr class="oddeven">';
178  print '<td class="nowrap">'.$myobjectstatic->getNomUrl(1).'</td>';
179  print '<td class="right nowrap">';
180  print "</td>";
181  print '<td class="right nowrap">'.dol_print_date($db->jdate($objp->tms), 'day')."</td>";
182  print '</tr>';
183  $i++;
184  }
185 
186  $db->free($resql);
187  } else {
188  print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
189  }
190  print "</table><br>";
191  }
192 }
193 
194 */
195 print '</div></div>';
196 
197 // End of page
198 llxFooter();
199 $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:56
llxFooter()
Empty footer.
Definition: wrapper.php:70
Class to offer components to list and upload files.
Class to manage generation of HTML components Only common components must be here.
if(isModEnabled('facture') &&!empty($user->rights->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') &&!empty($user->rights->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)) $resql
Social contributions to pay.
Definition: index.php:745
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_now($mode='auto')
Return date for now.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.