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


PHP Computer::getFormURL方法代码示例

本文整理汇总了PHP中Computer::getFormURL方法的典型用法代码示例。如果您正苦于以下问题:PHP Computer::getFormURL方法的具体用法?PHP Computer::getFormURL怎么用?PHP Computer::getFormURL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Computer的用法示例。


在下文中一共展示了Computer::getFormURL方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Computer

include '../inc/includes.php';
Session::checkRight("computer", READ);
if (!isset($_GET["id"])) {
    $_GET["id"] = "";
}
if (!isset($_GET["withtemplate"])) {
    $_GET["withtemplate"] = "";
}
$computer = new Computer();
//Add a new computer
if (isset($_POST["add"])) {
    $computer->check(-1, CREATE, $_POST);
    if ($newID = $computer->add($_POST)) {
        Event::log($newID, "computers", 4, "inventory", sprintf(__('%1$s adds the item %2$s'), $_SESSION["glpiname"], $_POST["name"]));
        if ($_SESSION['glpibackcreated']) {
            Html::redirect($computer->getFormURL() . "?id=" . $newID);
        }
    }
    Html::back();
    // delete a computer
} else {
    if (isset($_POST["delete"])) {
        $computer->check($_POST['id'], DELETE);
        $ok = $computer->delete($_POST);
        if ($ok) {
            Event::log($_POST["id"], "computers", 4, "inventory", sprintf(__('%s deletes an item'), $_SESSION["glpiname"]));
        }
        $computer->redirectToList();
    } else {
        if (isset($_POST["restore"])) {
            $computer->check($_POST['id'], DELETE);
开发者ID:glpi-project,项目名称:glpi,代码行数:31,代码来源:computer.form.php

示例2: showForItem

 /**
  * Prints a direct connection to a computer
  *
  * @param $item the Monitor/Phone/Peripheral/Printer
  *
  * @return nothing (print out a table)
  */
 static function showForItem(CommonDBTM $item)
 {
     // Prints a direct connection to a computer
     global $DB, $LANG;
     $comp = new Computer();
     $target = $comp->getFormURL();
     $ID = $item->getField('id');
     if (!$item->can($ID, "r")) {
         return false;
     }
     $canedit = $item->can($ID, "w");
     // Is global connection ?
     $global = $item->getField('is_global');
     $used = array();
     $compids = array();
     $crit = array('FIELDS' => array('id', 'computers_id'), 'itemtype' => $item->getType(), 'items_id' => $ID);
     foreach ($DB->request('glpi_computers_items', $crit) as $data) {
         $compids[$data['id']] = $data['computers_id'];
     }
     echo "<div class='spaced'><table width='50%' class='tab_cadre_fixe'>";
     echo "<tr><th colspan='2'>";
     if (count($compids) == 0) {
         echo $LANG['connect'][4];
     } else {
         if (count($compids) == 1) {
             echo $LANG['connect'][3] . "&nbsp;:&nbsp;" . count($compids);
         } else {
             echo $LANG['connect'][2] . "&nbsp;:&nbsp;" . count($compids);
         }
     }
     echo "</th></tr>";
     if (count($compids) > 0) {
         foreach ($compids as $key => $compid) {
             $comp->getFromDB($compid);
             echo "<tr><td class='b tab_bg_1" . ($comp->getField('is_deleted') ? "_2" : "") . "'>";
             echo $LANG['help'][25] . "&nbsp;:&nbsp;" . $comp->getLink() . "</td>";
             echo "<td class='tab_bg_2" . ($comp->getField('is_deleted') ? "_2" : "") . " center b'>";
             if ($canedit) {
                 echo "<a href=\"{$target}?disconnect=1&amp;computers_id={$compid}&amp;id={$key}\">" . $LANG['buttons'][10] . "</a>";
             } else {
                 echo "&nbsp;";
             }
             $used[] = $compid;
         }
     } else {
         echo "<tr><td class='tab_bg_1 b'>" . $LANG['help'][25] . "&nbsp;:&nbsp;";
         echo "<i>" . $LANG['connect'][1] . "</i></td>";
         echo "<td class='tab_bg_2' class='center'>";
         if ($canedit) {
             echo "<form method='post' action=\"{$target}\">";
             echo "<input type='hidden' name='items_id' value='{$ID}'>";
             echo "<input type='hidden' name='itemtype' value='" . $item->getType() . "'>";
             if ($item->isRecursive()) {
                 self::dropdownConnect('Computer', $item->getType(), "computers_id", getSonsOf("glpi_entities", $item->getEntityID()), 0, $used);
             } else {
                 self::dropdownConnect('Computer', $item->getType(), "computers_id", $item->getEntityID(), 0, $used);
             }
             echo "<input type='submit' name='connect' value=\"" . $LANG['buttons'][9] . "\"\n                   class='submit'>";
             echo "</form>";
         } else {
             echo "&nbsp;";
         }
     }
     if ($global && count($compids) > 0) {
         echo "</td></tr>";
         echo "<tr><td class='tab_bg_1'>&nbsp;</td>";
         echo "<td class='tab_bg_2' class='center'>";
         if ($canedit) {
             echo "<form method='post' action=\"{$target}\">";
             echo "<input type='hidden' name='items_id' value='{$ID}'>";
             echo "<input type='hidden' name='itemtype' value='" . $item->getType() . "'>";
             if ($item->isRecursive()) {
                 self::dropdownConnect('Computer', $item->getType(), "computers_id", getSonsOf("glpi_entities", $item->getEntityID()), 0, $used);
             } else {
                 self::dropdownConnect('Computer', $item->getType(), "computers_id", $item->getEntityID(), 0, $used);
             }
             echo "<input type='submit' name='connect' value=\"" . $LANG['buttons'][9] . "\"\n                   class='submit'>";
             echo "</form>";
         } else {
             echo "&nbsp;";
         }
     }
     echo "</td></tr>";
     echo "</table></div>";
 }
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:92,代码来源:computer_item.class.php


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