dolibarr  19.0.0-dev
knowledgemanagementindex.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("knowledgemanagement"));
34 
35 $action = GETPOST('action', 'aZ09');
36 
37 
38 // Security check
39 // if (! $user->rights->knowledgemanagement->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("KnowledgeManagementArea"));
67 
68 print load_fiche_titre($langs->trans("KnowledgeManagementArea"), '', 'knowledgemanagement.png@knowledgemanagement');
69 
70 print '<div class="fichecenter"><div class="fichethirdleft">';
71 
72 
73 /* BEGIN MODULEBUILDER DRAFT MYOBJECT
74 // Draft MyObject
75 if (!empty($conf->knowledgemanagement->enabled) && $user->rights->knowledgemanagement->read)
76 {
77  $langs->load("orders");
78 
79  $sql = "SELECT c.rowid, c.ref, c.ref_client, c.total_ht, c.tva as total_tva, c.total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas";
80  $sql.= ", s.code_client";
81  $sql.= " FROM ".MAIN_DB_PREFIX."commande as c";
82  $sql.= ", ".MAIN_DB_PREFIX."societe as s";
83  if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
84  $sql.= " WHERE c.fk_soc = s.rowid";
85  $sql.= " AND c.fk_statut = 0";
86  $sql.= " AND c.entity IN (".getEntity('commande').")";
87  if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
88  if ($socid) $sql.= " AND c.fk_soc = ".((int) $socid);
89 
90  $resql = $db->query($sql);
91  if ($resql)
92  {
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="3">'.$langs->trans("DraftMyObjects").($num?'<span class="badge marginleftonlyshort">'.$num.'</span>':'').'</th></tr>';
99 
100  $var = true;
101  if ($num > 0)
102  {
103  $i = 0;
104  while ($i < $num)
105  {
106 
107  $obj = $db->fetch_object($resql);
108  print '<tr class="oddeven"><td class="nowrap">';
109 
110  $myobjectstatic->id=$obj->rowid;
111  $myobjectstatic->ref=$obj->ref;
112  $myobjectstatic->ref_client=$obj->ref_client;
113  $myobjectstatic->total_ht = $obj->total_ht;
114  $myobjectstatic->total_tva = $obj->total_tva;
115  $myobjectstatic->total_ttc = $obj->total_ttc;
116 
117  print $myobjectstatic->getNomUrl(1);
118  print '</td>';
119  print '<td class="nowrap">';
120  print '</td>';
121  print '<td class="right" class="nowrap">'.price($obj->total_ttc).'</td></tr>';
122  $i++;
123  $total += $obj->total_ttc;
124  }
125  if ($total>0)
126  {
127 
128  print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td colspan="2" class="right">'.price($total)."</td></tr>";
129  }
130  }
131  else
132  {
133 
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  }
140  else
141  {
142  dol_print_error($db);
143  }
144 }
145 END MODULEBUILDER DRAFT MYOBJECT */
146 
147 
148 print '</div><div class="fichetwothirdright">';
149 
150 
151 $NBMAX = (empty($conf->global->MAIN_SIZE_SHORTLIST_LIMIT) ? 25 : $conf->global->MAIN_SIZE_SHORTLIST_LIMIT);
152 $max = $NBMAX;
153 
154 /* BEGIN MODULEBUILDER LASTMODIFIED MYOBJECT
155 // Last modified myobject
156 if (!empty($conf->knowledgemanagement->enabled) && $user->rights->knowledgemanagement->read) {
157  $sql = "SELECT s.rowid, s.ref, s.label, s.date_creation, s.tms";
158  $sql.= " FROM ".MAIN_DB_PREFIX."knowledgemanagement_myobject as s";
159  //if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
160  $sql.= " WHERE s.entity IN (".getEntity($myobjectstatic->element).")";
161  //if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
162  //if ($socid) $sql.= " AND s.rowid = $socid";
163  $sql .= " ORDER BY s.tms DESC";
164  $sql .= $db->plimit($max, 0);
165 
166  $resql = $db->query($sql);
167  if ($resql) {
168  $num = $db->num_rows($resql);
169  $i = 0;
170 
171  print '<table class="noborder centpercent">';
172  print '<tr class="liste_titre">';
173  print '<th colspan="2">';
174  print $langs->trans("BoxTitleLatestModifiedMyObjects", $max);
175  print '</th>';
176  print '<th class="right">'.$langs->trans("DateModificationShort").'</th>';
177  print '</tr>';
178  if ($num) {
179  while ($i < $num) {
180  $objp = $db->fetch_object($resql);
181 
182  $myobjectstatic->id=$objp->rowid;
183  $myobjectstatic->ref=$objp->ref;
184  $myobjectstatic->label=$objp->label;
185  $myobjectstatic->status = $objp->status;
186 
187  print '<tr class="oddeven">';
188  print '<td class="nowrap">'.$myobjectstatic->getNomUrl(1).'</td>';
189  print '<td class="right nowrap">';
190  print "</td>";
191  print '<td class="right nowrap">'.dol_print_date($db->jdate($objp->tms), 'day')."</td>";
192  print '</tr>';
193  $i++;
194  }
195 
196  $db->free($resql);
197  } else {
198  print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
199  }
200  print "</table><br>";
201  }
202 }
203 */
204 
205 print '</div></div>';
206 
207 // End of page
208 llxFooter();
209 $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($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_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.