本文整理汇总了PHP中Software::canEdit方法的典型用法代码示例。如果您正苦于以下问题:PHP Software::canEdit方法的具体用法?PHP Software::canEdit怎么用?PHP Software::canEdit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Software
的用法示例。
在下文中一共展示了Software::canEdit方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showForSoftware
/**
* Show Versions of a software
*
* @param $soft Software object
*
* @return nothing
**/
static function showForSoftware(Software $soft)
{
global $DB, $CFG_GLPI;
$softwares_id = $soft->getField('id');
if (!$soft->can($softwares_id, READ)) {
return false;
}
$canedit = $soft->canEdit($softwares_id);
echo "<div class='spaced'>";
if ($canedit) {
echo "<div class='center firstbloc'>";
echo "<a class='vsubmit' href='softwareversion.form.php?softwares_id={$softwares_id}'>" . _x('button', 'Add a version') . "</a>";
echo "</div>";
}
$query = "SELECT `glpi_softwareversions`.*,\n `glpi_states`.`name` AS sname\n FROM `glpi_softwareversions`\n LEFT JOIN `glpi_states` ON (`glpi_states`.`id` = `glpi_softwareversions`.`states_id`)\n WHERE `softwares_id` = '{$softwares_id}'\n ORDER BY `name`";
Session::initNavigateListItems('SoftwareVersion', sprintf(__('%1$s = %2$s'), Software::getTypeName(1), $soft->getName()));
if ($result = $DB->query($query)) {
if ($DB->numrows($result)) {
echo "<table class='tab_cadre_fixehov'><tr>";
echo "<th>" . self::getTypeName(Session::getPluralNumber()) . "</th>";
echo "<th>" . __('Status') . "</th>";
echo "<th>" . __('Operating system') . "</th>";
echo "<th>" . _n('Installation', 'Installations', Session::getPluralNumber()) . "</th>";
echo "<th>" . __('Comments') . "</th>";
echo "</tr>\n";
for ($tot = $nb = 0; $data = $DB->fetch_assoc($result); $tot += $nb) {
Session::addToNavigateListItems('SoftwareVersion', $data['id']);
$nb = Computer_SoftwareVersion::countForVersion($data['id']);
echo "<tr class='tab_bg_2'>";
echo "<td><a href='softwareversion.form.php?id=" . $data['id'] . "'>";
echo $data['name'] . (empty($data['name']) ? "(" . $data['id'] . ")" : "") . "</a></td>";
echo "<td>" . $data['sname'] . "</td>";
echo "<td class='right'>" . Dropdown::getDropdownName('glpi_operatingsystems', $data['operatingsystems_id']);
echo "</td>";
echo "<td class='numeric'>{$nb}</td>";
echo "<td>" . $data['comment'] . "</td></tr>\n";
}
echo "<tr class='tab_bg_1 noHover'><td class='right b' colspan='3'>" . __('Total') . "</td>";
echo "<td class='numeric b'>{$tot}</td><td></td></tr>";
echo "</table>\n";
} else {
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th>" . __('No item found') . "</th></tr>";
echo "</table>\n";
}
}
echo "</div>";
}