function loadItems()
 {
     $tpls = array('' => _('zvol ze seznamu'));
     $stemplate = new IEStemplate();
     $templates = $stemplate->getColumnsFromMySQL(array($stemplate->getmyKeyColumn(), $stemplate->nameColumn));
     foreach ($templates as $template_id => $template_info) {
         $tpls[$template_info[$stemplate->myKeyColumn]] = $template_info[$stemplate->nameColumn];
     }
     return $tpls;
 }
Esempio n. 2
0
/**
 * Icinga Editor hosta
 *
 * @package    IcingaEditor
 * @subpackage WebUI
 * @author     Vitex <*****@*****.**>
 * @copyright  2012 Vitex@hippy.cz (G)
 */
require_once 'includes/IEInit.php';
$oPage->onlyForLogged();
$hostId = $oPage->getRequestValue('host_id', 'int');
$host = new IEHost($hostId);
switch ($oPage->getRequestValue('action')) {
    case 'applystemplate':
        $stemplate = new IEStemplate($oPage->getRequestValue('stemplate_id', 'int'));
        $services = $stemplate->getDataValue('services');
        if (count($services)) {
            $service = new IEService();
            foreach ($services as $service_id => $service_name) {
                $service->loadFromMySQL($service_id);
                $service->addMember('host_name', $host->getId(), $host->getName());
                $service->saveToMySQL();
                $service->dataReset();
            }
        }
        $contacts = $stemplate->getDataValue('contacts');
        if (count($contacts)) {
            foreach ($contacts as $contact_id => $contact_name) {
                $host->addMember('contacts', $contact_id, $contact_name);
            }
Esempio n. 3
0
<?php

/**
 * Icinga Editor - Předloha sledovaných služeb
 *
 * @package    IcingaEditor
 * @subpackage WebUI
 * @author     Vitex <*****@*****.**>
 * @copyright  2012 Vitex@hippy.cz (G)
 */
require_once 'includes/IEInit.php';
$oPage->onlyForLogged();
$stemplate = new IEStemplate($oPage->getRequestValue('stemplate_id', 'int'));
switch ($oPage->getRequestValue('action')) {
    case 'new':
        $stemplate->setDataValue($stemplate->nameColumn, _('Nová předloha'));
        $stemplate->insertToSQL();
        $stemplate->setDataValue($stemplate->nameColumn, _('Nová předloha') . ' #' . $stemplate->getId());
        $stemplate->updateToMySQL();
        break;
    case 'copyhost':
        $host = new IEHost($oPage->getRequestValue('host_id', 'int'));
        $stemplate->setDataValue($stemplate->nameColumn, $host->getName());
        $stemplate->setDataValue('services', $host->getServices());
        if ($stemplate->saveToSQL()) {
            $stemplate->addStatusMessage(sprintf(_('Vytvořena nová předloha sledovaných služeb: %s'), $stemplate->getName()), 'success');
        } else {
            $stemplate->addStatusMessage(sprintf(_('Nebyla vytvořena nová předloha')), 'warning');
        }
        break;
    case 'export':