Qual: Simplify code of boxes

Qual: Reduce memory usage
This commit is contained in:
Laurent Destailleur 2008-12-07 15:55:40 +00:00
parent e6ff4ff887
commit a9efc85520
21 changed files with 664 additions and 783 deletions

View File

@ -64,7 +64,7 @@ class InfoBox
$confuserzone='MAIN_BOXES_'.$zone;
if ($user->id && $user->conf->$confuserzone)
{
// Recupere liste des boites d'un user si ce dernier a sa propre liste
// Get list of boxes of a particular user (if this one has its own list)
$sql = "SELECT b.rowid, b.box_id, b.position, b.box_order, b.fk_user,";
$sql.= " d.file, d.note";
$sql.= " FROM ".MAIN_DB_PREFIX."boxes as b, ".MAIN_DB_PREFIX."boxes_def as d";
@ -73,7 +73,7 @@ class InfoBox
$sql.= " AND b.fk_user = ".$user->id;
$sql.= " ORDER BY b.box_order";
dolibarr_syslog("InfoBox::listBoxes get user box list sql=$sql");
dolibarr_syslog("InfoBox::listBoxes get user box list sql=".$sql, LOG_DEBUG);
$result = $this->db->query($sql);
if ($result)
{
@ -120,7 +120,7 @@ class InfoBox
$sql.= " AND b.fk_user = 0";
$sql.= " ORDER BY b.box_order";
dolibarr_syslog("InfoBox::listBoxes get default box list sql=$sql");
dolibarr_syslog("InfoBox::listBoxes get default box list sql=".$sql, LOG_DEBUG);
$result = $this->db->query($sql);
if ($result)
{

View File

@ -62,6 +62,8 @@ class box_actions extends ModeleBoxes {
{
global $user, $langs, $db, $conf;
$this->max=$max;
include_once(DOL_DOCUMENT_ROOT."/actioncomm.class.php");
$actionstatic=new ActionComm($db);
@ -102,52 +104,32 @@ class box_actions extends ModeleBoxes {
$label=($langs->transnoentities("Action".$objp->code)!=("Action".$objp->code) ? $langs->transnoentities("Action".$objp->code) : $objp->label);
$this->info_box_contents[$i][0] = array('align' => 'left',
'nowrap' => 1,
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'logo' => ("task"),
'url' => DOL_URL_ROOT."/comm/action/fiche.php?id=".$objp->id);
$this->info_box_contents[$i][1] = array('td' => 'align="left" nowrap="1"',
'text' => dolibarr_trunc($label,12),
'text2'=> $late,
'url' => DOL_URL_ROOT."/comm/action/fiche.php?id=".$objp->id);
$this->info_box_contents[$i][1] = array('align' => 'left',
$this->info_box_contents[$i][2] = array('td' => 'align="left"',
'text' => dolibarr_trunc($objp->nom,20),
'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid);
$this->info_box_contents[$i][2] = array('align' => 'right',
$this->info_box_contents[$i][3] = array('td' => 'align="left"',
'text' => dolibarr_print_date($objp->dp, "dayhour"));
$this->info_box_contents[$i][3] = array('align' => 'right',
$this->info_box_contents[$i][4] = array('td' => 'align="right"',
'text' => $objp->percentage. "%");
$this->info_box_contents[$i][4] = array(
'align' => 'right',
$this->info_box_contents[$i][5] = array('td' => 'align="right" width="18"',
'text' => $actionstatic->LibStatut($objp->percentage,3));
$i++;
}
$i=$num;
while ($i < $max)
{
if ($num==0 && $i==$num)
{
$this->info_box_contents[$i][0] = array('align' => 'center','text'=>$langs->trans("NoActionsToDo"));
$this->info_box_contents[$i][1] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][2] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][3] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][4] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][5] = array('text'=>'&nbsp;');
} else {
//$this->info_box_contents[$i][0] = array('text'=>'&nbsp;');
//$this->info_box_contents[$i][1] = array('text'=>'&nbsp;');
//$this->info_box_contents[$i][2] = array('text'=>'&nbsp;');
//$this->info_box_contents[$i][3] = array('text'=>'&nbsp;');
//$this->info_box_contents[$i][4] = array('text'=>'&nbsp;');
//$this->info_box_contents[$i][5] = array('text'=>'&nbsp;');
}
$i++;
}
if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoActionsToDo"));
}
else {
dolibarr_print_error($db);

View File

@ -60,6 +60,8 @@ class box_bookmarks extends ModeleBoxes {
global $user, $langs, $db;
$langs->load("boxes");
$this->max=$max;
$this->info_box_head = array('text' => $langs->trans("BoxMyLastBookmarks",$max),
'sublink' => DOL_URL_ROOT.'/bookmarks/liste.php');
if ($user->rights->bookmark->creer)
@ -93,29 +95,19 @@ class box_bookmarks extends ModeleBoxes {
{
$objp = $db->fetch_object($result);
$this->info_box_contents[$i][0] = array('align' => 'left',
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'logo' => $this->boximg,
'text' => stripslashes($objp->title),
'url' => $objp->url,
'target' => $objp->target?'newtab':'');
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
'text' => $objp->title,
'url' => $objp->url,
'target' => $objp->target?'newtab':'');
$i++;
}
$i=$num;
while ($i < $max)
{
if ($num==0 && $i==$num)
{
$this->info_box_contents[$i][0] = array('align' => 'center', 'url'=> DOL_URL_ROOT.'/bookmarks/liste.php', 'text'=>$langs->trans("NoRecordedBookmarks"));
$this->info_box_contents[$i][1] = array('text'=>'&nbsp;');
} else {
$this->info_box_contents[$i][0] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][1] = array('text'=>'&nbsp;');
}
$i++;
}
if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center" colspan="2"', 'url'=> DOL_URL_ROOT.'/bookmarks/liste.php', 'text'=>$langs->trans("NoRecordedBookmarks"));
}
else
{

View File

@ -61,6 +61,8 @@ class box_clients extends ModeleBoxes {
global $user, $langs, $db;
$langs->load("boxes");
$this->max=$max;
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastCustomers",$max));
if ($user->rights->societe->lire)
@ -90,33 +92,21 @@ class box_clients extends ModeleBoxes {
{
$objp = $db->fetch_object($result);
$this->info_box_contents[$i][0] = array('align' => 'left',
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'logo' => $this->boximg,
'text' => stripslashes($objp->nom),
'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid);
$this->info_box_contents[$i][1] = array('align' => 'right',
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
'text' => $objp->nom,
'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid);
$this->info_box_contents[$i][2] = array('td' => 'align="right"',
'text' => dolibarr_print_date($objp->dc, "day"));
$i++;
}
$i=$num;
while ($i < $max)
{
if ($num==0 && $i==$num)
{
$this->info_box_contents[$i][0] = array('align' => 'center','text'=>$langs->trans("NoRecordedCustomers"));
$this->info_box_contents[$i][1] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][2] = array('text'=>'&nbsp;');
} else {
$this->info_box_contents[$i][0] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][1] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][2] = array('text'=>'&nbsp;');
}
$i++;
}
if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedCustomers"));
}
else {
dolibarr_print_error($db);

View File

@ -60,6 +60,8 @@ class box_commandes extends ModeleBoxes {
{
global $user, $langs, $db;
$this->max=$max;
include_once(DOL_DOCUMENT_ROOT."/commande/commande.class.php");
$commandestatic=new Commande($db);
@ -95,46 +97,29 @@ class box_commandes extends ModeleBoxes {
{
$objp = $db->fetch_object($result);
$this->info_box_contents[$i][0] = array('align' => 'left',
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'logo' => $this->boximg,
'url' => DOL_URL_ROOT."/commande/fiche.php?id=".$objp->rowid);
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
'text' => $objp->ref,
'url' => DOL_URL_ROOT."/commande/fiche.php?id=".$objp->rowid);
$this->info_box_contents[$i][1] = array('align' => 'left',
$this->info_box_contents[$i][2] = array('td' => 'align="left"',
'text' => $objp->nom,
'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid);
$this->info_box_contents[$i][2] = array('align' => 'right',
$this->info_box_contents[$i][3] = array('td' => 'align="right"',
'text' => dolibarr_print_date($objp->tms,'day'),
);
$this->info_box_contents[$i][3] = array(
'align' => 'right',
'width' => 18,
$this->info_box_contents[$i][4] = array('td' => 'align="right" width="18"',
'text' => $commandestatic->LibStatut($objp->fk_statut,$objp->facturee,3));
$i++;
}
$i=$num;
while ($i < $max)
{
if ($num==0 && $i==$num)
{
$this->info_box_contents[$i][0] = array('align' => 'center','text'=>$langs->trans("NoRecordedOrders"));
$this->info_box_contents[$i][1] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][2] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][3] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][4] = array('text'=>'&nbsp;');
} else {
$this->info_box_contents[$i][0] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][1] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][2] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][3] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][4] = array('text'=>'&nbsp;');
}
$i++;
}
if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedOrders"));
}
else {
dolibarr_print_error($db);

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2005 Christophe
* Copyright (C) 2005-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -61,6 +61,8 @@ class box_comptes extends ModeleBoxes {
{
global $user, $langs, $db, $conf;
$this->max=$max;
$this->info_box_head = array('text' => $langs->trans("BoxTitleCurrentAccounts"));
if ($user->rights->banque->lire)
@ -94,22 +96,19 @@ class box_comptes extends ModeleBoxes {
$solde_total += $solde;
$this->info_box_contents[$i][0] = array('align' => 'left',
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'logo' => $this->boximg,
'url' => DOL_URL_ROOT."/compta/bank/account.php?account=".$objp->rowid);
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
'text' => $objp->label,
'url' => DOL_URL_ROOT."/compta/bank/account.php?account=".$objp->rowid);
/*
$this->info_box_contents[$i][1] = array('align' => 'left',
'text' => $objp->bank
);
*/
$this->info_box_contents[$i][1] = array('align' => 'left',
$this->info_box_contents[$i][2] = array('td' => 'align="left"',
'text' => $objp->number
);
$this->info_box_contents[$i][2] = array('align' => 'right',
$this->info_box_contents[$i][3] = array('td' => 'align="right"',
'text' => price($solde).' '.$langs->trans("Currency".$objp->currency_code)
);
@ -117,17 +116,10 @@ class box_comptes extends ModeleBoxes {
}
// Total
$this->info_box_contents[$i][-1] = array('class' => 'liste_total');
$this->info_box_contents[$i][0] = array('align' => 'right',
//'width' => '75%',
'colspan' => '3',
'class' => 'liste_total',
$this->info_box_contents[$i][0] = array('tr' => 'class="liste_total"', 'td' => 'align="right" colspan="3" class="liste_total"',
'text' => $langs->trans('Total')
);
$this->info_box_contents[$i][1] = array('align' => 'right',
'class' => 'liste_total',
$this->info_box_contents[$i][1] = array('td' => 'align="right" class="liste_total"',
'text' => price($solde_total).' '.$langs->trans("Currency".$conf->monnaie)
);
@ -137,7 +129,7 @@ class box_comptes extends ModeleBoxes {
}
}
else {
$this->info_box_contents[0][0] = array('align' => 'left',
$this->info_box_contents[0][0] = array('td' => 'align="left"',
'text' => $langs->trans("ReadPermissionNotAllowed"));
}

View File

@ -56,6 +56,8 @@ class box_energie_graph extends ModeleBoxes {
global $user, $langs, $db;
$langs->load("boxes");
$this->max=$max;
$text = '<a href="energie/">'.$langs->trans("Energie").'</a>';
$this->info_box_head = array('text' => $text,$max);
@ -65,8 +67,10 @@ class box_energie_graph extends ModeleBoxes {
$libelle = '<img border="0" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=energie&file='.$file.'" alt="" title="">';
$this->info_box_contents[0][0] = array('align' => 'left',
$this->info_box_contents[0][0] = array('td' => 'align="left" width="16"',
'logo' => $this->boximg,
'url' => DOL_URL_ROOT."/energie/compteur.php?id=".$objp->rowid);
$this->info_box_contents[0][1] = array('td' => 'align="left"',
'text' => $libelle,
'url' => DOL_URL_ROOT."/energie/compteur.php?id=".$objp->rowid);

View File

@ -55,6 +55,8 @@ class box_energie_releve extends ModeleBoxes {
global $user, $langs, $db;
$langs->load("boxes");
$this->max=$max;
$text = '<a href="energie/">'.$langs->trans("Energie").'</a>';
$this->info_box_head = array('text' => $text,$max);
@ -75,12 +77,15 @@ class box_energie_releve extends ModeleBoxes {
{
$objp = $db->fetch_object($resql);
$this->info_box_contents[$i][0] = array('align' => 'left',
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'logo' => $this->boximg,
'url' => DOL_URL_ROOT."/energie/compteur.php?id=".$objp->rowid);
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
'text' => $objp->libelle,
'url' => DOL_URL_ROOT."/energie/compteur.php?id=".$objp->rowid);
$this->info_box_contents[$i][1] = array('align' => 'left',
$this->info_box_contents[$i][2] = array('td' => 'align="right"',
'text' => $objp->valeur);

View File

@ -66,6 +66,8 @@ class box_external_rss extends ModeleBoxes {
global $user, $langs, $conf;
$langs->load("boxes");
$this->max=$max;
// On recupere numero de param de la boite
ereg('^([0-9]+) ',$this->param,$reg);
$site=$reg[1];
@ -136,15 +138,20 @@ class box_external_rss extends ModeleBoxes {
$title=ereg_replace("([[:alnum:]])\?([[:alnum:]])","\\1'\\2",$title); // Gère problème des apostrophes mal codée/décodée par utf8
$title=ereg_replace("^\s+","",$title); // Supprime espaces de début
$this->info_box_contents["$href"]="$title";
$this->info_box_contents[$i][0] = array('align' => 'left',
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'logo' => $this->boximg,
'url' => $href,
'target' => 'newrss');
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
'text' => $title,
'url' => $href,
'maxlength' => 64,
'target' => 'newrss');
$this->info_box_contents[$i][1] = array('align' => 'right',
'text' => $date,
'td' => 'nowrap="1"');
$this->info_box_contents[$i][2] = array('td' => 'align="right" nowrap="1"',
'text' => $date);
}
}

View File

@ -62,6 +62,8 @@ class box_factures extends ModeleBoxes {
{
global $user, $langs, $db;
$this->max=$max;
include_once(DOL_DOCUMENT_ROOT."/facture.class.php");
$facturestatic=new Facture($db);
@ -108,59 +110,42 @@ class box_factures extends ModeleBoxes {
$late = '';
if($objp->paye == 0 && $objp->datelimite < (time() - $conf->facture->warning_delay)) { $late = img_warning(sprintf($l_due_date,dolibarr_print_date($objp->datelimite,'day')));}
$this->info_box_contents[$i][0] = array('align' => 'left',
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'logo' => $picto,
'url' => DOL_URL_ROOT."/compta/facture.php?facid=".$objp->facid);
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
'text' => $objp->facnumber,
'text2'=> $late,
'url' => DOL_URL_ROOT."/compta/facture.php?facid=".$objp->facid);
$this->info_box_contents[$i][1] = array('align' => 'left',
$this->info_box_contents[$i][2] = array('td' => 'align="left"',
'text' => $objp->nom,
'maxlength'=>40,
'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid);
$this->info_box_contents[$i][2] = array('align' => 'right',
$this->info_box_contents[$i][3] = array('td' => 'align="right"',
'text' => dolibarr_print_date($objp->datec,'day'),
);
$this->info_box_contents[$i][3] = array(
'align' => 'right',
'width' => 18,
$this->info_box_contents[$i][4] = array('td' => 'align="right" width="18"',
'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3));
$i++;
}
$i=$num;
while ($i < $max)
{
if ($num==0 && $i==$num)
{
$this->info_box_contents[$i][0] = array('align' => 'center','text'=>$langs->trans("NoRecordedInvoices"));
$this->info_box_contents[$i][1] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][2] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][3] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][4] = array('text'=>'&nbsp;');
} else {
$this->info_box_contents[$i][0] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][1] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][2] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][3] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][4] = array('text'=>'&nbsp;');
}
$i++;
}
if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedInvoices"));
}
else
{
$this->info_box_contents[0][0] = array( 'align' => 'left',
$this->info_box_contents[0][0] = array( 'td' => 'align="left"',
'maxlength'=>500,
'text' => ($db->error().' sql='.$sql));
}
}
else {
$this->info_box_contents[0][0] = array('align' => 'left',
$this->info_box_contents[0][0] = array('td' => 'align="left"',
'text' => $langs->trans("ReadPermissionNotAllowed"));
}
}

View File

@ -59,6 +59,8 @@ class box_factures_fourn extends ModeleBoxes {
{
global $user, $langs, $db;
$this->max=$max;
include_once(DOL_DOCUMENT_ROOT."/fourn/fournisseur.facture.class.php");
$facturestatic=new FactureFournisseur($db);
@ -99,54 +101,36 @@ class box_factures_fourn extends ModeleBoxes {
$late = '';
if ($objp->paye == 0 && $objp->datelimite < (time() - $conf->facture->fournisseur->warning_delay)) $late=img_warning(sprintf($l_due_date, dolibarr_print_date($objp->datelimite,'day')));
$this->info_box_contents[$i][0] = array('align' => 'left',
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'logo' => $this->boximg,
'url' => DOL_URL_ROOT."/fourn/facture/fiche.php?facid=".$objp->facid);
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
'text' => $objp->facnumber,
'text2'=> $late,
'url' => DOL_URL_ROOT."/fourn/facture/fiche.php?facid=".$objp->facid);
$this->info_box_contents[$i][1] = array('align' => 'left',
$this->info_box_contents[$i][2] = array('td' => 'align="left"',
'text' => $objp->nom,
'url' => DOL_URL_ROOT."/fourn/fiche.php?socid=".$objp->socid);
$this->info_box_contents[$i][2] = array(
'align' => 'right',
$this->info_box_contents[$i][3] = array('td' => 'align="right"',
'text' => dolibarr_print_date($objp->datec,'day'));
$this->info_box_contents[$i][3] = array(
'align' => 'right',
'width' => 18,
$this->info_box_contents[$i][4] = array('td' => 'align="right" width="18"',
'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3));
$i++;
}
$i=$num;
while ($i < $max)
{
if ($num==0 && $i==$num)
{
$this->info_box_contents[$i][0] = array('align' => 'center','text'=>$langs->trans("NoUnpayedCustomerBills"));
$this->info_box_contents[$i][1] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][2] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][3] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][4] = array('text'=>'&nbsp;');
} else {
$this->info_box_contents[$i][0] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][1] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][2] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][3] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][4] = array('text'=>'&nbsp;');
}
$i++;
}
if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoUnpayedCustomerBills"));
}
else {
dolibarr_print_error($db);
}
}
else {
$this->info_box_contents[0][0] = array('align' => 'left',
$this->info_box_contents[0][0] = array('td' => 'align="left"',
'text' => $langs->transnoentities("ReadPermissionNotAllowed"));
}
}

View File

@ -59,6 +59,8 @@ class box_factures_fourn_imp extends ModeleBoxes {
{
global $conf, $user, $langs, $db;
$this->max=$max;
include_once(DOL_DOCUMENT_ROOT."/fourn/fournisseur.facture.class.php");
$facturestatic=new FactureFournisseur($db);
@ -98,49 +100,36 @@ class box_factures_fourn_imp extends ModeleBoxes {
$late='';
if ($objp->datelimite < (time() - $conf->facture->fournisseur->warning_delay)) $late=img_warning(sprintf($l_due_date,dolibarr_print_date($objp->datelimite,'day')));
$this->info_box_contents[$i][0] = array('align' => 'left',
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'logo' => $this->boximg,
'url' => DOL_URL_ROOT."/fourn/facture/fiche.php?facid=".$objp->facid);
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
'text' => $objp->facnumber,
'text2'=> $late,
'url' => DOL_URL_ROOT."/fourn/facture/fiche.php?facid=".$objp->facid);
$this->info_box_contents[$i][1] = array('align' => 'left',
$this->info_box_contents[$i][2] = array('td' => 'align="left"',
'text' => $objp->nom,
'url' => DOL_URL_ROOT."/fourn/fiche.php?socid=".$objp->socid);
$this->info_box_contents[$i][2] = array('align' => 'right',
$this->info_box_contents[$i][3] = array('td' => 'align="right"',
'text' => dolibarr_print_date($objp->datelimite,'day'));
$this->info_box_contents[$i][3] = array(
'align' => 'right',
'width' => 18,
$this->info_box_contents[$i][4] = array('td' => 'align="right" width="18"',
'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3));
$i++;
}
$i=$num;
while ($i < $max)
{
if ($num==0 && $i==$num)
{
$this->info_box_contents[$i][0] = array('align' => 'center','text'=>$langs->trans("NoUnpayedSupplierBills"));
} else {
$this->info_box_contents[$i][0] = array('text'=>'&nbsp;');
}
$this->info_box_contents[$i][1] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][2] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][3] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][4] = array('text'=>'&nbsp;');
$i++;
}
if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoUnpayedSupplierBills"));
}
else {
dolibarr_print_error($db);
}
}
else {
$this->info_box_contents[0][0] = array('align' => 'left',
$this->info_box_contents[0][0] = array('td' => 'align="left"',
'text' => $langs->trans("ReadPermissionNotAllowed"));
}

View File

@ -62,6 +62,9 @@ class box_factures_imp extends ModeleBoxes {
{
global $conf, $user, $langs, $db;
$this->max=$max;
include_once(DOL_DOCUMENT_ROOT."/facture.class.php");
$facturestatic=new Facture($db);
$this->info_box_head = array('text' => $langs->trans("BoxTitleOldestUnpayedCustomerBills",$max));
@ -100,54 +103,41 @@ class box_factures_imp extends ModeleBoxes {
$late='';
if ($objp->datelimite < (time() - $conf->facture->warning_delay)) $late = img_warning(sprintf($l_due_date,dolibarr_print_date($objp->datelimite,'day')));
$this->info_box_contents[$i][0] = array('align' => 'left',
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'logo' => $this->boximg,
'url' => DOL_URL_ROOT."/compta/facture.php?facid=".$objp->facid);
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
'text' => $objp->facnumber,
'text2'=> $late,
'url' => DOL_URL_ROOT."/compta/facture.php?facid=".$objp->facid);
$this->info_box_contents[$i][1] = array('align' => 'left',
$this->info_box_contents[$i][2] = array('td' => 'align="left"',
'text' => $objp->nom,
'maxlength'=>44,
'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid);
$this->info_box_contents[$i][2] = array('align' => 'right',
$this->info_box_contents[$i][3] = array('td' => 'align="right"',
'text' => dolibarr_print_date($objp->datelimite,'day'),
);
$this->info_box_contents[$i][3] = array(
'align' => 'right',
'width' => 18,
$this->info_box_contents[$i][3] = array('td' => 'align="right" width="18"',
'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3));
$i++;
}
$i=$num;
while ($i < $max)
{
if ($num==0 && $i==$num)
{
$this->info_box_contents[$i][0] = array('align' => 'center','text'=>$langs->trans("NoUnpayedCustomerBills"));
} else {
$this->info_box_contents[$i][0] = array('text'=>'&nbsp;');
}
$this->info_box_contents[$i][1] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][2] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][3] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][4] = array('text'=>'&nbsp;');
$i++;
}
if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoUnpayedCustomerBills"));
}
else
{
$this->info_box_contents[0][0] = array( 'align' => 'left',
$this->info_box_contents[0][0] = array( 'td' => 'align="left"',
'maxlength'=>500,
'text' => ($db->error().' sql='.$sql));
}
}
else {
$this->info_box_contents[0][0] = array('align' => 'left',
$this->info_box_contents[0][0] = array('td' => 'align="left"',
'text' => $langs->trans("ReadPermissionNotAllowed"));
}
}

View File

@ -60,6 +60,8 @@ class box_fournisseurs extends ModeleBoxes {
global $user, $langs, $db;
$langs->load("boxes");
$this->max=$max;
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastSuppliers",$max));
if ($user->rights->societe->lire)
@ -89,40 +91,28 @@ class box_fournisseurs extends ModeleBoxes {
{
$objp = $db->fetch_object($result);
$this->info_box_contents[$i][0] = array('align' => 'left',
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'logo' => $this->boximg,
'url' => DOL_URL_ROOT."/fourn/fiche.php?socid=".$objp->socid);
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
'text' => $objp->nom,
'url' => DOL_URL_ROOT."/fourn/fiche.php?socid=".$objp->socid);
$this->info_box_contents[$i][1] = array('align' => 'right',
$this->info_box_contents[$i][2] = array('td' => 'align="right"',
'text' => dolibarr_print_date($objp->dc, "day"));
$i++;
}
$i=$num;
while ($i < $max)
{
if ($num==0 && $i==$num)
{
$this->info_box_contents[$i][0] = array('align' => 'center','text'=>$langs->trans("NoRecordedSuppliers"));
$this->info_box_contents[$i][1] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][2] = array('text'=>'&nbsp;');
} else {
$this->info_box_contents[$i][0] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][1] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][2] = array('text'=>'&nbsp;');
}
$i++;
}
if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedSuppliers"));
}
else {
dolibarr_print_error($db);
}
}
else {
$this->info_box_contents[0][0] = array('align' => 'left',
$this->info_box_contents[0][0] = array('td' => 'align="left"',
'text' => $langs->trans("ReadPermissionNotAllowed"));
}

View File

@ -60,25 +60,29 @@ class box_osc_clients extends ModeleBoxes {
global $user, $langs, $db;
$langs->load("boxes");
$this->max=$max;
$this->info_box_head = array('text' => $langs->trans("BoxTitleNbOfCustomers",$max));
if ($user->rights->boutique->lire)
{
$sql = "SELECT count(*) as cus FROM ".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."customers";
$result = $db->query($sql);
if ($result)
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows();
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num)
{
$objp = $db->fetch_object($result);
$objp = $db->fetch_object($resql);
$this->info_box_contents[$i][0] = array('align' => 'center',
$this->info_box_contents[$i][0] = array('td' => 'align="center" width="16"',
'logo' => $this->boximg,
'url' => DOL_URL_ROOT."/boutique/client/index.php");
$this->info_box_contents[$i][1] = array('td' => 'align="center"',
'text' => $objp->cus,
'url' => DOL_URL_ROOT."/boutique/client/index.php");
$i++;
@ -89,7 +93,7 @@ class box_osc_clients extends ModeleBoxes {
}
}
else {
$this->info_box_contents[0][0] = array('align' => 'left',
$this->info_box_contents[0][0] = array('td' => 'align="left"',
'text' => $langs->trans("ReadPermissionNotAllowed"));
}

View File

@ -61,6 +61,9 @@ class box_produits extends ModeleBoxes {
{
global $user, $langs, $db, $conf;
$this->max=$max;
include_once(DOL_DOCUMENT_ROOT."/product.class.php");
$productstatic=new Product($db);
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastProducts",$max));
@ -102,9 +105,11 @@ class box_produits extends ModeleBoxes {
}
}
$this->info_box_contents[$i][0] = array(
'align' => 'left',
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'logo' => ($objp->fk_product_type==1?'object_service':'object_product'),
'url' => DOL_URL_ROOT."/product/fiche.php?id=".$objp->rowid);
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
'text' => $objp->label,
'url' => DOL_URL_ROOT."/product/fiche.php?id=".$objp->rowid);
@ -118,22 +123,16 @@ class box_produits extends ModeleBoxes {
$price=price($objp->price_ttc);
$price_base_type=$langs->trans("TTC");
}
$this->info_box_contents[$i][1] = array(
'align' => 'right',
$this->info_box_contents[$i][2] = array('td' => 'align="right"',
'text' => $price);
$this->info_box_contents[$i][2] = array(
'align' => 'center',
'width' => 20,
$this->info_box_contents[$i][3] = array('td' => 'align="center" width="20"',
'text' => $price_base_type);
$this->info_box_contents[$i][3] = array(
'align' => 'right',
$this->info_box_contents[$i][4] = array('td' => 'align="right"',
'text' => dolibarr_print_date($objp->tms,'day'));
$this->info_box_contents[$i][4] = array(
'align' => 'right',
'width' => 18,
$this->info_box_contents[$i][5] = array('td' => 'align="right" width="18"',
'text' => $productstatic->LibStatut($objp->envente,3));
$i++;
@ -144,7 +143,7 @@ class box_produits extends ModeleBoxes {
}
}
else {
$this->info_box_contents[0][0] = array('align' => 'left',
$this->info_box_contents[0][0] = array('td' => 'align="left"',
'text' => $langs->trans("ReadPermissionNotAllowed"));
}
}

View File

@ -62,6 +62,8 @@ class box_propales extends ModeleBoxes {
global $user, $langs, $db;
$this->max=$max;
include_once(DOL_DOCUMENT_ROOT."/propal.class.php");
$propalstatic=new Propal($db);
@ -96,53 +98,36 @@ class box_propales extends ModeleBoxes {
{
$objp = $db->fetch_object($result);
$this->info_box_contents[$i][0] = array('align' => 'left',
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'logo' => $this->boximg,
'url' => DOL_URL_ROOT."/comm/propal.php?propalid=".$objp->rowid);
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
'text' => $objp->ref,
'url' => DOL_URL_ROOT."/comm/propal.php?propalid=".$objp->rowid);
$this->info_box_contents[$i][1] = array('align' => 'left',
$this->info_box_contents[$i][2] = array('td' => 'align="left"',
'text' => dolibarr_trunc($objp->nom,40),
'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid);
$this->info_box_contents[$i][2] = array(
'align' => 'right',
$this->info_box_contents[$i][3] = array('td' => 'align="right"',
'text' => dolibarr_print_date($objp->datec,'day'));
$this->info_box_contents[$i][3] = array(
'align' => 'right',
'width' => 18,
$this->info_box_contents[$i][4] = array('td' => 'align="right" width="18"',
'text' => $propalstatic->LibStatut($objp->fk_statut,3));
$i++;
}
$i=$num;
while ($i < $max)
if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedProposals"));
}
else
{
if ($num==0 && $i==$num)
{
$this->info_box_contents[$i][0] = array('align' => 'center','text'=>$langs->trans("NoRecordedProposals"));
$this->info_box_contents[$i][1] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][2] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][3] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][4] = array('text'=>'&nbsp;');
} else {
$this->info_box_contents[$i][0] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][1] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][2] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][3] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][4] = array('text'=>'&nbsp;');
}
$i++;
}
}
else {
dolibarr_print_error($db);
}
}
else {
$this->info_box_contents[0][0] = array('align' => 'left',
$this->info_box_contents[0][0] = array('td' => 'align="left"',
'text' => $langs->trans("ReadPermissionNotAllowed"));
}
}

View File

@ -19,10 +19,10 @@
*/
/**
\file htdocs/includes/boxes/box_prospect.php
\ingroup societe
\brief Module to generate the last prospects box.
\version $Id$
* \file htdocs/includes/boxes/box_prospect.php
* \ingroup societe
* \brief Module to generate the last prospects box.
* \version $Id$
*/
@ -46,11 +46,14 @@ class box_prospect extends ModeleBoxes {
/**
* \brief Constructeur de la classe
*/
function box_prospect()
function box_prospect($DB,$param)
{
global $langs;
$langs->load("boxes");
$this->db=$DB;
$this->param=$param;
$this->boxlabel=$langs->trans("BoxLastProspects");
}
@ -62,6 +65,8 @@ class box_prospect extends ModeleBoxes {
{
global $user, $langs, $db;
$this->max=$max;
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastProspects",$max));
if ($user->rights->societe->lire)
@ -91,38 +96,24 @@ class box_prospect extends ModeleBoxes {
{
$objp = $db->fetch_object($resql);
$this->info_box_contents[$i][0] = array('align' => 'left',
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'logo' => $this->boximg,
'text' => stripslashes($objp->nom),
'url' => DOL_URL_ROOT."/comm/prospect/fiche.php?socid=".$objp->socid);
$this->info_box_contents[$i][1] = array('align' => 'right',
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
'text' => $objp->nom,
'url' => DOL_URL_ROOT."/comm/prospect/fiche.php?socid=".$objp->socid);
$this->info_box_contents[$i][2] = array('td' => 'align="right"',
'text' => dolibarr_print_date($objp->dc, "day"));
$this->info_box_contents[$i][2] = array('align' => 'right',
'width' => 18,
$this->info_box_contents[$i][3] = array('td' => 'align="right" width="18"',
'text' => eregi_replace('img ','img height="14px" ',$prospectstatic->LibStatut($objp->fk_stcomm,3)));
$i++;
}
$i=$num;
while ($i < $max)
{
if ($num==0 && $i==$num)
{
$this->info_box_contents[$i][0] = array('align' => 'center','text'=>$langs->trans("NoRecordedProspects"));
$this->info_box_contents[$i][1] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][2] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][3] = array('text'=>'&nbsp;');
} else {
//$this->info_box_contents[$i][0] = array('text'=>'&nbsp;');
//$this->info_box_contents[$i][1] = array('text'=>'&nbsp;');
//$this->info_box_contents[$i][2] = array('text'=>'&nbsp;');
//$this->info_box_contents[$i][3] = array('text'=>'&nbsp;');
}
$i++;
}
if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedProspects"));
}
else
{
@ -131,7 +122,7 @@ class box_prospect extends ModeleBoxes {
}
else {
dolibarr_syslog("box_prospect::loadBox not allowed de read this box content",LOG_ERR);
$this->info_box_contents[0][0] = array('align' => 'left',
$this->info_box_contents[0][0] = array('td' => 'align="left"',
'text' => $langs->trans("ReadPermissionNotAllowed"));
}
}

View File

@ -60,6 +60,8 @@ class box_services_vendus extends ModeleBoxes {
{
global $user, $langs, $db, $conf;
$this->max=$max;
include_once(DOL_DOCUMENT_ROOT."/contrat/contrat.class.php");
$contratlignestatic=new ContratLigne($db);
@ -118,34 +120,37 @@ class box_services_vendus extends ModeleBoxes {
}
}
$this->info_box_contents[$i][0] = array('align' => 'left',
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'logo' => ($objp->fk_product_type==1?'object_service':'object_product'),
'url' => DOL_URL_ROOT."/contrat/fiche.php?id=".$objp->rowid);
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
'text' => $objp->label,
'maxlength' => 16,
'url' => DOL_URL_ROOT."/contrat/fiche.php?id=".$objp->rowid);
$this->info_box_contents[$i][1] = array('align' => 'left',
$this->info_box_contents[$i][2] = array('td' => 'align="left"',
'text' => $objp->nom,
'maxlength' => 40,
'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid);
$this->info_box_contents[$i][2] = array('align' => 'right',
$this->info_box_contents[$i][3] = array('td' => 'align="right"',
'text' => dolibarr_print_date($objp->datem,'day'));
$this->info_box_contents[$i][3] = array('align' => 'right',
'text' => $contratlignestatic->LibStatut($objp->statut,3),
'width' => 18
$this->info_box_contents[$i][4] = array('td' => 'align="right width="18"',
'text' => $contratlignestatic->LibStatut($objp->statut,3)
);
$i++;
}
}
else {
else
{
dolibarr_print_error($db);
}
}
else {
$this->info_box_contents[0][0] = array('align' => 'left',
$this->info_box_contents[0][0] = array('td' => 'align="left"',
'text' => $langs->trans("ReadPermissionNotAllowed"));
}

View File

@ -31,10 +31,9 @@
*/
class ModeleBoxes
{
var $MAXLENGTHBOX=60; // Mettre 0 pour pas de limite
var $db;
var $error='';
var $max=5;
/*
* \brief Constructeur
@ -46,7 +45,7 @@ class ModeleBoxes
/**
\brief Renvoi le dernier message d'erreur de cr<EFBFBD>ation de facture
* \brief Renvoi le dernier message d'erreur de creation de facture
*/
function error()
{
@ -55,7 +54,7 @@ class ModeleBoxes
/**
\brief Charge une ligne boxe depuis son rowid
* \brief Charge une ligne boxe depuis son rowid
*/
function fetch($rowid)
{
@ -91,27 +90,28 @@ class ModeleBoxes
/**
\brief Methode standard d'affichage des boites
\param $head tableau des caract<EFBFBD>ristiques du titre
\param $contents tableau des lignes de contenu
* \brief Methode standard d'affichage des boites
* \param $head tableau des caracteristiques du titre
* \param $contents tableau des lignes de contenu
*/
function showBox($head, $contents)
{
global $langs,$conf;
$MAXLENGTHBOX=60; // Mettre 0 pour pas de limite
$bcx[0] = 'class="box_pair"';
$bcx[1] = 'class="box_impair"';
$var = true;
// Define nbcol and nblines
// Define nbcol and nblines of the box to show
$nbcol=0;
if (isset($contents[0])) $nbcol=sizeof($contents[0])+1;
if (isset($contents[0])) $nbcol=sizeof($contents[0]);
$nblines=sizeof($contents);
print "\n\n<!-- Box start -->\n";
print '<div style="padding-right: 2px; padding-left: 2px; padding-bottom: 4px;" id="boxto_'.$this->box_id.'">'."\n";
// Affiche titre de la boite
// Show box title
if (! empty($head['text']) || ! empty($head['sublink']))
{
print '<div id="boxto_'.$this->box_id.'_title">'."\n";
@ -126,7 +126,7 @@ class ModeleBoxes
}
if (! empty($head['text']))
{
$s=dolibarr_trunc($head['text'],isset($head['limit'])?$head['limit']:$this->MAXLENGTHBOX);
$s=dolibarr_trunc($head['text'],isset($head['limit'])?$head['limit']:$MAXLENGTHBOX);
print $s;
}
if (! empty($head['sublink']))
@ -146,30 +146,27 @@ class ModeleBoxes
print "</div>\n";
}
// Affiche chaque ligne de la boite
// Show box lines
if ($nblines)
{
print '<table width="100%" class="noborder">'."\n";
// Loop on each record
for ($i=0, $n=$nblines; $i < $n; $i++)
{
if (isset($contents[$i]))
{
$var=!$var;
if (sizeof($contents[$i]))
{
if (isset($contents[$i][-1]['class'])) print '<tr valign="top" class="'.$contents[$i][-1]['class'].'">';
else print '<tr valign="top" '.$bcx[$var].'>';
}
// Affiche chaque cellule
for ($j=0, $m=isset($contents[$i][-1])?sizeof($contents[$i])-1:sizeof($contents[$i]); $j < $m; $j++)
// TR
if (isset($contents[$i][0]['tr'])) print '<tr valign="top" '.$contents[$i][0]['tr'].'>';
else print '<tr valign="top" '.$bcx[$var].'>';
// Loop on each TD
$nbcolthisline=sizeof($contents[$i]);
for ($j=0; $j < $nbcolthisline; $j++)
{
$tdparam="";
if (isset($contents[$i][$j]['align'])) $tdparam.=' align="'. $contents[$i][$j]['align'].'"';
if (isset($contents[$i][$j]['nowrap'])) $tdparam.=' nowrap="'. $contents[$i][$j]['align'].'"';
if (isset($contents[$i][$j]['width'])) $tdparam.=' width="'. $contents[$i][$j]['width'].'"';
if (isset($contents[$i][$j]['colspan'])) $tdparam.=' colspan="'. $contents[$i][$j]['colspan'].'"';
if (isset($contents[$i][$j]['class'])) $tdparam.=' class="'. $contents[$i][$j]['class'].'"';
// Define tdparam
$tdparam='';
if (isset($contents[$i][$j]['td'])) $tdparam.=' '.$contents[$i][$j]['td'];
if (!$contents[$i][$j]['text']) $contents[$i][$j]['text']="";
@ -179,50 +176,50 @@ class ModeleBoxes
$texte2withnotags=eregi_replace('<[^>]+>','',$texte2);
//print "xxx $textewithnotags y";
if (isset($contents[$i][$j]['logo']) && $contents[$i][$j]['logo']) print '<td width="16">';
else print '<td '.$tdparam.'>';
print '<td'.$tdparam.'>';
// Picto
if (isset($contents[$i][$j]['url'])) {
// Url
if (! empty($contents[$i][$j]['url'])) {
print '<a href="'.$contents[$i][$j]['url'].'" title="'.$textewithnotags.'"';
//print ' alt="'.$textewithnotags.'"'; // Pas de alt sur un "<a href>"
print isset($contents[$i][$j]['target'])?' target="'.$contents[$i][$j]['target'].'"':'';
print '>';
}
// Texte
if (isset($contents[$i][$j]['logo']) && $contents[$i][$j]['logo'])
// Logo
if (! empty($contents[$i][$j]['logo']))
{
$logo=eregi_replace("^object_","",$contents[$i][$j]['logo']);
print img_object($langs->trans("Show"),$logo);
if (isset($contents[$i][$j]['url'])) print '</a>';
print '</td><td '.$tdparam.'>';
if (isset($contents[$i][$j]['url']))
{
print '<a href="'.$contents[$i][$j]['url'].'" title="'.$textewithnotags.'"';
//print ' alt="'.$textewithnotags.'"'; // Pas de alt sur un "<a href>"
print isset($contents[$i][$j]['target'])?' target="'.$contents[$i][$j]['target'].'"':'';
print '>';
}
}
$maxlength=$this->MAXLENGTHBOX;
if (isset($contents[$i][$j]['maxlength'])) $maxlength=$contents[$i][$j]['maxlength'];
$maxlength=$MAXLENGTHBOX;
if (! empty($contents[$i][$j]['maxlength'])) $maxlength=$contents[$i][$j]['maxlength'];
if ($maxlength) $textewithnotags=dolibarr_trunc($textewithnotags,$maxlength);
if (eregi('^<img',$texte)) print $texte; // show text with no html cleaning
else print $textewithnotags; // show text with html cleaning
// End picto
if (isset($contents[$i][$j]['url'])) print '</a>';
// End Url
if (! empty($contents[$i][$j]['url'])) print '</a>';
if (eregi('^<img',$texte2)) print $texte2; // show text with no html cleaning
else print $texte2withnotags; // show text with html cleaning
print "</td>";
}
if (sizeof($contents[$i])) print "</tr>\n";
print "</tr>\n";
}
}
while ($i < $this->max)
{
$var=!$var;
print '<tr '.$bcx[$var].'><td colspan="'.$nbcol.'">&nbsp;</td></tr>';
$i++;
}
print "</table>\n";
}

View File

@ -20,7 +20,7 @@
/**
* \file htdocs/index.php
* \brief Page accueil par defaut
* \brief Dolibarr home page
* \version $Id$
*/
@ -28,16 +28,20 @@ require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/boxes.php");
// Simule le menu par défaut sur Home
// If not defined, we select menu "home"
if (! isset($_GET["mainmenu"])) $_GET["mainmenu"]="home";
$infobox=new InfoBox($db);
/*
* Actions
*/
// No actions
/*
* Affichage page
* View
*/
llxHeader();
@ -76,7 +80,7 @@ print '<tr><td valign="top" class="notopnoleft">';
/*
* Informations
* Informations area
*/
if (file_exists(DOL_DOCUMENT_ROOT.'/logo.png'))
@ -566,12 +570,12 @@ print '</td></tr></table>';
/*
* Affichage des boites
*
* Show boxes
*/
$boxarray=$infobox->listboxes("0",$user); // 0=valeur pour la page accueil
$boxid_left = array();
$boxid_right = array();
$boxarray=$infobox->listboxes("0",$user); // 0=value for home page
//$boxid_left = array();
//$boxid_right = array();
if (sizeof($boxarray))
{
@ -580,28 +584,30 @@ if (sizeof($boxarray))
print '<table width="100%" class="notopnoleftnoright">';
print '<tr><td class="notopnoleftnoright">'."\n";
print '<table width="100%" style="border-collapse: collapse; border: 0px; margin: 0px; padding: 0px;"><tr>';
// Affichage colonne gauche
print "\n<!-- Box container -->\n";
print '<table width="100%" style="border-collapse: collapse; border: 0px; margin: 0px; padding: 0px;"><tr><td width="50%" valign="top">'."\n";
print '<td width="50%" valign="top">'."\n";
print "\n<!-- Box left container -->\n";
print '<div id="left">'."\n";
$ii=0;
foreach ($boxarray as $key => $box)
{
//print "xxx".$key."-".$value;
if (eregi('^A',$box->box_order)) // colonne A
{
$ii++;
//print 'box_id '.$boxarray[$ii]->box_id.' ';
//print 'box_order '.$boxarray[$ii]->box_order.'<br>';
$boxid_left[$key] = $boxarray[$key]->box_id;
//$boxid_left[$key] = $box->box_id;
// Affichage boite key
$box->loadBox($conf->box_max_lines);
$box->showBox();
}
}
// If no box on left, we show add an invisible empty box
// If no box on left, we add an invisible empty box
if ($ii==0)
{
$box->box_id='A';
@ -611,14 +617,13 @@ if (sizeof($boxarray))
}
print "</div>\n";
print '</td>';
print "<!-- End box container -->\n";
print "\n";
print "</td>\n";
// Affichage colonne droite
print "\n<!-- Box container -->\n";
print '<td width="50%" valign="top">';
// print '<div id="right" style="position: absolute; display: block; width: 50%; padding: 0px; margin: 0px; float: right;">'."\n";
print "\n<!-- Box right container -->\n";
print '<div id="right">'."\n";
$ii=0;
@ -628,10 +633,9 @@ if (sizeof($boxarray))
if (eregi('^B',$box->box_order)) // colonne B
{
$ii++;
//print 'key:'.$key.'<br>';
//print 'box_id '.$boxarray[$key]->box_id.' ';
//print 'box_order '.$boxarray[$key]->box_order.'<br>';
$boxid_right[$key] = $boxarray[$key]->box_id;
//print 'box_id '.$boxarray[$ii]->box_id.' ';
//print 'box_order '.$boxarray[$ii]->box_order.'<br>';
//$boxid_right[$key] = $boxarray[$key]->box_id;
// Affichage boite key
$box->loadBox($conf->box_max_lines);
$box->showBox();
@ -648,8 +652,9 @@ if (sizeof($boxarray))
}
print "</div>\n";
print "</td></tr></table>\n";
print "<!-- End box container -->\n";
print "</td>";
print "</tr></table>\n";
print "\n";
print "</td></tr>";