/** * Get ESX jobs for this agent * * @param type $device_id deviceid of the agent runing and want job info to run * * @return $response array */ function run($taskjobstate) { $credential = new PluginFusioninventoryCredential(); $credentialip = new PluginFusioninventoryCredentialIp(); $credentialip->getFromDB($taskjobstate->fields['items_id']); $credential->getFromDB($credentialip->fields['plugin_fusioninventory_credentials_id']); $order['uuid'] = $taskjobstate->fields['uniqid']; $order['host'] = $credentialip->fields['ip']; $order['user'] = $credential->fields['username']; $order['password'] = $credential->fields['password']; return $order; }
/** * See dropdown credentials * * @param type $params */ static function dropdownCredentials($params = array()) { global $CFG_GLPI; $p = array(); if ($params['id'] == -1) { $p['value'] = ''; $p['itemtype'] = 0; $p['id'] = 0; } else { $credential = new PluginFusioninventoryCredential(); $credential->getFromDB($params['id']); if ($credential->getFromDB($params['id'])) { $p = $credential->fields; } else { $p['value'] = ''; $p['itemtype'] = 0; $p['id'] = 0; } } $types = self::getCredentialsItemTypes(); $types[''] = Dropdown::EMPTY_VALUE; $rand = Dropdown::showFromArray('plugin_fusioninventory_credentials_id', $types, array('value' => $p['itemtype'])); $params = array('itemtype' => '__VALUE__', 'id' => $p['id']); $url = $CFG_GLPI["root_doc"] . "/plugins/fusioninventory/ajax/dropdownCredentials.php"; Ajax::UpdateItemOnSelectEvent("dropdown_plugin_fusioninventory_credentials_id{$rand}", "span_credentials", $url, $params); echo " <span name='span_credentials' id='span_credentials'>"; if ($p['id']) { self::dropdownCredentialsForItemtype($p); } echo "</span>"; }