From f2fd79071113e631dc6c592bd4e0e9bc35892a72 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Sat, 20 Aug 2005 21:44:34 +0000 Subject: [PATCH] Nouveau fichier --- htdocs/projet/tasks/index.php | 156 ++++++++++++++++++++++++++++++++ htdocs/projet/tasks/pre.inc.php | 57 ++++++++++++ 2 files changed, 213 insertions(+) create mode 100644 htdocs/projet/tasks/index.php create mode 100644 htdocs/projet/tasks/pre.inc.php diff --git a/htdocs/projet/tasks/index.php b/htdocs/projet/tasks/index.php new file mode 100644 index 00000000000..9b2c016975f --- /dev/null +++ b/htdocs/projet/tasks/index.php @@ -0,0 +1,156 @@ + + * Copyright (C) 2004-2005 Laurent Destailleur + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (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 + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + * + */ + +/** + \file htdocs/projet/index.php + \ingroup projet + \brief Page d'accueil du module projet + \version $Revision$ +*/ + +require("./pre.inc.php"); + +/* + * Sécurité accés client + */ +if ($user->societe_id > 0) +{ + $action = ''; + $socidp = $user->societe_id; +} + +llxHeader("",$langs->trans("Projects"),"Projet"); + +print_titre($langs->trans("ProjectsArea")); + +print ''; +print '
'; + +/* + * + * Affichage de la liste des projets + * + */ +print ''; +print ''; +print_liste_field_titre($langs->trans("Project"),"index.php","s.nom","","","",$sortfield); +print ''; +print "\n"; + +$sql = "SELECT p.title, p.rowid, count(t.rowid)"; +$sql .= " FROM ".MAIN_DB_PREFIX."projet as p"; +$sql .= " , ".MAIN_DB_PREFIX."projet_task as t"; +$sql .= " WHERE t.fk_projet = p.rowid"; + +if ($socidp) +{ + $sql .= " AND s.idp = $socidp"; +} +$sql .= " GROUP BY p.rowid"; + +$var=true; +$resql = $db->query($sql); +if ( $resql ) +{ + $num = $db->num_rows($resql); + $i = 0; + + while ($i < $num) + { + $row = $db->fetch_row( $resql); + $var=!$var; + print ""; + print ''; + print ''; + print "\n"; + + $i++; + } + + $db->free($resql); +} +else +{ + dolibarr_print_error($db); +} +print "
'.$langs->trans("NbOpenTasks").'
'.$row[0].''.$row[2].'
"; + +print '
'; + +/* + * + * Affichage de la liste des projets + * + */ +print ''; +print ''; +print_liste_field_titre($langs->trans("Company"),"index.php","s.nom","","","",$sortfield); +print ''; +print "\n"; + +$sql = "SELECT p.title, p.rowid, sum(tt.task_duration)"; +$sql .= " FROM ".MAIN_DB_PREFIX."projet as p"; +$sql .= " , ".MAIN_DB_PREFIX."projet_task as t"; +$sql .= " , ".MAIN_DB_PREFIX."projet_task_time as tt"; +$sql .= " WHERE t.fk_projet = p.rowid"; +$sql .= " AND tt.fk_task = t.rowid"; + +if ($socidp) +{ + $sql .= " AND s.idp = $socidp"; +} +$sql .= " GROUP BY p.rowid"; + +$var=true; +$resql = $db->query($sql); +if ( $resql ) +{ + $num = $db->num_rows($resql); + $i = 0; + + while ($i < $num) + { + $row = $db->fetch_row( $resql); + $var=!$var; + print ""; + print ''; + print ''; + print "\n"; + + $i++; + } + + $db->free($resql); +} +else +{ + dolibarr_print_error($db); +} +print "
Nb heures
'.$row[0].''.$row[2].'
"; + +print '
'; + +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?> diff --git a/htdocs/projet/tasks/pre.inc.php b/htdocs/projet/tasks/pre.inc.php new file mode 100644 index 00000000000..871e7f983ed --- /dev/null +++ b/htdocs/projet/tasks/pre.inc.php @@ -0,0 +1,57 @@ + + * Copyright (C) 2005 Laurent Destailleur + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (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 + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + * + */ + +/*! + \file htdocs/projet/pre.inc.php + \ingroup projet + \brief Fichier de gestion du menu gauche du module projet + \version $Revision$ +*/ + +require ("../../main.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/project.class.php"); + +$langs->load("projects"); +$langs->load("companies"); + +$user->getrights('projet'); + +function llxHeader($head = "", $title="", $help_url='') +{ + global $langs; + + top_menu($head, $title); + + $menu = new Menu(); + + $menu->add(DOL_URL_ROOT."/comm/clients.php", $langs->trans("Customers")); + + $menu->add(DOL_URL_ROOT."/projet/", $langs->trans("Projects")); + $menu->add_submenu(DOL_URL_ROOT."/projet/liste.php", $langs->trans("List")); + + $menu->add(DOL_URL_ROOT."/projet/tasks/", $langs->trans("Tasks")); + + left_menu($menu->liste, $help_url); +} + +?>