Example #1
0
foreach ($eHTMLTree as $e) {
    $result = '';
    $style = null;
    if ($allowedTesting && $test && isset($e['expression'])) {
        if (evalExpressionData($e['expression']['value'], $macrosData)) {
            $result = 'TRUE';
            $style = ZBX_STYLE_GREEN;
        } else {
            $result = 'FALSE';
            $style = ZBX_STYLE_RED;
        }
    }
    $resultTable->addRow([$e['list'], (new CCol($result))->addClass($style)]);
}
$result = '';
if ($allowedTesting && $test) {
    if (evalExpressionData($expression, $macrosData)) {
        $result = 'TRUE';
        $style = ZBX_STYLE_GREEN;
    } else {
        $result = 'FALSE';
        $style = ZBX_STYLE_RED;
    }
}
$resultTable->setFooter([$outline, (new CCol($result))->addClass($style)]);
$form_list->addRow(_('Result'), (new CDiv($resultTable))->addClass(ZBX_STYLE_TABLE_FORMS_SEPARATOR)->setAttribute('style', 'min-width: ' . ZBX_TEXTAREA_BIG_WIDTH . 'px;'));
$tab = (new CTabView())->addTab('test_tab', null, $form_list);
$tab->setFooter(makeFormFooter((new CSubmit('test_expression', _('Test')))->setEnabled($allowedTesting), [(new CButton('close', _('Close')))->onClick('javascript: self.close();')]));
$form->addItem($tab);
$widget->addItem($form)->show();
require_once dirname(__FILE__) . '/include/page_footer.php';
foreach ($eHTMLTree as $e) {
    $result = '-';
    if ($allowedTesting && $test && isset($e['expression'])) {
        $result = evalExpressionData($e['expression']['value'], $macrosData, $octet);
    }
    $style = 'text-align: center;';
    if ($result != '-') {
        $style = $result == 'TRUE' ? 'background-color: #ccf; color: #00f;' : 'background-color: #fcc; color: #f00;';
    }
    $col = new CCol($result);
    $col->setAttribute('style', $style);
    $res_table->addRow(new CRow(array($e['list'], $col)));
}
$result = '-';
if ($allowedTesting && $test) {
    $result = evalExpressionData($expression, $macrosData, $octet);
}
$style = 'text-align: center;';
if ($result != '-') {
    $style = $result == 'TRUE' ? 'background-color: #ccf; color: #00f;' : 'background-color: #fcc; color: #f00;';
}
$col = new CCol($result);
$col->setAttribute('style', $style);
$res_table->setFooter(array($outline, $col), $res_table->headerClass);
$frm_test->addRow(_('Result'), $res_table);
// action buttons
$btn_test = new CSubmit('test_expression', _('Test'));
if (!$allowedTesting) {
    $btn_test->setAttribute('disabled', 'disabled');
}
$frm_test->addItemToBottomRow($btn_test);
Example #3
0
foreach ($eHTMLTree as $e) {
    $result = array('result' => '-', 'error' => '');
    if ($allowedTesting && $test && isset($e['expression'])) {
        $result = evalExpressionData($e['expression']['value'], $macrosData);
    }
    $style = 'text-align: center;';
    if ($result['result'] != '-') {
        $style = $result['result'] == 'TRUE' ? 'background-color: #ccf; color: #00f;' : 'background-color: #fcc; color: #f00;';
    }
    $col = new CCol(array($result['result'], SPACE, $result['error']));
    $col->setAttribute('style', $style);
    $resultTable->addRow(new CRow(array($e['list'], $col)));
}
$result = array('result' => '-', 'error' => '');
if ($allowedTesting && $test) {
    $result = evalExpressionData($expression, $macrosData);
}
$style = 'text-align: center;';
if ($result['result'] != '-') {
    $style = $result['result'] == 'TRUE' ? 'background-color: #ccf; color: #00f;' : 'background-color: #fcc; color: #f00;';
}
$col = new CCol(array($result['result'], SPACE, $result['error']));
$col->setAttribute('style', $style);
$resultTable->setFooter(array($outline, $col), $resultTable->headerClass);
$testForm->addRow(_('Result'), $resultTable);
// action buttons
$testButton = new CSubmit('test_expression', _('Test'));
if (!$allowedTesting) {
    $testButton->setAttribute('disabled', 'disabled');
}
$testForm->addItemToBottomRow($testButton);