[ 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/ -> myactivity.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: myactivity.php,v 1.4 2005/12/02 16:55:26 hregis Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/projet/activity/myactivity.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.4 $
  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  $langs->load("projects");
  44  
  45  llxHeader("",$langs->trans("MyActivity"));
  46  
  47  $now = time();
  48  
  49  print_titre($langs->trans("MyActivity"));
  50  
  51  print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
  52  print '<tr><td width="30%" valign="top">';
  53  
  54  /*
  55   *
  56   * Affichage de la liste des projets
  57   * 
  58   */
  59  print '<table class="noborder" width="100%">';
  60  print '<tr class="liste_titre">';
  61  print_liste_field_titre($langs->trans("Project"),"index.php","s.nom","","","",$sortfield);
  62  print '<td align="center">'.$langs->trans("NbOpenTasks").'</td>';
  63  print "</tr>\n";
  64  
  65  $sql = "SELECT p.title, p.rowid, count(t.rowid)";
  66  $sql .= " FROM ".MAIN_DB_PREFIX."projet as p";
  67  $sql .= " , ".MAIN_DB_PREFIX."projet_task as t";
  68  $sql .= " WHERE t.fk_projet = p.rowid";
  69  
  70  $sql .= " GROUP BY p.rowid";
  71  
  72  $var=true;
  73  $resql = $db->query($sql);
  74  if ( $resql )
  75  {
  76    $num = $db->num_rows($resql);
  77    $i = 0;
  78  
  79    while ($i < $num)
  80      {
  81        $row = $db->fetch_row( $resql);
  82        $var=!$var;
  83        print "<tr $bc[$var]>";
  84        print '<td><a href="'.DOL_URL_ROOT.'/projet/tasks/fiche.php?id='.$row[1].'">'.$row[0].'</a></td>';
  85        print '<td align="center">'.$row[2].'</td>';
  86        print "</tr>\n";
  87      
  88        $i++;
  89      }
  90    
  91    $db->free($resql);
  92  }
  93  else
  94  {
  95    dolibarr_print_error($db);
  96  }
  97  print "</table>";
  98  
  99  /* Affichage de la liste des projets de la semaine */
 100  print '<br /><table class="noborder" width="100%">';
 101  print '<tr class="liste_titre">';
 102  print '<td width="50%">'.$langs->trans('Today').'</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 tt.fk_user = ".$user->id;
 113  $sql .= " AND date_format(task_date,'%d%m%y') = ".strftime("%d%m%y",time());
 114  $sql .= " GROUP BY p.rowid";
 115  
 116  $var=true;
 117  $total=0;
 118  $resql = $db->query($sql);
 119  if ( $resql )
 120  {
 121    while ($row = $db->fetch_row($resql))
 122      {
 123        print "<tr $bc[$var]>";
 124        print '<td><a href="'.DOL_URL_ROOT.'/projet/tasks/fiche.php?id='.$row[1].'">'.$row[0].'</a></td>';
 125        print '<td align="center">'.$row[2].'</td>';
 126        print "</tr>\n";
 127        $total += $row[2];
 128        $var=!$var;
 129      }
 130    
 131    $db->free($resql);
 132  }
 133  else
 134  {
 135    dolibarr_print_error($db);
 136  }
 137  print "<tr $bc[$var]>";
 138  print '<td>'.$langs->trans('Total').'</td>';
 139  print '<td align="center">'.$total.'</td>';
 140  print "</tr>\n";    
 141  print "</table>";
 142  
 143  print '<br /><table class="noborder" width="100%">';
 144  print '<tr class="liste_titre">';
 145  print '<td width="50%">'.$langs->trans('Yesterday').'</td>';
 146  print '<td width="50%" align="center">Temps</td>';
 147  print "</tr>\n";
 148  
 149  $sql = "SELECT p.title, p.rowid, sum(tt.task_duration)";
 150  $sql .= " FROM ".MAIN_DB_PREFIX."projet as p";
 151  $sql .= " , ".MAIN_DB_PREFIX."projet_task as t";
 152  $sql .= " , ".MAIN_DB_PREFIX."projet_task_time as tt";
 153  $sql .= " WHERE t.fk_projet = p.rowid";
 154  $sql .= " AND tt.fk_task = t.rowid";
 155  $sql .= " AND tt.fk_user = ".$user->id;
 156  $sql .= " AND date_format(date_add(task_date, INTERVAL 1 DAY),'%d%m%y') = ".strftime("%d%m%y",time());
 157  $sql .= " GROUP BY p.rowid";
 158  
 159  $var=true;
 160  $total=0;
 161  $resql = $db->query($sql);
 162  if ( $resql )
 163  {
 164    while ($row = $db->fetch_row($resql))
 165      {
 166        print "<tr $bc[$var]>";
 167        print '<td><a href="'.DOL_URL_ROOT.'/projet/tasks/fiche.php?id='.$row[1].'">'.$row[0].'</a></td>';
 168        print '<td align="center">'.$row[2].'</td>';
 169        print "</tr>\n";
 170        $total += $row[2];
 171        $var=!$var;
 172      }
 173    
 174    $db->free($resql);
 175  }
 176  else
 177  {
 178    dolibarr_print_error($db);
 179  }
 180  print "<tr $bc[$var]>";
 181  print '<td>'.$langs->trans('Total').'</td>';
 182  print '<td align="center">'.$total.'</td>';
 183  print "</tr>\n";
 184  print "</table>";
 185  
 186  print '</td><td width="70%" valign="top">';
 187  
 188  /* Affichage de la liste des projets de la semaine */
 189  print '<table class="noborder" width="100%">';
 190  print '<tr class="liste_titre">';
 191  print '<td width="50%">Activité sur les projets cette semaine</td>';
 192  print '<td width="50%" align="center">Temps</td>';
 193  print "</tr>\n";
 194  
 195  $sql = "SELECT p.title, p.rowid, sum(tt.task_duration)";
 196  $sql .= " FROM ".MAIN_DB_PREFIX."projet as p";
 197  $sql .= " , ".MAIN_DB_PREFIX."projet_task as t";
 198  $sql .= " , ".MAIN_DB_PREFIX."projet_task_time as tt";
 199  $sql .= " WHERE t.fk_projet = p.rowid";
 200  $sql .= " AND tt.fk_task = t.rowid";
 201  $sql .= " AND tt.fk_user = ".$user->id;
 202  $sql .= " AND week(task_date) = ".strftime("%W",time());
 203  $sql .= " GROUP BY p.rowid";
 204  $total = 0;
 205  $var=true;
 206  $resql = $db->query($sql);
 207  if ( $resql )
 208  {
 209    while ($row = $db->fetch_row( $resql))
 210      {
 211        print "<tr $bc[$var]>";
 212        print '<td><a href="'.DOL_URL_ROOT.'/projet/tasks/fiche.php?id='.$row[1].'">'.$row[0].'</a></td>';
 213        print '<td align="center">'.$row[2].'</td>';
 214        print "</tr>\n";    
 215        $total += $row[2];
 216        $var=!$var;
 217      }
 218    
 219    $db->free($resql);
 220  }
 221  else
 222  {
 223    dolibarr_print_error($db);
 224  }
 225  print "<tr $bc[$var]>";
 226  print '<td>'.$langs->trans('Total').'</td>';
 227  print '<td align="center">'.$total.'</td>';
 228  print "</tr>\n";
 229  print "</table><br />";
 230  
 231  /* Affichage de la liste des projets du mois */
 232  print '<table class="noborder" width="100%">';
 233  print '<tr class="liste_titre">';
 234  print '<td width="50%">'.$langs->trans("Project").' ce mois : '.strftime("%B %Y", $now).'</td>';
 235  print '<td width="50%" align="center">Nb heures</td>';
 236  print "</tr>\n";
 237  
 238  $sql = "SELECT p.title, p.rowid, sum(tt.task_duration)";
 239  $sql .= " FROM ".MAIN_DB_PREFIX."projet as p";
 240  $sql .= " , ".MAIN_DB_PREFIX."projet_task as t";
 241  $sql .= " , ".MAIN_DB_PREFIX."projet_task_time as tt";
 242  $sql .= " WHERE t.fk_projet = p.rowid";
 243  $sql .= " AND tt.fk_task = t.rowid";
 244  $sql .= " AND tt.fk_user = ".$user->id;
 245  $sql .= " AND month(task_date) = ".strftime("%m",$now);
 246  $sql .= " GROUP BY p.rowid";
 247  
 248  $var=true;
 249  $resql = $db->query($sql);
 250  if ( $resql )
 251  {
 252    while ($row = $db->fetch_row($resql))
 253      {
 254        print "<tr $bc[$var]>";
 255        print '<td><a href="'.DOL_URL_ROOT.'/projet/tasks/fiche.php?id='.$row[1].'">'.$row[0].'</a></td>';
 256        print '<td align="center">'.$row[2].'</td>';
 257        print "</tr>\n";    
 258        $var=!$var;
 259      }  
 260    $db->free($resql);
 261  }
 262  else
 263  {
 264    dolibarr_print_error($db);
 265  }
 266  print "</table>";
 267  
 268  /* Affichage de la liste des projets du mois */
 269  print '<br /><table class="noborder" width="100%">';
 270  print '<tr class="liste_titre">';
 271  print '<td width="50%">'.$langs->trans("Project").' cette année : '.strftime("%Y", $now).'</td>';
 272  print '<td width="50%" align="center">Nb heures</td>';
 273  print "</tr>\n";
 274  
 275  $sql = "SELECT p.title, p.rowid, sum(tt.task_duration)";
 276  $sql .= " FROM ".MAIN_DB_PREFIX."projet as p";
 277  $sql .= " , ".MAIN_DB_PREFIX."projet_task as t";
 278  $sql .= " , ".MAIN_DB_PREFIX."projet_task_time as tt";
 279  $sql .= " WHERE t.fk_projet = p.rowid";
 280  $sql .= " AND tt.fk_task = t.rowid";
 281  $sql .= " AND tt.fk_user = ".$user->id;
 282  $sql .= " AND YEAR(task_date) = ".strftime("%Y",$now);
 283  $sql .= " GROUP BY p.rowid";
 284  
 285  $var=true;
 286  $resql = $db->query($sql);
 287  if ( $resql )
 288  {
 289    while ($row = $db->fetch_row($resql))
 290      {
 291        print "<tr $bc[$var]>";
 292        print '<td><a href="'.DOL_URL_ROOT.'/projet/tasks/fiche.php?id='.$row[1].'">'.$row[0].'</a></td>';
 293        print '<td align="center">'.$row[2].'</td>';
 294        print "</tr>\n";    
 295        $var=!$var;
 296      }  
 297    $db->free($resql);
 298  }
 299  else
 300  {
 301    dolibarr_print_error($db);
 302  }
 303  print "</table>";
 304  
 305  print '</td></tr></table>';
 306  
 307  $db->close();
 308  
 309  llxFooter("<em>Derni&egrave;re modification $Date: 2005/12/02 16:55:26 $ r&eacute;vision $Revision: 1.4 $</em>");
 310  ?>


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