59 public $hidden =
false;
146 $sql =
"SELECT b.rowid as id, b.box_id, b.position, b.box_order, b.fk_user";
147 $sql .=
" FROM ".MAIN_DB_PREFIX.
"boxes as b";
148 $sql .=
" WHERE b.entity = ".$conf->entity;
149 $sql .=
" AND b.rowid = ".((int) $rowid);
150 dol_syslog(get_class($this).
"::fetch rowid=".$rowid);
155 $obj = $this->
db->fetch_object(
$resql);
158 $this->
id = $obj->id;
159 $this->
rowid = $obj->id;
160 $this->box_id = $obj->box_id;
161 $this->position = $obj->position;
162 $this->box_order = $obj->box_order;
163 $this->fk_user = $obj->fk_user;
181 public function showBox($head = null, $contents = null, $nooutput = 0)
183 global $langs, $user, $conf;
185 if (!empty($this->hidden))
return '\n<!-- Box ".get_class($this)." hidden -->\n';
187 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
192 $cachedir = DOL_DATA_ROOT.
'/boxes/temp';
193 $fileid = get_class($this).
'id-'.$this->box_id.
'-e'.$conf->entity.
'-u'.$user->id.
'-s'.$user->socid.
'.cache';
194 $filename =
'/box-'.$fileid;
203 if (isset($contents[0])) $nbcol = count($contents[0]);
204 $nblines = count($contents);
206 $out .=
"\n<!-- Box ".get_class($this).
" start -->\n";
208 $out .=
'<div class="box boxdraggable" id="boxto_'.$this->box_id.
'">'.
"\n";
210 if (!empty($head[
'text']) || !empty($head[
'sublink']) || !empty($head[
'subpicto']) || $nblines)
212 $out .=
'<table summary="boxtable'.$this->box_id.
'" width="100%" class="noborder boxtable">'.
"\n";
216 if (!empty($head[
'text']) || !empty($head[
'sublink']) || !empty($head[
'subpicto']))
218 $out .=
'<tr class="liste_titre box_titre">';
220 if ($nbcol > 0) { $out .=
' colspan="'.$nbcol.
'"'; }
222 if (!empty($conf->use_javascript_ajax))
225 $out .=
'<div class="tdoverflowmax250 maxwidth150onsmartphone float">';
227 if (!empty($head[
'text']))
229 $s =
dol_trunc($head[
'text'], isset($head[
'limit']) ? $head[
'limit'] : $MAXLENGTHBOX);
232 if (!empty($conf->use_javascript_ajax))
238 if (!empty($conf->use_javascript_ajax))
241 if (!empty($head[
'sublink'])) $sublink .=
'<a href="'.$head[
'sublink'].
'"'.(empty($head[
'target']) ?
'' :
' target="'.$head[
'target'].
'"').
'>';
242 if (!empty($head[
'subpicto'])) $sublink .=
img_picto($head[
'subtext'], $head[
'subpicto'],
'class="opacitymedium marginleftonly '.(empty($head[
'subclass']) ?
'' : $head[
'subclass']).
'" id="idsubimg'.$this->boxcode.
'"');
243 if (!empty($head[
'sublink'])) $sublink .=
'</a>';
246 $out .=
'<div class="nocellnopadd boxclose floatright nowraponall">';
249 $out .=
img_picto($langs->trans(
"MoveBox", $this->box_id),
'grip_title',
'class="opacitymedium boxhandle hideonsmartphone cursormove marginleftonly"');
250 $out .=
img_picto($langs->trans(
"CloseBox", $this->box_id),
'close_title',
'class="opacitymedium boxclose cursorpointer marginleftonly" rel="x:y" id="imgclose'.$this->box_id.
'"');
251 $label = $head[
'text'];
253 if (!empty($head[
'graph'])) $label .=
' <span class="opacitymedium fa fa-bar-chart"></span>';
254 $out .=
'<input type="hidden" id="boxlabelentry'.$this->box_id.
'" value="'.
dol_escape_htmltag($label).
'">';
267 for ($i = 0, $n = $nblines; $i < $n; $i++)
269 if (isset($contents[$i]))
272 if (isset($contents[$i][0][
'tr'])) $out .=
'<tr '.$contents[$i][0][
'tr'].
'>';
273 else $out .=
'<tr class="oddeven">';
276 $nbcolthisline = count($contents[$i]);
277 for ($j = 0; $j < $nbcolthisline; $j++) {
280 if (!empty($contents[$i][$j][
'td'])) $tdparam .=
' '.$contents[$i][$j][
'td'];
282 $text = isset($contents[$i][$j][
'text']) ? $contents[$i][$j][
'text'] :
'';
283 $textwithnotags = preg_replace(
'/<([^>]+)>/i',
'', $text);
284 $text2 = isset($contents[$i][$j][
'text2']) ? $contents[$i][$j][
'text2'] :
'';
285 $text2withnotags = preg_replace(
'/<([^>]+)>/i',
'', $text2);
287 $textnoformat = isset($contents[$i][$j][
'textnoformat']) ? $contents[$i][$j][
'textnoformat'] :
'';
289 if (empty($contents[$i][$j][
'tooltip'])) $contents[$i][$j][
'tooltip'] =
"";
290 $tooltip = isset($contents[$i][$j][
'tooltip']) ? $contents[$i][$j][
'tooltip'] :
'';
292 $out .=
'<td'.$tdparam.
'>'.
"\n";
295 if (!empty($contents[$i][$j][
'url']) && empty($contents[$i][$j][
'logo']))
297 $out .=
'<a href="'.$contents[$i][$j][
'url'].
'"';
298 if (!empty($tooltip)) {
299 $out .=
' title="'.dol_escape_htmltag($langs->trans(
"Show").
' '.$tooltip, 1).
'" class="classfortooltip"';
302 $out .= isset($contents[$i][$j][
'target']) ?
' target="'.$contents[$i][$j][
'target'].
'"' :
'';
307 if (!empty($contents[$i][$j][
'logo']))
309 $logo = preg_replace(
"/^object_/i",
"", $contents[$i][$j][
'logo']);
310 $out .=
'<a href="'.$contents[$i][$j][
'url'].
'">';
311 $out .=
img_object($langs->trans(
"Show").
' '.$tooltip, $logo,
'class="classfortooltip"');
314 $maxlength = $MAXLENGTHBOX;
315 if (!empty($contents[$i][$j][
'maxlength'])) $maxlength = $contents[$i][$j][
'maxlength'];
317 if ($maxlength) $textwithnotags =
dol_trunc($textwithnotags, $maxlength);
318 if (preg_match(
'/^<(img|div|span)/i', $text) || !empty($contents[$i][$j][
'asis'])) $out .= $text;
319 else $out .= $textwithnotags;
322 if (!empty($contents[$i][$j][
'url'])) $out .=
'</a>';
324 if (preg_match(
'/^<(img|div|span)/i', $text2) || !empty($contents[$i][$j][
'asis2'])) $out .= $text2;
325 else $out .= $text2withnotags;
327 if (!empty($textnoformat)) $out .=
"\n".$textnoformat.
"\n";
337 if (!empty($head[
'text']) || !empty($head[
'sublink']) || !empty($head[
'subpicto']) || $nblines)
339 $out .=
"</table>\n";
343 if (empty($head[
'text']) && empty($head[
'sublink']) && empty($head[
'subpicto']) && !$nblines) $out .=
"<br>\n";
347 $out .=
"<!-- Box ".get_class($this).
" end -->\n\n";
348 if (!empty($conf->global->MAIN_ACTIVATE_FILECACHE)) {
352 dol_syslog(get_class($this).
'::showBoxCached');
353 $out =
"<!-- Box ".get_class($this).
" from cache -->";
357 if ($nooutput)
return $out;
373 global $conf, $langs, $db;
378 $iscoreorexternal = array();
384 $dirwidget = array(
'/core/boxes/');
385 if (is_array($forcedirwidget))
387 $dirwidget = $forcedirwidget;
390 foreach ($dirwidget as $reldir)
396 if (!is_dir($newdir))
continue;
398 $handle = opendir($newdir);
399 if (is_resource($handle))
401 while (($file = readdir($handle)) !==
false)
404 if (is_readable($newdir.
'/'.$file) && preg_match(
'/^(.+)\.php/', $file, $reg))
406 if (preg_match(
'/\.back$/', $file))
continue;
410 $modName = ucfirst($reg[1]);
412 if (in_array($modName, $modules))
414 $langs->load(
"errors");
415 print '<div class="error">'.$langs->trans(
"Error").
' : '.$langs->trans(
"ErrorDuplicateWidget", $modName,
"").
'</div>';
418 include_once $newdir.
'/'.$file;
421 print $e->getMessage();
426 $fullpath[$i] = $dir.
'/'.$file;
427 $relpath[$i] = preg_replace(
'/^\//',
'', $reldir).
'/'.$file;
428 $iscoreorexternal[$i] = ($reldir ==
'/core/boxes/' ?
'internal' :
'external');
429 $modules[$i] = $modName;
430 $orders[$i] = $part1;
445 foreach ($orders as $key => $value)
447 $modName = $modules[$key];
448 if (empty($modName))
continue;
450 if (!class_exists($modName))
452 print 'Error: A widget file was found but its class "'.$modName.
'" was not found.'.
"<br>\n";
456 $objMod =
new $modName($db);
457 if (is_object($objMod))
461 $disabledbymodule = 0;
465 if (preg_match(
'/NORUN$/i', $files[$key])) $disabledbyname = 1;
468 $widget[$j][
'picto'] = $objMod->picto ?
img_object(
'', $objMod->picto) :
img_object(
'',
'generic');
469 $widget[$j][
'file'] = $files[$key];
470 $widget[$j][
'fullpath'] = $fullpath[$key];
471 $widget[$j][
'relpath'] = $relpath[$key];
472 $widget[$j][
'iscoreorexternal'] = $iscoreorexternal[$key];
474 $widget[$j][
'status'] =
img_picto($langs->trans(
"Active"),
'tick');
475 if ($disabledbyname > 0 || $disabledbymodule > 1) $widget[$j][
'status'] =
'';
477 $text =
'<b>'.$langs->trans(
"Description").
':</b><br>';
478 $text .= $objMod->boxlabel.
'<br>';
479 $text .=
'<br><b>'.$langs->trans(
"Status").
':</b><br>';
480 if ($disabledbymodule == 2) $text .= $langs->trans(
"WidgetDisabledAsModuleDisabled", $module).
'<br>';
482 $widget[$j][
'info'] = $text;
dol_osencode($str)
Return a string encoded into OS filesystem encoding.
dol_cache_refresh($directory, $filename, $cachetime)
Test if Refresh needed.
</td >< tdcolspan="3">< spanclass="opacitymedium"></span ></td ></tr >< trclass="liste_total"> CREANCES DETTES< tdcolspan="3"class="right"></td >< tdcolspan="3"class="right"></td ></tr > CREANCES DETTES RECETTES DEPENSES trips CREANCES DETTES Y m expensereport p date_valid Y m expensereport pe datep $db idate($date_start)."' AND $column < p rowid
fetch($rowid)
Load a box line from its rowid.
static getWidgetsList($forcedirwidget=null)
Return list of widget.
__construct($db, $param= '')
Constructor.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
$conf db
API class for accounts.
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
img_object($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
error()
Return last error message.
print
Draft customers invoices.
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
dol_readcachefile($directory, $filename)
Read object from cachefile.
dol_trunc($string, $size=40, $trunc= 'right', $stringencoding= 'UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '...' if string larger than length.
showBox($head=null, $contents=null, $nooutput=0)
Standard method to show a box (usage by boxes not mandatory, a box can still use its own showBox func...
dol_filecache($directory, $filename, $object)
Store object in file.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $keepmoretags= '', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields...