22 |
*/ |
*/ |
23 |
|
|
24 |
/** |
/** |
25 |
\file htdocs/projet/index.php |
\file htdocs/projet/index.php |
26 |
\ingroup projet |
\ingroup projet |
27 |
\brief Page d'accueil du module projet |
\brief Page d'accueil du module projet |
28 |
\version $Revision$ |
\version $Revision$ |
29 |
*/ |
*/ |
30 |
|
|
31 |
require("./pre.inc.php"); |
require("./pre.inc.php"); |
|
|
|
32 |
$langs->load("projects"); |
$langs->load("projects"); |
33 |
|
|
34 |
|
if (!$user->rights->projet->lire) accessforbidden(); |
35 |
|
|
36 |
/* |
/* |
37 |
* Sécurité accés client |
* Sécurité accés client |
38 |
*/ |
*/ |
46 |
|
|
47 |
print_titre($langs->trans("ProjectsArea")); |
print_titre($langs->trans("ProjectsArea")); |
48 |
|
|
49 |
$sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"]; |
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">'; |
50 |
$sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"]; |
print '<tr><td width="30%" valign="top">'; |
|
$page=isset($_GET["page"])?$_GET["page"]:$_POST["page"]; |
|
51 |
|
|
52 |
if ($sortfield == "") $sortfield="p.ref"; |
/* |
53 |
if ($sortorder == "") $sortorder="ASC"; |
* |
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 |
$offset = $limit * $page ; |
$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 |
|
if ($socidp) |
69 |
|
{ |
70 |
|
$sql .= " AND s.idp = $socidp"; |
71 |
|
} |
72 |
|
$sql .= " GROUP BY p.rowid"; |
73 |
|
|
74 |
|
$var=true; |
75 |
|
$resql = $db->query($sql); |
76 |
|
if ( $resql ) |
77 |
|
{ |
78 |
|
$num = $db->num_rows($resql); |
79 |
|
$i = 0; |
80 |
|
|
81 |
|
while ($i < $num) |
82 |
|
{ |
83 |
|
$row = $db->fetch_row( $resql); |
84 |
|
$var=!$var; |
85 |
|
print "<tr $bc[$var]>"; |
86 |
|
print '<td><a href="'.DOL_URL_ROOT.'/projet/tasks/fiche.php?id='.$row[1].'">'.$row[0].'</a></td>'; |
87 |
|
print '<td align="center">'.$row[2].'</td>'; |
88 |
|
print "</tr>\n"; |
89 |
|
|
90 |
|
$i++; |
91 |
|
} |
92 |
|
|
93 |
|
$db->free($resql); |
94 |
|
} |
95 |
|
else |
96 |
|
{ |
97 |
|
dolibarr_print_error($db); |
98 |
|
} |
99 |
|
print "</table>"; |
100 |
|
|
101 |
|
print '</td><td width="70%">'; |
102 |
|
|
103 |
/* |
/* |
104 |
* |
* |
105 |
* Affichage de la liste des projets |
* Affichage de la liste des projets |
106 |
* |
* |
107 |
*/ |
*/ |
|
print '<br>'; |
|
108 |
print '<table class="noborder" width="100%">'; |
print '<table class="noborder" width="100%">'; |
109 |
print '<tr class="liste_titre">'; |
print '<tr class="liste_titre">'; |
110 |
print_liste_field_titre($langs->trans("Company"),"index.php","s.nom","","","",$sortfield); |
print_liste_field_titre($langs->trans("Company"),"index.php","s.nom","","","",$sortfield); |
120 |
$sql .= " AND s.idp = $socidp"; |
$sql .= " AND s.idp = $socidp"; |
121 |
} |
} |
122 |
$sql .= " GROUP BY s.nom"; |
$sql .= " GROUP BY s.nom"; |
123 |
$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit, $offset); |
//$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit, $offset); |
124 |
|
|
125 |
$var=true; |
$var=true; |
126 |
$resql = $db->query($sql); |
$resql = $db->query($sql); |
147 |
{ |
{ |
148 |
dolibarr_print_error($db); |
dolibarr_print_error($db); |
149 |
} |
} |
|
|
|
150 |
print "</table>"; |
print "</table>"; |
151 |
|
|
152 |
|
print '</td></tr></table>'; |
153 |
|
|
154 |
$db->close(); |
$db->close(); |
155 |
|
|
156 |
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>"); |
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>"); |