2004-10-20 23:06:45 +02:00
< ? php
2017-06-06 07:57:03 +02:00
/* Copyright ( C ) 2001 - 2004 Rodolphe Quiedeville < rodolphe @ quiedeville . org >
2017-10-26 13:09:11 +02:00
* Copyright ( C ) 2004 - 2017 Laurent Destailleur < eldy @ users . sourceforge . net >
2017-06-06 07:57:03 +02:00
* Copyright ( C ) 2005 - 2017 Regis Houssin < regis . houssin @ capnetworks . com >
* Copyright ( C ) 2011 - 2012 Juanjo Menent < jmenent @ 2 byte . es >
* Copyright ( C ) 2015 Marcos García < marcosgdf @ gmail . com >
2002-04-29 21:47:03 +02:00
*
* 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
2013-01-16 15:36:08 +01:00
* the Free Software Foundation ; either version 3 of the License , or
2002-04-29 21:47:03 +02:00
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
2011-08-01 01:19:04 +02:00
* along with this program . If not , see < http :// www . gnu . org / licenses />.
2002-04-29 19:53:37 +02:00
*/
2005-01-03 20:21:51 +01:00
/**
2008-11-19 19:19:51 +01:00
* \file htdocs / index . php
2008-12-07 16:55:40 +01:00
* \brief Dolibarr home page
2008-11-16 19:55:00 +01:00
*/
2005-01-03 20:21:51 +01:00
2016-09-08 12:12:00 +02:00
define ( 'NOCSRFCHECK' , 1 ); // This is main home and login page. We must be able to go on it from another web site.
2009-05-16 08:31:59 +02:00
2012-08-23 01:43:44 +02:00
require 'main.inc.php' ;
2012-08-22 23:11:24 +02:00
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php' ;
2002-04-29 19:53:37 +02:00
2008-12-07 16:55:40 +01:00
// If not defined, we select menu "home"
2017-05-10 00:44:54 +02:00
$_GET [ 'mainmenu' ] = GETPOST ( 'mainmenu' , 'aZ09' ) ? GETPOST ( 'mainmenu' , 'aZ09' ) : 'home' ;
2017-05-16 13:27:32 +02:00
$action = GETPOST ( 'action' , 'aZ09' );
2005-01-03 20:21:51 +01:00
2012-03-02 14:51:16 +01:00
$hookmanager -> initHooks ( array ( 'index' ));
2011-12-06 23:38:54 +01:00
2011-02-19 18:21:29 +01:00
2016-01-18 15:56:51 +01:00
2008-12-07 16:55:40 +01:00
/*
* Actions
*/
2006-11-01 16:15:14 +01:00
2011-02-19 18:21:29 +01:00
// Check if company name is defined (first install)
if ( ! isset ( $conf -> global -> MAIN_INFO_SOCIETE_NOM ) || empty ( $conf -> global -> MAIN_INFO_SOCIETE_NOM ))
{
2012-09-27 23:57:10 +02:00
header ( " Location: " . DOL_URL_ROOT . " /admin/index.php?mainmenu=home&leftmenu=setup&mesg=setupnotcomplete " );
2011-02-19 18:21:29 +01:00
exit ;
}
2016-07-23 13:20:34 +02:00
if ( count ( $conf -> modules ) <= ( empty ( $conf -> global -> MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING ) ? 1 : $conf -> global -> MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING )) // If only user module enabled
{
header ( " Location: " . DOL_URL_ROOT . " /admin/index.php?mainmenu=home&leftmenu=setup&mesg=setupnotcomplete " );
exit ;
}
2014-07-29 00:50:57 +02:00
if ( GETPOST ( 'addbox' )) // Add box (when submit is done from a form when ajax disabled)
{
require_once DOL_DOCUMENT_ROOT . '/core/class/infobox.class.php' ;
2017-05-10 11:47:34 +02:00
$zone = GETPOST ( 'areacode' , 'aZ09' );
$userid = GETPOST ( 'userid' , 'int' );
$boxorder = GETPOST ( 'boxorder' , 'aZ09' );
$boxorder .= GETPOST ( 'boxcombo' , 'aZ09' );
2014-07-29 00:50:57 +02:00
$result = InfoBox :: saveboxorder ( $db , $zone , $boxorder , $userid );
2017-03-09 13:22:43 +01:00
if ( $result > 0 ) setEventMessages ( $langs -> trans ( " BoxAdded " ), null );
2014-07-29 00:50:57 +02:00
}
2006-11-01 16:15:14 +01:00
/*
2008-12-07 16:55:40 +01:00
* View
2008-11-16 19:55:00 +01:00
*/
2005-01-03 20:21:51 +01:00
2016-03-01 00:59:42 +01:00
if ( ! is_object ( $form )) $form = new Form ( $db );
2014-01-26 18:30:45 +01:00
// Title
$title = $langs -> trans ( " HomeArea " ) . ' - Dolibarr ' . DOL_VERSION ;
if ( ! empty ( $conf -> global -> MAIN_APPLICATION_TITLE )) $title = $langs -> trans ( " HomeArea " ) . ' - ' . $conf -> global -> MAIN_APPLICATION_TITLE ;
llxHeader ( '' , $title );
2003-02-11 14:24:02 +01:00
2017-06-01 01:53:55 +02:00
2017-03-09 13:22:43 +01:00
$resultboxes = FormOther :: getBoxesArea ( $user , " 0 " ); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb)
2016-01-18 11:35:45 +01:00
print load_fiche_titre ( $langs -> trans ( " HomeArea " ), $resultboxes [ 'selectboxlist' ], 'title_home' );
2005-08-12 00:57:29 +02:00
2008-06-14 12:39:00 +02:00
if ( ! empty ( $conf -> global -> MAIN_MOTD ))
2004-07-26 16:38:34 +02:00
{
2011-07-08 17:35:08 +02:00
$conf -> global -> MAIN_MOTD = preg_replace ( '/<br(\s[\sa-zA-Z_="]*)?\/?>/i' , '<br>' , $conf -> global -> MAIN_MOTD );
if ( ! empty ( $conf -> global -> MAIN_MOTD ))
{
2017-06-01 01:53:55 +02:00
$substitutionarray = getCommonSubstitutionArray ( $langs );
complete_substitutions_array ( $substitutionarray , $langs );
$texttoshow = make_substitutions ( $conf -> global -> MAIN_MOTD , $substitutionarray , $langs );
2013-07-02 21:53:34 +02:00
2011-07-08 17:35:08 +02:00
print " \n <!-- Start of welcome text --> \n " ;
print '<table width="100%" class="notopnoleftnoright"><tr><td>' ;
2017-06-01 01:53:55 +02:00
print dol_htmlentitiesbr ( $texttoshow );
2011-07-08 17:35:08 +02:00
print '</td></tr></table><br>' ;
print " \n <!-- End of welcome text --> \n " ;
}
2004-07-26 16:38:34 +02:00
}
2005-08-12 00:57:29 +02:00
2011-08-18 00:13:26 +02:00
print '<div class="fichecenter"><div class="fichethirdleft">' ;
2005-08-12 00:57:29 +02:00
2005-08-12 23:45:18 +02:00
/*
2010-02-16 23:26:44 +01:00
* Dashboard Dolibarr states ( statistics )
2009-08-23 02:15:30 +02:00
* Hidden for external users
2005-08-12 23:45:18 +02:00
*/
2016-02-07 13:10:36 +01:00
$boxstat = '' ;
2005-12-02 14:33:20 +01:00
$langs -> load ( " commercial " );
2007-07-08 18:30:51 +02:00
$langs -> load ( " bills " );
2010-12-01 22:28:08 +01:00
$langs -> load ( " orders " );
2013-07-03 16:49:54 +02:00
$langs -> load ( " contracts " );
2010-12-01 22:28:08 +01:00
2013-07-19 15:29:40 +02:00
if ( empty ( $user -> societe_id ))
2005-08-12 23:45:18 +02:00
{
2016-02-07 13:10:36 +01:00
$boxstat .= '<div class="box">' ;
2017-11-11 00:28:00 +01:00
$boxstat .= '<table summary="' . dol_escape_htmltag ( $langs -> trans ( " DolibarrStateBoard " )) . '" class="noborder boxtable boxtablenobottom nohover" width="100%">' ;
2016-02-07 13:10:36 +01:00
$boxstat .= '<tr class="liste_titre">' ;
$boxstat .= '<th class="liste_titre">' . $langs -> trans ( " DolibarrStateBoard " ) . '</th>' ;
$boxstat .= '</tr>' ;
2017-03-03 13:30:02 +01:00
$boxstat .= '<tr class="impair"><td class="tdboxstats nohover flexcontainer">' ;
2011-07-08 17:35:08 +02:00
2013-01-19 14:32:37 +01:00
$object = new stdClass ();
2011-12-06 23:38:54 +01:00
$parameters = array ();
$action = '' ;
$reshook = $hookmanager -> executeHooks ( 'addStatisticLine' , $parameters , $object , $action ); // Note that $action and $object may have been modified by some hooks
2016-03-25 17:15:08 +01:00
$boxstat .= $hookmanager -> resPrint ;
2017-06-01 01:53:55 +02:00
2013-07-19 15:29:40 +02:00
if ( empty ( $reshook ))
{
// Condition to be checked for each display line dashboard
$conditions = array (
2015-12-05 19:31:32 +01:00
$user -> rights -> user -> user -> lire ,
2016-01-14 12:49:23 +01:00
! empty ( $conf -> societe -> enabled ) && $user -> rights -> societe -> lire && empty ( $conf -> global -> SOCIETE_DISABLE_CUSTOMERS ) && empty ( $conf -> global -> SOCIETE_DISABLE_CUSTOMERS_STATS ),
! empty ( $conf -> societe -> enabled ) && $user -> rights -> societe -> lire && empty ( $conf -> global -> SOCIETE_DISABLE_PROSPECTS ) && empty ( $conf -> global -> SOCIETE_DISABLE_PROSPECTS_STATS ),
2013-07-19 15:29:40 +02:00
! empty ( $conf -> fournisseur -> enabled ) && $user -> rights -> fournisseur -> lire && empty ( $conf -> global -> SOCIETE_DISABLE_SUPPLIERS_STATS ),
2016-04-23 13:06:46 +02:00
! empty ( $conf -> societe -> enabled ) && $user -> rights -> societe -> contact -> lire ,
2013-07-19 15:29:40 +02:00
! empty ( $conf -> adherent -> enabled ) && $user -> rights -> adherent -> lire ,
! empty ( $conf -> product -> enabled ) && $user -> rights -> produit -> lire ,
! empty ( $conf -> service -> enabled ) && $user -> rights -> service -> lire ,
! empty ( $conf -> propal -> enabled ) && $user -> rights -> propale -> lire ,
! empty ( $conf -> commande -> enabled ) && $user -> rights -> commande -> lire ,
! empty ( $conf -> facture -> enabled ) && $user -> rights -> facture -> lire ,
2016-12-03 18:20:57 +01:00
! empty ( $conf -> contrat -> enabled ) && $user -> rights -> contrat -> lire ,
2016-04-23 13:16:19 +02:00
! empty ( $conf -> ficheinter -> enabled ) && $user -> rights -> ficheinter -> lire ,
2016-01-14 13:30:27 +01:00
! empty ( $conf -> supplier_order -> enabled ) && $user -> rights -> fournisseur -> commande -> lire && empty ( $conf -> global -> SOCIETE_DISABLE_SUPPLIERS_ORDERS_STATS ),
! empty ( $conf -> supplier_invoice -> enabled ) && $user -> rights -> fournisseur -> facture -> lire && empty ( $conf -> global -> SOCIETE_DISABLE_SUPPLIERS_INVOICES_STATS ),
2016-03-04 16:08:51 +01:00
! empty ( $conf -> supplier_proposal -> enabled ) && $user -> rights -> supplier_proposal -> lire && empty ( $conf -> global -> SOCIETE_DISABLE_SUPPLIERS_PROPOSAL_STATS ),
2017-01-26 18:08:00 +01:00
! empty ( $conf -> projet -> enabled ) && $user -> rights -> projet -> lire ,
2017-03-07 22:31:34 +01:00
! empty ( $conf -> expensereport -> enabled ) && $user -> rights -> expensereport -> lire ,
! empty ( $conf -> don -> enabled ) && $user -> rights -> don -> lire
2016-02-28 00:19:12 +01:00
);
2013-07-19 15:29:40 +02:00
// Class file containing the method load_state_board for each line
2015-12-05 19:31:32 +01:00
$includes = array (
DOL_DOCUMENT_ROOT . " /user/class/user.class.php " ,
DOL_DOCUMENT_ROOT . " /societe/class/client.class.php " ,
DOL_DOCUMENT_ROOT . " /societe/class/client.class.php " ,
DOL_DOCUMENT_ROOT . " /fourn/class/fournisseur.class.php " ,
2016-04-23 13:06:46 +02:00
DOL_DOCUMENT_ROOT . " /contact/class/contact.class.php " ,
2015-12-05 19:31:32 +01:00
DOL_DOCUMENT_ROOT . " /adherents/class/adherent.class.php " ,
DOL_DOCUMENT_ROOT . " /product/class/product.class.php " ,
2017-06-06 07:57:03 +02:00
DOL_DOCUMENT_ROOT . " /product/class/product.class.php " ,
2015-12-05 19:31:32 +01:00
DOL_DOCUMENT_ROOT . " /comm/propal/class/propal.class.php " ,
DOL_DOCUMENT_ROOT . " /commande/class/commande.class.php " ,
DOL_DOCUMENT_ROOT . " /compta/facture/class/facture.class.php " ,
DOL_DOCUMENT_ROOT . " /contrat/class/contrat.class.php " ,
2016-04-23 13:16:19 +02:00
DOL_DOCUMENT_ROOT . " /fichinter/class/fichinter.class.php " ,
2015-12-05 19:31:32 +01:00
DOL_DOCUMENT_ROOT . " /fourn/class/fournisseur.commande.class.php " ,
DOL_DOCUMENT_ROOT . " /fourn/class/fournisseur.facture.class.php " ,
2016-03-04 16:08:51 +01:00
DOL_DOCUMENT_ROOT . " /supplier_proposal/class/supplier_proposal.class.php " ,
2017-06-01 01:53:55 +02:00
DOL_DOCUMENT_ROOT . " /projet/class/project.class.php " ,
2017-03-07 22:31:34 +01:00
DOL_DOCUMENT_ROOT . " /expensereport/class/expensereport.class.php " ,
DOL_DOCUMENT_ROOT . " /don/class/don.class.php "
2016-02-28 00:19:12 +01:00
);
2013-07-19 15:29:40 +02:00
// Name class containing the method load_state_board for each line
2015-12-05 19:31:32 +01:00
$classes = array ( 'User' ,
'Client' ,
2015-05-06 23:13:07 +02:00
'Client' ,
2013-07-19 15:29:40 +02:00
'Fournisseur' ,
2016-04-23 13:06:46 +02:00
'Contact' ,
2013-07-19 15:29:40 +02:00
'Adherent' ,
'Product' ,
2017-02-28 12:35:55 +01:00
'Product' ,
2014-10-25 17:22:03 +02:00
'Propal' ,
'Commande' ,
'Facture' ,
'Contrat' ,
2016-04-23 13:16:19 +02:00
'Fichinter' ,
2014-10-25 17:22:03 +02:00
'CommandeFournisseur' ,
2015-08-17 05:29:12 +02:00
'FactureFournisseur' ,
2016-03-04 16:08:51 +01:00
'SupplierProposal' ,
2017-01-26 18:08:00 +01:00
'Project' ,
2017-03-07 22:31:34 +01:00
'ExpenseReport' ,
'Don'
2016-02-28 00:19:12 +01:00
);
2013-07-19 15:29:40 +02:00
// Cle array returned by the method load_state_board for each line
2015-12-05 19:31:32 +01:00
$keys = array ( 'users' ,
'customers' ,
2013-07-19 15:29:40 +02:00
'prospects' ,
'suppliers' ,
2016-04-23 13:06:46 +02:00
'contacts' ,
2013-07-19 15:29:40 +02:00
'members' ,
'products' ,
'services' ,
2014-10-25 17:22:03 +02:00
'proposals' ,
'orders' ,
'invoices' ,
'Contracts' ,
2016-04-23 13:16:19 +02:00
'fichinters' ,
2014-10-25 17:22:03 +02:00
'supplier_orders' ,
2015-08-17 05:29:12 +02:00
'supplier_invoices' ,
2016-03-04 16:08:51 +01:00
'askprice' ,
2017-01-26 18:08:00 +01:00
'projects' ,
2017-03-07 22:31:34 +01:00
'expensereports' ,
'donations'
2016-02-28 00:19:12 +01:00
);
2013-07-19 15:29:40 +02:00
// Dashboard Icon lines
2015-12-05 19:31:32 +01:00
$icons = array ( 'user' ,
'company' ,
2013-07-19 15:29:40 +02:00
'company' ,
'company' ,
2016-04-23 13:06:46 +02:00
'contact' ,
2013-07-19 15:29:40 +02:00
'user' ,
'product' ,
'service' ,
2014-10-25 17:22:03 +02:00
'propal' ,
'order' ,
'bill' ,
'order' ,
'order' ,
2016-04-23 13:16:19 +02:00
'order' ,
2015-08-17 05:29:12 +02:00
'bill' ,
2016-03-04 16:08:51 +01:00
'propal' ,
2017-03-21 13:39:42 +01:00
'projectpub' ,
2017-03-07 22:31:34 +01:00
'trip' ,
'generic'
2016-02-28 00:19:12 +01:00
);
2013-07-19 15:29:40 +02:00
// Translation keyword
2015-12-05 19:31:32 +01:00
$titres = array ( " Users " ,
" ThirdPartyCustomersStats " ,
2013-07-19 15:29:40 +02:00
" ThirdPartyProspectsStats " ,
" Suppliers " ,
2016-04-23 13:06:46 +02:00
" Contacts " ,
2013-07-19 15:29:40 +02:00
" Members " ,
" Products " ,
" Services " ,
2013-07-25 10:20:41 +02:00
" CommercialProposalsShort " ,
2013-07-19 15:29:40 +02:00
" CustomersOrders " ,
" BillsCustomers " ,
2014-10-25 17:22:03 +02:00
" Contracts " ,
2016-04-23 13:16:19 +02:00
" Interventions " ,
2014-10-25 17:22:03 +02:00
" SuppliersOrders " ,
2016-03-04 16:08:51 +01:00
" SuppliersInvoices " ,
" SupplierProposalShort " ,
2017-01-26 18:08:00 +01:00
" Projects " ,
2017-03-07 22:31:34 +01:00
" ExpenseReports " ,
" Donations "
2016-02-28 00:19:12 +01:00
);
2013-07-19 15:29:40 +02:00
// Dashboard Link lines
2015-10-23 13:52:51 +02:00
$links = array (
2018-04-06 00:36:52 +02:00
DOL_URL_ROOT . '/user/list.php' ,
2017-10-16 20:16:30 +02:00
DOL_URL_ROOT . '/societe/list.php?type=c&mainmenu=companies' ,
DOL_URL_ROOT . '/societe/list.php?type=p&mainmenu=companies' ,
DOL_URL_ROOT . '/societe/list.php?type=f&mainmenu=companies' ,
DOL_URL_ROOT . '/contact/list.php?mainmenu=companies' ,
2015-12-05 19:31:32 +01:00
DOL_URL_ROOT . '/adherents/list.php?statut=1&mainmenu=members' ,
DOL_URL_ROOT . '/product/list.php?type=0&mainmenu=products' ,
DOL_URL_ROOT . '/product/list.php?type=1&mainmenu=products' ,
2017-10-16 20:20:55 +02:00
DOL_URL_ROOT . '/comm/propal/list.php?mainmenu=commercial&leftmenu=propals' ,
DOL_URL_ROOT . '/commande/list.php?mainmenu=commercial&leftmenu=orders' ,
DOL_URL_ROOT . '/compta/facture/list.php?mainmenu=accountancy&leftmenu=customers_bills' ,
DOL_URL_ROOT . '/contrat/list.php?mainmenu=commercial&leftmenu=contracts' ,
DOL_URL_ROOT . '/fichinter/list.php?mainmenu=commercial&leftmenu=ficheinter' ,
DOL_URL_ROOT . '/fourn/commande/list.php?mainmenu=commercial&leftmenu=orders_suppliers' ,
DOL_URL_ROOT . '/fourn/facture/list.php?mainmenu=accountancy&leftmenu=suppliers_bills' ,
DOL_URL_ROOT . '/supplier_proposal/list.php?mainmenu=commercial&leftmenu=' ,
2017-01-26 18:08:00 +01:00
DOL_URL_ROOT . '/projet/list.php?mainmenu=project' ,
2017-10-22 01:30:25 +02:00
DOL_URL_ROOT . '/expensereport/list.php?mainmenu=hrm&leftmenu=expensereport' ,
2017-03-07 22:31:34 +01:00
DOL_URL_ROOT . '/don/list.php?leftmenu=donations'
2016-02-28 00:19:12 +01:00
);
2013-07-19 15:29:40 +02:00
// Translation lang files
2015-12-05 19:31:32 +01:00
$langfile = array ( " users " ,
" companies " ,
2013-07-19 15:29:40 +02:00
" prospects " ,
" suppliers " ,
2016-04-23 13:06:46 +02:00
" companies " ,
2013-07-19 15:29:40 +02:00
" members " ,
" products " ,
2017-02-28 12:24:07 +01:00
" products " ,
2013-07-19 15:29:40 +02:00
" propal " ,
" orders " ,
2016-03-04 16:08:51 +01:00
" bills " ,
2015-08-17 05:29:12 +02:00
" contracts " ,
2016-04-23 13:16:19 +02:00
" interventions " ,
2017-02-28 21:15:39 +01:00
" bills " ,
" bills " ,
" supplier_proposal " ,
2017-01-26 18:08:00 +01:00
" projects " ,
2017-03-07 22:31:34 +01:00
" trips " ,
" donations "
2016-02-28 00:19:12 +01:00
);
2013-07-19 15:29:40 +02:00
// Loop and displays each line of table
foreach ( $keys as $key => $val )
{
if ( $conditions [ $key ])
{
$classe = $classes [ $key ];
// Search in cache if load_state_board is already realized
if ( ! isset ( $boardloaded [ $classe ]) || ! is_object ( $boardloaded [ $classe ]))
{
include_once $includes [ $key ]; // Loading a class cost around 1Mb
$board = new $classe ( $db );
$board -> load_state_board ( $user );
$boardloaded [ $classe ] = $board ;
}
2017-06-01 01:53:55 +02:00
else
2017-02-28 12:35:55 +01:00
{
$board = $boardloaded [ $classe ];
}
2013-07-19 15:29:40 +02:00
2017-06-01 01:53:55 +02:00
2015-06-10 18:58:42 +02:00
if ( ! empty ( $langfile [ $key ])) $langs -> load ( $langfile [ $key ]);
2014-01-26 18:30:45 +01:00
$text = $langs -> trans ( $titres [ $key ]);
2017-09-04 09:25:53 +02:00
//$sep=($conf->dol_use_jmobile?'<br>':' ');
2016-02-07 13:10:36 +01:00
$boxstat .= '<a href="' . $links [ $key ] . '" class="boxstatsindicator thumbstat nobold nounderline">' ;
$boxstat .= '<div class="boxstats">' ;
2017-09-04 09:25:53 +02:00
$boxstat .= '<span class="boxstatstext" title="' . dol_escape_htmltag ( $text ) . '">' . $text . '</span><br>' ;
$boxstat .= '<span class="boxstatsindicator">' . img_object ( " " , $icons [ $key ], 'class="inline-block"' ) . ' ' . ( $board -> nb [ $val ] ? $board -> nb [ $val ] : 0 ) . '</span>' ;
2016-02-07 13:10:36 +01:00
$boxstat .= '</div>' ;
$boxstat .= '</a>' ;
2013-07-19 15:29:40 +02:00
}
}
}
2018-03-04 10:47:35 +01:00
$boxstat .= '<a class="boxstatsindicator thumbstat nobold nounderline"><div class="boxstatsempty"></div></a>' ;
$boxstat .= '<a class="boxstatsindicator thumbstat nobold nounderline"><div class="boxstatsempty"></div></a>' ;
$boxstat .= '<a class="boxstatsindicator thumbstat nobold nounderline"><div class="boxstatsempty"></div></a>' ;
$boxstat .= '<a class="boxstatsindicator thumbstat nobold nounderline"><div class="boxstatsempty"></div></a>' ;
$boxstat .= '<a class="boxstatsindicator thumbstat nobold nounderline"><div class="boxstatsempty"></div></a>' ;
$boxstat .= '<a class="boxstatsindicator thumbstat nobold nounderline"><div class="boxstatsempty"></div></a>' ;
$boxstat .= '<a class="boxstatsindicator thumbstat nobold nounderline"><div class="boxstatsempty"></div></a>' ;
$boxstat .= '<a class="boxstatsindicator thumbstat nobold nounderline"><div class="boxstatsempty"></div></a>' ;
2017-06-01 01:53:55 +02:00
2016-02-07 13:10:36 +01:00
$boxstat .= '</td></tr>' ;
$boxstat .= '</table>' ;
$boxstat .= '</div>' ;
2005-08-12 23:45:18 +02:00
}
2016-02-07 14:22:52 +01:00
//print $boxstat;
2005-08-12 23:45:18 +02:00
2011-08-18 00:13:26 +02:00
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">' ;
2005-08-12 00:57:29 +02:00
/*
2010-11-13 17:59:53 +01:00
* Dolibarr Working Board with weather
2005-08-12 00:57:29 +02:00
*/
2010-12-01 22:28:08 +01:00
$showweather = empty ( $conf -> global -> MAIN_DISABLE_METEO ) ? 1 : 0 ;
2015-02-15 15:01:28 +01:00
2015-02-16 23:49:07 +01:00
//Array that contains all WorkboardResponse classes to process them
2010-11-13 17:59:53 +01:00
$dashboardlines = array ();
2010-02-16 23:26:44 +01:00
// Do not include sections without management permission
2017-12-06 14:22:37 +01:00
require_once DOL_DOCUMENT_ROOT . '/core/class/workboardresponse.class.php' ;
2015-02-15 15:01:28 +01:00
2010-11-13 17:59:53 +01:00
// Number of actions to do (late)
2012-09-15 11:21:22 +02:00
if ( ! empty ( $conf -> agenda -> enabled ) && $user -> rights -> agenda -> myactions -> read )
2007-10-05 20:37:34 +02:00
{
2017-09-27 15:21:36 +02:00
include_once DOL_DOCUMENT_ROOT . '/comm/action/class/actioncomm.class.php' ;
$board = new ActionComm ( $db );
2015-02-23 14:59:24 +01:00
2017-09-27 15:21:36 +02:00
$dashboardlines [] = $board -> load_board ( $user );
2007-10-05 20:37:34 +02:00
}
2005-09-05 10:54:52 +02:00
2016-01-18 15:56:51 +01:00
// Number of project opened
if ( ! empty ( $conf -> projet -> enabled ) && $user -> rights -> projet -> lire )
2005-08-12 00:57:29 +02:00
{
2017-09-27 15:21:36 +02:00
include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php' ;
$board = new Project ( $db );
$dashboardlines [] = $board -> load_board ( $user );
2007-10-05 20:37:34 +02:00
}
2005-08-12 00:57:29 +02:00
2016-01-18 15:56:51 +01:00
// Number of tasks to do (late)
if ( ! empty ( $conf -> projet -> enabled ) && empty ( $conf -> global -> PROJECT_HIDE_TASKS ) && $user -> rights -> projet -> lire )
2010-11-13 18:37:22 +01:00
{
2017-09-27 15:21:36 +02:00
include_once DOL_DOCUMENT_ROOT . '/projet/class/task.class.php' ;
$board = new Task ( $db );
$dashboardlines [] = $board -> load_board ( $user );
2010-11-13 18:37:22 +01:00
}
2010-11-13 17:59:53 +01:00
// Number of commercial proposals opened (expired)
2012-09-15 11:21:22 +02:00
if ( ! empty ( $conf -> propal -> enabled ) && $user -> rights -> propale -> lire )
2007-10-05 20:37:34 +02:00
{
2017-09-27 15:21:36 +02:00
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 " );
2016-03-04 16:08:51 +01:00
}
// Number of commercial proposals opened (expired)
if ( ! empty ( $conf -> supplier_proposal -> enabled ) && $user -> rights -> supplier_proposal -> lire )
{
2017-09-27 15:21:36 +02:00
include_once DOL_DOCUMENT_ROOT . '/supplier_proposal/class/supplier_proposal.class.php' ;
$board = new SupplierProposal ( $db );
$dashboardlines [] = $board -> load_board ( $user , " opened " );
// Number of commercial proposals CLOSED signed (billed)
$dashboardlines [] = $board -> load_board ( $user , " signed " );
2007-10-05 20:37:34 +02:00
}
2005-08-12 00:57:29 +02:00
2016-01-18 15:56:51 +01:00
// Number of customer orders a deal
if ( ! empty ( $conf -> commande -> enabled ) && $user -> rights -> commande -> lire )
{
2017-09-27 15:21:36 +02:00
include_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php' ;
$board = new Commande ( $db );
2016-01-18 15:56:51 +01:00
$dashboardlines [] = $board -> load_board ( $user );
}
// Number of suppliers orders a deal
if ( ! empty ( $conf -> supplier_order -> enabled ) && $user -> rights -> fournisseur -> commande -> lire )
{
2017-09-27 15:21:36 +02:00
include_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.commande.class.php' ;
$board = new CommandeFournisseur ( $db );
2016-01-18 15:56:51 +01:00
$dashboardlines [] = $board -> load_board ( $user );
}
2010-11-13 17:59:53 +01:00
// Number of services enabled (delayed)
2012-09-15 11:21:22 +02:00
if ( ! empty ( $conf -> contrat -> enabled ) && $user -> rights -> contrat -> lire )
2007-10-05 20:37:34 +02:00
{
2017-09-27 15:21:36 +02:00
include_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php' ;
$board = new Contrat ( $db );
$dashboardlines [] = $board -> load_board ( $user , " inactives " );
2015-02-15 15:01:28 +01:00
// Number of active services (expired)
2017-09-27 15:21:36 +02:00
$dashboardlines [] = $board -> load_board ( $user , " expired " );
2007-10-05 20:37:34 +02:00
}
2010-11-13 17:59:53 +01:00
// Number of invoices customers (has paid)
2012-09-15 11:21:22 +02:00
if ( ! empty ( $conf -> facture -> enabled ) && $user -> rights -> facture -> lire )
2007-10-05 20:37:34 +02:00
{
2017-09-27 15:21:36 +02:00
include_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php' ;
$board = new Facture ( $db );
$dashboardlines [] = $board -> load_board ( $user );
2007-10-05 20:37:34 +02:00
}
2005-08-12 00:57:29 +02:00
2010-11-13 18:37:22 +01:00
// Number of supplier invoices (has paid)
2017-07-25 13:36:57 +02:00
if ( ! empty ( $conf -> supplier_invoice -> enabled ) && ! empty ( $user -> rights -> fournisseur -> facture -> lire ))
2010-11-13 18:37:22 +01:00
{
2017-09-27 15:21:36 +02:00
include_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php' ;
$board = new FactureFournisseur ( $db );
$dashboardlines [] = $board -> load_board ( $user );
2010-11-13 18:37:22 +01:00
}
2010-11-13 17:59:53 +01:00
// Number of transactions to conciliate
2012-09-15 11:21:22 +02:00
if ( ! empty ( $conf -> banque -> enabled ) && $user -> rights -> banque -> lire && ! $user -> societe_id )
2007-10-05 20:37:34 +02:00
{
2017-09-27 15:21:36 +02:00
include_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php' ;
$board = new Account ( $db );
$nb = $board :: countAccountToReconcile (); // Get nb of account to reconciliate
if ( $nb > 0 )
{
$dashboardlines [] = $board -> load_board ( $user );
}
2007-10-05 20:37:34 +02:00
}
2005-08-12 00:57:29 +02:00
2010-11-13 17:59:53 +01:00
// Number of cheque to send
2016-05-27 10:38:15 +02:00
if ( ! empty ( $conf -> banque -> enabled ) && $user -> rights -> banque -> lire && ! $user -> societe_id && empty ( $conf -> global -> BANK_DISABLE_CHECK_DEPOSIT ))
2007-10-05 20:37:34 +02:00
{
2017-09-27 15:21:36 +02:00
include_once DOL_DOCUMENT_ROOT . '/compta/paiement/cheque/class/remisecheque.class.php' ;
$board = new RemiseCheque ( $db );
$dashboardlines [] = $board -> load_board ( $user );
2007-10-05 20:37:34 +02:00
}
2005-08-12 00:57:29 +02:00
2010-11-13 17:59:53 +01:00
// Number of foundation members
2012-09-15 11:21:22 +02:00
if ( ! empty ( $conf -> adherent -> enabled ) && $user -> rights -> adherent -> lire && ! $user -> societe_id )
2007-10-05 20:37:34 +02:00
{
2017-09-27 15:21:36 +02:00
include_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php' ;
$board = new Adherent ( $db );
$dashboardlines [] = $board -> load_board ( $user );
2005-09-13 11:29:50 +02:00
}
2005-08-12 00:57:29 +02:00
2016-01-18 11:35:45 +01:00
// Number of expense reports to approve
if ( ! empty ( $conf -> expensereport -> enabled ) && $user -> rights -> expensereport -> approve )
{
2017-09-27 15:21:36 +02:00
include_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php' ;
$board = new ExpenseReport ( $db );
2016-01-18 11:35:45 +01:00
$dashboardlines [] = $board -> load_board ( $user , 'toapprove' );
}
2015-08-17 05:29:12 +02:00
// Number of expense reports to pay
2016-01-18 11:35:45 +01:00
if ( ! empty ( $conf -> expensereport -> enabled ) && $user -> rights -> expensereport -> to_paid )
2015-08-17 05:29:12 +02:00
{
2017-09-27 15:21:36 +02:00
include_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php' ;
$board = new ExpenseReport ( $db );
2016-01-18 11:35:45 +01:00
$dashboardlines [] = $board -> load_board ( $user , 'topay' );
2015-08-17 05:29:12 +02:00
}
2017-12-06 12:31:00 +01:00
$object = new stdClass ();
$parameters = array ();
$action = '' ;
$reshook = $hookmanager -> executeHooks ( 'addOpenElementsDashboardLine' , $parameters , $object , $action ); // Note that $action and $object may have been modified by some hooks
if ( $reshook == 0 ) {
$dashboardlines = array_merge ( $dashboardlines , $hookmanager -> resArray );
}
2010-11-13 17:59:53 +01:00
// Calculate total nb of late
2017-09-27 15:21:36 +02:00
$totallate = $totaltodo = 0 ;
2015-02-15 15:01:28 +01:00
2015-02-15 15:10:51 +01:00
//Remove any invalid response
2015-02-16 23:49:07 +01:00
//load_board can return an integer if failed or WorkboardResponse if OK
2015-03-20 15:19:42 +01:00
$valid_dashboardlines = array ();
foreach ( $dashboardlines as $tmp )
{
if ( $tmp instanceof WorkboardResponse ) $valid_dashboardlines [] = $tmp ;
}
2015-02-15 15:01:28 +01:00
2015-11-21 00:43:35 +01:00
// We calculate $totallate. Must be defined before start of next loop because it is show in first fetch on next loop
2015-02-15 15:01:28 +01:00
foreach ( $valid_dashboardlines as $board )
2008-03-31 00:25:39 +02:00
{
2015-02-15 15:01:28 +01:00
if ( $board -> nbtodolate > 0 ) {
2017-09-27 15:21:36 +02:00
if ( ! empty ( $conf -> global -> MAIN_USE_METEO_WITH_PERCENTAGE )) $totaltodo += $board -> nbtodo ;
2015-02-15 15:01:28 +01:00
$totallate += $board -> nbtodolate ;
}
2015-11-21 00:43:35 +01:00
}
2017-09-27 15:21:36 +02:00
//var_dump($totallate, $totaltodo);
if ( ! empty ( $conf -> global -> MAIN_USE_METEO_WITH_PERCENTAGE )) $totallate = round ( $totallate / $totaltodo * 100 , 2 );
2017-09-25 17:13:50 +02:00
//var_dump($totallate);
2017-03-03 16:55:22 +01:00
$boxwork = '' ;
$boxwork .= '<div class="box">' ;
2017-11-26 22:23:21 +01:00
$boxwork .= '<table summary="' . dol_escape_htmltag ( $langs -> trans ( " WorkingBoard " )) . '" class="noborder boxtable boxtablenobottom boxworkingboard" width="100%">' . " \n " ;
2017-03-03 16:55:22 +01:00
$boxwork .= '<tr class="liste_titre">' ;
$boxwork .= '<th class="liste_titre">' . $langs -> trans ( " DolibarrWorkBoard " ) . '</th>' ;
$boxwork .= '</tr>' . " \n " ;
if ( $showweather )
2015-11-21 00:43:35 +01:00
{
2017-03-07 22:45:22 +01:00
$boxwork .= '<tr class="nohover">' ;
2017-03-23 19:26:28 +01:00
$boxwork .= '<td class="nohover hideonsmartphone center valignmiddle">' ;
2017-03-03 16:55:22 +01:00
$text = '' ;
2017-09-27 15:21:36 +02:00
if ( $totallate > 0 ) $text = $langs -> transnoentitiesnoconv ( " WarningYouHaveAtLeastOneTaskLate " ) . ' (' . $langs -> transnoentitiesnoconv ( " NActionsLate " , $totallate . ( ! empty ( $conf -> global -> MAIN_USE_METEO_WITH_PERCENTAGE ) ? '%' : '' )) . ')' ;
2017-03-23 19:48:34 +01:00
$text .= '. ' . $langs -> trans ( " LateDesc " );
//$text.=$form->textwithpicto('',$langs->trans("LateDesc"));
2017-03-03 16:55:22 +01:00
$options = 'height="64px"' ;
$boxwork .= showWeather ( $totallate , $text , $options );
$boxwork .= '</td>' ;
2017-03-23 19:48:34 +01:00
$boxwork .= '</tr>' ;
2017-03-03 16:55:22 +01:00
}
2015-11-21 00:43:35 +01:00
// Show dashboard
2017-03-07 22:45:22 +01:00
$nbworkboardempty = 0 ;
2017-03-14 14:33:25 +01:00
if ( ! empty ( $valid_dashboardlines ))
2015-11-21 00:43:35 +01:00
{
2017-08-20 16:21:07 +02:00
$boxwork .= '<tr class="nohover"><td class="tdboxstats nohover flexcontainer centpercent">' ;
2017-03-14 14:33:25 +01:00
foreach ( $valid_dashboardlines as $board )
2010-11-13 17:59:53 +01:00
{
2017-12-06 12:13:15 +01:00
if ( empty ( $board -> nbtodo )) $nbworkboardempty ++ ;
2017-03-23 19:26:28 +01:00
2017-03-14 14:33:25 +01:00
$textlate = $langs -> trans ( " NActionsLate " , $board -> nbtodolate );
$textlate .= ' (' . $langs -> trans ( " Late " ) . ' = ' . $langs -> trans ( " DateReference " ) . ' > ' . $langs -> trans ( " DateToday " ) . ' ' . ( ceil ( $board -> warning_delay ) >= 0 ? '+' : '' ) . ceil ( $board -> warning_delay ) . ' ' . $langs -> trans ( " days " ) . ')' ;
2017-06-01 01:53:55 +02:00
2017-03-23 19:26:28 +01:00
$boxwork .= '<div class="boxstatsindicator thumbstat150 nobold nounderline"><div class="boxstats130 boxstatsborder">' ;
$boxwork .= '<div class="boxstatscontent">' ;
2017-09-04 09:25:53 +02:00
$sep = ( $conf -> dol_use_jmobile ? '<br>' : ' ' );
2017-03-28 10:44:52 +02:00
$boxwork .= '<span class="boxstatstext" title="' . dol_escape_htmltag ( $board -> label ) . '">' . $board -> img . ' ' . $board -> label . '</span><br>' ;
2017-03-23 19:26:28 +01:00
$boxwork .= '<a class="valignmiddle dashboardlineindicator" href="' . $board -> url . '"><span class="dashboardlineindicator' . (( $board -> nbtodo == 0 ) ? ' dashboardlineok' : '' ) . '">' . $board -> nbtodo . '</span></a>' ;
$boxwork .= '</div>' ;
if ( $board -> nbtodolate > 0 )
2017-03-14 14:33:25 +01:00
{
2017-03-23 19:26:28 +01:00
$boxwork .= '<div class="dashboardlinelatecoin nowrap">' ;
$boxwork .= '<a title="' . dol_escape_htmltag ( $textlate ) . '" class="valignmiddle dashboardlineindicatorlate' . ( $board -> nbtodolate > 0 ? ' dashboardlineko' : ' dashboardlineok' ) . '" href="' . (( ! $board -> url_late ) ? $board -> url : $board -> url_late ) . '">' ;
2017-03-28 12:47:48 +02:00
//$boxwork .= img_picto($textlate, "warning_white", 'class="valigntextbottom"').'';
2017-09-04 09:25:53 +02:00
$boxwork .= img_picto ( $textlate , " warning_white " , 'class="inline-block hideonsmartphone valigntextbottom"' ) . '' ;
2017-03-23 19:26:28 +01:00
$boxwork .= '<span class="dashboardlineindicatorlate' . ( $board -> nbtodolate > 0 ? ' dashboardlineko' : ' dashboardlineok' ) . '">' ;
$boxwork .= $board -> nbtodolate ;
$boxwork .= '</span>' ;
$boxwork .= '</a>' ;
$boxwork .= '</div>' ;
}
$boxwork .= '</div></div>' ;
2017-03-14 14:33:25 +01:00
$boxwork .= " \n " ;
}
2017-06-01 01:53:55 +02:00
2018-03-04 10:47:35 +01:00
$boxwork .= '<div class="boxstatsindicator thumbstat150 nobold nounderline"><div class="boxstats150empty"></div></div>' ;
$boxwork .= '<div class="boxstatsindicator thumbstat150 nobold nounderline"><div class="boxstats150empty"></div></div>' ;
$boxwork .= '<div class="boxstatsindicator thumbstat150 nobold nounderline"><div class="boxstats150empty"></div></div>' ;
$boxwork .= '<div class="boxstatsindicator thumbstat150 nobold nounderline"><div class="boxstats150empty"></div></div>' ;
$boxwork .= '<div class="boxstatsindicator thumbstat150 nobold nounderline"><div class="boxstats150empty"></div></div>' ;
$boxwork .= '<div class="boxstatsindicator thumbstat150 nobold nounderline"><div class="boxstats150empty"></div></div>' ;
2017-08-20 16:21:07 +02:00
$boxwork .= '</td></tr>' ;
2017-03-14 14:33:25 +01:00
}
else
{
$boxwork .= '<tr class="nohover">' ;
2017-08-20 16:21:07 +02:00
$boxwork .= '<td class="nohover valignmiddle opacitymedium">' ;
2017-03-14 14:33:25 +01:00
$boxwork .= $langs -> trans ( " NoOpenedElementToProcess " );
$boxwork .= '</td>' ;
$boxwork .= '</tr>' ;
2008-03-31 00:25:39 +02:00
}
2017-03-23 19:26:28 +01:00
$boxwork .= '</td></tr>' ;
2016-02-07 13:10:36 +01:00
$boxwork .= '</table>' ; // End table array of working board
2016-02-07 14:22:52 +01:00
$boxwork .= '</div>' ;
2016-02-07 13:10:36 +01:00
print '</div></div></div><div class="clearboth"></div>' ;
2010-11-13 17:59:53 +01:00
2016-02-07 13:10:36 +01:00
print '<div class="fichecenter fichecenterbis">' ;
2010-11-13 17:59:53 +01:00
2002-04-29 19:53:37 +02:00
2003-02-13 17:58:48 +01:00
/*
2008-12-07 16:55:40 +01:00
* Show boxes
2003-02-13 17:58:48 +01:00
*/
2008-12-07 16:55:40 +01:00
2018-01-16 16:15:49 +01:00
$boxlist .= '<div class="twocolumns">' ;
2016-02-07 13:10:36 +01:00
2018-02-08 15:11:05 +01:00
$boxlist .= '<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">' ;
2016-02-07 13:10:36 +01:00
2018-01-17 13:55:53 +01:00
$boxlist .= $boxwork ;
2016-02-07 13:10:36 +01:00
$boxlist .= $resultboxes [ 'boxlista' ];
2018-01-16 16:15:49 +01:00
$boxlist .= '</div>' ;
2018-02-08 15:11:05 +01:00
$boxlist .= '<div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">' ;
2016-02-07 13:10:36 +01:00
2018-01-17 13:55:53 +01:00
$boxlist .= $boxstat ;
2016-02-07 13:10:36 +01:00
$boxlist .= $resultboxes [ 'boxlistb' ];
2018-01-16 16:15:49 +01:00
$boxlist .= '</div>' ;
2016-02-07 13:10:36 +01:00
$boxlist .= " \n " ;
2018-01-16 16:15:49 +01:00
$boxlist .= '</div>' ;
2016-02-07 13:10:36 +01:00
print $boxlist ;
2005-02-27 17:45:59 +01:00
2011-08-18 00:13:26 +02:00
print '</div>' ;
2009-08-24 21:29:52 +02:00
2016-02-07 13:10:36 +01:00
2009-08-24 21:29:52 +02:00
/*
* Show security warnings
*/
// Security warning repertoire install existe (si utilisateur admin)
if ( $user -> admin && empty ( $conf -> global -> MAIN_REMOVE_INSTALL_WARNING ))
{
2011-07-08 17:35:08 +02:00
$message = '' ;
2011-08-04 14:07:29 +02:00
// Check if install lock file is present
$lockfile = DOL_DATA_ROOT . '/install.lock' ;
if ( ! empty ( $lockfile ) && ! file_exists ( $lockfile ) && is_dir ( DOL_DOCUMENT_ROOT . " /install " ))
2011-07-08 17:35:08 +02:00
{
2011-10-29 23:52:05 +02:00
$langs -> load ( " errors " );
2011-07-08 17:35:08 +02:00
//if (! empty($message)) $message.='<br>';
2018-01-26 23:29:49 +01:00
$message .= info_admin ( $langs -> trans ( " WarningLockFileDoesNotExists " , DOL_DATA_ROOT ) . ' ' . $langs -> trans ( " WarningUntilDirRemoved " , DOL_DOCUMENT_ROOT . " /install " ), 0 , 0 , '1' , 'clearboth' );
2011-07-08 17:35:08 +02:00
}
// Conf files must be in read only mode
2011-07-30 12:23:24 +02:00
if ( is_writable ( $conffile ))
2011-07-08 17:35:08 +02:00
{
$langs -> load ( " errors " );
2011-10-29 23:52:05 +02:00
//$langs->load("other");
2011-07-08 17:35:08 +02:00
//if (! empty($message)) $message.='<br>';
2018-01-26 23:29:49 +01:00
$message .= info_admin ( $langs -> transnoentities ( " WarningConfFileMustBeReadOnly " ) . ' ' . $langs -> trans ( " WarningUntilDirRemoved " , DOL_DOCUMENT_ROOT . " /install " ), 0 , 0 , '1' , 'clearboth' );
2011-07-08 17:35:08 +02:00
}
if ( $message )
{
print $message ;
//$message.='<br>';
//print info_admin($langs->trans("WarningUntilDirRemoved",DOL_DOCUMENT_ROOT."/install"));
}
2009-08-24 21:29:52 +02:00
}
2013-01-16 15:54:07 +01:00
//print 'mem='.memory_get_usage().' - '.memory_get_peak_usage();
2013-01-15 17:06:53 +01:00
2011-12-12 01:39:55 +01:00
llxFooter ();
2009-08-24 21:29:52 +02:00
2003-02-13 17:58:48 +01:00
$db -> close ();
2002-04-29 19:53:37 +02:00
2010-11-13 17:59:53 +01:00
/**
* Show weather logo . Logo to show depends on $totallate and values for
2016-02-07 14:22:52 +01:00
* $conf -> global -> MAIN_METEO_LEVELx
2011-07-08 17:35:08 +02:00
*
* @ param int $totallate Nb of element late
* @ param string $text Text to show on logo
* @ param string $options More parameters on img tag
* @ return string Return img tag of weather
2010-11-13 17:59:53 +01:00
*/
function showWeather ( $totallate , $text , $options )
{
global $conf ;
$out = '' ;
$offset = 0 ;
2016-02-07 14:22:52 +01:00
$factor = 10 ; // By default
2017-06-01 01:53:55 +02:00
2017-09-25 17:13:50 +02:00
$used_conf = ! empty ( $conf -> global -> MAIN_USE_METEO_WITH_PERCENTAGE ) ? 'MAIN_METEO_PERCENTAGE_LEVEL' : 'MAIN_METEO_LEVEL' ;
2017-10-26 13:09:11 +02:00
2017-09-25 17:13:50 +02:00
$level0 = $offset ; if ( ! empty ( $conf -> global -> { $used_conf . '0' })) $level0 = $conf -> global -> { $used_conf . '0' };
$level1 = $offset + 1 * $factor ; if ( ! empty ( $conf -> global -> { $used_conf . '1' })) $level1 = $conf -> global -> { $used_conf . '1' };
$level2 = $offset + 2 * $factor ; if ( ! empty ( $conf -> global -> { $used_conf . '2' })) $level2 = $conf -> global -> { $used_conf . '2' };
$level3 = $offset + 3 * $factor ; if ( ! empty ( $conf -> global -> { $used_conf . '3' })) $level3 = $conf -> global -> { $used_conf . '3' };
2010-11-13 17:59:53 +01:00
2016-02-13 07:53:50 +01:00
if ( $totallate <= $level0 ) $out .= img_weather ( $text , 'weather-clear.png' , $options );
if ( $totallate > $level0 && $totallate <= $level1 ) $out .= img_weather ( $text , 'weather-few-clouds.png' , $options );
if ( $totallate > $level1 && $totallate <= $level2 ) $out .= img_weather ( $text , 'weather-clouds.png' , $options );
if ( $totallate > $level2 && $totallate <= $level3 ) $out .= img_weather ( $text , 'weather-many-clouds.png' , $options );
if ( $totallate > $level3 ) $out .= img_weather ( $text , 'weather-storm.png' , $options );
2010-11-13 17:59:53 +01:00
return $out ;
}