/[dolibarr]/dolibarr/htdocs/index.php
ViewVC logotype

Diff of /dolibarr/htdocs/index.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.36 by rodolphe, Tue Aug 23 13:05:59 2005 UTC revision 1.37 by eldy, Wed Aug 24 16:36:07 2005 UTC
# Line 18  Line 18 
18   *   *
19   * $Id$   * $Id$
20   * $Source$   * $Source$
  *  
21   */   */
22    
   
23  /**  /**
24          \file       htdocs/index.php          \file       htdocs/index.php
25          \brief      Page accueil par defaut          \brief      Page accueil par defaut
# Line 88  print '</table>'; Line 86  print '</table>';
86    
87    
88  /*  /*
89   * Dolibarr State Board   * Tableau de bord d'états Dolibarr (statistiques)
90     * Non affiché pour un utilisateur externe
91   */   */
92  print '<br>';  if ($user->societe_id == 0)
 print '<table class="noborder" width="100%">';  
 print '<tr class="liste_titre">';  
 print '<td colspan="2">'.$langs->trans("DolibarrStateBoard").'</td>';  
 print '<td align="right">&nbsp;</td>';  
 print '</tr>';  
   
 $var=true;  
   
 // Nbre de sociétés clients/prospects  
 if ($conf->societe->enabled  && $user->rights->societe->lire )  
 {  
   include_once("./client.class.php");  
   $board=new Client($db);  
   $board->load_state_board();  
     
   foreach($board->nb as $key=>$val)  
     {  
       $var=!$var;  
       print '<tr '.$bc[$var].'><td width="16">'.img_object($langs->trans("Customers"),"company").'</td>';  
       print '<td>';  
       if ($key == "customers") print $langs->trans("Customers");  
       if ($key == "prospects") print $langs->trans("Prospects");  
       print '</td>';  
       print '<td align="right">';  
       if ($key == "customers") print '<a href="'.DOL_URL_ROOT.'/comm/clients.php">';  
       if ($key == "prospects") print '<a href="'.DOL_URL_ROOT.'/comm/prospect/prospects.php">';  
       print $val;  
       print '</a></td>';  
       print '</tr>';  
     }  
 }  
   
 // Nbre de sociétés fournisseurs  
 if ($conf->fournisseur->enabled && $user->rights->fournisseur->lire)  
 {  
     include_once("./fourn/fournisseur.class.php");  
     $board=new Fournisseur($db);  
     $board->load_state_board();  
   
     foreach($board->nb as $key=>$val)  
     {  
         $var=!$var;  
         print '<tr '.$bc[$var].'><td width="16">'.img_object($langs->trans("Suppliers"),"company").'</td>';  
         print '<td>';  
         if ($key == "suppliers") print $langs->trans("Suppliers");  
         print '</td>';  
         print '<td align="right">';  
         if ($key == "suppliers") print '<a href="'.DOL_URL_ROOT.'/fourn/liste.php">';  
         print $val;  
         print '</a></td>';  
         print '</tr>';  
     }  
 }  
   
 // Nbre d'adhérents  
 if ($conf->adherent->enabled)  
 {  
     include_once("./adherents/adherent.class.php");  
     $board=new Adherent($db);  
     $board->load_state_board();  
   
     foreach($board->nb as $key=>$val)  
     {  
         $var=!$var;  
         print '<tr '.$bc[$var].'><td width="16">'.img_object($langs->trans("Adherent"),"user").'</td>';  
         print '<td>';  
         if ($key == "members") print $langs->trans("Adherents");  
         print '</td>';  
         print '<td align="right">';  
         if ($key == "members") print '<a href="'.DOL_URL_ROOT.'/adherents/liste.php?statut=1&amp;mainmenu=members">';  
         print $val;  
         print '</a></td>';  
         print '</tr>';  
     }  
 }  
   
 // Nbre de produits  
 if ($conf->produit->enabled && $user->rights->produit->lire)  
93  {  {
94      //include_once("./product.class.php");      print '<br>';
95      $board=new Product($db);      print '<table class="noborder" width="100%">';
96      $board->load_state_board();      print '<tr class="liste_titre">';
97        print '<td colspan="2">'.$langs->trans("DolibarrStateBoard").'</td>';
98      foreach($board->nb as $key=>$val)      print '<td align="right">&nbsp;</td>';
99      {      print '</tr>';
100          $var=!$var;      
101          print '<tr '.$bc[$var].'><td width="16">'.img_object($langs->trans("Products"),"product").'</td>';      $var=true;
102          print '<td>';      
103          if ($key == "products") print $langs->trans("Products");      // Condition à vérifier pour affichage de chaque ligne du tableau de bord
104          print '</td>';      $conditions=array($conf->societe->enabled && $user->rights->societe->lire,
105          print '<td align="right">';                        $conf->societe->enabled && $user->rights->societe->lire,
106          if ($key == "products") print '<a href="'.DOL_URL_ROOT.'/product/liste.php?type=0&amp;mainmenu=products">';                        $conf->fournisseur->enabled && $user->rights->fournisseur->lire,
107          print $val;                        $conf->adherent->enabled && $user->rights->adherent->lire,
108          print '</a></td>';                        $conf->produit->enabled && $user->rights->produit->lire,
109          print '</tr>';                        $conf->service->enabled && $user->rights->produit->lire,
110                          $conf->telephonie->enabled && $user->rights->telephonie->ligne->lire_restreint);
111        // Fichiers des classes qui contiennent la methode load_state_board pour chaque ligne
112        $includes=array(DOL_DOCUMENT_ROOT."/client.class.php",
113                        DOL_DOCUMENT_ROOT."/client.class.php",
114                        DOL_DOCUMENT_ROOT."/fourn/fournisseur.class.php",
115                        DOL_DOCUMENT_ROOT."/adherents/adherent.class.php",
116                        DOL_DOCUMENT_ROOT."/product.class.php",
117                        DOL_DOCUMENT_ROOT."/service.class.php",
118                        DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php");
119        // Nom des classes qui contiennent la methode load_state_board pour chaque ligne
120        $classes=array('Client',
121                       'Client',
122                       'Fournisseur',
123                       'Adherent',
124                       'Product',
125                       'Service',
126                       'LigneTel');
127        // Clé du tableau retourné par la methode laod_state_bord pour chaque ligne
128        $keys=array('customers',
129                    'prospects',
130                    'suppliers',
131                    'members',
132                    'products',
133                    'services',
134                    'sign');
135        // Icon des lignes du tableau de bord
136        $icons=array('company',
137                     'company',
138                     'company',
139                     'user',
140                     'product',
141                     'service',
142                     'phone');
143        // Titre des lignes du tableau de bord
144        $titres=array($langs->trans("Customers"),
145                      $langs->trans("Prospects"),
146                      $langs->trans("Suppliers"),
147                      $langs->trans("Members"),
148                      $langs->trans("Products"),
149                      $langs->trans("Services"),
150                      $langs->trans("Lignes de téléphonie suivis"));
151        // Liens des lignes du tableau de bord
152        $links=array(DOL_URL_ROOT.'/comm/clients.php',
153                     DOL_URL_ROOT.'/comm/prospect/prospects.php',
154                     DOL_URL_ROOT.'/fourn/liste.php',
155                     DOL_URL_ROOT.'/adherents/liste.php?statut=1&amp;mainmenu=members',
156                     DOL_URL_ROOT.'/product/liste.php?type=0&amp;mainmenu=products',
157                     DOL_URL_ROOT.'/product/liste.php?type=1&amp;mainmenu=products',
158                     DOL_URL_ROOT.'/telephonie/ligne/index.php');
159      
160        // Boucle et affiche chaque ligne du tableau
161        foreach ($keys as $key=>$val)
162        {
163            if ($conditions[$key])
164            {
165                $classe=$classes[$key];
166                // Cherche dans cache si le load_state_board deja réalisé
167                if (! is_object($boardloaded[$classe]))
168                {
169                    include_once($includes[$key]);
170                    $board=new $classe($db);
171                    $board->load_state_board($user);
172                    $boardloaded[$classe]=$board;
173                }
174                else $board=$boardloaded[$classe];
175                $var=!$var;
176                print '<tr '.$bc[$var].'><td width="16">'.img_object($titres[$key],$icons[$key]).'</td>';
177                print '<td>'.$titres[$key].'</td>';
178                print '<td align="right"><a href="'.$links[$key].'">'.$board->nb[$val].'</a></td>';
179                print '</tr>';
180            }
181      }      }
 }  
182    
183  // Nbre de services      print '</table>';
 if ($conf->service->enabled && $user->rights->produit->lire)  
 {  
     include_once("./service.class.php");  
     $board=new Service($db);  
     $board->load_state_board();  
   
     foreach($board->nb as $key=>$val)  
     {  
         $var=!$var;  
         print '<tr '.$bc[$var].'><td width="16">'.img_object($langs->trans("Services"),"service").'</td>';  
         print '<td>';  
         if ($key == "services") print $langs->trans("Services");  
         print '</td>';  
         print '<td align="right">';  
         if ($key == "services") print '<a href="'.DOL_URL_ROOT.'/product/liste.php?type=1&amp;mainmenu=products">';  
         print $val;  
         print '</a></td>';  
         print '</tr>';  
     }  
184  }  }
185    
 // Nbre de lignes telephoniques suivies  
 if ($conf->telephonie->enabled && $user->rights->telephonie->ligne->lire_restreint)  
 {  
   include_once(DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php");  
   $board=new LigneTel($db);  
   $board->load_state_board($user);  
     
   foreach($board->nb as $key=>$val)  
     {  
       $var=!$var;  
       print '<tr '.$bc[$var].'><td width="16">&nbsp;</td>';  
       print '<td>Lignes téléphoniques suivies</td>';  
       print '<td align="right"><a href="'.DOL_URL_ROOT.'/telephonie/ligne/">';  
       print $val;  
       print '</a></td>';  
       print '</tr>';  
     }  
 }  
   
 print '</table>';  
   
   
186  print '</td><td width="65%" valign="top" class="notopnoleftnoright">';  print '</td><td width="65%" valign="top" class="notopnoleftnoright">';
187    
188    

Legend:
Removed from v.1.36  
changed lines
  Added in v.1.37

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26