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


PHP Printer类代码示例

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


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


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