mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Prepare the ground to have a full editable homearea page
This commit is contained in:
parent
c71bb9d67c
commit
28c89dc3e3
|
|
@ -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.='</script>'."\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.='<table width="100%" class="notopnoleftnoright">';
|
||||
$boxlist.='<tr><td class="notopnoleftnoright">'."\n";
|
||||
//$boxlist.='<table width="100%" class="notopnoleftnoright">';
|
||||
//$boxlist.='<tr><td class="notopnoleftnoright">'."\n";
|
||||
|
||||
$boxlist.='<div class="fichehalfleft">';
|
||||
//$boxlist.='<div class="fichehalfleft">';
|
||||
|
||||
$boxlist.="\n<!-- Box left container -->\n";
|
||||
$boxlist.='<div id="left" class="connectedSortable">'."\n";
|
||||
$boxlista.="\n<!-- Box left container -->\n";
|
||||
$boxlista.='<div id="left" class="connectedSortable">'."\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.'<br>';
|
||||
// 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.= "</div>\n";
|
||||
$boxlist.= "<!-- End box left container -->\n";
|
||||
$boxlista.= "</div>\n";
|
||||
$boxlista.= "<!-- End box left container -->\n";
|
||||
|
||||
$boxlist.= '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
//$boxlist.= '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
|
||||
$boxlist.= "\n<!-- Box right container -->\n";
|
||||
$boxlist.= '<div id="right" class="connectedSortable">'."\n";
|
||||
$boxlistb.= "\n<!-- Box right container -->\n";
|
||||
$boxlistb.= '<div id="right" class="connectedSortable">'."\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.'<br>';
|
||||
// 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.= "</div>\n";
|
||||
$boxlist.= "<!-- End box right container -->\n";
|
||||
$boxlistb.= "</div>\n";
|
||||
$boxlistb.= "<!-- End box right container -->\n";
|
||||
|
||||
$boxlist.= '</div></div>';
|
||||
$boxlist.= "\n";
|
||||
//$boxlist.= '</div></div>';
|
||||
//$boxlist.= "\n";
|
||||
|
||||
$boxlist.= "</td></tr>";
|
||||
$boxlist.= "</table>";
|
||||
//$boxlist.= "</td></tr>";
|
||||
//$boxlist.= "</table>";
|
||||
}
|
||||
|
||||
return array('selectboxlist'=>count($boxactivated)?$selectboxlist:'', 'boxactivated'=>$boxactivated, 'boxlist'=>$boxlist);
|
||||
return array('selectboxlist'=>count($boxactivated)?$selectboxlist:'', 'boxactivated'=>$boxactivated, 'boxlista'=>$boxlista, 'boxlistb'=>$boxlistb);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
150
htdocs/index.php
150
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 '<div class="fichecenter"><div class="fichethirdleft">';
|
|||
/*
|
||||
* Informations area
|
||||
*/
|
||||
|
||||
print '<table summary="Login info" class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><th class="liste_titre" colspan="2">'.$langs->trans("Informations").'</th></tr>';
|
||||
print '<tr '.$bc[false].'>';
|
||||
print '<td class="nowrap">'.$langs->trans("User").'</td><td>'.$user->getNomUrl(0).'</td></tr>';
|
||||
print '<tr '.$bc[true].'>';
|
||||
print '<td class="nowrap">'.$langs->trans("PreviousConnexion").'</td><td>';
|
||||
if ($user->datepreviouslogin) print dol_print_date($user->datepreviouslogin,"dayhour",'tzuser');
|
||||
else print $langs->trans("Unknown");
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
print "</table>\n";
|
||||
|
||||
$boxinfo='';
|
||||
$boxinfo.= '<div class="box">';
|
||||
$boxinfo.= '<table summary="'.dol_escape_htmltag($langs->trans("LoginInformation")).'" class="noborder boxtable" width="100%">';
|
||||
$boxinfo.= '<tr class="liste_titre"><th class="liste_titre" colspan="2">'.$langs->trans("Informations").'</th></tr>';
|
||||
$boxinfo.= '<tr '.$bc[false].'>';
|
||||
$boxinfo.= '<td class="nowrap">'.$langs->trans("User").'</td><td>'.$user->getNomUrl(0).'</td></tr>';
|
||||
$boxinfo.= '<tr '.$bc[true].'>';
|
||||
$boxinfo.= '<td class="nowrap">'.$langs->trans("PreviousConnexion").'</td><td>';
|
||||
if ($user->datepreviouslogin) $boxinfo.= dol_print_date($user->datepreviouslogin,"dayhour",'tzuser');
|
||||
else $boxinfo.= $langs->trans("Unknown");
|
||||
$boxinfo.= '</td>';
|
||||
$boxinfo.= "</tr>\n";
|
||||
$boxinfo.= "</table>\n";
|
||||
$boxinfo.= '</div>';
|
||||
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 '<br>';
|
||||
print '<table summary="'.$langs->trans("DolibarrStateBoard").'" class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th class="liste_titre">'.$langs->trans("DolibarrStateBoard").'</th>';
|
||||
print '</tr>';
|
||||
print '<tr class="impair"><td class="tdboxstats nohover">';
|
||||
$boxstat.='<div class="box">';
|
||||
$boxstat.='<table summary="'.dol_escape_htmltag($langs->trans("DolibarrStateBoard")).'" class="noborder boxtable" width="100%">';
|
||||
$boxstat.='<tr class="liste_titre">';
|
||||
$boxstat.='<th class="liste_titre">'.$langs->trans("DolibarrStateBoard").'</th>';
|
||||
$boxstat.='</tr>';
|
||||
$boxstat.='<tr class="impair"><td class="tdboxstats nohover">';
|
||||
|
||||
$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 '<a href="'.$links[$key].'" class="boxstatsindicator thumbstat nobold nounderline">';
|
||||
print '<div class="boxstats">';
|
||||
print '<span class="boxstatstext">'.img_object("",$icons[$key]).' '.$text.'</span><br>';
|
||||
print '<span class="boxstatsindicator">'.$board->nb[$val].'</span>';
|
||||
print '</div>';
|
||||
print '</a>';
|
||||
$boxstat.='<a href="'.$links[$key].'" class="boxstatsindicator thumbstat nobold nounderline">';
|
||||
$boxstat.='<div class="boxstats">';
|
||||
$boxstat.='<span class="boxstatstext">'.img_object("",$icons[$key]).' '.$text.'</span><br>';
|
||||
$boxstat.='<span class="boxstatsindicator">'.$board->nb[$val].'</span>';
|
||||
$boxstat.='</div>';
|
||||
$boxstat.='</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print '</td></tr>';
|
||||
print '</table>';
|
||||
$boxstat.='</td></tr>';
|
||||
$boxstat.='</table>';
|
||||
$boxstat.='</div>';
|
||||
}
|
||||
print $boxstat;
|
||||
|
||||
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
||||
|
||||
|
|
@ -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 '<table class="noborder" width="100%">'."\n";
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th class="liste_titre" colspan="2">'.$langs->trans("DolibarrWorkBoard").'</th>';
|
||||
print '<th class="liste_titre" align="right">'.$langs->trans("Number").'</th>';
|
||||
print '<th class="liste_titre" align="right">'.$form->textwithpicto($langs->trans("Late"),$langs->trans("LateDesc")).'</th>';
|
||||
print '<th class="liste_titre"> </th>';
|
||||
$boxwork='';
|
||||
$boxwork.='<table summary="'.dol_escape_htmltag($langs->trans("WorkingBoard")).'" class="noborder boxtable" width="100%">'."\n";
|
||||
$boxwork.='<tr class="liste_titre">';
|
||||
$boxwork.='<th class="liste_titre" colspan="2">'.$langs->trans("DolibarrWorkBoard").'</th>';
|
||||
$boxwork.='<th class="liste_titre" align="right">'.$langs->trans("Number").'</th>';
|
||||
$boxwork.='<th class="liste_titre" align="right">'.$form->textwithpicto($langs->trans("Late"),$langs->trans("LateDesc")).'</th>';
|
||||
$boxwork.='<th class="liste_titre"> </th>';
|
||||
//print '<th class="liste_titre" width="20"> </th>';
|
||||
if ($showweather) print '<th class="liste_titre hideonsmartphone" width="80"> </th>';
|
||||
print '</tr>'."\n";
|
||||
if ($showweather) $boxwork.='<th class="liste_titre hideonsmartphone" width="80"> </th>';
|
||||
$boxwork.='</tr>'."\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 '<tr '.$bc[$var].'><td width="16">'.$board->img.'</td><td>'.$board->label.'</td>';
|
||||
print '<td align="right"><a class="dashboardlineindicator" href="'.$board->url.'"><span class="dashboardlineindicator">'.$board->nbtodo.'</span></a></td>';
|
||||
print '<td align="right">';
|
||||
$boxwork.= '<tr '.$bc[$var].'><td width="16">'.$board->img.'</td><td>'.$board->label.'</td>';
|
||||
$boxwork.= '<td align="right"><a class="dashboardlineindicator" href="'.$board->url.'"><span class="dashboardlineindicator">'.$board->nbtodo.'</span></a></td>';
|
||||
$boxwork.= '<td align="right">';
|
||||
//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 '<a title="'.dol_escape_htmltag($textlate).'" class="dashboardlineindicatorlate'.($board->nbtodolate>0?' dashboardlineko':' dashboardlineok').'" href="'.$board->url.'"><span class="dashboardlineindicatorlate'.($board->nbtodolate>0?' dashboardlineko':' dashboardlineok').'">';
|
||||
print $board->nbtodolate;
|
||||
print '</span></a>';
|
||||
$boxwork.= '<a title="'.dol_escape_htmltag($textlate).'" class="dashboardlineindicatorlate'.($board->nbtodolate>0?' dashboardlineko':' dashboardlineok').'" href="'.$board->url.'"><span class="dashboardlineindicatorlate'.($board->nbtodolate>0?' dashboardlineko':' dashboardlineok').'">';
|
||||
$boxwork.= $board->nbtodolate;
|
||||
$boxwork.= '</span></a>';
|
||||
//}
|
||||
print '</td>';
|
||||
print '<td align="left">';
|
||||
if ($board->nbtodolate > 0) print img_picto($langs->trans("NActionsLate",$board->nbtodolate).' (>'.ceil($board->warning_delay).' '.$langs->trans("days").')',"warning");
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
$boxwork.='</td>';
|
||||
$boxwork.='<td align="left">';
|
||||
if ($board->nbtodolate > 0) $boxwork.=img_picto($langs->trans("NActionsLate",$board->nbtodolate).' (>'.ceil($board->warning_delay).' '.$langs->trans("days").')',"warning");
|
||||
else $boxwork.=' ';
|
||||
$boxwork.='</td>';
|
||||
/*print '<td class="nowrap" align="right">';
|
||||
print ' (>'.ceil($board->warning_delay).' '.$langs->trans("days").')';
|
||||
print '</td>';*/
|
||||
|
||||
if ($showweather)
|
||||
{
|
||||
print '<td class="nohover hideonsmartphone" rowspan="'.$rowspan.'" width="80" style="border-left: 1px solid #DDDDDD" align="center">';
|
||||
$boxwork.='<td class="nohover hideonsmartphone" rowspan="'.$rowspan.'" width="80" style="border-left: 1px solid #DDDDDD" align="center">';
|
||||
$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 '</td>';
|
||||
$boxwork.=showWeather($totallate,$text,$options);
|
||||
$boxwork.='</td>';
|
||||
$showweather=0;
|
||||
}
|
||||
print '</tr>';
|
||||
print "\n";
|
||||
$boxwork.='</tr>';
|
||||
$boxwork.="\n";
|
||||
}
|
||||
|
||||
$boxwork.='</table>'; // End table array of working board
|
||||
|
||||
print '</table>'; // End table array
|
||||
print $boxwork;
|
||||
|
||||
print '</div></div></div><div class="clearboth"></div>';
|
||||
|
||||
print '<div class="fichecenter fichecenterbis">';
|
||||
|
||||
print '</div></div></div><div class="clearboth"></div><div class="fichecenter fichecenterbis">';
|
||||
|
||||
/*
|
||||
* Show boxes
|
||||
*/
|
||||
|
||||
print $resultboxes['boxlist'];
|
||||
$boxlist.='<table width="100%" class="notopnoleftnoright">';
|
||||
$boxlist.='<tr><td class="notopnoleftnoright">'."\n";
|
||||
|
||||
$boxlist.='<div class="fichehalfleft">';
|
||||
|
||||
$boxlist.=$resultboxes['boxlista'];
|
||||
|
||||
$boxlist.= '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
|
||||
$boxlist.=$resultboxes['boxlistb'];
|
||||
|
||||
$boxlist.= '</div></div>';
|
||||
$boxlist.= "\n";
|
||||
|
||||
$boxlist.= "</td></tr>";
|
||||
$boxlist.= "</table>";
|
||||
|
||||
print $boxlist;
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
/*
|
||||
* Show security warnings
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user