/** * 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();
/** * Přehled hostů bez potvrzeného senzoru, nebo se zastaralou konf. senzoru. * * @param array $hosts */ public function __construct($hosts) { $ok = 0; $noSensor = array(); $oldSensor = array(); $noParents = array(); $noIcon = array(); $noContacts = array(); EaseShared::webPage()->addItem(new EaseHtmlDivTag('preload', new IEFXPreloader(), array('class' => 'fuelux'))); foreach ($hosts as $host_id => $host_info) { if (is_null($host_info['host_name']) || !strlen($host_info['host_name'])) { unset($hosts[$host_id]); continue; } if (isset($host_info['config_hash'])) { $host = new IEHost((int) $host_id); if ($host->getConfigHash() == $host_info['config_hash']) { unset($hosts[$host_id]); $ok++; } else { //Zastaralá konfigurace $oldSensor[$host_id] = $host_info; } } else { $noSensor[$host_id] = $host_info; //senzor neregistrován } if (!isset($host_info['parents']) || !count($host_info['parents'])) { $noParents[$host_id] = $host_info; //Host bez rodičů } if (!isset($host_info['icon_image']) || !strlen(trim($host_info['icon_image']))) { $noIcon[$host_id] = $host_info; //Host bez ikony } if (!isset($host_info['contacts']) || !count($host_info['contacts']) || (!isset($host_info['contact_groups']) || !count($host_info['contact_groups']))) { $noContacts[$host_id] = $host_info; //Host bez kontaktů } } $hostsTabs = new EaseTWBTabs('hostsTabs'); if (count($oldSensor)) { $oldHostsTable = new EaseHtmlTableTag(null, array('class' => 'table')); foreach ($oldSensor as $host_id => $host_info) { $row = $oldHostsTable->addRowColumns(array(new EaseHtmlATag('host.php?host_id=' . $host_id, $host_info['host_name']), new EaseTWBLinkButton('sensor.php?host_id=' . $host_id, _('aktualizovat senzor')))); $row->setTagClass('warning'); } $hostsTabs->addTab(sprintf(_('Neakt. Senzor <span class="badge">%s</span>'), count($oldSensor)), $oldHostsTable); } if (count($noSensor)) { $noSensorTable = new EaseHtmlTableTag(null, array('class' => 'table')); foreach ($noSensor as $host_id => $host_info) { $row = $noSensorTable->addRowColumns(array(new EaseHtmlATag('host.php?host_id=' . $host_id, $host_info['host_name']), new EaseTWBLinkButton('sensor.php?host_id=' . $host_id, _('nasadit senzor')))); $row->setTagClass('danger'); } $hostsTabs->addTab(sprintf(_('Bez senzoru <span class="badge">%s</span>'), count($noSensor)), $noSensorTable); } if (count($noParents)) { $noParentsTable = new EaseHtmlTableTag(null, array('class' => 'table')); foreach ($noParents as $host_id => $host_info) { $row = $noParentsTable->addRowColumns(array(new EaseHtmlATag('host.php?host_id=' . $host_id, $host_info['host_name']), new EaseTWBLinkButton('host.php?action=parent&host_id=' . $host_id, _('přiřadit rodiče')), new EaseTWBLinkButton('watchroute.php?action=parent&host_id=' . $host_id, _('sledovat celou cestu'), 'warning', array('onClick' => "\$('#preload').css('visibility', 'visible');")))); $row->setTagClass('info'); } $hostsTabs->addTab(sprintf(_('Bez rodičů <span class="badge">%s</span>'), count($noParents)), $noParentsTable); } if (count($noIcon)) { $noIconTable = new EaseHtmlTableTag(null, array('class' => 'table')); foreach ($noIcon as $host_id => $host_info) { $row = $noIconTable->addRowColumns(array(new EaseHtmlATag('host.php?host_id=' . $host_id, $host_info['host_name']), new EaseTWBLinkButton('host.php?action=icon&host_id=' . $host_id, _('přiřadit ikonu')))); $row->setTagClass('default'); } $hostsTabs->addTab(sprintf(_('Bez ikony <span class="badge">%s</span>'), count($noIcon)), $noIconTable); } if (count($noContacts)) { $noContactsTable = new EaseHtmlTableTag(null, array('class' => 'table')); foreach ($noContacts as $host_id => $host_info) { $row = $noContactsTable->addRowColumns(array(new EaseHtmlATag('host.php?host_id=' . $host_id, $host_info['host_name']), new EaseTWBLinkButton('host.php?host_id=' . $host_id, _('přiřadit kontakty')))); $row->setTagClass('default'); } $hostsTabs->addTab(sprintf(_('Bez kontaktů <span class="badge">%s</span>'), count($noContacts)), $noContactsTable); } parent::__construct(_('Hosty dle stavu konfigurace'), 'info', $hostsTabs, sprintf(_('Celkem %s hostů bez aktuální konfigurace. (%s aktuální)'), count($hosts), $ok)); }
* @subpackage WebUI * @author Vitex <*****@*****.**> * @copyright 2012 Vitex@hippy.cz (G) */ 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'); }
$oUser->addStatusMessage(_('položka byla odebrána'), 'success'); } } $delete = $oPage->getGetValue('delete', 'bool'); if ($delete == 'true') { $Timeperiod->delete(); } $oPage->addItem(new IEPageTop(_('Editace časové periody') . ' ' . $Timeperiod->getName())); $oPage->addPageColumns(); $TimepriodEdit = new IECfgEditor($Timeperiod); $form = $oPage->columnII->addItem(new EaseHtmlForm('Perioda', 'timeperiod.php', 'POST', $TimepriodEdit, array('class' => 'form-horizontal'))); $form->setTagID($form->getTagName()); if (!is_null($Timeperiod->getMyKey())) { $form->addItem(new EaseHtmlInputHiddenTag($Timeperiod->getmyKeyColumn(), $Timeperiod->getMyKey())); } $TimesTable = new EaseHtmlTableTag(); $TimesTable->addRowHeaderColumns(array(new EaseLabeledTextInput('NewKey', null, _('Označení')), new EaseLabeledTextInput('NewTimes', null, _('Interval(y)')), '')); foreach ($Timeperiod->timeperiods as $TimeName => $TimeIntervals) { $TimesTable->addRowColumns(array($TimeName, $TimeIntervals, new EaseHtmlATag('?del=' . $TimeName . '&' . $Timeperiod->getmyKeyColumn() . '=' . $Timeperiod->getMyKey(), '<i class="icon-remove"></i>'))); } $form->addItem($TimesTable); $form->addItem(new EaseTWSubmitButton(_('Uložit'), 'success')); $oPage->AddCss(' input.ui-button { width: 100%; } '); $oPage->columnIII->addItem($Timeperiod->deleteButton()); if ($Timeperiod->getId()) { $oPage->columnI->addItem($Timeperiod->ownerLinkButton()); } $oPage->addItem(new IEPageBottom()); $oPage->draw();