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


PHP Phone::add方法代码示例

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


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

示例1: Phone

if (empty($_GET["id"])) {
    $_GET["id"] = "";
}
if (!isset($_GET["sort"])) {
    $_GET["sort"] = "";
}
if (!isset($_GET["order"])) {
    $_GET["order"] = "";
}
if (!isset($_GET["withtemplate"])) {
    $_GET["withtemplate"] = "";
}
$phone = new Phone();
if (isset($_POST["add"])) {
    $phone->check(-1, 'w', $_POST);
    $newID = $phone->add($_POST);
    Event::log($newID, "phones", 4, "inventory", $_SESSION["glpiname"] . " " . $LANG['log'][20] . " " . $_POST["name"] . ".");
    glpi_header($_SERVER['HTTP_REFERER']);
} else {
    if (isset($_POST["delete"])) {
        $phone->check($_POST["id"], 'd');
        $phone->delete($_POST);
        Event::log($_POST["id"], "phones", 4, "inventory", $_SESSION["glpiname"] . " " . $LANG['log'][22]);
        $phone->redirectToList();
    } else {
        if (isset($_POST["restore"])) {
            $phone->check($_POST["id"], 'd');
            $phone->restore($_POST);
            Event::log($_POST["id"], "phones", 4, "inventory", $_SESSION["glpiname"] . " " . $LANG['log'][23]);
            $phone->redirectToList();
        } else {
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:31,代码来源:phone.form.php

示例2: generate_entity

/** Generate bigdump : generate items for an entity
 *
 * @param $ID_entity entity ID
**/
function generate_entity($ID_entity) {
   global $MAX, $DB, $percent, $FIRST, $LAST, $MAX_KBITEMS_BY_CAT, $MAX_DISK,
         $DOCUMENTS, $NET_PORT, $NET_LOC;

   regenerateTreeCompleteName("glpi_entities");

   $current_year = date("Y");


   // DOMAIN
   $items = array("SP2MI", "CAMPUS"," IUT86", "PRESIDENCE", "CEAT", "D'omaine");
   $dp    = new Domain();
   $FIRST["domain"] = getMaxItem("glpi_domains")+1;

   for ($i=0 ; $i<$MAX['domain'] ; $i++) {
      if (isset($items[$i])) {
         $val = $items[$i];
      } else {
         $val = "domain $ID_entity '$i";
      }
      $dp->add(toolbox::addslashes_deep(array('name'         => $val,
                                              'entities_id'  => $ID_entity,
                                              'is_recursive' => 1,
                                              'comment'      => "comment $val")));
   }
   $LAST["domain"] = getMaxItem("glpi_domains");


   // STATUS
   $items = array("Reparation", "En stock", "En fonction", "Retour SAV", "En attente d'");
   $dp    = new State();
   $FIRST["state"] = getMaxItem("glpi_states")+1;
   for ($i=0 ; $i<$MAX['state'] ; $i++) {
      if (isset($items[$i])) {
         $val = $items[$i];
      } else {
         $val = "State $ID_entity '$i";
      }
      $state_id = $dp->add(toolbox::addslashes_deep(array('name'         => $val,
                                                          'entities_id'  => $ID_entity,
                                                          'is_recursive' => 1,
                                                          'comment'      => "comment $val")));

      // generate sub status
      for ($j=0 ; $j<$MAX['state'] ; $j++) {
         $val2 = "Sub $val $j";

         $dp->add(toolbox::addslashes_deep(array('name'         => $val2,
                                                 'entities_id'  => $ID_entity,
                                                 'is_recursive' => 1,
                                                 'states_id'    => $state_id,
                                                 'comment'      => "comment $val")));
      }

   }
   $LAST["state"]      = getMaxItem("glpi_states");


   // glpi_groups
   $FIRST["groups"] = getMaxItem("glpi_groups")+1;
   $group           = new Group();
   for ($i=0 ; $i<$MAX['groups'] ; $i++) {
      $gID = $group->add(toolbox::addslashes_deep(
                         array('entities_id'  => $ID_entity,
                               'name'         => "group d'$i",
                               'comment'      => "comment group d'$i",
                               'is_assign'    => 0)));

      // Generate sub group
      for ($j=0 ; $j<$MAX['groups'] ; $j++) {
         $group->add(toolbox::addslashes_deep(
                     array('entities_id'  => $ID_entity,
                           'name'         => "subgroup d'$j",
                           'comment'      => "comment subgroup d'$j of group $i",
                           'groups_id'    => $gID,
                           'is_assign'    => 0)));
      }
   }

   $LAST["groups"]      = getMaxItem("glpi_groups");

   $FIRST["techgroups"] = $LAST["groups"]+1;

   for ($i=0 ; $i<$MAX['groups'] ; $i++) {
         $group->add(toolbox::addslashes_deep(
                     array('entities_id'  => $ID_entity,
                           'name'         => "tech group d'$i",
                           'comment'      => "comment tech group d'$i")));
   }

   $LAST["techgroups"] = getMaxItem("glpi_groups");
   regenerateTreeCompleteName("glpi_groups");


   // glpi_users
   $FIRST["users_sadmin"] = getMaxItem("glpi_users")+1;
//.........这里部分代码省略.........
开发者ID:KaneoGmbH,项目名称:glpi,代码行数:101,代码来源:generate_bigdump.function.php

示例3: import

 /**
  * Function to import discovered device
  *
  * @param $items_id id of the device to import
  *
  * @return nothing
  *
  **/
 function import($items_id, $Import = 0, $NoImport = 0)
 {
     global $DB;
     $NetworkPort = new NetworkPort();
     $a_NetworkPorts = $NetworkPort->find("`items_id` = '" . $items_id . "'\n                      AND `itemtype` = 'PluginFusioninventoryUnmanaged'");
     $this->getFromDB($items_id);
     $this->fields = Toolbox::addslashes_deep($this->fields);
     $data = array();
     switch ($this->fields['item_type']) {
         case 'Printer':
             $Printer = new Printer();
             $data["entities_id"] = $this->fields["entities_id"];
             if (!empty($this->fields["name"])) {
                 $data["name"] = $this->fields["name"];
             }
             $data["locations_id"] = $this->fields["locations_id"];
             $data["serial"] = $this->fields["serial"];
             $data["otherserial"] = $this->fields["otherserial"];
             $data["contact"] = $this->fields["contact"];
             $data["domain"] = $this->fields["domain"];
             $data["comment"] = $this->fields["comment"];
             $data["is_dynamic"] = 1;
             $printer_id = $Printer->add($data);
             foreach ($a_NetworkPorts as $data_Port) {
                 $data_Port['items_id'] = $printer_id;
                 $data_Port['itemtype'] = $Printer->getType();
                 $NetworkPort->update($data_Port);
             }
             // Import SNMP
             $pfPrinter = new PluginFusioninventoryPrinter();
             $_SESSION['glpi_plugins_fusinvsnmp_table'] = "glpi_plugin_fusioninventory_printers";
             $query = "SELECT *\n                      FROM `glpi_plugin_fusioninventory_printers`\n                      WHERE `printers_id`='" . $printer_id . "' ";
             $result = $DB->query($query);
             $data = array();
             if ($DB->numrows($result) > 0) {
                 $data = $DB->fetch_assoc($result);
             }
             $data['sysdescr'] = $this->fields['sysdescr'];
             $data['plugin_fusioninventory_configsecurities_id'] = $this->fields['plugin_fusioninventory_configsecurities_id'];
             if ($DB->numrows($result) == 0) {
                 $data['printers_id'] = $printer_id;
                 $pfPrinter->add($data);
             } else {
                 $pfPrinter->update($data);
             }
             $this->deleteFromDB($items_id, 1);
             $Import++;
             break;
         case 'NetworkEquipment':
             $NetworkEquipment = new NetworkEquipment();
             $data["entities_id"] = $this->fields["entities_id"];
             if (!empty($this->fields["name"])) {
                 $data["name"] = $this->fields["name"];
             }
             $data["locations_id"] = $this->fields["locations_id"];
             $data["serial"] = $this->fields["serial"];
             $data["otherserial"] = $this->fields["otherserial"];
             $data["contact"] = $this->fields["contact"];
             $data["domain"] = $this->fields["domain"];
             $data["comment"] = $this->fields["comment"];
             $data["is_dynamic"] = 1;
             //            $data_Port = current($a_NetworkPorts);
             //            $data["ip"] = $data_Port["ip"];
             //            $data["mac"] = $data_Port["mac"];
             $NetworkEquipment_id = $NetworkEquipment->add($data);
             foreach ($a_NetworkPorts as $data_Port) {
                 $data_Port['items_id'] = $NetworkEquipment_id;
                 $data_Port['itemtype'] = $NetworkEquipment->getType();
                 $NetworkPort->update($data_Port);
             }
             $pfNetworkEquipment = new PluginFusioninventoryNetworkEquipment();
             $_SESSION['glpi_plugins_fusinvsnmp_table'] = "glpi_plugin_fusioninventory_networkequipments";
             $query = "SELECT *\n                      FROM `glpi_plugin_fusioninventory_networkequipments`\n                      WHERE `networkequipments_id`='" . $NetworkEquipment_id . "' ";
             $result = $DB->query($query);
             $data = array();
             if ($DB->numrows($result) > 0) {
                 $data = $DB->fetch_assoc($result);
             }
             $data['sysdescr'] = $this->fields['sysdescr'];
             $data['plugin_fusioninventory_configsecurities_id'] = $this->fields['plugin_fusioninventory_configsecurities_id'];
             if ($DB->numrows($result) == 0) {
                 $data['networkequipments_id'] = $NetworkEquipment_id;
                 $pfNetworkEquipment->add($data);
             } else {
                 $pfNetworkEquipment->update($data);
             }
             $this->deleteFromDB($items_id, 1);
             $Import++;
             break;
         case 'Peripheral':
             $Peripheral = new Peripheral();
             $data["entities_id"] = $this->fields["entities_id"];
//.........这里部分代码省略.........
开发者ID:korial29,项目名称:fusioninventory-for-glpi,代码行数:101,代码来源:unmanaged.class.php


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