本文整理汇总了PHP中Computer::getLink方法的典型用法代码示例。如果您正苦于以下问题:PHP Computer::getLink方法的具体用法?PHP Computer::getLink怎么用?PHP Computer::getLink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Computer
的用法示例。
在下文中一共展示了Computer::getLink方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Computer
}
$comp = new Computer();
$result = $DBread->query($Sql);
for ($prev = -1, $i = 0; $data = $DBread->fetch_array($result); $i++) {
if ($prev != $data["entity"]) {
$prev = $data["entity"];
echo "<tr class='tab_bg_4'><td class='center' colspan='{$colspan}'>" . Dropdown::getDropdownName("glpi_entities", $prev) . "</td></tr>\n";
}
echo "<tr class='tab_bg_2'>";
if ($canedit) {
echo "<td><input type='checkbox' name='item[" . $data["AID"] . "]' value='1'></td>";
}
echo "<td class='b'>" . $data["AID"] . "</td>";
if ($comp->getFromDB($data["AID"])) {
echo "<td>";
echo $comp->getLink(true);
echo "</td><td>";
echo Dropdown::getDropdownName("glpi_manufacturers", $comp->getField('manufacturers_id'));
echo "</td><td>";
echo Dropdown::getDropdownName("glpi_computermodels", $comp->getField('computermodels_id'));
echo "</td><td>" . $comp->getField('serial');
echo "</td><td>" . $comp->getField('otherserial') . "</td>";
} else {
echo "<td colspan='5'>" . $data["Aname"] . "</td>";
}
if ($col) {
echo "<td>" . $data["Aaddr"] . "</td>";
}
echo "<td>" . getLastOcsUpdate($data['AID']) . "</td>";
if ($canedit) {
echo "<td><input type='checkbox' name='item[" . $data["BID"] . "]' value='1'></td>";
示例2: showForCollectWmi
function showForCollectWmi($collects_wmis_id)
{
$pfCollect_Wmi = new PluginFusioninventoryCollect_Wmi();
$computer = new Computer();
$pfCollect_Wmi->getFromDB($collects_wmis_id);
echo "<table class='tab_cadre_fixe'>";
echo "<tr>";
echo "<th colspan='3'>";
echo $pfCollect_Wmi->fields['class'];
echo "</th>";
echo "</tr>";
echo "<tr>";
echo "<th>" . __('Computer') . "</th>";
echo "<th>" . __('Property', 'fusioninventory') . "</th>";
echo "<th>" . __('Value', 'fusioninventory') . "</th>";
echo "</tr>";
$a_data = $this->find("`plugin_fusioninventory_collects_wmis_id`='" . $collects_wmis_id . "'", "`property`");
foreach ($a_data as $data) {
echo "<tr class='tab_bg_1'>";
echo '<td>';
$computer->getFromDB($data['computers_id']);
echo $computer->getLink(1);
echo '</td>';
echo '<td>';
echo $data['property'];
echo '</td>';
echo '<td>';
echo $data['value'];
echo '</td>';
echo "</tr>";
}
echo '</table>';
}
示例3: showForm
/**
* Display form for antivirus
*
* @param $ID id of the antivirus
* @param $options array
*
* @return bool TRUE if form is ok
**/
function showForm($ID, $options = array())
{
global $CFG_GLPI;
if (!Session::haveRight("computer", UPDATE)) {
return false;
}
$comp = new Computer();
if ($ID > 0) {
$this->check($ID, READ);
$comp->getFromDB($this->fields['computers_id']);
} else {
$this->check(-1, CREATE, $options);
$comp->getFromDB($options['computers_id']);
}
$this->showFormHeader($options);
if ($this->isNewID($ID)) {
echo "<input type='hidden' name='computers_id' value='" . $options['computers_id'] . "'>";
}
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Computer') . "</td>";
echo "<td>" . $comp->getLink() . "</td>";
if (Plugin::haveImport()) {
echo "<td>" . __('Automatic inventory') . "</td>";
echo "<td>";
if ($ID && $this->fields['is_dynamic']) {
Plugin::doHook("autoinventory_information", $this);
} else {
_e('No');
}
echo "</td>";
} else {
echo "<td colspan='2'></td>";
}
echo "</tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Name') . "</td>";
echo "<td>";
Html::autocompletionTextField($this, "name");
echo "</td>";
echo "<td>" . __('Active') . "</td>";
echo "<td>";
Dropdown::showYesNo('is_active', $this->fields['is_active']);
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Manufacturer') . "</td>";
echo "<td>";
Dropdown::show('Manufacturer', array('value' => $this->fields["manufacturers_id"]));
echo "</td>";
echo "<td>" . __('Up to date') . "</td>";
echo "<td>";
Dropdown::showYesNo('is_uptodate', $this->fields['is_uptodate']);
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Antivirus version') . "</td>";
echo "<td>";
Html::autocompletionTextField($this, "antivirus_version");
echo "</td>";
echo "<td>" . __('Signature database version') . "</td>";
echo "<td>";
Html::autocompletionTextField($this, "signature_version");
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Expiration date') . "</td>";
echo "<td>";
Html::showDateField("date_expiration", array('value' => $this->fields['date_expiration']));
echo "</td>";
echo "<td colspan='2'></td>";
echo "</tr>";
$this->showFormButtons($options);
return true;
}
示例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] . " :</td>";
echo "<td colspan='3'>" . $comp->getLink() . "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['common'][16] . " :</td>";
echo "<td>";
autocompletionTextField($this, "name");
echo "</td><td>" . $LANG['computers'][62] . " :</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] . " :</td>";
echo "<td>";
Dropdown::show('VirtualMachineSystem', array('value' => $this->fields['virtualmachinesystems_id']));
echo "</td><td>" . $LANG['computers'][63] . " :</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] . " :</td>";
echo "<td>";
autocompletionTextField($this, "uuid");
echo "</td>";
echo "<td>" . $LANG['computers'][61] . " :</td>";
echo "<td>";
autocompletionTextField($this, "vcpu");
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['computers'][24] . " :</td>";
echo "<td>";
autocompletionTextField($this, "ram");
echo "</td>";
echo "<td>" . $LANG['computers'][64] . " :</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] . " : " . $computer->fields['name'];
$tooltip .= "<br>" . $LANG['common'][19] . " : ";
$tooltip .= "<br>" . $computer->fields['serial'];
$tooltip .= "<br>" . $computer->fields['comment'];
$url .= " " . showToolTip($tooltip, array('display' => false));
} else {
$url = $this->fields['name'];
}
echo $url;
}
echo "</td>";
echo "</tr>";
$this->showFormButtons($options);
$this->addDivForTabs();
return true;
}
示例5: plugin_ocsinventoryng_preProcessRulePreviewResults
/**
*
* Preview for test a Rule
* @since 0.84
* @param $params input data
* @return $output array
*/
function plugin_ocsinventoryng_preProcessRulePreviewResults($params)
{
$output = $params['output'];
switch ($params['params']['rule_itemtype']) {
case 'RuleImportComputer':
//If ticket is assign to an object, display this information first
if (isset($output["action"])) {
echo "<tr class='tab_bg_2'>";
echo "<td>" . __('Action type') . "</td>";
echo "<td>";
switch ($output["action"]) {
case PluginOcsinventoryngOcsServer::LINK_RESULT_LINK:
_e('Link possible');
break;
case PluginOcsinventoryngOcsServer::LINK_RESULT_NO_IMPORT:
_e('Import refused');
break;
case PluginOcsinventoryngOcsServer::LINK_RESULT_IMPORT:
_e('New computer created in GLPI');
break;
}
echo "</td>";
echo "</tr>";
if ($output["action"] != PluginOcsinventoryngOcsServer::LINK_RESULT_NO_IMPORT && isset($output["found_computers"])) {
echo "<tr class='tab_bg_2'>";
$item = new Computer();
if ($item->getFromDB($output["found_computers"][0])) {
echo "<td>" . __('Link with computer') . "</td>";
echo "<td>" . $item->getLink(array('comments' => true)) . "</td>";
}
echo "</tr>";
}
}
break;
}
return $output;
}
示例6: ADDDATE
$state_sql = " AND `states_id` = '" . $state . "' ";
}
$query = "SELECT `last_fusioninventory_update`, `computers_id`\n FROM `glpi_plugin_fusioninventory_inventorycomputercomputers`\n LEFT JOIN `glpi_computers` ON `computers_id`=`glpi_computers`.`id`\nWHERE ((NOW() > ADDDATE(last_fusioninventory_update, INTERVAL " . $nbdays . " DAY)\n OR last_fusioninventory_update IS NULL)\n " . $state_sql . ")" . getEntitiesRestrictRequest("AND", "glpi_computers") . "\n\nORDER BY last_fusioninventory_update DESC";
$result = $DB->query($query);
echo "<table class='tab_cadre_fixe' cellpadding='5' width='950'>";
echo "<tr class='tab_bg_1'>";
echo "<th colspan='5'>" . __('Number of items') . " : " . $DB->numrows($result) . "</th>";
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<th>" . __('Name') . "</th>";
echo "<th>" . __('Last inventory') . "</th>";
echo "<th>" . __('Serial Number') . "</th>";
echo "<th>" . __('Inventory number') . "</th>";
echo "<th>" . __('Status') . "</th>";
echo "</tr>";
while ($data = $DB->fetch_array($result)) {
echo "<tr class='tab_bg_1'>";
echo "<td>";
$computer->getFromDB($data['computers_id']);
echo $computer->getLink(1);
echo "</td>";
echo "<td>" . Html::convDateTime($data['last_fusioninventory_update']) . "</td>";
echo "<td>" . $computer->fields['serial'] . "</td>";
echo "<td>" . $computer->fields['otherserial'] . "</td>";
echo "<td>";
echo Dropdown::getDropdownName(getTableForItemType("State"), $computer->fields['states_id']);
echo "</td>";
echo "</tr>";
}
echo "</table>";
Html::footer();
示例7: showNetworkPortDetail
//.........这里部分代码省略.........
} else {
echo $pfNetworkPort->fields["ifouterrors"];
}
echo "</td>";
break;
case 10:
if ($pfNetworkPort->fields["portduplex"] == 2) {
echo "<td background='#cf9b9b' class='tab_bg_1_2'>";
echo __('Half', 'fusioninventory');
echo '</td>';
} else {
if ($pfNetworkPort->fields["portduplex"] == 3) {
echo '<td>';
echo __('Full', 'fusioninventory');
echo '</td>';
} else {
echo "<td></td>";
}
}
break;
case 11:
// ** internal mac
echo "<td>" . $networkPort->fields["mac"] . "</td>";
break;
case 13:
// ** Mac address and link to device which are connected to this port
$opposite_port = $nw->getOppositeContact($data["id"]);
if ($opposite_port != "" && $opposite_port != 0) {
$networkPortOpposite = new NetworkPort();
if ($networkPortOpposite->getFromDB($opposite_port)) {
$data_device = $networkPortOpposite->fields;
$item = new $data_device["itemtype"]();
$item->getFromDB($data_device["items_id"]);
$link1 = $item->getLink(1);
$link = str_replace($item->getName(0), $data_device["mac"], $item->getLink());
// * GetIP
$a_networknames = current($networkName->find("`itemtype`='NetworkPort'\n AND `items_id`='" . $item->getID() . "'", "", 1));
$a_ipaddresses = current($iPAddress->find("`itemtype`='NetworkName'\n AND `items_id`='" . $a_networknames['id'] . "'", "", 1));
$link2 = str_replace($item->getName(0), $a_ipaddresses['name'], $item->getLink());
if ($data_device["itemtype"] == 'PluginFusioninventoryUnmanaged') {
$icon = $this->getItemtypeIcon($item->fields["item_type"]);
if ($item->getField("accepted") == "1") {
echo "<td style='background:#bfec75'\n class='tab_bg_1_2'>" . $icon . $link1;
} else {
echo "<td background='#cf9b9b'\n class='tab_bg_1_2'>" . $icon . $link1;
}
if (!empty($link)) {
echo "<br/>" . $link;
}
if (!empty($link2)) {
echo "<br/>" . $link2;
}
if ($item->getField("hub") == "1") {
$this->displayHubConnections($data_device["items_id"], $background_img);
}
echo "</td>";
} else {
$icon = $this->getItemtypeIcon($data_device["itemtype"]);
echo "<td>" . $icon . $link1;
if (!empty($link)) {
echo "<br/>" . $link;
}
if (!empty($link2)) {
echo "<br/>" . $link2;
}
if ($data_device["itemtype"] == 'Phone') {
示例8: 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] . " :</td>";
echo "<td colspan='3'>" . $comp->getLink() . "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['common'][16] . " :</td>";
echo "<td>";
autocompletionTextField($this, "name");
echo "</td><td>" . $LANG['computers'][6] . " :</td>";
echo "<td>";
autocompletionTextField($this, "device");
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['computers'][5] . " :</td>";
echo "<td>";
autocompletionTextField($this, "mountpoint");
echo "</td><td>" . $LANG['computers'][4] . " :</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] . " :</td>";
echo "<td>";
autocompletionTextField($this, "totalsize");
echo " " . $LANG['common'][82] . "</td>";
echo "<td>" . $LANG['computers'][2] . " :</td>";
echo "<td>";
autocompletionTextField($this, "freesize");
echo " " . $LANG['common'][82] . "</td></tr>";
$this->showFormButtons($options);
$this->addDivForTabs();
return true;
}
示例9: plugin_fusioninventory_giveItem
function plugin_fusioninventory_giveItem($type, $id, $data, $num)
{
global $CFG_GLPI;
$searchopt =& Search::getOptions($type);
$table = $searchopt[$id]["table"];
$field = $searchopt[$id]["field"];
switch ($table . '.' . $field) {
case "glpi_plugin_fusioninventory_taskjobs.status":
$pfTaskjobstate = new PluginFusioninventoryTaskjobstate();
return $pfTaskjobstate->stateTaskjob($data['raw']['id'], '200', 'htmlvar', 'simple');
break;
case "glpi_plugin_fusioninventory_agents.version":
$array = importArrayFromDB($data['raw']['ITEM_' . $num]);
$input = "";
foreach ($array as $name => $version) {
$input .= "<strong>" . $name . "</strong> : " . $version . "<br/>";
}
$input .= "*";
$input = str_replace("<br/>*", "", $input);
return $input;
break;
case "glpi_plugin_fusioninventory_credentials.itemtype":
if ($label = PluginFusioninventoryCredential::getLabelByItemtype($data['raw']['ITEM_' . $num])) {
return $label;
} else {
return '';
}
break;
case 'glpi_plugin_fusioninventory_taskjoblogs.state':
$pfTaskjoblog = new PluginFusioninventoryTaskjoblog();
return $pfTaskjoblog->getDivState($data['raw']['ITEM_' . $num]);
break;
case 'glpi_plugin_fusioninventory_taskjoblogs.comment':
$comment = $data['raw']['ITEM_' . $num];
return PluginFusioninventoryTaskjoblog::convertComment($comment);
break;
case 'glpi_plugin_fusioninventory_taskjobstates.plugin_fusioninventory_agents_id':
$pfAgent = new PluginFusioninventoryAgent();
$pfAgent->getFromDB($data['raw']['ITEM_' . $num]);
if (!isset($pfAgent->fields['name'])) {
return NOT_AVAILABLE;
}
$itemtype = PluginFusioninventoryTaskjoblog::getStateItemtype($data['raw']['ITEM_0']);
if ($itemtype == 'PluginFusioninventoryDeployPackage') {
$computer = new Computer();
$computer->getFromDB($pfAgent->fields['computers_id']);
return $computer->getLink(1);
}
return $pfAgent->getLink(1);
break;
case 'glpi_plugin_fusioninventory_ignoredimportdevices.ip':
case 'glpi_plugin_fusioninventory_ignoredimportdevices.mac':
$array = importArrayFromDB($data['raw']['ITEM_' . $num]);
return implode("<br/>", $array);
break;
case 'glpi_plugin_fusioninventory_ignoredimportdevices.method':
$a_methods = PluginFusioninventoryStaticmisc::getmethods();
foreach ($a_methods as $mdata) {
if ($mdata['method'] == $data['raw']['ITEM_' . $num]) {
return $mdata['name'];
}
}
break;
}
if ($table == "glpi_plugin_fusioninventory_agentmodules") {
if ($type == 'Computer') {
$pfAgentmodule = new PluginFusioninventoryAgentmodule();
$a_modules = $pfAgentmodule->find("`modulename`='" . $field . "'");
$data2 = current($a_modules);
if ($table . "." . $field == "glpi_plugin_fusioninventory_agentmodules." . $data2['modulename']) {
if (strstr($data['raw']["ITEM_" . $num . "_0"], '"' . $data['raw']["ITEM_" . $num . "_1"] . '"')) {
if ($data['raw']['ITEM_' . $num] == '0') {
return Dropdown::getYesNo(TRUE);
} else {
return Dropdown::getYesNo(FALSE);
}
}
return Dropdown::getYesNo($data['raw']['ITEM_' . $num]);
}
} else {
$pfAgentmodule = new PluginFusioninventoryAgentmodule();
$a_modules = $pfAgentmodule->find("`modulename`='" . $field . "'");
foreach ($a_modules as $data2) {
if ($table . "." . $field == "glpi_plugin_fusioninventory_agentmodules." . $data2['modulename']) {
if (strstr($data['raw']["ITEM_" . $num . "_0"], '"' . $data['raw']['id'] . '"')) {
if ($data['raw']['ITEM_' . $num] == 0) {
return Dropdown::getYesNo('1');
} else {
return Dropdown::getYesNo('0');
}
}
return Dropdown::getYesNo($data['raw']['ITEM_' . $num]);
}
}
}
}
switch ($type) {
case 'Computer':
if ($table . '.' . $field == 'glpi_plugin_fusioninventory_networkports.id') {
if (strstr($data['raw']["ITEM_{$num}"], "\$")) {
//.........这里部分代码省略.........
示例10: showForItem
/**
* Prints a direct connection to a computer
*
* @param $item the Monitor/Phone/Peripheral/Printer
*
* @return nothing (print out a table)
*/
static function showForItem(CommonDBTM $item)
{
// Prints a direct connection to a computer
global $DB, $LANG;
$comp = new Computer();
$target = $comp->getFormURL();
$ID = $item->getField('id');
if (!$item->can($ID, "r")) {
return false;
}
$canedit = $item->can($ID, "w");
// Is global connection ?
$global = $item->getField('is_global');
$used = array();
$compids = array();
$crit = array('FIELDS' => array('id', 'computers_id'), 'itemtype' => $item->getType(), 'items_id' => $ID);
foreach ($DB->request('glpi_computers_items', $crit) as $data) {
$compids[$data['id']] = $data['computers_id'];
}
echo "<div class='spaced'><table width='50%' class='tab_cadre_fixe'>";
echo "<tr><th colspan='2'>";
if (count($compids) == 0) {
echo $LANG['connect'][4];
} else {
if (count($compids) == 1) {
echo $LANG['connect'][3] . " : " . count($compids);
} else {
echo $LANG['connect'][2] . " : " . count($compids);
}
}
echo "</th></tr>";
if (count($compids) > 0) {
foreach ($compids as $key => $compid) {
$comp->getFromDB($compid);
echo "<tr><td class='b tab_bg_1" . ($comp->getField('is_deleted') ? "_2" : "") . "'>";
echo $LANG['help'][25] . " : " . $comp->getLink() . "</td>";
echo "<td class='tab_bg_2" . ($comp->getField('is_deleted') ? "_2" : "") . " center b'>";
if ($canedit) {
echo "<a href=\"{$target}?disconnect=1&computers_id={$compid}&id={$key}\">" . $LANG['buttons'][10] . "</a>";
} else {
echo " ";
}
$used[] = $compid;
}
} else {
echo "<tr><td class='tab_bg_1 b'>" . $LANG['help'][25] . " : ";
echo "<i>" . $LANG['connect'][1] . "</i></td>";
echo "<td class='tab_bg_2' class='center'>";
if ($canedit) {
echo "<form method='post' action=\"{$target}\">";
echo "<input type='hidden' name='items_id' value='{$ID}'>";
echo "<input type='hidden' name='itemtype' value='" . $item->getType() . "'>";
if ($item->isRecursive()) {
self::dropdownConnect('Computer', $item->getType(), "computers_id", getSonsOf("glpi_entities", $item->getEntityID()), 0, $used);
} else {
self::dropdownConnect('Computer', $item->getType(), "computers_id", $item->getEntityID(), 0, $used);
}
echo "<input type='submit' name='connect' value=\"" . $LANG['buttons'][9] . "\"\n class='submit'>";
echo "</form>";
} else {
echo " ";
}
}
if ($global && count($compids) > 0) {
echo "</td></tr>";
echo "<tr><td class='tab_bg_1'> </td>";
echo "<td class='tab_bg_2' class='center'>";
if ($canedit) {
echo "<form method='post' action=\"{$target}\">";
echo "<input type='hidden' name='items_id' value='{$ID}'>";
echo "<input type='hidden' name='itemtype' value='" . $item->getType() . "'>";
if ($item->isRecursive()) {
self::dropdownConnect('Computer', $item->getType(), "computers_id", getSonsOf("glpi_entities", $item->getEntityID()), 0, $used);
} else {
self::dropdownConnect('Computer', $item->getType(), "computers_id", $item->getEntityID(), 0, $used);
}
echo "<input type='submit' name='connect' value=\"" . $LANG['buttons'][9] . "\"\n class='submit'>";
echo "</form>";
} else {
echo " ";
}
}
echo "</td></tr>";
echo "</table></div>";
}
示例11: showForm
/**
* Display form for agent configuration
*
* @param $computers_id integer ID of the agent
* @param $options array
*
* @return bool TRUE if form is ok
*
**/
function showForm($computers_id, $options = array())
{
if ($computers_id != '') {
$this->getFromDB($computers_id);
} else {
$this->getEmpty();
$pfConfig = new PluginFusioninventoryConfig();
unset($this->fields['id']);
$this->fields['threads_networkdiscovery'] = $pfConfig->getValue('threads_networkdiscovery');
$this->fields['timeout_networkdiscovery'] = $pfConfig->getValue('timeout_networkdiscovery');
$this->fields['threads_networkinventory'] = $pfConfig->getValue('threads_networkinventory');
$this->fields['timeout_networkinventory'] = $pfConfig->getValue('timeout_networkinventory');
$this->fields['senddico'] = 0;
}
$this->initForm($computers_id, $options);
$this->showFormHeader($options);
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Name') . " :</td>";
echo "<td align='center'>";
Html::autocompletionTextField($this, 'name', array('size' => 40));
echo "</td>";
echo "<td>" . __('Device_id', 'fusioninventory') . " :</td>";
echo "<td align='center'>";
echo $this->fields["device_id"];
echo "</td>";
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Computer link', 'fusioninventory') . " :</td>";
echo "<td align='center'>";
if (!empty($this->fields["computers_id"])) {
$oComputer = new Computer();
$oComputer->getFromDB($this->fields["computers_id"]);
echo $oComputer->getLink(1);
echo Html::hidden('computers_id', array('value' => $this->fields["computers_id"]));
} else {
Computer_Item::dropdownConnect("Computer", "Computer", 'computers_id', $_SESSION['glpiactive_entity']);
}
echo "</td>";
echo "<td>" . __('Token') . " :</td>";
echo "<td align='center'>";
echo $this->fields["token"];
echo "</td>";
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('locked', 'fusioninventory') . " :</td>";
echo "<td align='center'>";
Dropdown::showYesNo('lock', $this->fields["lock"]);
echo "</td>";
echo "<td>" . __('Version') . " :</td>";
echo "<td align='center'>";
$a_versions = importArrayFromDB($this->fields["version"]);
foreach ($a_versions as $module => $version) {
echo "<strong>" . $module . "</strong>: " . $version . "<br/>";
}
echo "</td>";
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Threads number', 'fusioninventory') . " " . "(" . strtolower(__('Network discovery', 'fusioninventory')) . ") :</td>";
echo "<td align='center'>";
Dropdown::showNumber("threads_networkdiscovery", array('value' => $this->fields["threads_networkdiscovery"], 'min' => 1, 'max' => 400));
echo "</td>";
echo "<td>" . __('Useragent', 'fusioninventory') . " :</td>";
echo "<td align='center'>";
echo $this->fields["useragent"];
echo "</td>";
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('SNMP timeout', 'fusioninventory') . " " . "(" . strtolower(__('Network discovery', 'fusioninventory')) . ") :</td>";
echo "<td align='center'>";
Dropdown::showNumber("timeout_networkdiscovery", array('value' => $this->fields["timeout_networkdiscovery"], 'min' => 0, 'max' => 60));
echo "</td>";
echo "<td>" . __('Last contact', 'fusioninventory') . " :</td>";
echo "<td align='center'>";
echo Html::convDateTime($this->fields["last_contact"]);
echo "</td>";
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Threads number', 'fusioninventory') . " " . "(" . strtolower(__('Network inventory (SNMP)', 'fusioninventory')) . ") :</td>";
echo "<td align='center'>";
Dropdown::showNumber("threads_networkinventory", array('value' => $this->fields["threads_networkinventory"], 'min' => 1, 'max' => 400));
echo "</td>";
echo "<td>" . __('FusionInventory tag', 'fusioninventory') . " :</td>";
echo "<td align='center'>";
echo $this->fields["tag"];
echo "</td>";
echo "</tr>";
echo "<td>" . __('SNMP timeout', 'fusioninventory') . " " . "(" . strtolower(__('Network inventory (SNMP)', 'fusioninventory')) . ") :</td>";
echo "<td align='center'>";
Dropdown::showNumber("timeout_networkinventory", array('value' => $this->fields["timeout_networkinventory"], 'min' => 0, 'max' => 60));
echo "</td>";
echo "<td colspan='2'>";
//.........这里部分代码省略.........
示例12: showForCollectFile
function showForCollectFile($collects_files_id)
{
$pfCollect_File = new PluginFusioninventoryCollect_File();
$computer = new Computer();
$pfCollect_File->getFromDB($collects_files_id);
echo "<table class='tab_cadre_fixe'>";
echo "<tr>";
echo "<th colspan='3'>";
echo $pfCollect_File->fields['name'];
echo "</th>";
echo "</tr>";
echo "<tr>";
echo "<th>" . __('Computer') . "</th>";
echo "<th>" . __('pathfile', 'fusioninventory') . "</th>";
echo "<th>" . __('Size', 'fusioninventory') . "</th>";
echo "</tr>";
$a_data = $this->find("`plugin_fusioninventory_collects_files_id`='" . $collects_files_id . "'", "`pathfile`");
foreach ($a_data as $data) {
echo "<tr class='tab_bg_1'>";
echo '<td>';
$computer->getFromDB($data['computers_id']);
echo $computer->getLink(1);
echo '</td>';
echo '<td>';
echo $data['pathfile'];
echo '</td>';
echo '<td>';
echo Toolbox::getSize($data['size']);
echo '</td>';
echo "</tr>";
}
echo '</table>';
}
示例13: showForCollectRegistry
function showForCollectRegistry($collects_registries_id)
{
$pfCollect_Registry = new PluginFusioninventoryCollect_Registry();
$computer = new Computer();
$pfCollect_Registry->getFromDB($collects_registries_id);
echo "<table class='tab_cadre_fixe'>";
echo "<tr>";
echo "<th colspan='3'>";
echo $pfCollect_Registry->fields['hive'] . $pfCollect_Registry->fields['path'];
echo "</th>";
echo "</tr>";
echo "<tr>";
echo "<th>" . __('Computer') . "</th>";
echo "<th>" . __('Value', 'fusioninventory') . "</th>";
echo "<th>" . __('Data', 'fusioninventory') . "</th>";
echo "</tr>";
$a_data = $this->find("`plugin_fusioninventory_collects_registries_id`='" . $collects_registries_id . "'", "`key`");
foreach ($a_data as $data) {
echo "<tr class='tab_bg_1'>";
echo '<td>';
$computer->getFromDB($data['computers_id']);
echo $computer->getLink(1);
echo '</td>';
echo '<td>';
echo $data['key'];
echo '</td>';
echo '<td>';
echo $data['value'];
echo '</td>';
echo "</tr>";
}
echo '</table>';
}
示例14: 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;
if (!Session::haveRight("computer", UPDATE)) {
return false;
}
$comp = new Computer();
if ($ID > 0) {
$this->check($ID, READ);
$comp->getFromDB($this->fields['computers_id']);
} else {
$this->check(-1, CREATE, $options);
$comp->getFromDB($options['computers_id']);
}
$this->showFormHeader($options);
if ($this->isNewID($ID)) {
echo "<input type='hidden' name='computers_id' value='" . $options['computers_id'] . "'>";
}
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Computer') . "</td>";
echo "<td>" . $comp->getLink() . "</td>";
if (Plugin::haveImport()) {
echo "<td>" . __('Automatic inventory') . "</td>";
echo "<td>";
if ($ID && $this->fields['is_dynamic']) {
Plugin::doHook("autoinventory_information", $this);
} else {
_e('No');
}
echo "</td>";
} else {
echo "<td colspan='2'></td>";
}
echo "</tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Name') . "</td>";
echo "<td>";
Html::autocompletionTextField($this, "name");
echo "</td><td>" . __('Partition') . "</td>";
echo "<td>";
Html::autocompletionTextField($this, "device");
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Mount point') . "</td>";
echo "<td>";
Html::autocompletionTextField($this, "mountpoint");
echo "</td><td>" . __('File system') . "</td>";
echo "<td>";
FileSystem::dropdown(array('value' => $this->fields["filesystems_id"]));
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Global size') . "</td>";
echo "<td>";
Html::autocompletionTextField($this, "totalsize");
echo " " . __('Mio') . "</td>";
echo "<td>" . __('Free size') . "</td>";
echo "<td>";
Html::autocompletionTextField($this, "freesize");
echo " " . __('Mio') . "</td></tr>";
$this->showFormButtons($options);
return true;
}
示例15: showForItem
/**
* Prints a direct connection to a computer
*
* @param $item CommonDBTM object: the Monitor/Phone/Peripheral/Printer
* @param $withtemplate integer withtemplate param (default '')
*
* @return nothing (print out a table)
**/
static function showForItem(CommonDBTM $item, $withtemplate = '')
{
// Prints a direct connection to a computer
global $DB;
$comp = new Computer();
$ID = $item->getField('id');
if (!$item->can($ID, READ)) {
return false;
}
$canedit = $item->canEdit($ID);
$rand = mt_rand();
// Is global connection ?
$global = $item->getField('is_global');
$used = array();
$compids = array();
$crit = array('FIELDS' => array('id', 'computers_id', 'is_dynamic'), 'itemtype' => $item->getType(), 'items_id' => $ID, 'is_deleted' => 0);
foreach ($DB->request('glpi_computers_items', $crit) as $data) {
$compids[$data['id']] = $data['computers_id'];
$dynamic[$data['id']] = $data['is_dynamic'];
$used['Computer'][] = $data['computers_id'];
}
$number = count($compids);
if ($canedit && ($global || !$number)) {
echo "<div class='firstbloc'>";
echo "<form name='computeritem_form{$rand}' id='computeritem_form{$rand}' method='post'\n action='" . Toolbox::getItemTypeFormURL(__CLASS__) . "'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_2'><th colspan='2'>" . __('Connect a computer') . "</th></tr>";
echo "<tr class='tab_bg_1'><td class='right'>";
echo "<input type='hidden' name='items_id' value='{$ID}'>";
echo "<input type='hidden' name='itemtype' value='" . $item->getType() . "'>";
if ($item->isRecursive()) {
self::dropdownConnect('Computer', $item->getType(), "computers_id", getSonsOf("glpi_entities", $item->getEntityID()), 0, $used);
} else {
self::dropdownConnect('Computer', $item->getType(), "computers_id", $item->getEntityID(), 0, $used);
}
echo "</td><td class='center'>";
echo "<input type='submit' name='add' value=\"" . _sx('button', 'Connect') . "\" class='submit'>";
echo "</td></tr>";
echo "</table>";
Html::closeForm();
echo "</div>";
}
echo "<div class='spaced'>";
if ($canedit && $number) {
Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
$massiveactionparams = array('num_displayed' => $number, 'specific_actions' => array('purge' => _x('button', 'Disconnect')), 'container' => 'mass' . __CLASS__ . $rand);
Html::showMassiveActions($massiveactionparams);
}
echo "<table class='tab_cadre_fixehov'>";
if ($number > 0) {
$header_begin = "<tr>";
$header_top = '';
$header_bottom = '';
$header_end = '';
if ($canedit) {
$header_top .= "<th width='10'>" . Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand);
$header_top .= "</th>";
$header_bottom .= "<th width='10'>" . Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand);
$header_bottom .= "</th>";
}
$header_end .= "<th>" . __('Name') . "</th>";
if (Plugin::haveImport()) {
$header_end .= "<th>" . __('Automatic inventory') . "</th>";
}
$header_end .= "<th>" . __('Entity') . "</th>";
$header_end .= "<th>" . __('Serial number') . "</th>";
$header_end .= "<th>" . __('Inventory number') . "</th>";
$header_end .= "</tr>";
echo $header_begin . $header_top . $header_end;
foreach ($compids as $key => $compid) {
$comp->getFromDB($compid);
echo "<tr class='tab_bg_1'>";
if ($canedit) {
echo "<td width='10'>";
Html::showMassiveActionCheckBox(__CLASS__, $key);
echo "</td>";
}
echo "<td " . ($comp->getField('is_deleted') ? "class='tab_bg_2_2'" : "") . ">" . $comp->getLink() . "</td>";
if (Plugin::haveImport()) {
echo "<td>" . Dropdown::getYesNo($dynamic[$key]) . "</td>";
}
echo "<td class='center'>" . Dropdown::getDropdownName("glpi_entities", $comp->getField('entities_id'));
echo "</td>";
echo "<td class='center'>" . $comp->getField('serial') . "</td>";
echo "<td class='center'>" . $comp->getField('otherserial') . "</td>";
echo "</tr>";
}
echo $header_begin . $header_bottom . $header_end;
} else {
echo "<tr><td class='tab_bg_1 b'><i>" . __('Not connected') . "</i>";
echo "</td></tr>";
}
//.........这里部分代码省略.........