コード例 #1
0
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
**/
$widget = new CWidget();
if (!empty($this->data['parent_discoveryid'])) {
    $widget->setTitle(_('Graph prototypes'))->addItem(get_header_host_table('graphs', $this->data['hostid'], $this->data['parent_discoveryid']));
} else {
    $widget->setTitle(_('Graphs'))->addItem(get_header_host_table('graphs', $this->data['hostid']));
}
// create form
$graphForm = (new CForm())->setName('graphForm')->addVar('form', $this->data['form'])->addVar('hostid', $this->data['hostid'])->addVar('ymin_itemid', $this->data['ymin_itemid'])->addVar('ymax_itemid', $this->data['ymax_itemid']);
if (!empty($this->data['parent_discoveryid'])) {
    $graphForm->addVar('parent_discoveryid', $this->data['parent_discoveryid']);
}
if (!empty($this->data['graphid'])) {
    $graphForm->addVar('graphid', $this->data['graphid']);
}
// create form list
$graphFormList = new CFormList('graphFormList');
$is_templated = (bool) $this->data['templates'];
if ($is_templated) {
コード例 #2
0
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
**/
$screenWidget = new CWidget();
$form = (new CFilter('web.hostscreen.filter.state'))->addNavigator();
$screenWidget->addItem($form);
if (empty($this->data['screen']) || empty($this->data['host'])) {
    $screenWidget->setTitle(_('Screens'))->addItem(new CTableInfo());
    $screenBuilder = new CScreenBuilder();
    CScreenBuilder::insertScreenStandardJs(['timeline' => $screenBuilder->timeline]);
} else {
    $screenWidget->setTitle([$this->data['screen']['name'], SPACE, _('on'), SPACE, (new CSpan($this->data['host']['name']))->addClass(ZBX_STYLE_ORANGE)]);
    $controls = new CList();
    // host screen list
    if (!empty($this->data['screens'])) {
        $screenComboBox = new CComboBox('screenList', 'host_screen.php?hostid=' . $this->data['hostid'] . '&screenid=' . $this->data['screenid'], 'javascript: redirect(this.options[this.selectedIndex].value);');
        foreach ($this->data['screens'] as $screen) {
            $screenComboBox->addItem('host_screen.php?hostid=' . $this->data['hostid'] . '&screenid=' . $screen['screenid'], $screen['name']);
        }
        $controls->addItem($screenComboBox)->addItem(get_icon('fullscreen', ['fullscreen' => $this->data['fullscreen']]));
        $screenWidget->setControls($controls);
    }
    // append screens to widget
コード例 #3
0
}
// create history screen
$screen = CScreenBuilder::getScreen(['resourcetype' => SCREEN_RESOURCE_HISTORY, 'action' => $this->data['action'], 'itemids' => $data['itemids'], 'profileIdx' => $profileIdx, 'profileIdx2' => $profileIdx2, 'updateProfile' => $updateProfile, 'period' => $this->data['period'], 'stime' => $this->data['stime'], 'filter' => getRequest('filter'), 'filter_task' => getRequest('filter_task'), 'mark_color' => getRequest('mark_color'), 'plaintext' => $this->data['plaintext'], 'graphtype' => $this->data['graphtype']]);
// append plaintext to widget
if ($this->data['plaintext']) {
    foreach ($headerPlaintext as $text) {
        $historyWidget->addItem([new CSpan($text), BR()]);
    }
    $screen = $screen->get();
    $pre = new CPre();
    foreach ($screen as $text) {
        $pre->addItem([$text, BR()]);
    }
    $historyWidget->addItem($pre);
} else {
    $historyWidget->setTitle($header['left'])->setControls($header['right']);
    if (isset($this->data['iv_string'][$this->data['value_type']])) {
        $filterForm->addNavigator();
    }
    if (in_array($this->data['action'], [HISTORY_VALUES, HISTORY_GRAPH, HISTORY_BATCH_GRAPH])) {
        if (!isset($filterForm)) {
            $filterForm = new CFilter('web.history.filter.state');
        }
        // display the graph type filter for graphs with multiple items
        if ($this->data['action'] == HISTORY_BATCH_GRAPH) {
            $filterForm->addColumn((new CFormList())->addRow(_('Graph type'), (new CRadioButtonList('graphtype', (int) $this->data['graphtype']))->addValue(_('Normal'), GRAPH_TYPE_NORMAL)->addValue(_('Stacked'), GRAPH_TYPE_STACKED)->setModern(true)));
            $filterForm->removeButtons();
            $filterForm->addVar('fullscreen', $this->data['fullscreen']);
            $filterForm->addVar('action', $this->data['action']);
            $filterForm->addVar('itemids', $this->data['itemids']);
        }
コード例 #4
0
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
**/
$triggersWidget = new CWidget();
// append host summary to widget header
if (!empty($this->data['hostid'])) {
    $hostTableElement = $this->data['elements_field'] == 'group_graphid' ? 'graphs' : 'trigger';
    $triggersWidget->addItem(get_header_host_table($hostTableElement, $this->data['hostid']));
}
if (!empty($this->data['title'])) {
    $triggersWidget->setTitle($this->data['title']);
}
// create form
$triggersForm = (new CForm())->setName('triggersForm')->addVar($this->data['elements_field'], $this->data['elements'])->addVar('hostid', $this->data['hostid'])->addVar('action', $this->data['action']);
// create form list
$triggersFormList = new CFormList('triggersFormList');
// append copy types to form list
$triggersFormList->addRow(_('Target type'), new CComboBox('copy_type', $this->data['copy_type'], 'submit()', [COPY_TYPE_TO_HOST => _('Hosts'), COPY_TYPE_TO_TEMPLATE => _('Templates'), COPY_TYPE_TO_HOST_GROUP => _('Host groups')]));
// append groups to form list
if ($this->data['copy_type'] == COPY_TYPE_TO_HOST || $this->data['copy_type'] == COPY_TYPE_TO_TEMPLATE) {
    $groupComboBox = new CComboBox('copy_groupid', $this->data['copy_groupid'], 'submit()');
    foreach ($this->data['groups'] as $group) {
        if (empty($this->data['copy_groupid'])) {
            $this->data['copy_groupid'] = $group['groupid'];
        }
        $groupComboBox->addItem($group['groupid'], $group['name']);