当前位置: 首页>>代码示例>>PHP>>正文


PHP Software::canEdit方法代码示例

本文整理汇总了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>";
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:55,代码来源:softwareversion.class.php


注:本文中的Software::canEdit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。