function showCentral($who) { global $DB, $CFG_GLPI; echo "<table class='tab_cadre_central'><tr><td>"; if ($this->canView()) { $who = Session::getLoginUserID(); if (Session::isMultiEntitiesMode()) { $colsup = 1; } else { $colsup = 0; } $ASSIGN = ""; if ($who > 0) { $ASSIGN = " AND ((`" . $this->getTable() . "`.`users_id` = '{$who}')"; } //if ($who_group>0) { $ASSIGN .= " OR (`" . $this->getTable() . "`.`groups_id` IN (SELECT `groups_id` \n FROM `glpi_groups_users` \n WHERE `users_id` = '{$who}') )"; //} $query = "SELECT `" . $this->getTable() . "`.`id` AS plugin_projet_tasks_id,\n `" . $this->getTable() . "`.`name` AS name_task, \n `" . $this->getTable() . "`.`plugin_projet_tasktypes_id`,\n `" . $this->getTable() . "`.`is_deleted`, "; $query .= "`" . $this->getTable() . "`.`users_id` AS users_id_task, \n `glpi_plugin_projet_projets`.`id`, \n `glpi_plugin_projet_projets`.`name`, \n `glpi_plugin_projet_projets`.`entities_id`, \n `glpi_plugin_projet_projets`.`plugin_projet_projetstates_id`, \n `glpi_plugin_projet_projets`.`users_id` "; $query .= " FROM `" . $this->getTable() . "`,`glpi_plugin_projet_projets` "; $query .= " WHERE \n `" . $this->getTable() . "`.`plugin_projet_projets_id` = `glpi_plugin_projet_projets`.`id` "; //not show finished tasks $finished = " `for_dependency` = '1' "; $states = getAllDatasFromTable("glpi_plugin_projet_taskstates", $finished); $tab = array(); if (!empty($states)) { foreach ($states as $state) { $tab[] = $state['id']; } } if (!empty($tab)) { $query .= "AND `plugin_projet_taskstates_id` NOT IN (" . implode(',', $tab) . ")"; } $query .= " {$ASSIGN} ) \n AND `glpi_plugin_projet_projets`.`is_template` = '0' \n AND `" . $this->getTable() . "`.`is_deleted` = '0' \n AND `glpi_plugin_projet_projets`.`is_deleted` = '0'"; $PluginProjetProjet = new PluginProjetProjet(); $itemtable = "glpi_plugin_projet_projets"; if ($PluginProjetProjet->isEntityAssign()) { $LINK = " AND "; $query .= getEntitiesRestrictRequest($LINK, $itemtable); } $query .= " ORDER BY `glpi_plugin_projet_projets`.`name` DESC LIMIT 10;"; $result = $DB->query($query); $number = $DB->numrows($result); echo "<table class='tab_cadre_central'><tr><td>"; if ($number > 0) { Session::initNavigateListItems($this->getType()); echo "<div align='center'>"; echo "<table class='tab_cadre' style='text-align:center' width='100%'>"; echo "<tr><th colspan='" . (7 + $colsup) . "'>" . PluginProjetProjet::getTypeName(2) . ": " . __('Tasks in progress', 'projet') . " <a href='" . $CFG_GLPI["root_doc"] . "/plugins/projet/front/task.php'>" . __('All') . "</a></th></tr>"; echo "<tr><th>" . self::getTypeName(2) . "</th>"; if (Session::isMultiEntitiesMode()) { echo "<th>" . __('Entity') . "</th>"; } echo "<th>" . __('Type', 'Types', 1) . "</th>"; echo "<th>" . __('Planning') . "</th>"; echo "<th>" . PluginProjetProjet::getTypeName(1) . "</th>"; echo "<th>" . __('State', 'States', 1) . "</th>"; echo "<th>" . _n('Responsible', 'Responsibles', 2, 'projet') . "</th>"; echo "<th>" . __('User', 'Users', 1) . "</th>"; echo "</tr>"; while ($data = $DB->fetch_array($result)) { Session::addToNavigateListItems($this->getType(), $data['plugin_projet_tasks_id']); echo "<tr class='tab_bg_1" . ($data["is_deleted"] == '1' ? "_2" : "") . "'>"; echo "<td align='center'><a href='" . $CFG_GLPI["root_doc"] . "/plugins/projet/front/task.form.php?id=" . $data["plugin_projet_tasks_id"] . "'>" . $data["name_task"]; if ($_SESSION["glpiis_ids_visible"]) { echo " (" . $data["plugin_projet_tasks_id"] . ")"; } echo "</a></td>"; if (Session::isMultiEntitiesMode()) { echo "<td class='center'>"; echo Dropdown::getDropdownName("glpi_entities", $data['entities_id']) . "</td>"; } echo "<td align='center'>"; echo Dropdown::getDropdownName("glpi_plugin_projet_tasktypes", $data["plugin_projet_tasktypes_id"]); echo "</td>"; echo "<td align='center'>"; $restrict = " `plugin_projet_tasks_id` = '" . $data['plugin_projet_tasks_id'] . "' "; $plans = getAllDatasFromTable("glpi_plugin_projet_taskplannings", $restrict); if (!empty($plans)) { foreach ($plans as $plan) { echo Html::convDateTime($plan["begin"]) . " -> " . Html::convDateTime($plan["end"]); } } else { _e('None'); } echo "</td>"; echo "<td align='center'>"; echo "<a href='" . $CFG_GLPI["root_doc"] . "/plugins/projet/front/projet.form.php?id=" . $data["id"] . "'>"; echo $data["name"]; if ($_SESSION["glpiis_ids_visible"]) { echo " (" . $data["id"] . ")"; } echo "</a></td>"; echo "<td align='center'>"; echo Dropdown::getDropdownName("glpi_plugin_projet_projetstates", $data['plugin_projet_projetstates_id']) . "</td>"; echo "<td align='center'>"; echo getUserName($data["users_id"]) . "</td>"; echo "<td align='center'>"; echo getUserName($data["users_id_task"]) . "</td>"; echo "</tr>"; } echo "</table>"; echo "</div>"; } echo "</td></tr></table>"; } echo "</td></tr></table>"; }