本文整理匯總了PHP中Printer::getEmpty方法的典型用法代碼示例。如果您正苦於以下問題:PHP Printer::getEmpty方法的具體用法?PHP Printer::getEmpty怎麽用?PHP Printer::getEmpty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Printer
的用法示例。
在下文中一共展示了Printer::getEmpty方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: addToDB
function addToDB()
{
if ($this->getName()) {
$cfg_ocs = getOcsConf($_SESSION["ocs_server_id"]);
parent::getEmpty();
$this->fields = array();
$this->fields["name"] = $this->getName();
$this->fields["comments"] = $this->port . '\\n' . $this->error;
$this->fields["date_mod"] = date("Y-m-d H:i:s");
$this->fields["is_global"] = 0;
$this->fields["model"] = ocsImportDropdown("glpi_dropdown_model_printers", "name", $this->driver);
if ($this->fgLPT) {
$this->fields["flags_par"] = 1;
}
if ($this->fgCOM) {
$this->fields["flags_serial"] = 1;
}
if ($this->fgUSB) {
$this->fields["flags_usb"] = 1;
}
if ($this->id = parent::addToDB()) {
if ($cfg_ocs["default_state"]) {
updateState(PRINTER_TYPE, $this->id, $cfg_ocs["default_state"], 0, 0);
}
// Si connexion directe : connexion avec lien du lieu et du contact
foreach ($this->servers as $server => &$queue) {
// Si serveur : le lieu et le contact seront ceux du serveur
if ($server === $this->server) {
$queue->connectToServer($this->id);
} else {
$queue->connectToUC($this->id);
}
}
// Connexion des files d'impression
foreach ($this->queues as $host => &$queue) {
if ($host != $queue->server) {
$queue->connectToUC($this->id);
}
}
// Connexion IP
if ($this->IP != '') {
$netport = array();
$netport["ifaddr"] = $this->IP;
$netport["ifmac"] = '';
//$line2["MACADDR"];
$netport["iface"] = ocsImportDropdown("glpi_dropdown_iface", "name", "Ethernet");
$netport["name"] = "Ethernet";
$netport["on_device"] = $this->id;
$netport["logical_number"] = 0;
$netport["device_type"] = PRINTER_TYPE;
$np = new Netport();
$np->add($netport);
}
}
}
return $this->id;
}