[ Index ]
 

Code source de Dolibarr 2.0.1

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/htdocs/projet/activity/ -> index.php (source)

   1  <?php
   2  /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
   3   *
   4   * This program is free software; you can redistribute it and/or modify
   5   * it under the terms of the GNU General Public License as published by
   6   * the Free Software Foundation; either version 2 of the License, or
   7   * (at your option) any later version.
   8   *
   9   * This program is distributed in the hope that it will be useful,
  10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12   * GNU General Public License for more details.
  13   *
  14   * You should have received a copy of the GNU General Public License
  15   * along with this program; if not, write to the Free Software
  16   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17   *
  18   * $Id: index.php,v 1.1 2005/08/22 17:10:46 rodolphe Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/projet/activity/index.php,v $
  20   *
  21   */
  22  
  23  /**
  24     \file       htdocs/projet/index.php
  25     \ingroup    projet
  26     \brief      Page d'accueil du module projet
  27     \version    $Revision: 1.1 $
  28  */
  29  
  30  require ("./pre.inc.php");
  31  
  32  if (!$user->rights->projet->lire) accessforbidden();
  33  
  34  /*
  35   * Sécurité accés client
  36   */
  37  if ($user->societe_id > 0) 
  38  {
  39    $action = '';
  40    $socidp = $user->societe_id;
  41  }
  42  
  43  llxHeader("",$langs->trans("Activity"));
  44  
  45  $now = time();
  46  
  47  print_titre($langs->trans("Activity"));
  48  
  49  print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
  50  print '<tr><td width="30%" valign="top">';
  51  
  52  /*
  53   *
  54   * Affichage de la liste des projets
  55   * 
  56   */
  57  print '<table class="noborder" width="100%">';
  58  print '<tr class="liste_titre">';
  59  print_liste_field_titre($langs->trans("Project"),"index.php","s.nom","","","",$sortfield);
  60  print '<td align="center">'.$langs->trans("NbOpenTasks").'</td>';
  61  print "</tr>\n";
  62  
  63  $sql = "SELECT p.title, p.rowid, count(t.rowid)";
  64  $sql .= " FROM ".MAIN_DB_PREFIX."projet as p";
  65  $sql .= " , ".MAIN_DB_PREFIX."projet_task as t";
  66  $sql .= " WHERE t.fk_projet = p.rowid";
  67  
  68  $sql .= " GROUP BY p.rowid";
  69  
  70  $var=true;
  71  $resql = $db->query($sql);
  72  if ( $resql )
  73  {
  74    $num = $db->num_rows($resql);
  75    $i = 0;
  76  
  77    while ($i < $num)
  78      {
  79        $row = $db->fetch_row( $resql);
  80        $var=!$var;
  81        print "<tr $bc[$var]>";
  82        print '<td><a href="'.DOL_URL_ROOT.'/projet/tasks/fiche.php?id='.$row[1].'">'.$row[0].'</a></td>';
  83        print '<td align="center">'.$row[2].'</td>';
  84        print "</tr>\n";
  85      
  86        $i++;
  87      }
  88    
  89    $db->free($resql);
  90  }
  91  else
  92  {
  93    dolibarr_print_error($db);
  94  }
  95  print "</table>";
  96  
  97  print '</td><td width="70%" valign="top">';
  98  
  99  /* Affichage de la liste des projets du mois */
 100  print '<table class="noborder" width="100%">';
 101  print '<tr class="liste_titre">';
 102  print '<td width="50%">Activité sur les projets cette semaine</td>';
 103  print '<td width="50%" align="center">Temps</td>';
 104  print "</tr>\n";
 105  
 106  $sql = "SELECT p.title, p.rowid, sum(tt.task_duration)";
 107  $sql .= " FROM ".MAIN_DB_PREFIX."projet as p";
 108  $sql .= " , ".MAIN_DB_PREFIX."projet_task as t";
 109  $sql .= " , ".MAIN_DB_PREFIX."projet_task_time as tt";
 110  $sql .= " WHERE t.fk_projet = p.rowid";
 111  $sql .= " AND tt.fk_task = t.rowid";
 112  $sql .= " AND week(task_date) = ".strftime("%W",time());
 113  $sql .= " GROUP BY p.rowid";
 114  
 115  $var=true;
 116  $resql = $db->query($sql);
 117  if ( $resql )
 118  {
 119    $num = $db->num_rows($resql);
 120    $i = 0;
 121  
 122    while ($i < $num)
 123      {
 124        $row = $db->fetch_row( $resql);
 125        $var=!$var;
 126        print "<tr $bc[$var]>";
 127        print '<td><a href="'.DOL_URL_ROOT.'/projet/tasks/fiche.php?id='.$row[1].'">'.$row[0].'</a></td>';
 128        print '<td align="center">'.$row[2].'</td>';
 129        print "</tr>\n";    
 130        $i++;
 131      }
 132    
 133    $db->free($resql);
 134  }
 135  else
 136  {
 137    dolibarr_print_error($db);
 138  }
 139  print "</table><br />";
 140  
 141  /* Affichage de la liste des projets du mois */
 142  print '<table class="noborder" width="100%">';
 143  print '<tr class="liste_titre">';
 144  print '<td width="50%">'.$langs->trans("Project").' ce mois : '.strftime("%B %Y", $now).'</td>';
 145  print '<td width="50%" align="center">Nb heures</td>';
 146  print "</tr>\n";
 147  
 148  $sql = "SELECT p.title, p.rowid, sum(tt.task_duration)";
 149  $sql .= " FROM ".MAIN_DB_PREFIX."projet as p";
 150  $sql .= " , ".MAIN_DB_PREFIX."projet_task as t";
 151  $sql .= " , ".MAIN_DB_PREFIX."projet_task_time as tt";
 152  $sql .= " WHERE t.fk_projet = p.rowid";
 153  $sql .= " AND tt.fk_task = t.rowid";
 154  $sql .= " AND month(task_date) = ".strftime("%m",$now);
 155  $sql .= " GROUP BY p.rowid";
 156  
 157  $var=true;
 158  $resql = $db->query($sql);
 159  if ( $resql )
 160  {
 161    $num = $db->num_rows($resql);
 162    $i = 0;
 163  
 164    while ($i < $num)
 165      {
 166        $row = $db->fetch_row( $resql);
 167        $var=!$var;
 168        print "<tr $bc[$var]>";
 169        print '<td><a href="'.DOL_URL_ROOT.'/projet/tasks/fiche.php?id='.$row[1].'">'.$row[0].'</a></td>';
 170        print '<td align="center">'.$row[2].'</td>';
 171        print "</tr>\n";    
 172        $i++;
 173      }
 174    
 175    $db->free($resql);
 176  }
 177  else
 178  {
 179    dolibarr_print_error($db);
 180  }
 181  print "</table>";
 182  
 183  /* Affichage de la liste des projets du mois */
 184  print '<br /><table class="noborder" width="100%">';
 185  print '<tr class="liste_titre">';
 186  print '<td width="50%">'.$langs->trans("Project").' cette année : '.strftime("%Y", $now).'</td>';
 187  print '<td width="50%" align="center">Nb heures</td>';
 188  print "</tr>\n";
 189  
 190  $sql = "SELECT p.title, p.rowid, sum(tt.task_duration)";
 191  $sql .= " FROM ".MAIN_DB_PREFIX."projet as p";
 192  $sql .= " , ".MAIN_DB_PREFIX."projet_task as t";
 193  $sql .= " , ".MAIN_DB_PREFIX."projet_task_time as tt";
 194  $sql .= " WHERE t.fk_projet = p.rowid";
 195  $sql .= " AND tt.fk_task = t.rowid";
 196  $sql .= " AND YEAR(task_date) = ".strftime("%Y",$now);
 197  $sql .= " GROUP BY p.rowid";
 198  
 199  $var=true;
 200  $resql = $db->query($sql);
 201  if ( $resql )
 202  {
 203    $num = $db->num_rows($resql);
 204    $i = 0;
 205  
 206    while ($i < $num)
 207      {
 208        $row = $db->fetch_row( $resql);
 209        $var=!$var;
 210        print "<tr $bc[$var]>";
 211        print '<td><a href="'.DOL_URL_ROOT.'/projet/tasks/fiche.php?id='.$row[1].'">'.$row[0].'</a></td>';
 212        print '<td align="center">'.$row[2].'</td>';
 213        print "</tr>\n";    
 214        $i++;
 215      }
 216    
 217    $db->free($resql);
 218  }
 219  else
 220  {
 221    dolibarr_print_error($db);
 222  }
 223  print "</table>";
 224  
 225  print '</td></tr></table>';
 226  
 227  $db->close();
 228  
 229  llxFooter("<em>Derni&egrave;re modification $Date: 2005/08/22 17:10:46 $ r&eacute;vision $Revision: 1.1 $</em>");
 230  ?>


Généré le : Mon Nov 26 12:29:37 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics