private function singlehost($host) { $this->title = sprintf(_('Host %s'), $host['hostname']); $tpl = new Template('page_hosts_singlehost.html'); if ($_SESSION['hosts'][$host['hostname']]['connected']) { $nics = 0; foreach ($_SESSION['hosts'][$host['hostname']]['hardware']->pciDevice as $device) { if ($device->classId == 512) { $nics++; } } $tpl->setVars(array('manufacturer' => $_SESSION['hosts'][$host['hostname']]['hardware']->systemInfo->vendor, 'model' => $_SESSION['hosts'][$host['hostname']]['hardware']->systemInfo->model, 'cpucores' => $_SESSION['hosts'][$host['hostname']]['hardware']->cpuInfo->numCpuCores, 'processortype' => $_SESSION['hosts'][$host['hostname']]['hardware']->cpuPkg[0]->description, 'processorsockets' => count($_SESSION['hosts'][$host['hostname']]['hardware']->cpuPkg), 'numbernics' => $nics, 'virtualmachines' => count($_SESSION['hosts'][$host['hostname']]['vm']))); $tpl->parse('connected'); $tpl->hideBlock('notconnected'); } else { $tpl->setVar('text_notconnected', _('This host is currently not connected')); $tpl->parse('notconnected'); $tpl->hideBlock('connected'); } $tpl->setVars(array('label_host' => sprintf(_('Host %s'), $host['hostname']), 'label_manufacturer' => _('Manufacturer'), 'label_model' => _('Model'), 'label_cpucores' => _('CPU cores'), 'label_processortype' => _('Processor type'), 'label_processorsockets' => _('Processor sockets'), 'label_numbernics' => _('Number of NICs'), 'label_virtualmachines' => _('Virtual machines'), 'label_editsettings' => _('Edit settings'), 'label_deletehost' => _('Delete host'), 'hostname' => $host['hostname'])); $this->html['content'] = $tpl->get(); }
private function novms($hosts) { $tpl = new Template('page_vms_novms.html'); $tpl->setVar('label_vms', _('Virtual machines')); if ($hosts) { $tpl->setVar('label_addvm', _('Add vm')); $tpl->setVar('text_novms', _('You do not have any virtual machines defined. Please use the button below to add an virtual machine.')); $tpl->parse('hashosts'); } else { $tpl->setVar('text_novms', _('You do not have any hosts defined.')); $tpl->hideBlock('hashosts'); } $this->html['content'] = $tpl->get(); }