• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Printer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: updatePrinter

 /**
  * Function to update Printer
  *
  * @param array $a_inventory data fron agent inventory
  * @param id $items_id id of the printer
  *
  * @return nothing
  */
 function updatePrinter($a_inventory, $items_id)
 {
     global $DB;
     $printer = new Printer();
     $pfPrinter = new PluginFusioninventoryPrinter();
     $printer->getFromDB($items_id);
     if (!isset($_SESSION['glpiactiveentities_string'])) {
         $_SESSION['glpiactiveentities_string'] = $printer->fields['entities_id'];
     }
     if (!isset($_SESSION['glpiactiveentities'])) {
         $_SESSION['glpiactiveentities'] = array($printer->fields['entities_id']);
     }
     if (!isset($_SESSION['glpiactive_entity'])) {
         $_SESSION['glpiactive_entity'] = $printer->fields['entities_id'];
     }
     // * Printer
     $db_printer = $printer->fields;
     $a_lockable = PluginFusioninventoryLock::getLockFields('glpi_printers', $items_id);
     $a_ret = PluginFusioninventoryToolbox::checkLock($a_inventory['Printer'], $db_printer, $a_lockable);
     $a_inventory['Printer'] = $a_ret[0];
     $input = $a_inventory['Printer'];
     $input['id'] = $items_id;
     $printer->update($input);
     // * Printer fusion (ext)
     $db_printer = array();
     $query = "SELECT *\n            FROM `" . getTableForItemType("PluginFusioninventoryPrinter") . "`\n            WHERE `printers_id` = '{$items_id}'";
     $result = $DB->query($query);
     while ($data = $DB->fetch_assoc($result)) {
         foreach ($data as $key => $value) {
             $db_printer[$key] = Toolbox::addslashes_deep($value);
         }
     }
     if (count($db_printer) == '0') {
         // Add
         $a_inventory['PluginFusioninventoryPrinter']['printers_id'] = $items_id;
         $pfPrinter->add($a_inventory['PluginFusioninventoryPrinter']);
     } else {
         // Update
         $idtmp = $db_printer['id'];
         unset($db_printer['id']);
         unset($db_printer['printers_id']);
         unset($db_printer['plugin_fusioninventory_configsecurities_id']);
         $a_ret = PluginFusioninventoryToolbox::checkLock($a_inventory['PluginFusioninventoryPrinter'], $db_printer);
         $a_inventory['PluginFusioninventoryPrinter'] = $a_ret[0];
         $input = $a_inventory['PluginFusioninventoryPrinter'];
         $input['id'] = $idtmp;
         $pfPrinter->update($input);
     }
     // * Ports
     $this->importPorts($a_inventory, $items_id);
     // Page counters
     $this->importPageCounters($a_inventory['pagecounters'], $items_id);
     // Cartridges
     $this->importCartridges($a_inventory['cartridge'], $items_id);
 }
开发者ID:korial29,项目名称:fusioninventory-for-glpi,代码行数:63,代码来源:inventoryprinterlib.class.php


示例2: testPrinterTemplate

 /**
  * Check delete / purge on a template of printer
  */
 public function testPrinterTemplate()
 {
     $printer = new Printer();
     // Create
     $id[0] = $printer->add(array('name' => "Printer 1", 'entities_id' => 0, 'is_template' => 1));
     $this->assertGreaterThan(0, $id[0], "Fail to create Printer Template");
     $this->assertTrue($printer->getFromDB($id[0]), "Fail: can't read Template");
     $this->assertEquals(0, $printer->fields['is_deleted'], "Fail: is_deleted set");
     $this->assertEquals(1, $printer->fields['is_template'], "Fail: is_template not set");
     // Delete (= purge)
     $this->assertTrue($printer->delete(array('id' => $id[0]), 0), "Fail: can't delete Template");
     $this->assertFalse($printer->getFromDB($id[0]), "Fail: can read Template (deleted)");
 }
开发者ID:btry,项目名称:glpi,代码行数:16,代码来源:DeleteRestore.php


示例3: getInstance

 /**
  * @return null|Printer
  * get singleton instance
  */
 public static function getInstance()
 {
     if (!self::$instance) {
         self::$instance = new Printer();
     }
     return self::$instance;
 }
开发者ID:anggadarkprince,项目名称:web-businesscareer,代码行数:11,代码来源:Printer.class.php


示例4: render

 private function render($model = 'Invoice', $pdf = false)
 {
     sfConfig::set('sf_web_debug', false);
     $template = TemplateTable::getTemplateForModel($model);
     $printer = new Printer($model, $template->getId());
     $data = $this->getInvoiceDataFromRequest($this->getRequest());
     return $pdf ? $printer->renderPdf($data) : $printer->render($data);
 }
开发者ID:solutema,项目名称:siwapp-sf1,代码行数:8,代码来源:actions.class.php


示例5: outputToDevice

 public static function outputToDevice($deviceID)
 {
     if ($deviceID == 1) {
         Monitor::drawDataToMonitor();
     }
     if ($deviceID == 2) {
         Printer::sendDataToPrinter();
     }
 }
开发者ID:nahidacm,项目名称:designpatterns,代码行数:9,代码来源:io.php


示例6: showForm

 function showForm(Printer $item, $options = array())
 {
     // ** Get link OID fields
     $mapping_name = array();
     $id = $item->getID();
     $a_cartridges = $this->find("`printers_id`='" . $id . "'");
     echo "<div align='center'><form method='post' name='snmp_form' id='snmp_form'\n                 action=\"" . $options['target'] . "\">";
     echo "<table class='tab_cadre' cellpadding='5' width='950'>";
     echo "<tr class='tab_bg_1'>";
     echo "<th align='center' colspan='3'>";
     echo __('Cartridge(s)', 'fusioninventory');
     echo "</th>";
     echo "</tr>";
     asort($mapping_name);
     $mapping = new PluginFusioninventoryMapping();
     foreach ($a_cartridges as $a_cartridge) {
         echo "<tr class='tab_bg_1'>";
         echo "<td align='center'>";
         $mapping->getFromDB($a_cartridge['plugin_fusioninventory_mappings_id']);
         echo $mapping->getTranslation($mapping->fields);
         echo " : ";
         echo "</td>";
         echo "<td align='center'>";
         echo "</td>";
         echo "<td align='center'>";
         if ($a_cartridge['state'] == 100000) {
             echo __('OK');
         } else {
             if ($a_cartridge['state'] < 0) {
                 $a_cartridge['state'] = $a_cartridge['state'] * -1;
                 echo $a_cartridge['state'];
                 echo ' ' . __('remaining pages', 'fusioninventory');
             } else {
                 PluginFusioninventoryDisplay::bar($a_cartridge['state']);
             }
         }
         echo "</td>";
         echo "</tr>";
     }
     echo "</table>";
     Html::closeForm();
     echo "</div>";
 }
开发者ID:korial29,项目名称:fusioninventory-for-glpi,代码行数:43,代码来源:printercartridge.class.php


示例7: __construct

 public function __construct($invoice)
 {
     parent::__construct();
     $this->setTo($invoice->customer_email, $invoice->customer_name);
     // To get all the properties loaded for the template
     foreach ($invoice->Items as $it) {
         $it->refreshRelated();
     }
     $data[] = $invoice;
     $model = get_class($invoice);
     $printer = new Printer($model, TemplateTable::getTemplateForModel($model)->getId());
     try {
         $body = $printer->render($data);
         $pdf = $printer->renderPdf($data)->output();
         $attachment = new Swift_Attachment($pdf, $model . '-' . $invoice->getId() . '.pdf', 'application/pdf');
         $this->setSubject(PropertyTable::get('company_name') . ' [' . $model . ': ' . $invoice . ']')->setBody($printer->render($data), 'text/html')->attach($attachment);
         $this->setReadyState(true);
     } catch (LogicException $e) {
         $this->setReadyState(false);
     }
 }
开发者ID:solutema,项目名称:siwapp-sf1,代码行数:21,代码来源:EmailMessages.php


示例8: getTabNameForItem

 function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     if (!$withtemplate && Printer::canView()) {
         switch ($item->getType()) {
             case 'CartridgeItem':
                 if ($_SESSION['glpishow_count_on_tabs']) {
                     return self::createTabEntry(PrinterModel::getTypeName(Session::getPluralNumber()), self::countForCartridgeItem($item));
                 }
                 return PrinterModel::getTypeName(Session::getPluralNumber());
                 break;
         }
     }
     return '';
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:14,代码来源:cartridgeitem_printermodel.class.php


示例9: testVisibility

 public function testVisibility()
 {
     $this->Login();
     $p = new Printer();
     // Visibility from root + tree
     $this->setEntity('_test_root_entity', true);
     $this->assertTrue($p->can(getItemByTypeName('Printer', '_test_printer_all', true), READ));
     $this->assertTrue($p->can(getItemByTypeName('Printer', '_test_printer_ent0', true), READ));
     $this->assertTrue($p->can(getItemByTypeName('Printer', '_test_printer_ent1', true), READ));
     $this->assertTrue($p->can(getItemByTypeName('Printer', '_test_printer_ent2', true), READ));
     // Visibility from root only
     $this->setEntity('_test_root_entity', false);
     $this->assertTrue($p->can(getItemByTypeName('Printer', '_test_printer_all', true), READ));
     $this->assertTrue($p->can(getItemByTypeName('Printer', '_test_printer_ent0', true), READ));
     $this->assertFalse($p->can(getItemByTypeName('Printer', '_test_printer_ent1', true), READ));
     $this->assertFalse($p->can(getItemByTypeName('Printer', '_test_printer_ent2', true), READ));
     // Visibility from child
     $this->setEntity('_test_child_1', false);
     $this->assertTrue($p->can(getItemByTypeName('Printer', '_test_printer_all', true), READ));
     $this->assertFalse($p->can(getItemByTypeName('Printer', '_test_printer_ent0', true), READ));
     $this->assertTrue($p->can(getItemByTypeName('Printer', '_test_printer_ent1', true), READ));
     $this->assertFalse($p->can(getItemByTypeName('Printer', '_test_printer_ent2', true), READ));
 }
开发者ID:btry,项目名称:glpi,代码行数:23,代码来源:PrinterTest.php


示例10: actionUpdate

	public function actionUpdate(){
		$id = Yii::app()->request->getParam('id');
		$model = Printer::model()->findByPk($id);
		
		if(Yii::app()->request->isPostRequest) {
			$model->attributes = Yii::app()->request->getPost('Printer');
			if($model->save()){
				Yii::app()->user->setFlash('success' , '修改成功');
				$this->redirect(array('printer/index' , 'companyId' => $this->companyId));
			}
		}
		$this->render('update' , array(
				'model'=>$model,
		));
	}
开发者ID:song-yuan,项目名称:wymenujp,代码行数:15,代码来源:PrinterController.php


示例11: title

 /**
  * Show report title
  **/
 static function title()
 {
     global $PLUGIN_HOOKS, $CFG_GLPI;
     // Report generation
     // Default Report included
     $report_list["default"]["name"] = __('Default report');
     $report_list["default"]["file"] = "report.default.php";
     if (Contract::canView()) {
         // Rapport ajoute par GLPI V0.2
         $report_list["Contrats"]["name"] = __('By contract');
         $report_list["Contrats"]["file"] = "report.contract.php";
     }
     if (Infocom::canView()) {
         $report_list["Par_annee"]["name"] = __('By year');
         $report_list["Par_annee"]["file"] = "report.year.php";
         $report_list["Infocoms"]["name"] = __('Hardware financial and administrative information');
         $report_list["Infocoms"]["file"] = "report.infocom.php";
         $report_list["Infocoms2"]["name"] = __('Other financial and administrative information (licenses, cartridges, consumables)');
         $report_list["Infocoms2"]["file"] = "report.infocom.conso.php";
     }
     if (Session::haveRight("networking", READ)) {
         $report_list["Rapport prises reseau"]["name"] = __('Network report');
         $report_list["Rapport prises reseau"]["file"] = "report.networking.php";
     }
     if (Session::haveRight("reservation", READ)) {
         $report_list["reservation"]["name"] = __('Loan');
         $report_list["reservation"]["file"] = "report.reservation.php";
     }
     if (Computer::canView() || Monitor::canView() || Session::haveRight("networking", READ) || Peripheral::canView() || Printer::canView() || Phone::canView()) {
         $report_list["state"]["name"] = _n('Status', 'Statuses', Session::getPluralNumber());
         $report_list["state"]["file"] = "report.state.php";
     }
     //Affichage du tableau de presentation des stats
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr><th colspan='2'>" . __('Select the report you want to generate') . "</th></tr>";
     echo "<tr class='tab_bg_1'><td class='center'>";
     $count = count($report_list);
     $selected = -1;
     $values = array($CFG_GLPI["root_doc"] . '/front/report.php' => Dropdown::EMPTY_VALUE);
     while ($data = each($report_list)) {
         $val = $data[0];
         $name = $report_list["{$val}"]["name"];
         $file = $report_list["{$val}"]["file"];
         $key = $CFG_GLPI["root_doc"] . "/front/" . $file;
         $values[$key] = $name;
         if (stripos($_SERVER['REQUEST_URI'], $key) !== false) {
             $selected = $key;
         }
     }
     $names = array();
     $optgroup = array();
     if (isset($PLUGIN_HOOKS["reports"]) && is_array($PLUGIN_HOOKS["reports"])) {
         foreach ($PLUGIN_HOOKS["reports"] as $plug => $pages) {
             if (is_array($pages) && count($pages)) {
                 foreach ($pages as $page => $name) {
                     $names[$plug . '/' . $page] = array("name" => $name, "plug" => $plug);
                     $optgroup[$plug] = Plugin::getInfo($plug, 'name');
                 }
             }
         }
         asort($names);
     }
     foreach ($optgroup as $opt => $title) {
         $group = $title;
         foreach ($names as $key => $val) {
             if ($opt == $val["plug"]) {
                 $file = $CFG_GLPI["root_doc"] . "/plugins/" . $key;
                 $values[$group][$file] = $val["name"];
                 if (stripos($_SERVER['REQUEST_URI'], $file) !== false) {
                     $selected = $file;
                 }
             }
         }
     }
     Dropdown::showFromArray('statmenu', $values, array('on_change' => "window.location.href=this.options[this.selectedIndex].value", 'value' => $selected));
     echo "</td>";
     echo "</tr>";
     echo "</table>";
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:82,代码来源:report.class.php


示例12: 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


示例13: showGraph

    /**
     * Show printer graph form
     **/
    function showGraph($id, $options = array())
    {
        global $DB, $CFG_GLPI;
        $printer = new Printer();
        $where = '';
        $begin = '';
        $end = '';
        $timeUnit = 'day';
        $graphField = 'pages_total';
        $pagecounters = array();
        $graphType = 'day';
        if (isset($_SESSION['glpi_plugin_fusioninventory_graph_begin'])) {
            $begin = $_SESSION['glpi_plugin_fusioninventory_graph_begin'];
        }
        if ($begin == 'NULL' or $begin == '') {
            $begin = date("Y-m-01");
            // first day of current month
        }
        if (isset($_SESSION['glpi_plugin_fusioninventory_graph_end'])) {
            $end = $_SESSION['glpi_plugin_fusioninventory_graph_end'];
        }
        if (isset($_SESSION['glpi_plugin_fusioninventory_graph_type'])) {
            $graphType = $_SESSION['glpi_plugin_fusioninventory_graph_type'];
        }
        if ($end == 'NULL' or $end == '') {
            $end = date("Y-m-d");
            // today
        }
        if (isset($_SESSION['glpi_plugin_fusioninventory_graph_timeUnit'])) {
            $timeUnit = $_SESSION['glpi_plugin_fusioninventory_graph_timeUnit'];
        }
        if (!isset($_SESSION['glpi_plugin_fusioninventory_graph_printersComp'])) {
            $_SESSION['glpi_plugin_fusioninventory_graph_printersComp'] = array();
        }
        if (isset($_SESSION['glpi_plugin_fusioninventory_graph_printerCompAdd'])) {
            $printerCompAdd = $_SESSION['glpi_plugin_fusioninventory_graph_printerCompAdd'];
            if (!key_exists($printerCompAdd, $_SESSION['glpi_plugin_fusioninventory_graph_printersComp'])) {
                $oPrinter = new Printer();
                if ($oPrinter->getFromDB($printerCompAdd)) {
                    $_SESSION['glpi_plugin_fusioninventory_graph_printersComp'][$printerCompAdd] = $oPrinter->getField('name');
                }
            }
        } elseif (isset($_SESSION['glpi_plugin_fusioninventory_graph_printerCompRemove'])) {
            unset($_SESSION['glpi_plugin_fusioninventory_graph_printersComp'][$_SESSION['glpi_plugin_fusioninventory_graph_printerCompRemove']]);
        }
        $oPrinter = new Printer();
        $printers = $_SESSION['glpi_plugin_fusioninventory_graph_printersComp'];
        $printersView = $printers;
        // printers without the current printer
        if (isset($printersView[$id])) {
            unset($printersView[$id]);
        } else {
            if ($oPrinter->getFromDB($id)) {
                $printers[$id] = $oPrinter->getField('name');
            }
        }
        $printersList = '';
        foreach ($printers as $printers_id => $printername) {
            if ($printersList != '') {
                $printersList .= '<br/>';
            }
            if ($printers_id == $id) {
                $printersList .= $printername;
            } else {
                $oPrinter->getFromDB($printers_id);
                $printersList .= $oPrinter->getLink(1);
            }
        }
        $printersIds = "";
        foreach (array_keys($printers) as $printerId) {
            if ($printersIds != '') {
                $printersIds .= ', ';
            }
            $printersIds .= $printerId;
        }
        $where = " WHERE `printers_id` IN(" . $printersIds . ")";
        if ($begin != '' || $end != '') {
            $where .= " AND " . getDateRequest("`date`", $begin, $end);
        }
        $group = '';
        switch ($timeUnit) {
            case 'day':
                $group = "GROUP BY `printers_id`, `year`, `month`, `day`";
                break;
            case 'week':
                $group = "GROUP BY `printers_id`, `year`, `month`, `week`";
                break;
            case 'month':
                $group = "GROUP BY `printers_id`, `year`, `month`";
                break;
            case 'year':
                $group = "GROUP BY `printers_id`, `year`";
                break;
        }
        echo "<form method='post' name='snmp_form' id='snmp_form' action='" . $CFG_GLPI['root_doc'] . "/plugins/fusioninventory/front/printer_info.form.php'>";
        echo "<table class='tab_cadre' cellpadding='5' width='950'>";
        $mapping = new PluginFusioninventoryMapping();
//.........这里部分代码省略.........
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:101,代码来源:printerlog.class.php


示例14: pluginFusioninventoryUpdate


//.........这里部分代码省略.........
    $migration->addKey($newTable, array("printers_id", "date"), "printers_id");
    $migration->migrationOneTable($newTable);
    $DB->list_fields($newTable, FALSE);
    /*
     *  glpi_plugin_fusioninventory_printercartridges
     */
    $newTable = "glpi_plugin_fusioninventory_printercartridges";
    $migration->renameTable("glpi_plugin_fusinvsnmp_printercartridges", $newTable);
    $migration->renameTable("glpi_plugin_tracker_printers_cartridges", $newTable);
    if (!TableExists($newTable)) {
        $DB->query('CREATE TABLE `' . $newTable . '` (
                        `id` bigint(100) NOT NULL AUTO_INCREMENT,
                        PRIMARY KEY (`id`)
                   ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1');
    }
    $migration->changeField($newTable, "id", "id", "bigint(100) NOT NULL AUTO_INCREMENT");
    $migration->changeField($newTable, "printers_id", "printers_id", "int(11) NOT NULL DEFAULT '0'");
    $migration->changeField($newTable, "plugin_fusioninventory_mappings_id", "plugin_fusioninventory_mappings_id", "int(11) NOT NULL DEFAULT '0'");
    $migration->changeField($newTable, "cartridges_id", "cartridges_id", "int(11) NOT NULL DEFAULT '0'");
    $migration->changeField($newTable, "state", "state", "int(3) NOT NULL DEFAULT '100'");
    $migration->migrationOneTable($newTable);
    $migration->changeField($newTable, "ID", "id", "bigint(100) NOT NULL AUTO_INCREMENT");
    $migration->changeField($newTable, "FK_printers", "printers_id", "int(11) NOT NULL DEFAULT '0'");
    $migration->changeField($newTable, "FK_cartridges", "cartridges_id", "int(11) NOT NULL DEFAULT '0'");
    $migration->addField($newTable, "plugin_fusioninventory_mappings_id", "int(11) NOT NULL DEFAULT '0'");
    $migration->migrationOneTable($newTable);
    // Update with mapping
    if (FieldExists($newTable, "object_name")) {
        $query = "SELECT * FROM `" . $newTable . "`\n               GROUP BY `object_name`";
        $result = $DB->query($query);
        while ($data = $DB->fetch_array($result)) {
            $pfMapping = new PluginFusioninventoryMapping();
            $mapping = 0;
            if ($mapping = $pfMapping->get("Printer", $data['object_name'])) {
                $DB->query("UPDATE `" . $newTable . "`\n                     SET `plugin_fusioninventory_mappings_id`='" . $mapping['id'] . "'\n                        WHERE `object_name`='" . $data['object_name'] . "'");
            }
        }
    }
    $migration->dropField($newTable, "object_name");
    $migration->migrationOneTable($newTable);
    $migration->addField($newTable, "id", "bigint(100) NOT NULL AUTO_INCREMENT");
    $migration->addField($newTable, "printers_id", "int(11) NOT NULL DEFAULT '0'");
    $migration->addField($newTable, "plugin_fusioninventory_mappings_id", "int(11) NOT NULL DEFAULT '0'");
    $migration->addField($newTable, "cartridges_id", "int(11) NOT NULL DEFAULT '0'");
    $migration->addField($newTable, "state", "int(3) NOT NULL DEFAULT '100'");
    $migration->addKey($newTable, "printers_id");
    $migration->addKey($newTable, "plugin_fusioninventory_mappings_id");
    $migration->addKey($newTable, "cartridges_id");
    $migration->migrationOneTable($newTable);
    $DB->list_fields($newTable, FALSE);
    /*
     * glpi_plugin_fusioninventory_networkports
     */
    $newTable = "glpi_plugin_fusioninventory_networkports";
    $migration->renameTable("glpi_plugin_fusinvsnmp_networkports", $newTable);
    $migration->renameTable("glpi_plugin_tracker_networking_ports", $newTable);
    if (!TableExists($newTable)) {
        $DB->query('CREATE TABLE `' . $newTable . '` (
                        `id` int(11) NOT NULL AUTO_INCREMENT,
                        PRIMARY KEY (`id`)
                   ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1');
    }
    $migration->changeField($newTable, "id", "id", "int(11) NOT NULL AUTO_INCREMENT");
    $migration->changeField($newTable, "networkports_id", "networkports_id", "int(11) NOT NULL DEFAULT '0'");
    $migration->changeField($newTable, "ifmtu", "ifmtu", "int(8) NOT NULL DEFAULT '0'");
    $migration->changeField($newTable, "ifspeed", "ifspeed", "bigint(50) NOT NULL DEFAULT '0'");
开发者ID:C-Duv,项目名称:fusioninventory-for-glpi,代码行数:67,代码来源:update.php


示例15: countForPrinter

 /**
  * @param $item Printer object
  **/
 static function countForPrinter(Printer $item)
 {
     return countElementsInTable(array('glpi_cartridges'), ['glpi_cartridges.printers_id' => $item->getField('id')]);
 }
开发者ID:glpi-project,项目名称:glpi,代码行数:7,代码来源:cartridge.class.php


示例16: importPrinter

 /**
  *
  * Import printers from OCS
  * @since 1.0
  * @param $cfg_ocs OCSNG mode configuration
  * @param $computers_id computer's id in GLPI
  * @param $ocsid computer's id in OCS
  * @param $ocsservers_id OCS server id
  * @param $entity the entity in which the printer will be created
  * @param $dohistory record in history link between printer and computer
  */
 static function importPrinter($cfg_ocs, $computers_id, $ocsservers_id, $ocsid, $entity, $dohistory)
 {
     global $PluginOcsinventoryngDBocs, $DB;
     self::checkOCSconnection($ocsservers_id);
     if ($cfg_ocs["import_printer"]) {
         $already_processed = array();
         $conn = new Computer_Item();
         $query = "SELECT*\n                     FROM `printers`\n                     WHERE `HARDWARE_ID` = '{$ocsid}'";
         $result = $PluginOcsinventoryngDBocs->query($query);
         $p = new Printer();
         if ($PluginOcsinventoryngDBocs->numrows($result) > 0) {
             while ($line = $PluginOcsinventoryngDBocs->fetch_array($result)) {
                 $line = Toolbox::clean_cross_side_scripting_deep(Toolbox::addslashes_deep($line));
                 $print = array();
                 // TO TEST : PARSE NAME to have real name.
                 $print['name'] = self::encodeOcsDataInutf8($cfg_ocs["ocs_db_utf8"], $line['NAME']);
                 if (empty($print["name"])) {
                     $print["name"] = $line["DRIVER"];
                 }
                 $management_process = $cfg_ocs["import_printer"];
                 //Params for the dictionnary
                 $params['name'] = $print['name'];
                 $params['manufacturer'] = "";
                 $params['DRIVER'] = $line['DRIVER'];
                 $params['PORT'] = $line['PORT'];
                 if (!empty($print["name"])) {
                     $rulecollection = new RuleDictionnaryPrinterCollection();
                     $res_rule = Toolbox::addslashes_deep($rulecollection->processAllRules(Toolbox::stripslashes_deep($params), array(), array()));
                     if (!isset($res_rule["_ignore_import"]) || !$res_rule["_ignore_import"]) {
                         foreach ($res_rule as $key => $value) {
                             if ($value != '' && $value[0] != '_') {
                                 $print[$key] = $value;
                             }
                         }
                         if (isset($res_rule['is_global'])) {
                             if (!$res_rule['is_global']) {
                                 $management_process = 2;
                             } else {
                                 $management_process = 1;
                             }
                         }
                         //Look for a monitor with the same name (and serial if possible) already connected
                         //to this computer
                         $query = "SELECT `p`.`id`, `gci`.`is_deleted`\n                               FROM `glpi_printers` as `p`, `glpi_computers_items` as `gci`\n                               WHERE `p`.`id` = `gci`.`items_id`\n                                  AND `gci`.`is_dynamic`='1'\n                                  AND `computers_id`='{$computers_id}'\n                                  AND `itemtype`='Printer'\n                                  AND `p`.`name`='" . $print["name"] . "'";
                         $results = $DB->query($query);
                         $id = false;
                         $lock = false;
                         if ($DB->numrows($results) > 0) {
                             $id = $DB->result($results, 0, 'id');
                             $lock = $DB->result($results, 0, 'is_deleted');
                         }
                         if (!$id) {
                             // Clean printer object
                             $p->reset();
                             $print["comment"] = $line["PORT"] . "\r\n" . $line["DRIVER"];
                             self::analizePrinterPorts($print, $line["PORT"]);
                             $id_printer = 0;
                             if ($management_process == 1) {
                                 //Config says : manage printers as global
                                 //check if printers already exists in GLPI
                                 $print["is_global"] = MANAGEMENT_GLOBAL;
                                 $query = "SELECT `id`\n                                      FROM `glpi_printers`\n                                      WHERE `name` = '" . $print["name"] . "'\n                                         AND `is_global` = '1'\n                                         AND `entities_id` = '{$entity}'";
                                 $result_search = $DB->query($query);
                                 if ($DB->numrows($result_search) > 0) {
                                     //Periph is already in GLPI
                                     //Do not import anything just get periph ID for link
                                     $id_printer = $DB->result($result_search, 0, "id");
                                     $already_processed[] = $id_printer;
                                 } else {
                                     $input = $print;
                                     if ($cfg_ocs["states_id_default"] > 0) {
                                         $input["states_id"] = $cfg_ocs["states_id_default"];
                                     }
                                     $input["entities_id"] = $entity;
                                     $id_printer = $p->add($input);
                                 }
                             } else {
                                 if ($management_process == 2) {
                                     //Config says : manage printers as single units
                                     //Import all printers as non global.
                                     $input = $print;
                                     $input["is_global"] = MANAGEMENT_UNITARY;
                                     if ($cfg_ocs["states_id_default"] > 0) {
                                         $input["states_id"] = $cfg_ocs["states_id_default"];
                                     }
                                     $input["entities_id"] = $entity;
                                     $input['is_dynamic'] = 1;
                                     $id_printer = $p->add($input);
                                 }
//.........这里部分代码省略.........
开发者ID:geldarr,项目名称:hack-space,代码行数:101,代码来源:ocsserver.class.php


示例17: showForm

 function showForm(Printer $item, $options = array())
 {
     global $DB;
     Session::checkRight('plugin_fusioninventory_printer', READ);
     $id = $item->getID();
     if (!($data = $this->find("`printers_id`='" . $id . "'", '', 1))) {
         // Add in database if not exist
         $input = array();
         $input['printers_id'] = $id;
         $_SESSION['glpi_plugins_fusinvsnmp_table'] = 'glpi_printers';
         $ID_tn = $this->add($input);
         $this->getFromDB($ID_tn);
     } else {
         foreach ($data as $datas) {
             $this->fields = $datas;
         }
     }
     // Form printer informations
     echo "<div align='center'>";
     echo "<form method='post' name='snmp_form' id='snmp_form'\n                 action=\"" . $options['target'] . "\">";
     echo "<table class='tab_cadre' cellpadding='5' width='950'>";
     echo "<tr class='tab_bg_1'>";
     echo "<th colspan='4'>";
     echo __('SNMP information', 'fusioninventory');
     echo "</th>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td align='center'>";
     echo __('Sysdescr', 'fusioninventory');
     echo "</td>";
     echo "<td>";
     echo "<textarea name='sysdescr' cols='45' rows='5'>";
     echo $this->fields['sysdescr'];
     echo "</textarea>";
     echo "</td>";
     echo "<td align='center'>";
     echo __('Last inventory', 'fusioninventory') . "&nbsp;:";
     echo "</td>";
     echo "<td>";
     echo Html::convDateTime($this->fields['last_fusioninventory_update']);
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td align='center'></td>";
     echo "<td align='center'>";
     echo "</td>";
     echo "<td align='center'>" . __('SNMP authentication', 'fusioninventory') . "&nbsp;:</td>";
     echo "<td align='center'>";
     PluginFusioninventoryConfigSecurity::auth_dropdown($this->fields["plugin_fusioninventory_configsecurities_id"]);
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_2 center'>";
     echo "<td colspan='4'>";
     echo "<div align='center'>";
     echo "<input type='hidden' name='id' value='" . $id . "'>";
     echo "<input type='submit' name='update' value=\"" . __('Update') . "\" class='submit' >";
     echo "</td>";
     echo "</tr>";
     echo "</table>";
     Html::closeForm();
     echo "</div>";
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:62,代码来源:printer.class.php


示例18: getPrinters

 private function getPrinters()
 {
     $printers = Printer::model()->findAll('dpid=:companyId and delete_flag=0', array(':companyId' => $this->companyId));
     $printers = $printers ? $printers : array();
     return CHtml::listData($printers, 'lid', 'name');
 }
开发者ID:song-yuan,项目名称:wymenujp,代码行数:6,代码来源:PrinterWayController.php


示例19: updatePrinterFromNetdiscovery

 /**
  * @test
  */
 public function updatePrinterFromNetdiscovery()
 {
     global $DB;
     $DB->connect();
     $pfCNetworkDiscovery = new PluginFusioninventoryCommunicationNetworkDiscovery();
     $GLPIlog = new GLPIlogs();
     $networkName = new NetworkName();
     $iPAddress = new IPAddress();
     $_SESSION['SOURCE_XMLDEVICE'] = array('AUTHSNMP' => '1', 'DESCRIPTION' => 'Photosmart D7200 series', 'ENTITY' => '0', 'FIRMWARE' => '', 'IP' => '192.168.20.102', 'MAC' => '00:21:5a:0b:bb:c4', 'MANUFACTURER' => 'Hewlett-Packard', 'MODEL' => '', 'MODELSNMP' => 'Printer0093', 'NETBIOSNAME' => 'HP00215A0BBBC4', 'SERIAL' => 'MY89AQG0V9050N', 'SNMPHOSTNAME' => 'HP0BBBC4new', 'TYPE' => 'PRINTER');
     $printer = new Printer();
     $a_printers = $printer->f 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Problem类代码示例发布时间:2022-05-23
下一篇:
PHP Price类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap