Can be overloaded (ex : infocom)
public maybeRecursive ( ) : boolean | ||
return | boolean |
static function showUsers(CommonDBTM $item) { global $DB, $CFG_GLPI; $ID = $item->getField('id'); if ($item->isNewID($ID)) { return false; } if (!plugin_projet_haveRight('projet', 'r')) { return false; } if (!$item->can($item->fields['id'], 'r')) { return false; } $canread = $item->can($ID, 'r'); $query = "SELECT `glpi_plugin_projet_projets`.* FROM `glpi_plugin_projet_projets` " . " LEFT JOIN `glpi_entities` ON (`glpi_entities`.`id` = `glpi_plugin_projet_projets`.`entities_id`) "; if ($item->getType() == 'User') { $query .= " WHERE `glpi_plugin_projet_projets`.`users_id` = '" . $ID . "' "; } else { $query .= " WHERE `glpi_plugin_projet_projets`.`groups_id` = '" . $ID . "' "; } $query .= "AND `glpi_plugin_projet_projets`.`is_template` = 0 " . getEntitiesRestrictRequest(" AND ", "glpi_plugin_projet_projets", '', '', $item->maybeRecursive()); $result = $DB->query($query); $number = $DB->numrows($result); if (Session::isMultiEntitiesMode()) { $colsup = 1; } else { $colsup = 0; } if ($number > 0) { echo "<form method='post' action=\"" . $CFG_GLPI["root_doc"] . "/plugins/projet/front/projet.form.php\">"; echo "<div align='center'><table class='tab_cadre_fixe'>"; echo "<tr><th colspan='" . (4 + $colsup) . "'>" . __('Responsible of projects', 'projet') . ":</th></tr>"; echo "<tr><th>" . __('Name') . "</th>"; if (Session::isMultiEntitiesMode()) { echo "<th>" . __('Entity') . "</th>"; } echo "<th>" . __('Description') . "</th>"; echo "<th>" . __('Progress') . "</th>"; echo "</tr>"; while ($data = $DB->fetch_array($result)) { echo "<tr class='tab_bg_1" . ($data["is_deleted"] == '1' ? "_2" : "") . "'>"; if ($canread && (in_array($data['entities_id'], $_SESSION['glpiactiveentities']) || $data["recursive"])) { echo "<td class='center'><a href='" . $CFG_GLPI["root_doc"] . "/plugins/projet/front/projet.form.php?id=" . $data["id"] . "'>" . $data["name"]; if ($_SESSION["glpiis_ids_visible"]) { echo " (" . $data["id"] . ")"; } echo "</a></td>"; } else { echo "<td class='center'>" . $data["name"]; if ($_SESSION["glpiis_ids_visible"]) { echo " (" . $data["id"] . ")"; } echo "</td>"; } if (Session::isMultiEntitiesMode()) { echo "<td class='center'>" . Dropdown::getDropdownName("glpi_entities", $data['entities_id']) . "</td>"; } echo "<td align='center'>" . Html::resume_text($data["description"], 250) . "</td>"; echo "<td align='center'>" . $data["advance"] . " %</td>"; echo "</tr>"; } echo "</table></div>"; Html::closeForm(); echo "<br>"; } else { echo "<div align='center'><table class='tab_cadre_fixe' style='text-align:center'>"; echo "<tr><th>" . __('Responsible of projects', 'projet') . " - " . __('No item found'); echo "</th></tr></table></div><br>"; } }
/** * Is the object recursive * * @return boolean **/ function isRecursive() { // Case of Duplicate Entity info to child if (parent::maybeRecursive()) { return parent::isRecursive(); } if (preg_match('/^itemtype/', $this->itemtype)) { $type = $this->fields[$this->itemtype]; } else { $type = $this->itemtype; } if (class_exists($type)) { $item = new $type(); if ($item->getFromDB($this->fields[$this->items_id])) { return $item->isRecursive(); } } return false; }