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.='"; + //$boxlist.= "
'."\n"; + //$boxlist.=''; + //$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"; - $boxlist.= '
'; - $boxlist.= "\n"; + //$boxlist.= '
'; + //$boxlist.= "\n"; - $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 ''; -print ''; -print ''; -print ''; -print ''; -print "\n"; -print "
'.$langs->trans("Informations").'
'.$langs->trans("User").''.$user->getNomUrl(0).'
'.$langs->trans("PreviousConnexion").''; -if ($user->datepreviouslogin) print dol_print_date($user->datepreviouslogin,"dayhour",'tzuser'); -else print $langs->trans("Unknown"); -print '
\n"; - +$boxinfo=''; +$boxinfo.= '
'; +$boxinfo.= ''; +$boxinfo.= ''; +$boxinfo.= ''; +$boxinfo.= ''; +$boxinfo.= ''; +$boxinfo.= ''; +$boxinfo.= "\n"; +$boxinfo.= "
'.$langs->trans("Informations").'
'.$langs->trans("User").''.$user->getNomUrl(0).'
'.$langs->trans("PreviousConnexion").''; +if ($user->datepreviouslogin) $boxinfo.= dol_print_date($user->datepreviouslogin,"dayhour",'tzuser'); +else $boxinfo.= $langs->trans("Unknown"); +$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 ''; - print ''; - print ''; + $boxstat.='
'.$langs->trans("DolibarrStateBoard").'
'; + $boxstat.='
'; + $boxstat.=''; + $boxstat.=''; + $boxstat.=''; + $boxstat.=''; + $boxstat.=''; - print '
'.$langs->trans("DolibarrStateBoard").'
'; $var=true; @@ -292,19 +295,21 @@ if (empty($user->societe_id)) $var=!$var; if (!empty($langfile[$key])) $langs->load($langfile[$key]); $text=$langs->trans($titres[$key]); - print ''; - print '
'; - print ''.img_object("",$icons[$key]).' '.$text.'
'; - print ''.$board->nb[$val].''; - print '
'; - print '
'; + $boxstat.=''; + $boxstat.='
'; + $boxstat.=''.img_object("",$icons[$key]).' '.$text.'
'; + $boxstat.=''.$board->nb[$val].''; + $boxstat.='
'; + $boxstat.='
'; } } } - print '
'; + $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 ''; -print ''; -print ''; -print ''; +$boxwork=''; +$boxwork.='
'.$langs->trans("DolibarrWorkBoard").''.$langs->trans("Number").''.$form->textwithpicto($langs->trans("Late"),$langs->trans("LateDesc")).' 
'."\n"; +$boxwork.=''; +$boxwork.=''; +$boxwork.=''; +$boxwork.=''; +$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 ''; - print ''; - print ''; + $boxwork.= ''; + $boxwork.= ''; - print ''; + $boxwork.=''; + $boxwork.=''; /*print '';*/ if ($showweather) { - print ''; + $boxwork.=showWeather($totallate,$text,$options); + $boxwork.=''; $showweather=0; } - print ''; - print "\n"; + $boxwork.=''; + $boxwork.="\n"; } +$boxwork.='
'.$langs->trans("DolibarrWorkBoard").''.$langs->trans("Number").''.$form->textwithpicto($langs->trans("Late"),$langs->trans("LateDesc")).'   
 
'.$board->img.''.$board->label.''.$board->nbtodo.''; + $boxwork.= '
'.$board->img.''.$board->label.''.$board->nbtodo.''; //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 ''; - if ($board->nbtodolate > 0) print img_picto($langs->trans("NActionsLate",$board->nbtodolate).' (>'.ceil($board->warning_delay).' '.$langs->trans("days").')',"warning"); - else print ' '; - print ''; + if ($board->nbtodolate > 0) $boxwork.=img_picto($langs->trans("NActionsLate",$board->nbtodolate).' (>'.ceil($board->warning_delay).' '.$langs->trans("days").')',"warning"); + else $boxwork.=' '; + $boxwork.=''; print ' (>'.ceil($board->warning_delay).' '.$langs->trans("days").')'; 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 '
'; // End table array of working board -print ''; // End table array +print $boxwork; +print '
'; + +print '
'; -print '
'; /* * Show boxes */ -print $resultboxes['boxlist']; +$boxlist.=''; +$boxlist.='"; +$boxlist.= "
'."\n"; + +$boxlist.='
'; + +$boxlist.=$resultboxes['boxlista']; + +$boxlist.= '
'; + +$boxlist.=$resultboxes['boxlistb']; + +$boxlist.= '
'; +$boxlist.= "\n"; + +$boxlist.= "
"; + +print $boxlist; print '
'; + /* * Show security warnings */