diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php
index 474c07f4b0a..fc8ee1c30d0 100644
--- a/htdocs/core/class/html.formother.class.php
+++ b/htdocs/core/class/html.formother.class.php
@@ -960,16 +960,15 @@ class FormOther
-
/**
- * Show a HTML Tab with boxes of a particular area including personalized choices of user.
+ * Get array with HTML tabs with boxes of a particular area including personalized choices of user.
* Class 'Form' must be known.
*
* @param User $user Object User
* @param String $areacode Code of area for pages (0=value for Home page)
* @return array array('selectboxlist'=>, 'boxactivated'=>, 'boxlist'=>)
*/
- static function printBoxesArea($user,$areacode)
+ static function getBoxesArea($user,$areacode)
{
global $conf,$langs,$db;
@@ -980,9 +979,8 @@ class FormOther
// $boxactivated will be array of boxes enabled into global setup
// $boxidactivatedforuser will be array of boxes choosed by user
- $selectboxlist=$boxlist='';
+ $selectboxlist='';
$boxactivated=InfoBox::listBoxes($db,'activated',$areacode,(empty($user->conf->$confuserzone)?null:$user)); // Search boxes of common+user (or common only if user has no specific setup)
- //var_dump($boxactivated);
$boxidactivatedforuser=array();
foreach($boxactivated as $box)
@@ -990,6 +988,7 @@ class FormOther
if (empty($user->conf->$confuserzone) || $box->fk_user == $user->id) $boxidactivatedforuser[$box->id]=$box->id; // We keep only boxes to show for user
}
+ // Define selectboxlist
$arrayboxtoactivatelabel=array();
if (! empty($user->conf->$confuserzone))
{
@@ -1092,8 +1091,8 @@ class FormOther
$selectboxlist.=''."\n";
}
+ // Define boxlista and boxlistb
$nbboxactivated=count($boxidactivatedforuser);
- //print load_fiche_titre(($nbboxactivated?$langs->trans("OtherInformationsBoxes"):''),$selectboxlist,'','','otherboxes');
if ($nbboxactivated)
{
@@ -1102,13 +1101,13 @@ class FormOther
$emptybox=new ModeleBoxes($db);
- $boxlist.='
';
- $boxlist.=''."\n";
+ //$boxlist.='';
+ //$boxlist.=''."\n";
- $boxlist.='';
+ //$boxlist.=' ';
- $boxlist.="\n\n";
- $boxlist.=' '."\n";
+ $boxlista.="\n\n";
+ $boxlista.=' '."\n";
// Define $box_max_lines
$box_max_lines=5;
@@ -1124,9 +1123,9 @@ class FormOther
$ii++;
//print 'box_id '.$boxactivated[$ii]->box_id.' ';
//print 'box_order '.$boxactivated[$ii]->box_order.' ';
- // Affichage boite key
+ // Show box
$box->loadBox($box_max_lines);
- $boxlist.= $box->outputBox();
+ $boxlista.= $box->outputBox();
}
}
@@ -1135,15 +1134,15 @@ class FormOther
$emptybox->box_id='A';
$emptybox->info_box_head=array();
$emptybox->info_box_contents=array();
- $boxlist.= $emptybox->outputBox(array(),array());
+ $boxlista.= $emptybox->outputBox(array(),array());
}
- $boxlist.= " \n";
- $boxlist.= "\n";
+ $boxlista.= " \n";
+ $boxlista.= "\n";
- $boxlist.= ' ';
+ //$boxlist.= ' ';
- $boxlist.= "\n\n";
- $boxlist.= ' '."\n";
+ $boxlistb.= "\n\n";
+ $boxlistb.= ' '."\n";
$ii=0;
foreach ($boxactivated as $key => $box)
@@ -1155,9 +1154,9 @@ class FormOther
$ii++;
//print 'box_id '.$boxactivated[$ii]->box_id.' ';
//print 'box_order '.$boxactivated[$ii]->box_order.' ';
- // Affichage boite key
+ // Show box
$box->loadBox($box_max_lines);
- $boxlist.= $box->outputBox();
+ $boxlistb.= $box->outputBox();
}
}
@@ -1166,19 +1165,19 @@ class FormOther
$emptybox->box_id='B';
$emptybox->info_box_head=array();
$emptybox->info_box_contents=array();
- $boxlist.= $emptybox->outputBox(array(),array());
+ $boxlistb.= $emptybox->outputBox(array(),array());
}
- $boxlist.= " \n";
- $boxlist.= "\n";
+ $boxlistb.= " \n";
+ $boxlistb.= "\n";
- $boxlist.= ' ';
- $boxlist.= "\n";
+ //$boxlist.= ' ';
+ //$boxlist.= "\n";
- $boxlist.= " | ";
- $boxlist.= " ";
+ //$boxlist.= " |
";
+ //$boxlist.= "
";
}
- return array('selectboxlist'=>count($boxactivated)?$selectboxlist:'', 'boxactivated'=>$boxactivated, 'boxlist'=>$boxlist);
+ return array('selectboxlist'=>count($boxactivated)?$selectboxlist:'', 'boxactivated'=>$boxactivated, 'boxlista'=>$boxlista, 'boxlistb'=>$boxlistb);
}
diff --git a/htdocs/index.php b/htdocs/index.php
index d876b718ce8..3e2fa24eed0 100644
--- a/htdocs/index.php
+++ b/htdocs/index.php
@@ -73,7 +73,7 @@ if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title=$langs->trans("HomeAr
llxHeader('',$title);
-$resultboxes=FormOther::printBoxesArea($user,"0");
+$resultboxes=FormOther::getBoxesArea($user,"0");
print load_fiche_titre($langs->trans("HomeArea"),$resultboxes['selectboxlist'],'title_home');
@@ -107,38 +107,41 @@ print '';
/*
* Informations area
*/
-
-print '
';
-print '| '.$langs->trans("Informations").' |
';
-print '';
-print '| '.$langs->trans("User").' | '.$user->getNomUrl(0).' |
';
-print '';
-print '| '.$langs->trans("PreviousConnexion").' | ';
-if ($user->datepreviouslogin) print dol_print_date($user->datepreviouslogin,"dayhour",'tzuser');
-else print $langs->trans("Unknown");
-print ' | ';
-print "
\n";
-print "
\n";
-
+$boxinfo='';
+$boxinfo.= '
';
+$boxinfo.= '
';
+$boxinfo.= '| '.$langs->trans("Informations").' |
';
+$boxinfo.= '';
+$boxinfo.= '| '.$langs->trans("User").' | '.$user->getNomUrl(0).' |
';
+$boxinfo.= '';
+$boxinfo.= '| '.$langs->trans("PreviousConnexion").' | ';
+if ($user->datepreviouslogin) $boxinfo.= dol_print_date($user->datepreviouslogin,"dayhour",'tzuser');
+else $boxinfo.= $langs->trans("Unknown");
+$boxinfo.= ' | ';
+$boxinfo.= "
\n";
+$boxinfo.= "
\n";
+$boxinfo.= '
';
+print $boxinfo;
/*
* Dashboard Dolibarr states (statistics)
* Hidden for external users
*/
+$boxstat='';
+
$langs->load("commercial");
$langs->load("bills");
$langs->load("orders");
$langs->load("contracts");
-//print memory_get_usage();
if (empty($user->societe_id))
{
- print '
';
- print '
';
- print '';
- print '| '.$langs->trans("DolibarrStateBoard").' | ';
- print '
';
- print '';
+ $boxstat.='';
+ $boxstat.=' ';
+ $boxstat.=' |
';
+ $boxstat.='
';
+ $boxstat.='
';
}
+print $boxstat;
print '
';
@@ -317,21 +322,18 @@ $showweather=empty($conf->global->MAIN_DISABLE_METEO)?1:0;
//Array that contains all WorkboardResponse classes to process them
$dashboardlines=array();
-print '
'."\n";
-print '';
-print '| '.$langs->trans("DolibarrWorkBoard").' | ';
-print ''.$langs->trans("Number").' | ';
-print ''.$form->textwithpicto($langs->trans("Late"),$langs->trans("LateDesc")).' | ';
-print ' | ';
+$boxwork='';
+$boxwork.=''."\n";
+$boxwork.='';
+$boxwork.='| '.$langs->trans("DolibarrWorkBoard").' | ';
+$boxwork.=''.$langs->trans("Number").' | ';
+$boxwork.=''.$form->textwithpicto($langs->trans("Late"),$langs->trans("LateDesc")).' | ';
+$boxwork.=' | ';
//print ' | ';
-if ($showweather) print ' | ';
-print '
'."\n";
+if ($showweather) $boxwork.=' | ';
+$boxwork.=''."\n";
-
-//
// Do not include sections without management permission
-//
-
require DOL_DOCUMENT_ROOT.'/core/class/workboardresponse.class.php';
// Number of actions to do (late)
@@ -357,7 +359,6 @@ if (! empty($conf->projet->enabled) && empty($conf->global->PROJECT_HIDE_TASKS)
{
include_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
$board=new Task($db);
-
$dashboardlines[] = $board->load_board($user);
}
@@ -367,7 +368,6 @@ if (! empty($conf->propal->enabled) && $user->rights->propale->lire)
include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
$board=new Propal($db);
$dashboardlines[] = $board->load_board($user,"opened");
-
// Number of commercial proposals CLOSED signed (billed)
$dashboardlines[] = $board->load_board($user,"signed");
}
@@ -377,7 +377,6 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
{
include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
$board=new Commande($db);
-
$dashboardlines[] = $board->load_board($user);
}
@@ -386,7 +385,6 @@ if (! empty($conf->supplier_order->enabled) && $user->rights->fournisseur->comma
{
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
$board=new CommandeFournisseur($db);
-
$dashboardlines[] = $board->load_board($user);
}
@@ -396,7 +394,6 @@ if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire)
include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
$board=new Contrat($db);
$dashboardlines[] = $board->load_board($user,"inactives");
-
// Number of active services (expired)
$dashboardlines[] = $board->load_board($user,"expired");
}
@@ -445,7 +442,6 @@ if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->appr
{
include_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
$board=new ExpenseReport($db);
-
$dashboardlines[] = $board->load_board($user,'toapprove');
}
@@ -454,7 +450,6 @@ if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->to_p
{
include_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
$board=new ExpenseReport($db);
-
$dashboardlines[] = $board->load_board($user,'topay');
}
@@ -483,55 +478,76 @@ foreach($valid_dashboardlines as $board)
foreach($valid_dashboardlines as $board)
{
$var=!$var;
- print '| '.$board->img.' | '.$board->label.' | ';
- print ''.$board->nbtodo.' | ';
- print '';
+ $boxwork.= ' |
| '.$board->img.' | '.$board->label.' | ';
+ $boxwork.= ''.$board->nbtodo.' | ';
+ $boxwork.= '';
//if ($board->nbtodolate > 0)
//{
$textlate = $langs->trans("Late").' = '.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($board->warning_delay) >= 0 ? '+' : '').ceil($board->warning_delay).' '.$langs->trans("days");
- print '';
- print $board->nbtodolate;
- print '';
+ $boxwork.= '';
+ $boxwork.= $board->nbtodolate;
+ $boxwork.= '';
//}
- print ' | ';
- print '';
- if ($board->nbtodolate > 0) print img_picto($langs->trans("NActionsLate",$board->nbtodolate).' (>'.ceil($board->warning_delay).' '.$langs->trans("days").')',"warning");
- else print ' ';
- print ' | ';
+ $boxwork.='';
+ $boxwork.='';
+ if ($board->nbtodolate > 0) $boxwork.=img_picto($langs->trans("NActionsLate",$board->nbtodolate).' (>'.ceil($board->warning_delay).' '.$langs->trans("days").')',"warning");
+ else $boxwork.=' ';
+ $boxwork.=' | ';
/*print '';
print ' (>'.ceil($board->warning_delay).' '.$langs->trans("days").')';
print ' | ';*/
if ($showweather)
{
- print '';
+ $boxwork.=' | ';
$text='';
if ($totallate > 0) $text=$langs->transnoentitiesnoconv("WarningYouHaveAtLeastOneTaskLate").' ('.$langs->transnoentitiesnoconv("NActionsLate",$totallate).')';
$options='height="64px"';
if ($rowspan <= 2) $options='height="24"'; // Weather logo is smaller if dashboard has few elements
else if ($rowspan <= 3) $options='height="48"'; // Weather logo is smaller if dashboard has few elements
- print showWeather($totallate,$text,$options);
- print ' | ';
+ $boxwork.=showWeather($totallate,$text,$options);
+ $boxwork.='';
$showweather=0;
}
- print '
';
- print "\n";
+ $boxwork.='';
+ $boxwork.="\n";
}
+$boxwork.='
'; // End table array of working board
-print '
'; // End table array
+print $boxwork;
+print '
';
+
+print '';
-print '
';
/*
* Show boxes
*/
-print $resultboxes['boxlist'];
+$boxlist.='
';
+$boxlist.='| '."\n";
+
+$boxlist.=' ';
+
+$boxlist.=$resultboxes['boxlista'];
+
+$boxlist.= ' ';
+
+$boxlist.=$resultboxes['boxlistb'];
+
+$boxlist.= ' ';
+$boxlist.= "\n";
+
+$boxlist.= " |
";
+$boxlist.= "
";
+
+print $boxlist;
print '
';
+
/*
* Show security warnings
*/