<?php /** * Icinga Editor - časové periody * * @package IcingaEditor * @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')); }
public function delete($id = null) { if (is_null($id)) { $id = $this->getId(); } if ($id != $this->getId()) { $this->loadFromMySQL($id); } $userGroup = new IEUserGroup(); $userGroup->delUser($id); $command = new IECommand(); $myCommand = $command->getOwned($id); if ($myCommand) { foreach ($myCommand as $command_id => $cmd) { $command->loadFromMySQL((int) $command_id); $command->delete(); } } $contact = new IEContact(); $myContact = $contact->getOwned($id); if ($myContact) { foreach ($myContact as $contact_id => $cmd) { if ($contact->loadFromMySQL((int) $contact_id)) { $contact->delete(); } } } $contactgroup = new IEContactgroup(); $myContactgroup = $contactgroup->getOwned($id); if ($myContactgroup) { foreach ($myContactgroup as $contactgroup_id => $cmd) { $contactgroup->loadFromMySQL((int) $contactgroup_id); $contactgroup->delete(); } } $hostgroup = new IEHostgroup(); $myHostgroup = $hostgroup->getOwned($id); if ($myHostgroup) { foreach ($myHostgroup as $hostgroup_id => $cmd) { $hostgroup->loadFromMySQL((int) $hostgroup_id); $hostgroup->delete(); } } $host = new IEHost(); $myHost = $host->getOwned($id); if ($myHost) { foreach ($myHost as $host_id => $cmd) { $host->loadFromMySQL((int) $host_id); $host->delete(); } } $servicegroup = new IEServicegroup(); $myServicegroup = $servicegroup->getOwned($id); if ($myServicegroup) { foreach ($myServicegroup as $servicegroup_id => $cmd) { $servicegroup->loadFromMySQL((int) $servicegroup_id); $servicegroup->delete(); } } $service = new IEService(); $myService = $service->getOwned($id); if ($myService) { foreach ($myService as $service_id => $cmd) { $service->loadFromMySQL((int) $service_id); $service->delete(); } } $timeperiod = new IETimeperiod(); $myTimeperiod = $timeperiod->getOwned($id); if ($myTimeperiod) { foreach ($myTimeperiod as $timeperiod_id => $cmd) { $timeperiod->loadFromMySQL((int) $timeperiod_id); $timeperiod->delete(); } } $cfgfile = constant('CFG_GENERATED') . '/' . $this->getUserLogin() . '.cfg'; if (file_exists($cfgfile)) { if (unlink($cfgfile)) { $this->addStatusMessage(sprintf(_('Konfigurace uživatele %s byla smazána'), $this->getUserLogin()), 'success'); } else { $this->addStatusMessage(sprintf(_('Konfigurace uživatele %s nebyla smazána'), $this->getUserLogin()), 'error'); } } if ($this->deleteFromMySQL()) { $this->addStatusMessage(sprintf(_('Uživatel %s byl smazán'), $this->getUserLogin())); require_once 'Ease/EaseMail.php'; $email = new EaseMail($this->getDataValue('email'), _('Oznámení o zrušení účtu')); $email->setMailHeaders(array('From' => EMAIL_FROM)); $email->addItem(new EaseHtmlDivTag(null, "Právě jste byl/a smazán/a z Aplikace VSMonitoring s těmito přihlašovacími údaji:\n")); $email->addItem(new EaseHtmlDivTag(null, ' Login: ' . $this->GetUserLogin() . "\n")); $email->send(); return true; } else { return FALSE; } }
* * @package IcingaEditor * @subpackage WebUI * @author Vitex <*****@*****.**> * @copyright 2012 Vitex@hippy.cz (G) */ require_once 'includes/IEInit.php'; $oPage->onlyForLogged(); $oPage->addPageColumns(); $userID = $oPage->getRequestValue('user_id', 'int'); if ($userID) { $oPage->onlyForAdmin(); } $host = new IEHost(); $hostgroup = new IEHostgroup(); $contact = new IETimeperiod(); $command = new IECommand(); $service = new IEService(); $serviceGroup = new IEServicegroup(); $ownership = $oPage->getRequestValue('ownership'); if ($ownership) { $host->switchOwners($userID, $ownership); $hostgroup->switchOwners($userID, $ownership); $contact->switchOwners($userID, $ownership); $command->switchOwners($userID, $ownership); $service->switchOwners($userID, $ownership); $serviceGroup->switchOwners($userID, $ownership); $oPage->addStatusMessage(_('Vlastnictví byla předána')); } $user = new IEUser($userID); $oPage->addItem(new IEPageTop($user->getUserName()));
* @subpackage WebUI * @author Vitex <*****@*****.**> * @copyright 2012 Vitex@hippy.cz (G) */ require_once 'includes/IEInit.php'; require_once 'classes/IEContact.php'; require_once 'classes/IEContactgroup.php'; require_once 'classes/IEHost.php'; require_once 'classes/IEHostgroup.php'; require_once 'classes/IETimeperiod.php'; require_once 'classes/IECommand.php'; require_once 'classes/IEServicegroup.php'; $oPage->onlyForLogged(); $oPage->addItem(new IEPageTop(_('Icinga Editor'))); $oPage->addPageColumns(); $Timeperiod = new IETimeperiod(); $pocTimeperiods = $Timeperiod->getMyRecordsCount(); if ($pocTimeperiods) { $success = $oPage->columnIII->addItem(new EaseHtmlDivTag('Timeperiod', new EaseTWBLinkButton('timeperiods.php', _('<i class="icon-list"></i>') . ' ' . sprintf(_('Definováno %s časových period'), $pocTimeperiods)), array('class' => 'alert alert-success'))); } else { $warning = $oPage->columnIII->addItem(new EaseHtmlDivTag('Host', _('Nemáte definovaný žádné časové periody'), array('class' => 'alert alert-info'))); $warning->addItem(new EaseTWBLinkButton('timeperiod.php', _('Založit první časovou periodu <i class="icon-edit"></i>'))); } $contact = new IEContact(); $pocContact = $contact->getMyRecordsCount(); if ($pocContact) { $success = $oPage->columnII->addItem(new EaseHtmlDivTag('Contact', new EaseTWBLinkButton('contacts.php', _('<i class="icon-list"></i>') . ' ' . sprintf(_('Definováno %s kontaktů'), $pocContact)), array('class' => 'alert alert-success'))); } else { if ($pocTimeperiods) { $warning = $oPage->columnII->addItem(new EaseHtmlDivTag('Contact', _('Nemáte definovaný kontakt'), array('class' => 'alert alert-info'))); $warning->addItem(new EaseTWBLinkButton('contact.php', _('Založit první kontakt ' . EaseTWBPart::GlyphIcon('edit'))));
<?php /** * Icinga Editor Timeprioda * * @package IcingaEditor * @subpackage WebUI * @author Vitex <*****@*****.**> * @copyright 2012 Vitex@hippy.cz (G) */ require_once 'includes/IEInit.php'; require_once 'classes/IETimeperiod.php'; require_once 'classes/IECfgEditor.php'; $oPage->onlyForLogged(); $Timeperiod = new IETimeperiod($oPage->getRequestValue('timeperiod_id', 'int')); if ($oPage->isPosted()) { unset($_POST['Save']); $Timeperiod->takeData($_POST); $TimepriodID = $Timeperiod->saveToMySQL(); if (is_null($TimepriodID)) { $oUser->addStatusMessage(_('časová perioda nebyl uložena'), 'warning'); } else { $oUser->addStatusMessage(_('časová byla uložena'), 'success'); } } $DelColumn = $oPage->getGetValue('del'); if (!is_null($DelColumn)) { $Del = $Timeperiod->delTime($DelColumn); $TimepriodID = $Timeperiod->saveToMySQL(); if (is_null($TimepriodID) && !$Del) { $oUser->addStatusMessage(_('položka nebyla odebrána'), 'warning');