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


PHP Computer::getEntityID方法代码示例

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


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

示例1: pdfForComputer

 static function pdfForComputer(PluginPdfSimplePDF $pdf, Computer $item)
 {
     global $DB;
     $ID = $item->getField('id');
     // From ComputerVirtualMachine::showForComputer()
     $virtualmachines = getAllDatasFromTable('glpi_computervirtualmachines', "`computers_id` = '{$ID}'");
     $pdf->setColumnsSize(100);
     if (count($virtualmachines)) {
         $pdf->displayTitle("<b>" . __('List of virtual machines') . "</b>");
         $pdf->setColumnsSize(20, 8, 8, 8, 25, 8, 8, 15);
         $pdf->setColumnsAlign('left', 'center', 'center', 'center', 'left', 'right', 'right', 'left');
         $typ = explode(' ', __('Virtualization system'));
         $sys = explode(' ', __('Virtualization model'));
         $sta = explode(' ', __('State of the virtual machine'));
         $pdf->displayTitle(__('Name'), $typ[0], $sys[0], $sta[0], __('UUID'), __('CPU'), __('Mio'), __('Machine'));
         foreach ($virtualmachines as $virtualmachine) {
             $name = '';
             if ($link_computer = ComputerVirtualMachine::findVirtualMachine($virtualmachine)) {
                 $computer = new Computer();
                 if ($computer->getFromDB($link_computer)) {
                     $name = $computer->getName();
                 }
             }
             $pdf->displayLine($virtualmachine['name'], Html::clean(Dropdown::getDropdownName('glpi_virtualmachinetypes', $virtualmachine['virtualmachinetypes_id'])), Html::clean(Dropdown::getDropdownName('glpi_virtualmachinesystems', $virtualmachine['virtualmachinesystems_id'])), Html::clean(Dropdown::getDropdownName('glpi_virtualmachinestates', $virtualmachine['virtualmachinestates_id'])), $virtualmachine['uuid'], $virtualmachine['vcpu'], Html::clean(Html::formatNumber($virtualmachine['ram'], false, 0)), $name);
         }
     } else {
         $pdf->displayTitle("<b>" . __('No virtual machine associated with the computer') . "</b>");
     }
     // From ComputerVirtualMachine::showForVirtualMachine()
     if ($item->fields['uuid']) {
         $where = "`uuid`" . ComputerVirtualMachine::getUUIDRestrictRequest($item->fields['uuid']);
         $hosts = getAllDatasFromTable('glpi_computervirtualmachines', $where);
         if (count($hosts)) {
             $pdf->setColumnsSize(100);
             $pdf->displayTitle("<b>" . __('List of host machines') . "</b>");
             $pdf->setColumnsSize(26, 37, 37);
             $pdf->displayTitle(__('Name'), __('Operating system'), __('Entity'));
             $computer = new Computer();
             foreach ($hosts as $host) {
                 if ($computer->getFromDB($host['computers_id'])) {
                     $pdf->displayLine($computer->getName(), Html::clean(Dropdown::getDropdownName('glpi_operatingsystems', $computer->getField('operatingsystems_id'))), Html::clean(Dropdown::getDropdownName('glpi_entities', $computer->getEntityID())));
                 }
             }
         }
     }
     $pdf->displaySpace();
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:47,代码来源:computervirtualmachine.class.php

示例2: showForm

 /**
  * Print the version form
  *
  * @param $ID integer ID of the item
  * @param $options array
  *     - target for the Form
  *     - computers_id ID of the computer for add process
  *
  * @return true if displayed  false if item not found or not right to display
  **/
 function showForm($ID, $options = array())
 {
     global $CFG_GLPI, $LANG;
     $computers_id = -1;
     if (isset($options['computers_id'])) {
         $computers_id = $options['computers_id'];
     }
     if (!haveRight("computer", "w")) {
         return false;
     }
     $comp = new Computer();
     if ($ID > 0) {
         $this->check($ID, 'r');
         $comp->getFromDB($this->fields['computers_id']);
     } else {
         $comp->getFromDB($computers_id);
         // Create item
         $input = array('entities_id' => $comp->getEntityID());
         $this->check(-1, 'w', $input);
     }
     $this->showTabs($options);
     $this->showFormHeader($options);
     if ($ID > 0) {
         $computers_id = $this->fields["computers_id"];
     } else {
         echo "<input type='hidden' name='computers_id' value='{$computers_id}'>";
     }
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['help'][25] . "&nbsp;:</td>";
     echo "<td colspan='3'>" . $comp->getLink() . "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['common'][16] . "&nbsp;:</td>";
     echo "<td>";
     autocompletionTextField($this, "name");
     echo "</td><td>" . $LANG['computers'][62] . "&nbsp;:</td>";
     echo "<td>";
     Dropdown::show('VirtualMachineType', array('value' => $this->fields['virtualmachinetypes_id']));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['computers'][60] . "&nbsp;:</td>";
     echo "<td>";
     Dropdown::show('VirtualMachineSystem', array('value' => $this->fields['virtualmachinesystems_id']));
     echo "</td><td>" . $LANG['computers'][63] . "&nbsp;:</td>";
     echo "<td>";
     Dropdown::show('VirtualMachineState', array('value' => $this->fields['virtualmachinestates_id']));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['computers'][58] . "&nbsp;:</td>";
     echo "<td>";
     autocompletionTextField($this, "uuid");
     echo "</td>";
     echo "<td>" . $LANG['computers'][61] . "&nbsp;:</td>";
     echo "<td>";
     autocompletionTextField($this, "vcpu");
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['computers'][24] . "&nbsp;:</td>";
     echo "<td>";
     autocompletionTextField($this, "ram");
     echo "</td>";
     echo "<td>" . $LANG['computers'][64] . "&nbsp;:</td>";
     echo "<td>";
     if ($link_computer = self::findVirtualMachine($this->fields)) {
         $computer = new Computer();
         if ($computer->can($link_computer, 'r')) {
             $url = "<a href='computer.form.php?id=" . $link_computer . "'>";
             $url .= $computer->fields["name"] . "</a>";
             $tooltip = $LANG['common'][16] . "&nbsp;: " . $computer->fields['name'];
             $tooltip .= "<br>" . $LANG['common'][19] . "&nbsp;: ";
             $tooltip .= "<br>" . $computer->fields['serial'];
             $tooltip .= "<br>" . $computer->fields['comment'];
             $url .= "&nbsp; " . showToolTip($tooltip, array('display' => false));
         } else {
             $url = $this->fields['name'];
         }
         echo $url;
     }
     echo "</td>";
     echo "</tr>";
     $this->showFormButtons($options);
     $this->addDivForTabs();
     return true;
 }
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:93,代码来源:computervirtualmachine.class.php

示例3: logProcessedComputer

 /**
  * @param $ocsid
  * @param $ocsservers_id
  * @param $action
  * @param $threadid
  * @param $threads_id
  **/
 function logProcessedComputer($ocsid, $ocsservers_id, $action, $threadid, $threads_id)
 {
     $input["ocsid"] = $ocsid;
     if (isset($action["rule_matched"])) {
         $input["rules_id"] = json_encode($action['rule_matched']);
     } else {
         $input["rules_id"] = "";
     }
     $input["threadid"] = $threadid;
     $input["plugin_ocsinventoryng_threads_id"] = $threads_id;
     $input["plugin_ocsinventoryng_ocsservers_id"] = $ocsservers_id;
     $input["action"] = $action['status'];
     if (isset($action["entities_id"])) {
         $input["entities_id"] = $action['entities_id'];
     } else {
         $input['entities_id'] = 0;
     }
     if (isset($action['computers_id'])) {
         $comp = new Computer();
         if ($comp->getFromDB($action['computers_id'])) {
             $input['computers_id'] = $comp->getID();
             $input['entities_id'] = $comp->getEntityID();
         }
     }
     $input["process_time"] = date("Y-m-d H:i:s");
     $this->add($input);
 }
开发者ID:JULIO8,项目名称:respaldo_glpi,代码行数:34,代码来源:detail.class.php

示例4: showForm

 /**
  * Print the version form
  *
  * @param $ID integer ID of the item
  * @param $options array
  *     - target for the Form
  *     - computers_id ID of the computer for add process
  *
  * @return true if displayed  false if item not found or not right to display
  **/
 function showForm($ID, $options = array())
 {
     global $CFG_GLPI, $LANG;
     $computers_id = -1;
     if (isset($options['computers_id'])) {
         $computers_id = $options['computers_id'];
     }
     if (!haveRight("computer", "w")) {
         return false;
     }
     $comp = new Computer();
     if ($ID > 0) {
         $this->check($ID, 'r');
         $comp->getFromDB($this->fields['computers_id']);
     } else {
         $comp->getFromDB($computers_id);
         // Create item
         $input = array('entities_id' => $comp->getEntityID());
         $this->check(-1, 'w', $input);
     }
     $this->showTabs($options);
     $this->showFormHeader($options);
     if ($ID > 0) {
         $computers_id = $this->fields["computers_id"];
     } else {
         echo "<input type='hidden' name='computers_id' value='{$computers_id}'>";
     }
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['help'][25] . "&nbsp;:</td>";
     echo "<td colspan='3'>" . $comp->getLink() . "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['common'][16] . "&nbsp;:</td>";
     echo "<td>";
     autocompletionTextField($this, "name");
     echo "</td><td>" . $LANG['computers'][6] . "&nbsp;:</td>";
     echo "<td>";
     autocompletionTextField($this, "device");
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['computers'][5] . "&nbsp;:</td>";
     echo "<td>";
     autocompletionTextField($this, "mountpoint");
     echo "</td><td>" . $LANG['computers'][4] . "&nbsp;:</td>";
     echo "<td>";
     Dropdown::show('FileSystem', array('value' => $this->fields["filesystems_id"]));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['computers'][3] . "&nbsp;:</td>";
     echo "<td>";
     autocompletionTextField($this, "totalsize");
     echo "&nbsp;" . $LANG['common'][82] . "</td>";
     echo "<td>" . $LANG['computers'][2] . "&nbsp;:</td>";
     echo "<td>";
     autocompletionTextField($this, "freesize");
     echo "&nbsp;" . $LANG['common'][82] . "</td></tr>";
     $this->showFormButtons($options);
     $this->addDivForTabs();
     return true;
 }
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:69,代码来源:computerdisk.class.php


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