2005-08-20 23:44:34 +02:00
|
|
|
<?php
|
2009-01-10 04:40:06 +01:00
|
|
|
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
2012-02-15 23:08:20 +01:00
|
|
|
* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
2012-12-30 15:13:49 +01:00
|
|
|
* Copyright (C) 2006-2010 Regis Houssin <regis.houssin@capnetworks.com>
|
2008-09-10 22:49:21 +02:00
|
|
|
*
|
2005-08-20 23:44:34 +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
|
2005-08-20 23:44:34 +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/>.
|
2005-08-20 23:44:34 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
2009-01-10 04:40:06 +01:00
|
|
|
* \file htdocs/projet/tasks/index.php
|
|
|
|
|
* \ingroup project
|
2010-02-21 01:16:47 +01:00
|
|
|
* \brief List all task of a project
|
2008-09-10 22:49:21 +02:00
|
|
|
*/
|
2005-08-20 23:44:34 +02:00
|
|
|
|
2010-03-01 09:42:10 +01:00
|
|
|
require ("../../main.inc.php");
|
2012-08-22 23:11:24 +02:00
|
|
|
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
|
|
|
|
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
|
|
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
|
|
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
2005-08-20 23:44:34 +02:00
|
|
|
|
2008-09-10 13:14:45 +02:00
|
|
|
$langs->load('projects');
|
2010-05-30 22:25:08 +02:00
|
|
|
$langs->load('users');
|
2008-09-10 13:14:45 +02:00
|
|
|
|
2012-02-27 22:26:22 +01:00
|
|
|
$id=GETPOST('id','int');
|
2013-03-01 00:56:29 +01:00
|
|
|
$search_project=GETPOST('search_project');
|
2012-03-19 14:44:27 +01:00
|
|
|
|
2012-02-15 23:08:20 +01:00
|
|
|
|
2008-09-10 22:49:21 +02:00
|
|
|
// Security check
|
|
|
|
|
$socid=0;
|
|
|
|
|
if ($user->societe_id > 0) $socid = $user->societe_id;
|
2010-05-30 14:21:32 +02:00
|
|
|
if (!$user->rights->projet->lire) accessforbidden();
|
2008-09-10 22:49:21 +02:00
|
|
|
|
2009-07-27 02:17:35 +02:00
|
|
|
$sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"];
|
|
|
|
|
$sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"];
|
|
|
|
|
$page = isset($_GET["page"])? $_GET["page"]:$_POST["page"];
|
|
|
|
|
$page = is_numeric($page) ? $page : 0;
|
|
|
|
|
$page = $page == -1 ? 0 : $page;
|
|
|
|
|
|
2010-05-30 14:21:32 +02:00
|
|
|
$mine = $_REQUEST['mode']=='mine' ? 1 : 0;
|
|
|
|
|
|
2009-07-27 02:17:35 +02:00
|
|
|
|
2012-03-19 14:44:27 +01:00
|
|
|
|
2008-09-10 22:49:21 +02:00
|
|
|
/*
|
|
|
|
|
* View
|
|
|
|
|
*/
|
2010-05-29 01:26:08 +02:00
|
|
|
|
2012-02-15 23:08:20 +01:00
|
|
|
$form=new Form($db);
|
|
|
|
|
$projectstatic = new Project($db);
|
|
|
|
|
$taskstatic = new Task($db);
|
|
|
|
|
|
2010-05-29 01:26:08 +02:00
|
|
|
$title=$langs->trans("Activities");
|
|
|
|
|
if ($mine) $title=$langs->trans("MyActivities");
|
2008-09-10 22:49:21 +02:00
|
|
|
|
|
|
|
|
llxHeader("",$title,"Projet");
|
2005-08-20 23:44:34 +02:00
|
|
|
|
2012-02-15 23:08:20 +01:00
|
|
|
if ($id)
|
2010-02-07 03:39:01 +01:00
|
|
|
{
|
2012-02-15 23:08:20 +01:00
|
|
|
$projectstatic->fetch($id);
|
2010-02-07 10:49:10 +01:00
|
|
|
$projectstatic->societe->fetch($projectstatic->societe->id);
|
2010-02-07 03:39:01 +01:00
|
|
|
}
|
|
|
|
|
|
2010-02-14 17:54:00 +01:00
|
|
|
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num);
|
2008-09-10 13:14:45 +02:00
|
|
|
|
2010-05-29 01:26:08 +02:00
|
|
|
// Show description of content
|
|
|
|
|
if ($mine) print $langs->trans("MyProjectsDesc").'<br><br>';
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if ($user->rights->projet->all->lire && ! $socid) print $langs->trans("ProjectsDesc").'<br><br>';
|
|
|
|
|
else print $langs->trans("ProjectsPublicDesc").'<br><br>';
|
|
|
|
|
}
|
|
|
|
|
|
2014-01-06 12:42:50 +01:00
|
|
|
// Get list of project id allowed to user (in a string list separated by coma)
|
2010-06-24 23:10:43 +02:00
|
|
|
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,1,$socid);
|
2012-03-19 14:44:27 +01:00
|
|
|
|
2009-07-28 15:37:28 +02:00
|
|
|
// Get list of tasks in tasksarray and taskarrayfiltered
|
2012-03-19 14:44:27 +01:00
|
|
|
// We need all tasks (even not limited to a user because a task to user can have a parent that is not affected to him).
|
2013-03-01 00:56:29 +01:00
|
|
|
$tasksarray=$taskstatic->getTasksArray(0, 0, $projectstatic->id, $socid, 0, $search_project);
|
2009-07-28 15:37:28 +02:00
|
|
|
// We load also tasks limited to a particular user
|
2010-02-14 17:54:00 +01:00
|
|
|
$tasksrole=($mine ? $taskstatic->getUserRolesForProjectsOrTasks(0,$user,$projectstatic->id,0) : '');
|
2009-07-28 15:37:28 +02:00
|
|
|
|
2012-03-19 14:44:27 +01:00
|
|
|
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
|
|
|
|
print '<input type="hidden" name="mode" value="'.GETPOST('mode').'">';
|
|
|
|
|
|
2005-08-20 23:44:34 +02:00
|
|
|
print '<table class="noborder" width="100%">';
|
2012-03-19 14:44:27 +01:00
|
|
|
|
2005-08-20 23:44:34 +02:00
|
|
|
print '<tr class="liste_titre">';
|
2010-02-21 01:16:47 +01:00
|
|
|
print '<td>'.$langs->trans("Project").'</td>';
|
2009-07-28 15:37:28 +02:00
|
|
|
print '<td width="80">'.$langs->trans("RefTask").'</td>';
|
|
|
|
|
print '<td>'.$langs->trans("LabelTask").'</td>';
|
2012-02-15 23:08:20 +01:00
|
|
|
print '<td align="center">'.$langs->trans("DateStart").'</td>';
|
|
|
|
|
print '<td align="center">'.$langs->trans("DateEnd").'</td>';
|
2013-10-30 21:44:04 +01:00
|
|
|
print '<td align="center">'.$langs->trans("PlannedWorkload");
|
|
|
|
|
// TODO Replace 86400 and 7 to take account working hours per day and working day per weeks
|
|
|
|
|
//print '<br>('.$langs->trans("DelayWorkHour").')';
|
|
|
|
|
print '</td>';
|
|
|
|
|
print '<td align="right">'.$langs->trans("ProgressDeclared").'</td>';
|
2008-09-10 22:49:21 +02:00
|
|
|
print '<td align="right">'.$langs->trans("TimeSpent").'</td>';
|
2013-10-30 21:44:04 +01:00
|
|
|
print '<td align="right">'.$langs->trans("ProgressCalculated").'</td>';
|
2008-09-10 22:49:21 +02:00
|
|
|
print "</tr>\n";
|
2012-03-19 14:44:27 +01:00
|
|
|
|
|
|
|
|
print '<tr class="liste_titre">';
|
|
|
|
|
print '<td class="liste_titre">';
|
2013-03-01 00:56:29 +01:00
|
|
|
print '<input type="text" class="flat" name="search_project" value="'.$search_project.'" size="8">';
|
2012-03-19 14:44:27 +01:00
|
|
|
print '</td>';
|
2013-10-30 21:44:04 +01:00
|
|
|
print '<td class="liste_titre" colspan="7">';
|
2012-03-19 14:44:27 +01:00
|
|
|
print ' ';
|
|
|
|
|
print '</td>';
|
2014-01-13 10:15:07 +01:00
|
|
|
print '<td class="liste_titre" align="right"><input class="liste_titre" type="image" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'"></td>';
|
2012-03-19 14:44:27 +01:00
|
|
|
print "</tr>\n";
|
|
|
|
|
|
2014-03-10 01:49:44 +01:00
|
|
|
if (count($tasksarray) > 1000)
|
|
|
|
|
{
|
|
|
|
|
print '<tr '.$bc[0].'>';
|
|
|
|
|
print '<td colspan="9">';
|
|
|
|
|
print $langs->trans("TooManyDataPleaseUseMoreFilters");
|
|
|
|
|
print '</td></tr>';
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// Show all lines in taskarray (recursive function to go down on tree)
|
|
|
|
|
$j=0; $level=0;
|
|
|
|
|
$nboftaskshown=projectLinesa($j, 0, $tasksarray, $level, true, 1, $tasksrole, $projectsListId, 0);
|
|
|
|
|
}
|
|
|
|
|
|
2008-09-10 22:49:21 +02:00
|
|
|
print "</table>";
|
2009-07-28 15:37:28 +02:00
|
|
|
|
2012-03-19 14:44:27 +01:00
|
|
|
print '</form>';
|
|
|
|
|
|
2008-09-10 22:49:21 +02:00
|
|
|
print '</div>';
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Actions
|
|
|
|
|
*/
|
2010-02-10 16:55:29 +01:00
|
|
|
if ($user->rights->projet->creer)
|
2009-08-06 14:01:08 +02:00
|
|
|
{
|
|
|
|
|
print '<div class="tabsAction">';
|
2010-05-30 23:07:47 +02:00
|
|
|
print '<a class="butAction" href="'.DOL_URL_ROOT.'/projet/tasks.php?action=create">'.$langs->trans('AddTask').'</a>';
|
2009-08-06 14:01:08 +02:00
|
|
|
print '</div>';
|
|
|
|
|
}
|
2008-09-10 22:49:21 +02:00
|
|
|
|
2005-08-20 23:44:34 +02:00
|
|
|
|
2011-08-27 16:24:16 +02:00
|
|
|
llxFooter();
|
2012-02-15 23:08:20 +01:00
|
|
|
|
|
|
|
|
$db->close();
|
2005-08-20 23:44:34 +02:00
|
|
|
?>
|