本文整理汇总了PHP中CommonDBTM::maybeRecursive方法的典型用法代码示例。如果您正苦于以下问题:PHP CommonDBTM::maybeRecursive方法的具体用法?PHP CommonDBTM::maybeRecursive怎么用?PHP CommonDBTM::maybeRecursive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CommonDBTM
的用法示例。
在下文中一共展示了CommonDBTM::maybeRecursive方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showUsers
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>";
}
}
示例2: isRecursive
/**
* 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;
}