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


PHP Printer::addOrRestoreFromTrash方法代码示例

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


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

示例1: replayDictionnaryOnOnePrinter

 /**
  * Replay dictionnary on one printer
  *
  * @param &$new_printers   array containing new printers already computed
  * @param $res_rule        array of rule results
  * @param $params          array
  * @param &$printers_ids   array containing replay printer need to be dustbined
  **/
 function replayDictionnaryOnOnePrinter(array &$new_printers, array $res_rule, $params = array(), array &$printers_ids)
 {
     global $DB;
     $p['id'] = 0;
     $p['name'] = '';
     $p['manufacturer'] = '';
     $p['is_global'] = '';
     $p['entity'] = 0;
     foreach ($params as $key => $value) {
         $p[$key] = $value;
     }
     $input["name"] = $p['name'];
     $input["manufacturer"] = $p['manufacturer'];
     if (empty($res_rule)) {
         $res_rule = $this->processAllRules($input, array(), array());
     }
     $printer = new Printer();
     //Printer's name has changed
     if (isset($res_rule["name"]) && $res_rule["name"] != $p['name']) {
         $manufacturer = "";
         if (isset($res_rule["manufacturer"])) {
             $manufacturer = addslashes(Dropdown::getDropdownName("glpi_manufacturers", $res_rule["manufacturer"]));
         } else {
             $manufacturer = addslashes($p['manufacturer']);
         }
         //New printer not already present in this entity
         if (!isset($new_printers[$p['entity']][$res_rule["name"]])) {
             // create new printer or restore it from dustbin
             $new_printer_id = $printer->addOrRestoreFromTrash($res_rule["name"], $manufacturer, $p['entity']);
             $new_printers[$p['entity']][$res_rule["name"]] = $new_printer_id;
         } else {
             $new_printer_id = $new_printers[$p['entity']][$res_rule["name"]];
         }
         // Move direct connections
         $this->moveDirectConnections($p['id'], $new_printer_id);
     } else {
         $new_printer_id = $p['id'];
         $res_rule["id"] = $p['id'];
         if (isset($res_rule["manufacturer"])) {
             if ($res_rule["manufacturer"] != '') {
                 $res_rule["manufacturers_id"] = $res_rule["manufacturer"];
             }
             unset($res_rule["manufacturer"]);
         }
         $printer->update($res_rule);
     }
     // Add to printer to deleted list
     if ($new_printer_id != $p['id']) {
         $printers_ids[] = $p['id'];
     }
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:59,代码来源:ruledictionnaryprintercollection.class.php


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