function afterAdd() { $this->addItem(new EaseTWBFormGroup(_('Jméno'), new EaseHtmlInputTextTag('host_name', EaseShared::webPage()->getRequestValue('host_name')), _('hostname'), _('DOMAIN\\machine'), _('Název sledovaného stroje'))); $this->addItem(new EaseTWBFormGroup(_('Platforma'), new IEPlatformSelector('platform'), null, _('Platforma sledovaného stroje'))); $this->addItem(new EaseTWSubmitButton(_('Založit') . ' ' . EaseTWBPart::GlyphIcon('forward'), 'success')); $this->addItem(new EaseHtmlInputHiddenTag('host_group', EaseShared::webPage()->getRequestValue('host_group'))); }
function __construct($formName, $formAction = null, $formMethod = 'post', $formContents = null, $tagProperties = null) { parent::__construct($formName, $formAction, $formMethod, $formContents, $tagProperties); $this->addItem(new EaseTWBFormGroup(_('IP adresa serveru'), new EaseHtmlInputTextTag('serverip'), '', $_SERVER['SERVER_ADDR'], _('Adresa na níž běží icinga. Sem se posílají NSCA testy a z této adresy je povoleno se dotazovat NRPE pluginů'))); $this->addItem(new EaseTWBFormGroup(_('nsca heslo'), new EaseHtmlInputTextTag('nscapassword'), '', '', _('Heslo kterým je šifrována NSCA komunikace'))); $this->addItem(new EaseTWSubmitButton(_('Uložit') . ' ' . EaseTWBPart::GlyphIcon('save'), 'success')); }
function finalize() { $addNewItem = new IEServiceSelect('new_service_id'); $this->addItem(new EaseTWBFormGroup(_('Náhradní služba'), $addNewItem, _('Jméno služby'), sprintf(_('Tato služba se zamění za právě zvolenou službu <strong>%s</strong> u všech hostů kteří ji používají'), $this->service->getName()))); $this->addItem(new EaseTWBFormGroup(_('Vyměnit'), new EaseTWSubmitButton(_('Vyměnit službu') . ' ' . EaseTWBPart::GlyphIcon('flash'), 'info'))); $this->addItem(new EaseHtmlInputHiddenTag('service_id', $this->service->getID())); $this->addItem(new EaseHtmlInputHiddenTag('action', 'swap')); }
/** * Editor k přidávání členů skupiny * * @param string $fieldName název políčka formuláře * @param string $fieldCaption popisek políčka * @param IEcfg $dataSource editovaný objekt */ public function __construct($fieldName, $fieldCaption, $dataSource, $members) { $iDColumn = $dataSource->keywordsInfo[$fieldName]['refdata']['idcolumn']; $nameColumn = $dataSource->keywordsInfo[$fieldName]['refdata']['captioncolumn']; $sTable = $dataSource->keywordsInfo[$fieldName]['refdata']['table']; if (isset($dataSource->keywordsInfo[$fieldName]['refdata']['condition'])) { $conditions = $dataSource->keywordsInfo[$fieldName]['refdata']['condition']; } else { $conditions = array(); } if (isset($dataSource->keywordsInfo[$fieldName]['refdata']['public']) && intval($dataSource->keywordsInfo[$fieldName]['refdata']['public'])) { $sqlConds = " ( " . $dataSource->myDbLink->prepSelect(array_merge($conditions, array($dataSource->userColumn => EaseShared::user()->getUserID()))) . " ) OR ( " . $dataSource->myDbLink->prepSelect(array_merge($conditions, array('public' => 1))) . ") "; } else { $sqlConds = $dataSource->myDbLink->prepSelect(array_merge($conditions, array($dataSource->userColumn => EaseShared::user()->getUserID()))); } $initialContent = new EaseTWBPanel($fieldCaption); $initialContent->setTagCss(array('width' => '100%')); if (is_null($dataSource->getMyKey())) { $initialContent->addItem(_('Nejprve je potřeba uložit záznam')); } else { if ($sTable == $dataSource->myTable) { $tmpKey = $dataSource->getMyKey(); if ($tmpKey) { $members[$tmpKey] = true; } } if ($members && count($members)) { $aviavbleCond = 'AND ' . $iDColumn . ' NOT IN (' . join(',', array_keys($members)) . ') '; } else { $aviavbleCond = ''; } $membersAviableArray = EaseShared::myDbLink()->queryToArray('SELECT ' . $nameColumn . ', ' . $iDColumn . ' ' . 'FROM `' . $sTable . '` ' . 'WHERE (' . $sqlConds . ') ' . $aviavbleCond . 'ORDER BY ' . $nameColumn, $iDColumn); if ($sTable == $dataSource->myTable) { unset($members[$dataSource->getMyKey()]); } $addText = _('Přiřadit'); $delText = _('Odebrat'); if (count($membersAviableArray)) { foreach ($membersAviableArray as $memberID => $memberName) { $reftable = $dataSource->keywordsInfo[$fieldName]['refdata']['table']; $initialContent->addItem(new EaseTWBButtonDropdown($memberName[$nameColumn], 'inverse', 'xs', array(new EaseHtmlATag($reftable . '.php?' . $reftable . '_id=' . $memberID, EaseTWBPart::GlyphIcon('wrench') . ' ' . _('Editace')), new EaseHtmlATag(null, EaseTWBPart::GlyphIcon('plus-sign') . ' ' . $addText, array('onClick' => "addGroupMember('" . get_class($dataSource) . "','" . $dataSource->getId() . "','" . $fieldName . "','" . $memberName[$nameColumn] . "','" . $memberID . "')", 'class' => 'handle', 'data-addtext' => $addText, 'data-deltext' => $delText))), array('id' => get_class($dataSource) . '_' . $fieldName . '_' . $memberID, 'style' => 'margin: 1px;'))); } } if ($members && count($members)) { $initialContent->addItem('</br>'); foreach ($members as $memberID => $memberName) { $reftable = $dataSource->keywordsInfo[$fieldName]['refdata']['table']; $initialContent->addItem(new EaseTWBButtonDropdown($memberName, 'success', 'xs', array(new EaseHtmlATag($reftable . '.php?' . $reftable . '_id=' . $memberID, EaseTWBPart::GlyphIcon('wrench') . ' ' . _('Editace')), new EaseHtmlATag(null, EaseTWBPart::GlyphIcon('remove') . ' ' . _('Odebrat'), array('onClick' => "delGroupMember('" . get_class($dataSource) . "','" . $dataSource->getId() . "','" . $fieldName . "','" . $memberName . "','" . $memberID . "')", 'class' => 'handle', 'data-addtext' => $addText, 'data-deltext' => $delText))), array('id' => get_class($dataSource) . '_' . $fieldName . '_' . $memberID, 'style' => 'margin: 1px;'))); } } } parent::__construct($initialContent); }
/** * Editor k přidávání členů skupiny * * @param IEServices $service */ public function __construct($service) { $hostsAssigned = array(); parent::__construct(); $fieldName = $this->getmyKeyColumn(); $initialContent = new EaseTWBPanel(_('Sledované hosty služby'), 'default'); $initialContent->setTagCss(array('width' => '100%')); if (is_null($service->getMyKey())) { $initialContent->addItem(_('Nejprve je potřeba uložit záznam')); } else { $serviceName = $service->getName(); $host = new IEHost(); if (EaseShared::user()->getSettingValue('admin')) { $allHosts = $host->getAllFromMySQL(NULL, array($host->myKeyColumn, $host->nameColumn, 'platform', 'register'), null, $host->nameColumn, $host->myKeyColumn); } else { $allHosts = $host->getListing(null, true, array('platform', 'register')); } if ($service->getDataValue('host_name')) { foreach ($service->getDataValue('host_name') as $hostId => $hostName) { if (isset($allHosts[$hostId])) { $hostsAssigned[$hostId] = $allHosts[$hostId]; } } } foreach ($allHosts as $hostID => $hostInfo) { if ($hostInfo['register'] != 1) { unset($allHosts[$hostID]); } if ($hostInfo['platform'] != 'generic' && $hostInfo['platform'] != $service->getDataValue('platform')) { unset($allHosts[$hostID]); } } foreach ($hostsAssigned as $hostID => $hostInfo) { unset($allHosts[$hostID]); } if (count($allHosts)) { foreach ($allHosts as $hostID => $hostInfo) { $initialContent->addItem(new EaseTWBButtonDropdown($hostInfo[$host->nameColumn], 'inverse', 'xs', array(new EaseHtmlATag('host.php?host_id=' . $hostID . '&service_id=' . $service->getId(), EaseTWBPart::GlyphIcon('wrench') . ' ' . _('Editace')), new EaseHtmlATag('?addhost=' . $hostInfo[$host->nameColumn] . '&host_id=' . $hostID . '&' . $service->getmyKeyColumn() . '=' . $service->getMyKey() . '&' . $service->nameColumn . '=' . $service->getName(), EaseTWBPart::GlyphIcon('plus') . ' ' . _('Začít sledovat'))))); } } if (count($hostsAssigned)) { $initialContent->addItem('<br/>'); foreach ($hostsAssigned as $hostID => $hostInfo) { $initialContent->addItem(new EaseTWBButtonDropdown($hostInfo[$host->nameColumn], 'success', 'xs', array(new EaseHtmlATag('?delhost=' . $hostInfo[$host->nameColumn] . '&host_id=' . $hostID . '&' . $service->getmyKeyColumn() . '=' . $service->getMyKey() . '&' . $service->nameColumn . '=' . $service->getName(), EaseTWBPart::GlyphIcon('remove') . ' ' . _('Přestat sledovat')), new EaseHtmlATag('host.php?host_id=' . $hostID . '&service_id=' . $service->getId(), EaseTWBPart::GlyphIcon('wrench') . ' ' . _('Editace'))))); } } } $this->addItem($initialContent); }
function afterAdd() { $group_name = $this->userGroup->getDataValue('usergroup_name'); $this->addItem(new EaseTWBFormGroup(_('Jméno'), new EaseHtmlInputTextTag('usergroup_name', $group_name), $group_name, _('Název skupiny'), _('Adminové'))); $this->addItem($this->userGroup->memberSelector()); $usergroup_id = $this->userGroup->getMyKey(); if ($usergroup_id) { $this->addItem(new EaseHtmlInputHiddenTag($this->userGroup->getMyKeyColumn(), $usergroup_id)); } if ($usergroup_id) { $this->addItem(new EaseTWSubmitButton(_('Uložit') . ' ' . EaseTWBPart::GlyphIcon('save'), 'success')); } else { $this->addItem(new EaseTWSubmitButton(_('Založit') . ' ' . EaseTWBPart::GlyphIcon('forward'), 'success')); } }
function &parentButton($parentInfo, $op, $host) { $pName = $parentInfo['host_name']; $parentID = $parentInfo['host_id']; if ($op == 'plus') { $operation = 'add'; $opCaption = _('Přiřadit rodiče'); $type = 'default'; } else { $operation = 'del'; $opCaption = _('Odstranit rodiče'); $type = 'success'; } $parentMenu = new EaseTWBButtonDropdown($pName, $type, 'xs', array(new EaseHtmlATag('?' . $operation . '=parents&name=' . $parentInfo[$host->nameColumn] . '&member=' . $parentID . '&' . $host->myKeyColumn . '=' . $host->getId(), EaseTWBPart::GlyphIcon($op) . ' ' . $opCaption), new EaseHtmlATag('host.php?host_id=' . $parentID, EaseTWBPart::GlyphIcon('wrench') . ' ' . _('Editace')))); return $parentMenu; }
function finalize() { parent::finalize(); $platform = $this->service->getDataValue('platform'); $this->addItem(new EaseTWBFormGroup(_('Jméno'), new EaseHtmlInputTextTag('service_name', $this->service->getName()), $this->service->getName(), _('Název služby testu'))); $addNewItem = new EaseHtmlInputSearchTag('check_command-remote', $this->service->getDataValue('check_command-remote'), array('class' => 'search-input', 'title' => _('vzdálený test'))); $addNewItem->setDataSource('jsoncommand.php?maxRows=20&platform=' . $platform); $this->addItem(new EaseTWBFormGroup(_('Vzdálený Příkaz'), $addNewItem, _('Hledej příkazy pro: ') . $platform, _('Příkaz vykonávaný vzdáleným senzorem NRPE/NSCP.exe'))); $this->addItem(new EaseTWBFormGroup(_('Parametry'), new EaseHtmlInputTextTag('check_command-params', $this->service->getDataValue('check_command-params')), $this->service->getDataValue('command-params'), _('Parametry vzdáleného příkazu. (Pro nrpe oddělované vykřičníkem.)'))); $this->addItem(new EaseTWBFormGroup(_('Platforma'), new IEPlatformSelector('platform', null, $platform), _('Platforma sledovaného stroje'))); $this->addItem(new EaseTWSubmitButton(_('Založit') . ' ' . EaseTWBPart::GlyphIcon('forward'), 'success')); $serviceId = $this->service->getId(); if ($serviceId) { $this->addItem(new EaseHtmlInputHiddenTag('service_id', $serviceId)); } }
public function finalize() { $subcontatcts = $this->contact->getChilds(); foreach ($subcontatcts as $subcontatctID => $subcontatctInfo) { $this->addItem(new EaseTWBButtonDropdown($subcontatctInfo['type'] . ' ' . $subcontatctInfo['contact'], 'success', 'xs', array(new EaseHtmlATag('contact.php?parent_id=' . $this->contact->getId() . '&contact_id=' . $subcontatctID, EaseTWBPart::GlyphIcon('wrench') . ' ' . _('Vlastnosti')), new EaseHtmlATag('?contact_id=' . $this->contact->getId() . '&delsubcont_id=' . $subcontatctID, EaseTWBPart::GlyphIcon('minus') . ' ' . _('smazat') . ' ' . $subcontatctInfo['type'])))); unset($this->subcontactTypes[$subcontatctInfo['type']]); $this->addItem('<br/>'); } if (count($this->subcontactTypes)) { $form = new EaseTWBForm('ContatctTweak', 'contacttweak.php'); $form->addItem(new EaseHtmlSelect('contact', $this->subcontactTypes)); $form->addItem(new EaseHtmlInputHiddenTag('contact_id', $this->contact->getId())); $form->addItem(new EaseTWBFormGroup(_('Kontakt'), new EaseHtmlInputTextTag('cnt', $this->cnt), EaseShared::webPage()->getRequestValue('cnt'), _('telefonní číslo, email či jabberová adresa dle druhu kontaktu'))); $form->addItem(new EaseTWSubmitButton(_('Uložit'), 'success')); $this->addItem(new EaseTWBPanel(_('Přidat kontaktní údaj'), 'default', $form)); } else { $this->addItem(new EaseHtmlDivTag('plno', _('K tomuto kontaktu již není možné přidávat další údaje.'), array('class' => 'well warning', 'style' => 'margin: 10px'))); } }
/** * Editor k přidávání členů skupiny * * @param IEService|IEHost $holder */ public function __construct($holder) { $contactsAssigned = array(); parent::__construct(); $fieldName = $this->getmyKeyColumn(); $initialContent = new EaseTWBPanel(_('Cíle notifikací')); $initialContent->setTagCss(array('width' => '100%')); if (is_null($holder->getMyKey())) { $initialContent->addItem(_('Nejprve je potřeba uložit záznam')); } else { $serviceName = $holder->getName(); $contact = new IEContact(); $allContacts = $contact->getListing(null, true, array('alias', 'parent_id')); foreach ($holder->getDataValue('contacts') as $contactId => $contactName) { if (isset($allContacts[$contactId])) { $contactsAssigned[$contactId] = $allContacts[$contactId]; } } foreach ($allContacts as $contactID => $contactInfo) { if ($contactInfo['register'] != 1) { unset($allContacts[$contactID]); } if (!$contactInfo['parent_id']) { unset($allContacts[$contactID]); } } foreach ($contactsAssigned as $contactID => $contactInfo) { unset($allContacts[$contactID]); } if (count($allContacts)) { foreach ($allContacts as $contactID => $contactInfo) { $initialContent->addItem(new EaseTWBButtonDropdown($contactInfo[$contact->nameColumn], 'inverse', 'xs', array(new EaseHtmlATag('contacttweak.php?contact_id=' . $contactInfo['parent_id'] . '&service_id=' . $holder->getId(), EaseTWBPart::GlyphIcon('wrench') . ' ' . _('Editace')), new EaseHtmlATag('?addcontact=' . $contactInfo[$contact->nameColumn] . '&contact_id=' . $contactID . '&' . $holder->getmyKeyColumn() . '=' . $holder->getMyKey() . '&' . $holder->nameColumn . '=' . $holder->getName(), EaseTWBPart::GlyphIcon('plus') . ' ' . _('Začít obesílat'))))); } } if (count($contactsAssigned)) { $initialContent->addItem('<br/>'); foreach ($contactsAssigned as $contactID => $contactInfo) { $initialContent->addItem(new EaseTWBButtonDropdown($contactInfo[$contact->nameColumn], 'success', 'xs', array(new EaseHtmlATag('?delcontact=' . $contactInfo[$contact->nameColumn] . '&contact_id=' . $contactID . '&' . $holder->getmyKeyColumn() . '=' . $holder->getMyKey() . '&' . $holder->nameColumn . '=' . $holder->getName(), EaseTWBPart::GlyphIcon('remove') . ' ' . _('Přestat obesílat')), new EaseHtmlATag('contacttweak.php?contact_id=' . $contactInfo['parent_id'] . '&service_id=' . $holder->getId(), EaseTWBPart::GlyphIcon('wrench') . ' ' . _('Editace'))))); } } } $this->addItem($initialContent); }
/** * Editor k přidávání členů skupiny * * @param IEHosts $Host */ public function __construct($Host) { $FieldName = 'parents'; $InitialContent = new EaseTWBPanel(_('Potomci')); $InitialContent->setTagCss(array('width' => '100%')); if (is_null($Host->getMyKey())) { $InitialContent->addItem(_('Nejprve je potřeba uložit záznam')); } else { $Service = new IEService(); $ServicesAssigned = $Service->myDbLink->queryToArray('SELECT ' . $Service->myKeyColumn . ',' . $Service->nameColumn . ' FROM ' . $Service->myTable . ' WHERE ' . $FieldName . ' LIKE \'%"' . $Host->getName() . '"%\'', $Service->myKeyColumn); $AllServices = $Service->getListing(); foreach ($AllServices as $ServiceID => $ServiceInfo) { if ($ServiceInfo['register'] != 1) { unset($AllServices[$ServiceID]); } } foreach ($ServicesAssigned as $ServiceID => $ServiceInfo) { unset($AllServices[$ServiceID]); } if (count($AllServices)) { foreach ($AllServices as $ServiceID => $ServiceInfo) { $Jellybean = new EaseHtmlSpanTag($ServiceInfo[$Service->nameColumn], null, array('class' => 'jellybean gray')); $Jellybean->addItem(new EaseHtmlATag('?addservice=' . $ServiceInfo[$Service->nameColumn] . '&service_id=' . $ServiceID . '&' . $Host->getmyKeyColumn() . '=' . $Host->getMyKey() . '&' . $Host->nameColumn . '=' . $Host->getName(), $ServiceInfo[$Service->nameColumn])); $InitialContent->addItem($Jellybean); } } if (count($ServicesAssigned)) { $InitialContent->addItem('</br>'); foreach ($ServicesAssigned as $ServiceID => $ServiceInfo) { $Jellybean = new EaseHtmlSpanTag($ServiceInfo[$Service->nameColumn], null, array('class' => 'jellybean')); $Jellybean->addItem($ServiceInfo[$Service->nameColumn]); $Jellybean->addItem(new EaseHtmlATag('?delservice=' . $ServiceInfo[$Service->nameColumn] . '&service_id=' . $ServiceID . '&' . $Host->getmyKeyColumn() . '=' . $Host->getMyKey() . '&' . $Host->nameColumn . '=' . $Host->getName(), EaseTWBPart::GlyphIcon('remove'))); $InitialContent->addItem($Jellybean); } } } parent::__construct($InitialContent); }
/** * Hlavní menu aplikace * * @param string $name * @param mixed $content * @param array $properties */ public function __construct($name = null, $content = null, $properties = null) { parent::__construct("Menu", new EaseHtmlImgTag('img/vsmonitoring.png', 'VSMonitoring', 20, 20, array('class' => 'img-rounded')), array('class' => 'navbar-fixed-top')); $user = EaseShared::user(); EaseTWBPart::twBootstrapize(); if (!$user->getUserID()) { $this->addMenuItem('<a href="createaccount.php">' . EaseTWBPart::GlyphIcon('leaf') . ' ' . _('Registrace') . '</a>', 'right'); $this->addMenuItem(' <li class="divider-vertical"></li> <li class="dropdown"> <a class="dropdown-toggle" href="login.php" data-toggle="dropdown"><i class="icon-circle-arrow-left"></i> ' . _('Přihlášení') . '<strong class="caret"></strong></a> <div class="dropdown-menu" style="padding: 15px; padding-bottom: 0px; left: -120px;"> <form method="post" class="navbar-form navbar-left" action="login.php" accept-charset="UTF-8"> <input class="form-control" style="margin-bottom: 15px;" type="text" placeholder="' . _('login') . '" id="username" name="login"> <input class="form-control" style="margin-bottom: 15px;" type="password" placeholder="' . _('Heslo') . '" id="password" name="password"> <!-- input style="float: left; margin-right: 10px;" type="checkbox" name="remember-me" id="remember-me" value="1"> <label class="string optional" for="remember-me"> ' . _('zapamatuj si mne') . '</label --> <input class="btn btn-primary btn-block" type="submit" id="sign-in" value="' . _('přihlásit') . '"> </form> </div>', 'right'); } else { $userMenu = '<li class="dropdown" style="width: 120px; text-align: right; background-image: url( ' . $user->getIcon() . ' ) ; background-repeat: no-repeat; background-position: left center; background-size: 40px 40px;"><a href="#" class="dropdown-toggle" data-toggle="dropdown">' . $user->getUserLogin() . ' <b class="caret"></b></a> <ul class="dropdown-menu" style="text-align: left; left: -60px;"> <li><a href="settings.php">' . EaseTWBPart::GlyphIcon('wrench') . '<i class="icon-cog"></i> ' . _('Nastavení') . '</a></li> '; if ($user->getSettingValue('admin')) { $userMenu .= '<li><a href="overview.php">' . EaseTWBPart::GlyphIcon('list') . ' ' . _('Přehled konfigurací') . '</a></li>'; } $this->addMenuItem($userMenu . ' <li><a href="http://v.s.cz/kontakt.php">' . EaseTWBPart::GlyphIcon('envelope') . ' ' . _('Uživatelská podpora') . '</a></li> <li class="divider"></li> <li><a href="logout.php">' . EaseTWBPart::GlyphIcon('off') . ' ' . _('Odhlášení') . '</a></li> </ul> </li> ', 'right'); } }
$contactgroup = new IEContactgroup(); $pocContactgroup = $contactgroup->getMyRecordsCount(); if ($pocContactgroup) { $success = $oPage->columnII->addItem(new EaseHtmlDivTag('Contactgroup', new EaseTWBLinkButton('contactgroups.php', _('<i class="icon-list"></i>') . ' ' . sprintf(_('Definováno %s skupin kontaktů'), $pocContactgroup)), array('class' => 'alert alert-success'))); } else { $warning = $oPage->columnII->addItem(new EaseHtmlDivTag('Contactgroup', _('Nemáte definovanou skupinu kontaktů'), array('class' => 'alert alert-info'))); $warning->addItem(new EaseTWBLinkButton('contactgroup.php', _('Založit první skupinu kontaktů ' . EaseTWBPart::GlyphIcon('edit')))); } $host = new IEHost(); $pocHostu = $host->getMyRecordsCount(); if ($pocHostu) { $success = $oPage->columnI->addItem(new EaseHtmlDivTag('Host', new EaseTWBLinkButton('hosts.php', _('<i class="icon-list"></i>') . ' ' . sprintf(_('Definováno %s hostů'), $pocHostu)), array('class' => 'alert alert-success'))); } else { if ($pocTimeperiods) { $warning = $oPage->columnI->addItem(new EaseHtmlDivTag('Host', _('Nemáte definovaný žádný host'), array('class' => 'alert alert-info'))); $warning->addItem(new EaseTWBLinkButton('host.php', _('Založit první host') . ' ' . EaseTWBPart::GlyphIcon('edit'))); } else { $warning = $oPage->columnI->addItem(new EaseHtmlDivTag('Host', _('Hosty vyžadují časovou periodu ..'), array('class' => 'alert alert-danger'))); } } $hostgroup = new IEHostgroup(); $pocHostgroups = $hostgroup->getMyRecordsCount(); if ($pocHostgroups) { $success = $oPage->columnI->addItem(new EaseHtmlDivTag('Hostgroup', new EaseTWBLinkButton('hostgroups.php', _('<i class="icon-list"></i>') . ' ' . sprintf(_('Definováno %s skupin hostů'), $pocHostgroups)), array('class' => 'alert alert-success'))); } else { $warning = $oPage->columnI->addItem(new EaseHtmlDivTag('Host', _('Nemáte definovaný žádnou skupinu hostů'), array('class' => 'alert alert-info'))); $warning->addItem(new EaseTWBLinkButton('hostgroup.php', _('Založit první skupinu hostů <i class="icon-edit"></i>'))); } $command = new IECommand(); $PocCommands = $command->getMyRecordsCount(); if ($PocCommands) {
$host->saveToMysql(); } $oPage->redirect('host.php?host_id=' . $host->getId()); exit; } } $contact = new IEContact(); $pocContact = $contact->getMyRecordsCount(); if (!$pocContact) { $warning = $oPage->columnIII->addItem(new EaseHtmlDivTag('Contact', _('Nemáte definovaný kontakt'), array('class' => 'alert alert-info'))); $warning->addItem(new EaseTWBLinkButton('contact.php?autocreate=default', _('Založit výchozí kontakt') . ' ' . EaseTWBPart::GlyphIcon('edit'))); } $pocHostu = $host->getMyRecordsCount(); if ($pocHostu) { $success = $oPage->columnIII->addItem(new EaseHtmlDivTag('Host', new EaseTWBLinkButton('hosts.php', _('<i class="icon-list"></i>') . ' ' . sprintf(_('Definováno %s hostů'), $pocHostu)), array('class' => 'alert alert-success'))); } $firstHost = $oPage->columnII->addItem(new EaseTWBForm('firsthost')); $firstHost->addItem(new EaseHtmlInputHiddenTag('host_group', $oPage->getRequestValue('host_group'))); $firstHost->setTagProperties(array('onSubmit' => "\$('#preload').css('visibility', 'visible');")); $firstHost->addItem(new EaseTWBFormGroup(_('Hostname serveru'), new EaseHtmlInputTextTag('host_name', $hostName), null, _('Název hostu, tedy to co následuje po http:// ve webové adrese až k prvnímu lomítku, nebo otazníku.'))); $firstHost->addItem(new EaseTWBFormGroup(_('IPv4 Adresa'), new EaseHtmlInputTextTag('address', $address), null, _('čtyři číslice od 0 do 255 oddělené tečkou'))); $firstHost->addItem(new EaseTWBFormGroup(_('IPv6 Adresa'), new EaseHtmlInputTextTag('address6', $addressSix), null, _('nejvíce osm skupin čtyř hexadecimálních číslic oddělených dvojtečkou'))); $firstHost->addItem(new EaseTWSubmitButton(EaseTWBPart::GlyphIcon('plus') . ' ' . _('Přidej host'), 'success')); $oPage->columnI->addItem(new EaseHtmlDivTag(null, _('Po zadání alespoň jednoho vstupního údaje si tento ' . 'průvodce dohledá ostatní a provede sken na některé základní služby.' . '<br>Pokud budou tyto nalezeny aktivují se jejich testy. Informace o stavu bude odesílána na první zadaný kontakt'), array('class' => 'well'))); $oPage->columnI->addItem(new EaseHtmlDivTag(null, _('Pro instalaci nového vzdáleného senzoru prosím nejprve na sledovaném počítači nainstalujte balík' . ' a poté ' . '<code>wget -O - http://v.s.cz/info@vitexsoftware.cz.gpg.key | sudo apt-key add -</code> <code>echo deb http://v.s.cz/ stable main | sudo tee /etc/apt/sources.list.d/vitexsoftware.list</code> <code>sudo aptitude update</code> <code>aptitude install nagios-nrpe-server nagios-check-clamscan</code>'), array('class' => 'well'))); $oPage->addItem(new EaseHtmlDivTag('preload', new IEFXPreloader(), array('class' => 'fuelux'))); $oPage->addItem(new IEPageBottom()); $oPage->draw();
/** * Icinga Editor - přehled userů * * @package IcingaEditor * @subpackage WebUI * @author Vitex <*****@*****.**> * @copyright 2012 Vitex@hippy.cz (G) */ require_once 'includes/IEInit.php'; require_once 'classes/IEHost.php'; $oPage->onlyForLogged(); $oPage->addItem(new IEPageTop(_('Přehled uživatelů'))); $oPage->addPageColumns(); $user = new IEUser(); $users = $user->getColumnsFromMySQL(array('id', 'login'), null, 'login', $oUser->getmyKeyColumn()); if ($users) { $oPage->columnII->addItem(new EaseHtmlH4Tag(_('Uživatelé'))); $cntList = new EaseHtmlTableTag(null, array('class' => 'table')); $cid = 1; foreach ($users as $cId => $cInfo) { if (!$cId) { continue; } $lastRow = $cntList->addRowColumns(array($cid++, new IEUser((int) $cId), new EaseHtmlATag('userinfo.php?user_id=' . $cId, $cInfo['login'] . ' <i class="icon-edit"></i>'), new EaseHtmlATag('apply.php?force_user_id=' . $cId, _('Přegenerovat konfiguraci') . ' <i class="icon-repeat"></i>'))); } $oPage->columnII->addItem($cntList); } $oPage->columnIII->addItem(new EaseTWBLinkButton('createaccount.php', _('Založit uživatele') . ' ' . EaseTWBPart::GlyphIcon('edit'))); $oPage->addItem(new IEPageBottom()); $oPage->draw();
*/ require_once 'includes/IEInit.php'; require_once 'classes/IETimeperiod.php'; $oPage->onlyForLogged(); $oPage->addItem(new IEPageTop(_('Přehled časových period'))); $oPage->addPageColumns(); $Timeperiod = new IETimeperiod(); $Periods = $Timeperiod->getListing(); if ($Periods) { $cntList = new EaseHtmlTableTag(null, array('class' => 'table')); $cid = 1; foreach ($Periods as $cId => $cInfo) { $lastRow = $cntList->addRowColumns(array($cid++, new EaseHtmlATag('timeperiod.php?timeperiod_id=' . $cInfo['timeperiod_id'], $cInfo['timeperiod_name'] . ' <i class="icon-edit"></i>'))); if ($cInfo['generate'] == 0) { $lastRow->setTagCss(array('border-right' => '1px solid red')); } if ($cInfo['public'] == 1) { if ($cInfo[$Timeperiod->userColumn] == $oUser->getUserID()) { $lastRow->setTagCss(array('border-left' => '1px solid green')); } else { $lastRow->setTagCss(array('border-left' => '1px solid blue')); } } } $oPage->columnII->addItem($cntList); } else { $oUser->addStatusMessage(_('Nemáte definované časové periody'), 'warning'); } $oPage->columnIII->addItem(new EaseTWBLinkButton('timeperiod.php', _('Založit časovou periodu ' . EaseTWBPart::GlyphIcon('edit')))); $oPage->addItem(new IEPageBottom()); $oPage->draw();
$hostgroup->delete(); $oPage->redirect('hostgroups.php'); exit; } break; } $oPage->addItem(new IEPageTop(_('Editace skupiny hostů') . ' ' . $hostgroup->getName())); $hostgroupEdit = new IECfgEditor($hostgroup); $form = new EaseTWBForm('Hostgroup', 'hostgroup.php', 'POST', $hostgroupEdit, array('class' => 'form-horizontal')); $form->setTagID($form->getTagName()); if (!is_null($hostgroup->getMyKey())) { $form->addItem(new EaseHtmlInputHiddenTag($hostgroup->getmyKeyColumn(), $hostgroup->getMyKey())); } $form->addItem(new EaseTWSubmitButton(_('Uložit'), 'success')); $oPage->addItem(new IEPageBottom()); $infopanel = new IEInfoBox($hostgroup); $tools = new EaseTWBPanel(_('Nástroje'), 'warning'); if ($hostgroup->getId()) { $tools->addItem($hostgroup->deleteButton()); $tools->addItem(new EaseTWBPanel(_('Transfer'), 'warning', $hostgroup->transferForm())); } $pageRow = new EaseTWBRow(); $pageRow->addColumn(2, $infopanel); $pageRow->addColumn(6, new EaseTWBPanel(new EaseHtmlH1Tag($hostgroup->getDataValue('alias') . ' <small>' . $hostgroup->getName() . '</small>'), 'default', $form)); $pageRow->addColumn(4, $tools); $oPage->container->addItem($pageRow); $operations = $tools->addItem(new EaseTWBPanel(_('Hromadné operace')), 'success'); $operations->addItem(new IEContactAsignForm()); $tools->addItem(new EaseTWBLinkButton('wizard-host.php?hostgroup_id=' . $hostgroup->getId(), EaseTWBPart::GlyphIcon('plus') . _('nový host ve skupině'), 'success')); //$tools->addItem(new EaseTWBLinkButton('hglayouteditor.php?hostgroup_id=' . $hostgroup->getId(), EaseTWBPart::GlyphIcon('globe') . _('Rozvržení topologie'), 'info')); $oPage->draw();
/** * Editor k přidávání členů skupiny * * @param IEHost $host */ public function __construct($host) { parent::__construct(); $fieldName = $this->getmyKeyColumn(); if ($host->getDataValue('platform') == 'generic') { $note = '<small><span class="label label-info">Tip:</span> ' . _('Další sledovatelné služby budou nabídnuty po nastavení platformy hosta a vzdáleného senzoru.') . '</small>'; } else { $note = array(); } $initialContent = new EaseTWBPanel(_('Sledované služby'), 'default', null, $note); $initialContent->setTagCss(array('width' => '100%')); if (is_null($host->getMyKey())) { $initialContent->addItem(_('Nejprve je potřeba uložit záznam')); } else { $hostName = $host->getName(); $service = new IEService(); $parentServUsed = array(); $host_active = (bool) $host->getCfgValue('active_checks_enabled'); $host_passive = (bool) $host->getCfgValue('passive_checks_enabled'); $servicesAssigned = $service->myDbLink->queryToArray('SELECT ' . $service->myKeyColumn . ',display_name,' . $service->nameColumn . ' FROM ' . $service->myTable . ' WHERE ' . $fieldName . ' LIKE \'%"' . $host->getName() . '"%\'', $service->myKeyColumn); $allServices = $service->getListing(null, true, array('platform', 'parent_id', 'passive_checks_enabled', 'active_checks_enabled', 'display_name')); foreach ($allServices as $serviceID => $serviceInfo) { $servicePassive = (bool) $serviceInfo['passive_checks_enabled']; $serviceActive = (bool) $serviceInfo['active_checks_enabled']; if ($serviceInfo['register'] != 1) { unset($allServices[$serviceID]); continue; } if ($serviceInfo['platform'] != 'generic' && $serviceInfo['platform'] != $host->getDataValue('platform')) { unset($allServices[$serviceID]); continue; } if ((!$host_passive || !$servicePassive) && (!$host_active || !$serviceActive)) { unset($allServices[$serviceID]); continue; } } foreach ($servicesAssigned as $serviceID => $serviceInfo) { if (isset($allServices[$serviceID]) && isset($parentServUsed[$allServices[$serviceID]['parent_id']])) { $parentServUsed[$allServices[$serviceID]['parent_id']] = $allServices[$serviceID]['parent_id']; } unset($allServices[$serviceID]); } if (count($allServices)) { foreach ($allServices as $serviceID => $serviceInfo) { if (isset($parentServUsed[$serviceInfo['parent_id']])) { continue; } $unchMenu = array(); if (intval($serviceInfo['parent_id'])) { $unchMenu[] = new EaseHtmlATag('servicetweak.php?service_id=' . $serviceID, EaseTWBPart::GlyphIcon('wrench') . ' ' . _('Editace')); } $unchMenu[] = new EaseHtmlATag('?addservice=' . $serviceInfo[$service->nameColumn] . '&service_id=' . $serviceID . '&' . $host->getmyKeyColumn() . '=' . $host->getMyKey() . '&' . $host->nameColumn . '=' . $host->getName(), EaseTWBPart::GlyphIcon('plus') . ' ' . _('Začít sledovat')); if (strlen($serviceInfo['display_name'])) { $serviceName = $serviceInfo['display_name']; } else { $serviceName = $serviceInfo[$service->nameColumn]; } $initialContent->addItem(new EaseTWBButtonDropdown($serviceName, 'inverse', 'xs', $unchMenu)); } } if (count($servicesAssigned)) { $saveAsTemplateButton = new EaseTWBLinkButton('stemplate.php?action=copyhost&host_id=' . $host->getId(), _('Uložit jako předlohu'), 'success'); $initialContent->footer($saveAsTemplateButton); $initialContent->addItem('</br>'); foreach ($servicesAssigned as $serviceID => $serviceInfo) { if (strlen($serviceInfo['display_name'])) { $serviceName = $serviceInfo['display_name']; } else { $serviceName = $serviceInfo[$service->nameColumn]; } $initialContent->addItem(new EaseTWBButtonDropdown($serviceName, 'success', 'xs', array(new EaseHtmlATag('?delservice=' . $serviceInfo[$service->nameColumn] . '&service_id=' . $serviceID . '&' . $host->getmyKeyColumn() . '=' . $host->getMyKey() . '&' . $host->nameColumn . '=' . $host->getName(), EaseTWBPart::GlyphIcon('remove') . ' ' . _('Přestat sledovat')), new EaseHtmlATag('servicetweak.php?service_id=' . $serviceID . '&host_id=' . $host->getId(), EaseTWBPart::GlyphIcon('wrench') . ' ' . _('Editace'))))); } } else { $presetSelForm = new EaseTWBForm('presetSelForm'); $presetSelForm->addItem(new EaseHtmlInputHiddenTag($host->getmyKeyColumn(), $host->getId())); $presetSelForm->addItem(new EaseHtmlInputHiddenTag('action', 'applystemplate')); $presetSelForm->addItem(new IEStemplateSelect('stemplate_id')); $presetSelForm->addItem(new EaseTWSubmitButton(_('Aplikovat předlohu'), 'success')); $presetSelForm->setTagClass('form-inline'); $initialContent->footer($presetSelForm); } } $this->addItem($initialContent); }
/** * Vrací mazací tlačítko * * @param string $name jméno objektu * @param string $urlAdd Předávaná část URL * @return \EaseJQConfirmedLinkButton */ public function deleteButton($name = null, $urlAdd = '') { if ($this->getOwnerID() == EaseShared::user()->getUserID() || EaseShared::user()->getSettingValue('admin')) { if ($this->allowTemplating && $this->isTemplate()) { $columnsList = array($this->getmyKeyColumn(), $this->nameColumn, $this->userColumn); if ($this->publicRecords) { $columnsList[] = 'public'; } $used = $this->getColumnsFromMySQL($columnsList, array('use' => $this->getDataValue('name')), $this->nameColumn, $this->getmyKeyColumn()); if (count($used)) { $usedFrame = new EaseTWBPanel(_('je předlohou pro'), 'info', null, _('není proto možné smazat')); foreach ($used as $usId => $usInfo) { if ($this->publicRecords && $usInfo['public'] != true && $usInfo[$this->userColumn] != EaseShared::user()->getUserID()) { $usedFrame->addItem(new EaseHtmlSpanTag(null, $usInfo[$this->nameColumn], array('class' => 'jellybean gray'))); } else { $usedFrame->addItem(new EaseHtmlSpanTag(null, new EaseHtmlATag('?' . $this->getmyKeyColumn() . '=' . $usId . '&' . $urlAdd, $usInfo[$this->nameColumn]), array('class' => 'jellybean'))); } } return $usedFrame; } } EaseShared::webPage()->addItem(new IEConfirmationDialog('delete' . $this->getId(), '?' . $this->getmyKeyColumn() . '=' . $this->getID() . '&delete=true' . '&' . $urlAdd, _('Smazat') . ' ' . $name, sprintf(_('Opravdu smazat %s ?'), '<strong>' . $this->getName() . '</strong>'))); return new EaseHtmlButtonTag(array(EaseTWBPart::GlyphIcon('remove'), _('Smazat') . ' ' . $this->keyword . ' ' . $this->getName()), array('style' => 'cursor: default', 'class' => 'btn btn-danger', 'id' => 'triggerdelete' . $this->getId(), 'data-id' => $this->getId())); } else { return ''; } }
/** * Stav senzoru a jeho nastavení * * @param IEHost $host */ public function __construct($host) { $commonWell = new EaseTWBWell(); $commonRow = new EaseTWBRow(); $hostColumn = $commonRow->addColumn(6, new EaseHtmlATag('host.php?host_id=' . $host->getId(), new EaseHtmlH1Tag($host->getName()))); $hostColumn->addItem($host); $hostColumn->addItem($host->sensorStatusLabel()); $commonWell->addItem($commonRow); $commonRow->addColumn(4, new EaseTWBPanel(_('Ruční nastavení stavu senzoru'), 'info', new IESensorConfirmForm($host))); $sensorTabs = new EaseTWBTabs('sensorTabs'); switch ($host->getDataValue('platform')) { case 'windows': $pltIco = 'logos/base/win40.gif'; $cfgGenerator = new IENSCPConfigGenerator($host); if ($host->getCfgValue('active_checks_enabled')) { $windowsActiveTab = $sensorTabs->addTab(_('Windows NRPE')); $windowsActiveTab->addItem(new EaseHtmlH1Tag('<img src="' . $pltIco . '">' . _('aktivní NRPE pro NSC++'))); $windowsActiveTab->addItem(new EaseTWBLinkButton('http://www.nsclient.org/download/', ' NSC++ ' . EaseTWBPart::GlyphIcon('download'), 'success', array('style' => "background-image:url('img/nscpp.png'); width: 212px; height: 60px; ", 'title' => 'Download'))); $windowsActiveTab->addItem(new EaseTWBLinkButton('host.php?action=populate&host_id=' . $host->getID(), _('Oskenovat a sledovat služby'), null, array('onClick' => "\$('#preload').css('visibility', 'visible');"))); $windowsActiveTab->addItem(new EaseTWBLinkButton('nscpcfggen.php?host_id=' . $host->getId(), $host->getName() . '_nscp.bat ' . EaseTWBPart::GlyphIcon('download'), 'success')); $windowsActiveTab->addItem(new EaseTWBContainer('<pre>' . htmlspecialchars($cfgGenerator->getCfg(false)) . '</pre>', array('font-face' => 'fixed'))); } if ($host->getCfgValue('passive_checks_enabled')) { $windowsPassiveTab = $sensorTabs->addTab(_('Windows NSCA')); $windowsPassiveTab->addItem(new EaseHtmlH1Tag('<img src="' . $pltIco . '">' . _('pasivní NSCA pro NSC++'))); $windowsPassiveTab->addItem(new EaseTWBLinkButton('http://www.nsclient.org/download/', ' NSC++ ' . EaseTWBPart::GlyphIcon('download'), 'success', array('style' => "background-image:url('img/nscpp.png'); width: 212px; height: 60px; ", 'title' => 'Download'))); $windowsPassiveTab->addItem(new EaseTWBLinkButton('nscpcfggen.php?host_id=' . $host->getId(), $host->getName() . '_nscp.bat ' . EaseTWBPart::GlyphIcon('download'), 'success')); $windowsPassiveTab->addItem(new EaseTWBWell('<pre>' . htmlspecialchars($cfgGenerator->getCfg(false), ENT_QUOTES) . '</pre>', array('font-face' => 'fixed'))); } break; case 'linux': $pltIco = 'logos/base/linux40.gif'; $preferences = new IEPreferences(); $prefs = $preferences->getPrefs(); if ($host->getCfgValue('active_checks_enabled')) { $nrpe_cfgGenerator = new IENRPEConfigGenerator($host); $linuxActiveTab = $sensorTabs->addTab(_('Linux NRPE')); $linuxActiveTab->addItem(new EaseHtmlH1Tag('<img src="' . $pltIco . '">' . _('aktivní NRPE pro NRPE Server'))); $linuxActiveTab->addItem(new EaseHtmlPTag(_('Nainstalujte nejprve senzor tímto příkazem') . ':')); $linuxActiveTab->addItem(new EaseHtmlDiv('<pre>sudo aptitude -y install nagios-nrpe-server</pre>', array('class' => 'code'))); $linuxActiveTab->addItem(new EaseTWBLinkButton('nrpecfggen.php?host_id=' . $host->getId(), $host->getName() . '_nrpe.sh ' . EaseTWBPart::GlyphIcon('download'), 'success')); $linuxActiveTab->addItem(new EaseTWBContainer('<pre>' . htmlspecialchars($nrpe_cfgGenerator->getCfg(false)) . '</pre>', array('font-face' => 'fixed'))); $linuxActiveTab->addItem(new EaseTWBLinkButton('host.php?action=populate&host_id=' . $host->getID(), _('Oskenovat a sledovat služby'), null, array('onClick' => "\$('#preload').css('visibility', 'visible');"))); } if ($host->getCfgValue('passive_checks_enabled')) { $linuxPassiveTab = $sensorTabs->addTab(_('Linux NSCA')); $linuxPassiveTab->addItem(new EaseHtmlH1Tag('<img src="' . $pltIco . '">' . _('pasivní NSCA pro NSCP Senzor'))); $linuxPassiveTab->addItem(new EaseTWBLinkButton('nscpcfggen.php?host_id=' . $host->getId(), $host->getName() . '_nscp.sh ' . EaseTWBPart::GlyphIcon('download'), 'success')); $cfgGenerator = new IENSCPConfigGenerator($host); $linuxPassiveTab->addItem(new EaseTWBContainer('<pre>' . htmlspecialchars($cfgGenerator->getCfg(false)) . '</pre>', array('font-face' => 'fixed'))); } break; default: $pltIco = 'logos/unknown.gif'; if ($host->getCfgValue('active_checks_enabled')) { $genericActiveTab = $sensorTabs->addTab(_('Generic Active')); $genericActiveTab->addItem(new EaseTWBLinkButton('host.php?action=populate&host_id=' . $host->getID(), _('Oskenovat a sledovat služby'), null, array('onClick' => "\$('#preload').css('visibility', 'visible');"))); } if ($host->getCfgValue('passive_checks_enabled')) { $genericPassiveTab = $sensorTabs->addTab(_('Generic Passive')); } break; } parent::__construct($commonWell); $this->addItem($sensorTabs); }
/** * Volba členů skupiny * * @return \EaseTWBPanel */ public function memberSelector() { $users = array(); $unassigned = array(); if ($this->getMyKey()) { $ua = $this->myDbLink->queryToArray('SELECT id,login FROM user WHERE id NOT IN ( SELECT user_id FROM user_to_group WHERE group_id=' . $this->getMyKey() . ' )', 'id'); foreach ($ua as $id => $userInfo) { $unassigned[$id] = $userInfo['login']; } } foreach ($this->members as $userId => $login) { $users[$userId] = new EaseTWBButtonDropdown($login, 'success', 'xs', array(new EaseHtmlATag('?action=delmember&usergroup_id=' . $this->getMyKey() . '&member_id=' . $userId, EaseTWBPart::GlyphIcon('minus') . ' ' . _('Odebrat ze skupiny')), new EaseHtmlATag('userinfo.php?user_id=' . $userId, EaseTWBPart::GlyphIcon('wrench') . ' ' . _('Editace')))); } foreach ($unassigned as $userId => $login) { $users[$userId] = new EaseTWBButtonDropdown($login, 'inverse', 'xs', array(new EaseHtmlATag('?action=addmember&usergroup_id=' . $this->getMyKey() . '&member_id=' . $userId, EaseTWBPart::GlyphIcon('plus') . ' ' . _('Přidat do skupiny')), new EaseHtmlATag('userinfo.php?user_id=' . $userId, EaseTWBPart::GlyphIcon('wrench') . ' ' . _('Editace')))); } return new EaseTWBPanel(_('členové skupiny'), 'default', $users); }
/** * Vrací mazací tlačítko * * @param string $name jméno objektu * @param string $urlAdd Předávaná část URL * @return \EaseJQConfirmedLinkButton */ public function deleteButton($name = null, $urlAdd = '') { // return new EaseJQConfirmedLinkButton('?user_id=' . $this->getID() . '&delete=true' . '&' . $urlAdd, _('Smazat ') . ' ' . $this->getUserLogin() . ' ' . EaseTWBPart::GlyphIcon('remove-sign')); EaseShared::webPage()->addItem(new IEConfirmationDialog('delete' . $this->getId(), '?user_id=' . $this->getID() . '&delete=true' . '&' . $urlAdd, _('Smazat') . ' ' . $name, sprintf(_('Opravdu smazat %s ?'), '<strong>' . $this->getUserName() . '</strong>'))); return new EaseHtmlButtonTag(array(EaseTWBPart::GlyphIcon('remove'), _('Smazat') . ' ' . $this->keyword . ' ' . $this->getUserName()), array('style' => 'cursor: default', 'class' => 'btn btn-danger', 'id' => 'triggerdelete' . $this->getId(), 'data-id' => $this->getId())); }
/** * Vložení menu */ public function afterAdd() { $nav = $this->addItem(new IEBootstrapMenu()); $user = EaseShared::user(); $userID = $user->getUserID(); if ($userID) { //Authenticated user $nav->addMenuItem(new IENavBarSearchBox('search', 'search.php')); if ($user->getSettingValue('admin')) { $users = $user->getColumnsFromMySQL(array('id', 'login'), array('id' => '!0'), 'login', $user->getmyKeyColumn()); $userList = array(); if ($users) { foreach ($users as $uID => $uInfo) { $userList['userinfo.php?user_id=' . $uInfo['id']] = EaseTWBPart::GlyphIcon('user') . ' ' . $uInfo['login']; } if (count($userList)) { $userList[] = ''; } } // $usergroups = $this->myDbLink->queryToArray('SELECT * FROM user_groups' . 'usergroup_id'); $nav->addDropDownMenu(_('Uživatelé'), array_merge($userList, array('createaccount.php' => EaseTWBPart::GlyphIcon('plus') . ' ' . _('Nový uživatel'), 'users.php' => EaseTWBPart::GlyphIcon('list') . ' ' . _('Přehled uživatelů'), 'usergroup.php' => EaseTWBPart::GlyphIcon('plus') . ' ' . _('Nová skupina uživatelů'), 'usergroups.php' => EaseTWBPart::GlyphIcon('list') . ' ' . _('Přehled skupin uživatelů')))); } $this->changesButton($nav); $this->groupsHostsMenu($nav); // $nav->addDropDownMenu(_('Hosti'), $hostGroupHostsMenuItem); if (EaseShared::user()->getSettingValue('admin')) { $nav->addDropDownMenu(_('Služby'), array('wizard-service.php' => EaseTWBPart::GlyphIcon('forward') . ' ' . _('Průvodce založením služby'), 'service.php' => EaseTWBPart::GlyphIcon('plus') . ' ' . _('Nová služba'), 'services.php' => EaseTWBPart::GlyphIcon('list') . ' ' . _('Přehled služeb'), 'servicegroup.php' => EaseTWBPart::GlyphIcon('plus') . ' ' . _('Nová skupina služeb'), 'servicegroups.php' => EaseTWBPart::GlyphIcon('list') . ' ' . _('Přehled skupin služeb'), '' => '', 'stemplate.php?action=new' => EaseTWBPart::GlyphIcon('plus') . ' ' . _('Nová předloha sledované služby'), 'stemplates.php' => EaseTWBPart::GlyphIcon('list') . ' ' . _('Přehled předloh sled. sl.'))); } else { $service = new IEService(); $services = $service->getListing(null, null, array('icon_image', 'platform')); if (count($services)) { $services_menu = array('services.php' => EaseTWBPart::GlyphIcon('list') . ' ' . _('Přehled služeb')); foreach ($services as $serviceID => $serviceInfo) { $services_menu['servicetweak.php?service_id=' . $serviceID] = $serviceInfo[$service->nameColumn]; } $nav->addDropDownMenu(_('Služby'), $services_menu); } } $contact = new IEContact(); $contacts = $contact->getListing(null, null, array('parent_id')); foreach ($contacts as $contactID => $contactInfo) { //Vyfiltrovat pouze primární kontakty if ($contactInfo['parent_id']) { unset($contacts[$contactID]); } } if (count($contacts)) { $contacts_menu = array('contacts.php' => EaseTWBPart::GlyphIcon('list') . ' ' . _('Přehled Kontaktů')); foreach ($contacts as $contactID => $contactInfo) { $contacts_menu['contacttweak.php?contact_id=' . $contactID] = $contactInfo[$contact->nameColumn]; } $contacts_menu[] = ''; } else { $contacts_menu = array(); } $nav->addDropDownMenu(_('Kontakty'), array_merge($contacts_menu, array('contacts.php' => EaseTWBPart::GlyphIcon('list') . ' ' . _('Přehled kontaktů'), 'newcontact.php' => EaseTWBPart::GlyphIcon('plus') . ' ' . _('Nový kontakt'), 'contactgroups.php' => EaseTWBPart::GlyphIcon('list') . ' ' . _('Přehled skupin kontaktů'), 'contactgroup.php' => EaseTWBPart::GlyphIcon('edit') . ' ' . _('Nová skupina kontaktů')))); if ($user->getSettingValue('admin')) { $nav->addDropDownMenu(_('Příkaz'), array('command.php' => EaseTWBPart::GlyphIcon('edit') . ' ' . _('Nový příkaz'), 'commands.php' => EaseTWBPart::GlyphIcon('list-alt') . ' ' . _('Přehled příkazů'), 'importcommand.php' => EaseTWBPart::GlyphIcon('import') . ' ' . _('Importovat'), '', 'script.php' => EaseTWBPart::GlyphIcon('edit') . ' ' . _('Nový skript'), 'scripts.php' => EaseTWBPart::GlyphIcon('list-alt') . ' ' . _('Přehled skriptů'))); $nav->addDropDownMenu(_('Rozšířené'), array('timeperiods.php' => EaseTWBPart::GlyphIcon('list') . ' ' . _('Přehled časových period'), 'timeperiod.php' => EaseTWBPart::GlyphIcon('plus') . ' ' . _('Nová časová perioda'), 'preferences.php' => EaseTWBPart::GlyphIcon('wrench') . ' ' . _('Nastavení icingy'), 'regenall.php' => EaseTWBPart::GlyphIcon('ok') . ' ' . _('Přegenerovat všechny konfiguráky'), 'reset.php' => EaseTWBPart::GlyphIcon('cog') . ' ' . _('Reset Objektů'), 'dbrecreate.php' => EaseTWBPart::GlyphIcon('wrench') . ' ' . _('Reinicializovat databázi'), 'fixer.php' => EaseTWBPart::GlyphIcon('ok-circle') . ' ' . _('Opravit databázi'), 'import.php' => EaseTWBPart::GlyphIcon('import') . ' ' . _('Importovat'))); } $results = array('nagstamon.php' => EaseTWBPart::GlyphIcon('info') . ' ' . _('PC Lin/Win/Mac'), 'anag.php' => EaseTWBPart::GlyphIcon('info') . ' ' . _('Android'), 'wpnag.php' => EaseTWBPart::GlyphIcon('Info') . ' ' . _('Win Phone')); if (file_exists('/etc/apache2/conf-enabled/icinga-web.conf')) { $results['/icinga-web/'] = EaseTWBPart::GlyphIcon('Info') . ' ' . _('Web'); } $nav->addDropDownMenu(_('Výsledky testů'), $results); } }
list($msg, $WarningCount) = explode(':', $line); if (intval(trim($WarningCount))) { $oUser->addStatusMessage(sprintf(_('celkem %s varování'), $WarningCount), 'warning'); } else { $oUser->addStatusMessage(_('test proběhl bez varování'), 'success'); } } if (strstr($line, 'Total Errors')) { list($msg, $errorCount) = explode(':', $line); if (intval(trim($errorCount))) { $oUser->addStatusMessage(sprintf(_('celkem %s chyb'), $errorCount), 'warning'); } else { $oUser->addStatusMessage(_('test proběhl bez chyb'), 'success'); } } } fclose($testing); if (!intval($errorCount) && !is_null($WarningCount)) { if (IECfg::reloadIcinga()) { $oPage->container->addItem(_('Všechny vaše konfigurační soubory byly přegenerovány')); $oPage->container->addItem(new EaseTWBLinkButton('main.php', _('Hotovo') . ' ' . EaseTWBPart::GlyphIcon('ok-sign'), 'success')); EaseShared::user()->setSettingValue('unsaved', false); } } } if ($oUser->getSettingValue('admin') && isset($originalUserID)) { EaseShared::user(new EaseUser($originalUserID)); EaseShared::user()->loginSuccess(); } $oPage->addItem(new IEPageBottom()); $oPage->draw();