Example #1
0
    default:
        $commandEditor = new IECfgEditor($command);
        $form = new EaseTWBForm('Command', 'command.php', 'POST', $commandEditor, array('class' => 'form-horizontal'));
        if (!$command->getId()) {
            $form->addItem(new EaseTWSubmitButton(_('Založit'), 'success'));
        } else {
            $form->addItem(new EaseTWSubmitButton(_('Uložit'), 'success'));
        }
        break;
}
$oPage->addItem(new IEPageBottom());
$infopanel = new IEInfoBox($command);
$tools = new EaseTWBPanel(_('Nástroje'), 'warning');
if ($command->getId()) {
    $tools->addItem($command->deleteButton());
    $tools->addItem(new EaseTWBPanel(_('Transfer'), 'warning', $command->transferForm()));
    $service = new IEService();
    $usages = $service->getColumnsFromMySQL(array($service->getMyKeyColumn(), $service->nameColumn), array('check_command' => $command->getName()), $service->nameColumn, $service->getMyKeyColumn());
    if (count($usages)) {
        $usedBy = new EaseTWBPanel(_('Používající služby'));
        $listing = $usedBy->addItem(new EaseHtmlUlTag(null, array('class' => 'list-group')));
        foreach ($usages as $usage) {
            $listing->addItem(new EaseHtmlLiTag(new EaseHtmlATag('service.php?service_id=' . $usage['service_id'], $usage[$service->nameColumn]), array('class' => 'list-group-item')));
        }
        $infopanel->addItem($usedBy);
    }
    $contact = new IEContact();
    $hostNotify = $contact->getColumnsFromMySQL(array($contact->getMyKeyColumn(), $contact->nameColumn), array('host_notification_commands' => '%' . $command->getName() . '%'), $contact->nameColumn, $contact->getMyKeyColumn());
    $serviceNotify = $contact->getColumnsFromMySQL(array($contact->getMyKeyColumn(), $contact->nameColumn), array('service_notification_commands' => '%' . $command->getName() . '%'), $contact->nameColumn, $contact->getMyKeyColumn());
    $usages = array_merge($hostNotify, $serviceNotify);
    if (count($usages)) {