当前位置: 首页>>代码示例>>PHP>>正文


PHP CList::addItem方法代码示例

本文整理汇总了PHP中CList::addItem方法的典型用法代码示例。如果您正苦于以下问题:PHP CList::addItem方法的具体用法?PHP CList::addItem怎么用?PHP CList::addItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CList的用法示例。


在下文中一共展示了CList::addItem方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: toString

 public function toString($destroy = true)
 {
     if (count($this->tabs) == 1) {
         $this->setAttribute('class', 'min-width ui-tabs ui-widget ui-widget-content ui-corner-all widget');
         $header = reset($this->headers);
         $header = new CDiv($header);
         $header->addClass('ui-corner-all ui-widget-header header');
         $header->setAttribute('id', 'tab_' . key($this->headers));
         $this->addItem($header);
         $tab = reset($this->tabs);
         $tab->addClass('ui-tabs ui-tabs-panel ui-widget ui-widget-content ui-corner-all widget');
         $this->addItem($tab);
     } else {
         $headersList = new CList();
         foreach ($this->headers as $id => $header) {
             $tabLink = new CLink($header, '#' . $id, null, null, false);
             $tabLink->setAttribute('id', 'tab_' . $id);
             $headersList->addItem($tabLink);
         }
         $this->addItem($headersList);
         $this->addItem($this->tabs);
         $options = array();
         if (!is_null($this->selectedTab)) {
             $options['selected'] = $this->selectedTab;
         }
         if ($this->rememberTab) {
             $options['cookie'] = array();
         }
         zbx_add_post_js('jQuery("#' . $this->id . '").tabs(' . zbx_jsvalue($options, true) . ').show();');
     }
     return parent::toString($destroy);
 }
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:32,代码来源:class.ctabview.php

示例2: toString

    public function toString($destroy = true)
    {
        if (count($this->tabs) == 1) {
            $this->setAttribute('class', 'min-width ui-tabs ui-widget ui-widget-content ui-corner-all widget');
            $header = reset($this->headers);
            $header = new CDiv($header);
            $header->addClass('ui-corner-all ui-widget-header header');
            $header->setAttribute('id', 'tab_' . key($this->headers));
            $this->addItem($header);
            $tab = reset($this->tabs);
            $tab->addClass('ui-tabs ui-tabs-panel ui-widget ui-widget-content ui-corner-all widget');
            $this->addItem($tab);
        } else {
            $headersList = new CList();
            foreach ($this->headers as $id => $header) {
                $tabLink = new CLink($header, '#' . $id, null, null, false);
                $tabLink->setAttribute('id', 'tab_' . $id);
                $headersList->addItem($tabLink);
            }
            $this->addItem($headersList);
            $this->addItem($this->tabs);
            if ($this->selectedTab === null) {
                $activeTab = get_cookie('tab', 0);
                $createEvent = '';
            } else {
                $activeTab = $this->selectedTab;
                $createEvent = 'create: function() { jQuery.cookie("tab", ' . $this->selectedTab . '); },';
            }
            $disabledTabs = $this->disabledTabs === null ? '' : 'disabled: ' . CJs::encodeJson($this->disabledTabs) . ',';
            zbx_add_post_js('
				jQuery("#' . $this->id . '").tabs({
					' . $createEvent . '
					' . $disabledTabs . '
					active: ' . $activeTab . ',
					activate: function(event, ui) {
						jQuery.cookie("tab", ui.newTab.index().toString());
					}
				})
				.css("visibility", "visible");');
        }
        return parent::toString($destroy);
    }
开发者ID:TonywalkerCN,项目名称:Zabbix,代码行数:42,代码来源:CTabView.php

示例3: __construct

 /**
  * @param string $options['name']
  * @param int    $options['value']		(optional) Default: TRIGGER_SEVERITY_NOT_CLASSIFIED
  * @param bool   $options['all']		(optional)
  */
 public function __construct(array $options = [])
 {
     parent::__construct();
     $id = zbx_formatDomId($options['name']);
     $this->addClass(ZBX_STYLE_RADIO_SEGMENTED);
     $this->setId($id);
     if (!array_key_exists('value', $options)) {
         $options['value'] = TRIGGER_SEVERITY_NOT_CLASSIFIED;
     }
     $severity_from = array_key_exists('all', $options) && $options['all'] ? -1 : TRIGGER_SEVERITY_NOT_CLASSIFIED;
     $config = select_config();
     for ($severity = $severity_from; $severity < TRIGGER_SEVERITY_COUNT; $severity++) {
         $name = $severity == -1 ? _('all') : getSeverityName($severity, $config);
         $class = $severity == -1 ? null : getSeverityStyle($severity);
         $radio = (new CInput('radio', $options['name'], $severity))->setId(zbx_formatDomId($options['name'] . '_' . $severity));
         if ($severity === $options['value']) {
             $radio->setAttribute('checked', 'checked');
         }
         parent::addItem((new CListItem([$radio, new CLabel($name, $options['name'] . '_' . $severity)]))->addClass($class));
     }
 }
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:26,代码来源:CSeverity.php

示例4: toString

 public function toString($destroy = true)
 {
     if ($this->modern) {
         $this->addClass(ZBX_STYLE_RADIO_SEGMENTED);
     } else {
         $this->addClass($this->orientation == self::ORIENTATION_HORIZONTAL ? ZBX_STYLE_LIST_HOR_CHECK_RADIO : ZBX_STYLE_LIST_CHECK_RADIO);
     }
     foreach ($this->values as $key => $value) {
         if ($value['id'] === null) {
             $value['id'] = zbx_formatDomId($this->name) . '_' . $key;
         }
         $radio = (new CInput('radio', $this->name, $value['value']))->setEnabled($this->enabled)->onChange($value['on_change'])->setId($value['id']);
         if ($value['value'] === $this->value) {
             $radio->setAttribute('checked', 'checked');
         }
         if ($this->modern) {
             parent::addItem([$radio, new CLabel($value['name'], $value['id'])]);
         } else {
             parent::addItem(new CLabel([$radio, $value['name']], $value['id']));
         }
     }
     return parent::toString($destroy);
 }
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:23,代码来源:CRadioButtonList.php

示例5: getList

 function getList()
 {
     $list = new CList();
     foreach ($this->stage as $id => $data) {
         if ($id < $this->getStep()) {
             $style = 'completed';
         } else {
             if ($id == $this->getStep()) {
                 $style = 'current';
             } else {
                 $style = null;
             }
         }
         $list->addItem($data['title'], $style);
     }
     return $list;
 }
开发者ID:rennhak,项目名称:zabbix,代码行数:17,代码来源:setup.inc.php

示例6: createServiceMonitoringTree

/**
 * Creates nodes that can be used to display the SLA report tree using the CTree class.
 *
 * @see CTree
 *
 * @param array $services       an array of services to display in the tree
 * @param array $slaData        sla report data, see CService::getSla()
 * @param $period
 * @param array $parentService
 * @param array $service
 * @param array $dependency
 * @param array $tree
 */
function createServiceMonitoringTree(array $services, array $slaData, $period, &$tree, array $parentService = array(), array $service = array(), array $dependency = array())
{
    // if no parent service is given, start from the root
    if (!$service) {
        $serviceNode = array('id' => 0, 'parentid' => 0, 'caption' => _('root'), 'status' => SPACE, 'sla' => SPACE, 'sla2' => SPACE, 'trigger' => array(), 'reason' => SPACE, 'graph' => SPACE);
        $service = $serviceNode;
        $service['serviceid'] = 0;
        $service['dependencies'] = array();
        $service['trigger'] = array();
        // add all top level services as children of "root"
        foreach ($services as $topService) {
            if (!$topService['parent']) {
                $service['dependencies'][] = array('servicedownid' => $topService['serviceid'], 'soft' => 0, 'linkid' => 0);
            }
        }
        $tree = array($serviceNode);
    } else {
        $serviceSla = $slaData[$service['serviceid']];
        $slaValues = reset($serviceSla['sla']);
        // caption
        // remember the selected time period when following the bar link
        $periods = array('today' => 'daily', 'week' => 'weekly', 'month' => 'monthly', 'year' => 'yearly', 24 => 'daily', 24 * 7 => 'weekly', 24 * 30 => 'monthly', 24 * DAY_IN_YEAR => 'yearly');
        $caption = array(new CLink(array(get_node_name_by_elid($service['serviceid'], null, ': '), $service['name']), 'report3.php?serviceid=' . $service['serviceid'] . '&year=' . date('Y') . '&period=' . $periods[$period]));
        $trigger = $service['trigger'];
        if ($trigger) {
            $url = new CLink($trigger['description'], 'events.php?source=' . EVENT_SOURCE_TRIGGERS . '&triggerid=' . $trigger['triggerid']);
            $caption[] = ' - ';
            $caption[] = $url;
        }
        // reason
        $problemList = '-';
        if ($serviceSla['problems']) {
            $problemList = new CList(null, 'service-problems');
            foreach ($serviceSla['problems'] as $problemTrigger) {
                $problemList->addItem(new CLink($problemTrigger['description'], 'events.php?source=' . EVENT_SOURCE_TRIGGERS . '&triggerid=' . $problemTrigger['triggerid']));
            }
        }
        // sla
        $sla = '-';
        $sla2 = '-';
        if ($service['showsla'] && $slaValues['sla'] !== null) {
            $slaGood = $slaValues['sla'];
            $slaBad = 100 - $slaValues['sla'];
            $p = min($slaBad, 20);
            $width = 160;
            $widthRed = $width * $p / 20;
            $widthGreen = $width - $widthRed;
            $chart1 = null;
            if ($widthGreen > 0) {
                $chart1 = new CDiv(null, 'sla-bar-part sla-green');
                $chart1->setAttribute('style', 'width: ' . $widthGreen . 'px;');
            }
            $chart2 = null;
            if ($widthRed > 0) {
                $chart2 = new CDiv(null, 'sla-bar-part sla-red');
                $chart2->setAttribute('style', 'width: ' . $widthRed . 'px;');
            }
            $bar = new CLink(array($chart1, $chart2, new CDiv('80%', 'sla-bar-legend sla-bar-legend-start'), new CDiv('100%', 'sla-bar-legend sla-bar-legend-end')), 'srv_status.php?serviceid=' . $service['serviceid'] . '&showgraph=1' . url_param('path'));
            $bar = new CDiv($bar, 'sla-bar');
            $bar->setAttribute('title', _s('Only the last 20%% of the indicator is displayed.'));
            $slaBar = array($bar, new CSpan(sprintf('%.4f', $slaBad), 'sla-value ' . ($service['goodsla'] > $slaGood ? 'red' : 'green')));
            $sla = new CDiv($slaBar, 'invisible');
            $sla2 = array(new CSpan(sprintf('%.4f', $slaGood), 'sla-value ' . ($service['goodsla'] > $slaGood ? 'red' : 'green')), '/', new CSpan(sprintf('%.4f', $service['goodsla']), 'sla-value'));
        }
        $serviceNode = array('id' => $service['serviceid'], 'caption' => $caption, 'description' => $service['trigger'] ? $service['trigger']['description'] : _('None'), 'reason' => $problemList, 'sla' => $sla, 'sla2' => $sla2, 'parentid' => $parentService ? $parentService['serviceid'] : 0, 'status' => $serviceSla['status'] !== null ? $serviceSla['status'] : '-');
    }
    // hard dependencies and dependencies for the "root" node
    if (!$dependency || $dependency['soft'] == 0) {
        $tree[$serviceNode['id']] = $serviceNode;
        foreach ($service['dependencies'] as $dependency) {
            $childService = $services[$dependency['servicedownid']];
            createServiceMonitoringTree($services, $slaData, $period, $tree, $service, $childService, $dependency);
        }
    } else {
        $serviceNode['caption'] = new CSpan($serviceNode['caption'], 'service-caption-soft');
        $tree[$serviceNode['id'] . '.' . $dependency['linkid']] = $serviceNode;
    }
}
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:91,代码来源:services.inc.php

示例7: getFavouriteScreens

/**
 * Get favourite screens and slide shows.
 *
 * @return CList
 */
function getFavouriteScreens()
{
    $data = getFavouriteScreensData();
    $favourites = new CList(null, 'favorites', _('No screens added.'));
    if ($data['screens']) {
        foreach ($data['screens'] as $screen) {
            $favourites->addItem(new CLink($screen['label'], 'screens.php?elementid=' . $screen['id']), 'nowrap');
        }
    }
    if ($data['slideshows']) {
        foreach ($data['slideshows'] as $slideshow) {
            $favourites->addItem(new CLink($slideshow['label'], 'slides.php?elementid=' . $slideshow['id']), 'nowrap');
        }
    }
    return $favourites;
}
开发者ID:omidmt,项目名称:zabbix-greenplum,代码行数:21,代码来源:blocks.inc.php

示例8: CTable

 function stage3()
 {
     $table = new CTable(null, 'requirements');
     $table->setAlign('center');
     $DB['TYPE'] = $this->getConfig('DB_TYPE');
     $cmbType = new CComboBox('type', $DB['TYPE'], 'this.form.submit();');
     $frontendSetup = new FrontendSetup();
     $databases = $frontendSetup->getSupportedDatabases();
     foreach ($databases as $id => $name) {
         $cmbType->addItem($id, $name);
     }
     $table->addRow(array(new CCol(_('Database type'), 'header'), $cmbType));
     switch ($DB['TYPE']) {
         case ZBX_DB_SQLITE3:
             $database = new CTextBox('database', $this->getConfig('DB_DATABASE', 'zabbix'));
             $database->attr('onchange', "disableSetupStepButton('#next_2')");
             $table->addRow(array(new CCol(_('Database file'), 'header'), $database));
             break;
         default:
             $server = new CTextBox('server', $this->getConfig('DB_SERVER', 'localhost'));
             $server->attr('onchange', "disableSetupStepButton('#next_2')");
             $table->addRow(array(new CCol(_('Database host'), 'header'), $server));
             $port = new CNumericBox('port', $this->getConfig('DB_PORT', '0'), 5, 'no', false, false);
             $port->attr('style', '');
             $port->attr('onchange', "disableSetupStepButton('#next_2'); validateNumericBox(this, 'false', 'false');");
             $table->addRow(array(new CCol(_('Database port'), 'header'), array($port, ' 0 - use default port')));
             $database = new CTextBox('database', $this->getConfig('DB_DATABASE', 'zabbix'));
             $database->attr('onchange', "disableSetupStepButton('#next_2')");
             $table->addRow(array(new CCol(_('Database name'), 'header'), $database));
             if ($DB['TYPE'] == ZBX_DB_DB2) {
                 $schema = new CTextBox('schema', $this->getConfig('DB_SCHEMA', ''));
                 $schema->attr('onchange', "disableSetupStepButton('#next_2')");
                 $table->addRow(array(new CCol(_('Database schema'), 'header'), $schema));
             }
             $user = new CTextBox('user', $this->getConfig('DB_USER', 'root'));
             $user->attr('onchange', "disableSetupStepButton('#next_2')");
             $table->addRow(array(new CCol(_('User'), 'header'), $user));
             $password = new CPassBox('password', $this->getConfig('DB_PASSWORD', ''));
             $password->attr('onchange', "disableSetupStepButton('#next_2')");
             $table->addRow(array(new CCol(_('Password'), 'header'), $password));
             break;
     }
     global $ZBX_MESSAGES;
     if (!empty($ZBX_MESSAGES)) {
         $lst_error = new CList(null, 'messages');
         foreach ($ZBX_MESSAGES as $msg) {
             $lst_error->addItem($msg['message'], $msg['type']);
         }
         $table = array($table, $lst_error);
     }
     return array(new CDiv(new CDiv(array('Please create database manually, and set the configuration parameters for connection to this database.', BR(), BR(), 'Press "Test connection" button when done.', BR(), $table), 'vertical_center'), 'table_wraper'), new CDiv(array(isset($_REQUEST['retry']) ? !$this->DISABLE_NEXT_BUTTON ? new CSpan(array(_('OK'), BR()), 'ok') : new CSpan(array(_('Fail'), BR()), 'fail') : null, new CSubmit('retry', 'Test connection')), 'info_bar'));
 }
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:52,代码来源:setup.inc.php

示例9: show_messages

function show_messages($bool = true, $okmsg = null, $errmsg = null)
{
    global $page, $ZBX_MESSAGES;
    if (!defined('PAGE_HEADER_LOADED')) {
        return null;
    }
    if (defined('ZBX_API_REQUEST')) {
        return null;
    }
    if (!isset($page['type'])) {
        $page['type'] = PAGE_TYPE_HTML;
    }
    $message = array();
    $width = 0;
    $height = 0;
    if (!$bool && !is_null($errmsg)) {
        $msg = _('ERROR') . ': ' . $errmsg;
    } elseif ($bool && !is_null($okmsg)) {
        $msg = $okmsg;
    }
    if (isset($msg)) {
        switch ($page['type']) {
            case PAGE_TYPE_IMAGE:
                array_push($message, array('text' => $msg, 'color' => !$bool ? array('R' => 255, 'G' => 0, 'B' => 0) : array('R' => 34, 'G' => 51, 'B' => 68), 'font' => 2));
                $width = max($width, imagefontwidth(2) * zbx_strlen($msg) + 1);
                $height += imagefontheight(2) + 1;
                break;
            case PAGE_TYPE_XML:
                echo htmlspecialchars($msg) . "\n";
                break;
            case PAGE_TYPE_HTML:
            default:
                $msg_tab = new CTable($msg, $bool ? 'msgok' : 'msgerr');
                $msg_tab->setCellPadding(0);
                $msg_tab->setCellSpacing(0);
                $row = array();
                $msg_col = new CCol(bold($msg), 'msg_main msg');
                $msg_col->setAttribute('id', 'page_msg');
                $row[] = $msg_col;
                if (isset($ZBX_MESSAGES) && !empty($ZBX_MESSAGES)) {
                    $msg_details = new CDiv(_('Details'), 'blacklink');
                    $msg_details->setAttribute('onclick', 'javascript: showHide("msg_messages", IE ? "block" : "table");');
                    $msg_details->setAttribute('title', _('Maximize') . '/' . _('Minimize'));
                    array_unshift($row, new CCol($msg_details, 'clr'));
                }
                $msg_tab->addRow($row);
                $msg_tab->show();
                break;
        }
    }
    if (isset($ZBX_MESSAGES) && !empty($ZBX_MESSAGES)) {
        if ($page['type'] == PAGE_TYPE_IMAGE) {
            $msg_font = 2;
            foreach ($ZBX_MESSAGES as $msg) {
                if ($msg['type'] == 'error') {
                    array_push($message, array('text' => $msg['message'], 'color' => array('R' => 255, 'G' => 55, 'B' => 55), 'font' => $msg_font));
                } else {
                    array_push($message, array('text' => $msg['message'], 'color' => array('R' => 155, 'G' => 155, 'B' => 55), 'font' => $msg_font));
                }
                $width = max($width, imagefontwidth($msg_font) * zbx_strlen($msg['message']) + 1);
                $height += imagefontheight($msg_font) + 1;
            }
        } elseif ($page['type'] == PAGE_TYPE_XML) {
            foreach ($ZBX_MESSAGES as $msg) {
                echo '[' . $msg['type'] . '] ' . $msg['message'] . "\n";
            }
        } else {
            $lst_error = new CList(null, 'messages');
            foreach ($ZBX_MESSAGES as $msg) {
                $lst_error->addItem($msg['message'], $msg['type']);
                $bool = $bool && 'error' != zbx_strtolower($msg['type']);
            }
            $msg_show = 6;
            $msg_count = count($ZBX_MESSAGES);
            if ($msg_count > $msg_show) {
                $msg_count = $msg_show * 16;
                $lst_error->setAttribute('style', 'height: ' . $msg_count . 'px;');
            }
            $tab = new CTable(null, $bool ? 'msgok' : 'msgerr');
            $tab->setCellPadding(0);
            $tab->setCellSpacing(0);
            $tab->setAttribute('id', 'msg_messages');
            $tab->setAttribute('style', 'width: 100%;');
            if (isset($msg_tab) && $bool) {
                $tab->setAttribute('style', 'display: none;');
            }
            $tab->addRow(new CCol($lst_error, 'msg'));
            $tab->show();
        }
        $ZBX_MESSAGES = null;
    }
    if ($page['type'] == PAGE_TYPE_IMAGE && count($message) > 0) {
        $width += 2;
        $height += 2;
        $canvas = imagecreate($width, $height);
        imagefilledrectangle($canvas, 0, 0, $width, $height, imagecolorallocate($canvas, 255, 255, 255));
        foreach ($message as $id => $msg) {
            $message[$id]['y'] = 1 + (isset($previd) ? $message[$previd]['y'] + $message[$previd]['h'] : 0);
            $message[$id]['h'] = imagefontheight($msg['font']);
            imagestring($canvas, $msg['font'], 1, $message[$id]['y'], $msg['text'], imagecolorallocate($canvas, $msg['color']['R'], $msg['color']['G'], $msg['color']['B']));
//.........这里部分代码省略.........
开发者ID:itnihao,项目名称:Zabbix_,代码行数:101,代码来源:func.inc.php

示例10: isset

/*
 * Header
 */
$triggerData = isset($_REQUEST['triggerid']) ? API::Trigger()->get(['triggerids' => $_REQUEST['triggerid'], 'output' => API_OUTPUT_EXTEND, 'selectHosts' => API_OUTPUT_EXTEND, 'expandDescription' => true]) : null;
$reportWidget = (new CWidget())->setTitle(_('Availability report'));
if ($triggerData) {
    $triggerData = reset($triggerData);
    $host = reset($triggerData['hosts']);
    $triggerData['hostid'] = $host['hostid'];
    $triggerData['hostname'] = $host['name'];
    $reportWidget->setControls((new CList())->addItem(new CLink($triggerData['hostname'], '?filter_groupid=' . $_REQUEST['filter_groupid']))->addItem($triggerData['description']));
    $table = (new CTableInfo())->addRow(new CImg('chart4.php?triggerid=' . $_REQUEST['triggerid']));
    $reportWidget->addItem(BR())->addItem($table)->show();
} elseif (isset($_REQUEST['filter_hostid'])) {
    $controls = new CList();
    $controls->addItem([_('Mode') . SPACE, new CComboBox('mode', $availabilityReportMode, 'submit()', [AVAILABILITY_REPORT_BY_HOST => _('By host'), AVAILABILITY_REPORT_BY_TEMPLATE => _('By trigger template')])]);
    $headerForm = (new CForm('get'))->addItem($controls);
    $reportWidget->setControls($headerForm);
    $triggerOptions = ['output' => ['triggerid', 'description', 'expression', 'value'], 'expandDescription' => true, 'monitored' => true, 'selectHosts' => ['name'], 'filter' => [], 'hostids' => null, 'limit' => $config['search_limit'] + 1];
    /*
     * Filter
     */
    $filterForm = (new CFilter('web.avail_report.filter.state'))->addVar('config', $availabilityReportMode)->addVar('filter_timesince', date(TIMESTAMP_FORMAT, $_REQUEST['filter_timesince']))->addVar('filter_timetill', date(TIMESTAMP_FORMAT, $_REQUEST['filter_timetill']));
    $filterColumn1 = new CFormList();
    $filterColumn2 = new CFormList();
    // report by template
    if ($availabilityReportMode == AVAILABILITY_REPORT_BY_TEMPLATE) {
        // trigger options
        if (!empty($_REQUEST['filter_hostid'])) {
            $hosts = API::Host()->get(['output' => ['hostid'], 'templateids' => $_REQUEST['filter_hostid']]);
            $triggerOptions['hostids'] = zbx_objectValues($hosts, 'hostid');
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:31,代码来源:report2.php

示例11: getList

 function getList()
 {
     $list = new CList();
     foreach ($this->stage as $id => $data) {
         $list->addItem($data['title'], $id <= $this->getStep() ? ZBX_STYLE_SETUP_LEFT_CURRENT : null);
     }
     return $list;
 }
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:8,代码来源:CSetupWizard.php

示例12: CWidget

** 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
    $screenBuilder = new CScreenBuilder(['screen' => $this->data['screen'], 'mode' => SCREEN_MODE_PREVIEW, 'hostid' => $this->data['hostid'], 'period' => $this->data['period'], 'stime' => $this->data['stime'], 'profileIdx' => 'web.screens', 'profileIdx2' => $this->data['screen']['screenid']]);
    $screenWidget->addItem((new CDiv($screenBuilder->show()))->addClass(ZBX_STYLE_TABLE_FORMS_CONTAINER));
    CScreenBuilder::insertScreenStandardJs(['timeline' => $screenBuilder->timeline, 'profileIdx' => $screenBuilder->profileIdx]);
}
return $screenWidget;
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:31,代码来源:monitoring.hostscreen.php

示例13: CWidget

** 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())->setTitle(_('Screens'));
$controls = new CList();
if (!$data['templateid']) {
    $controls->addItem(new CComboBox('config', 'screens.php', 'redirect(this.options[this.selectedIndex].value);', ['screens.php' => _('Screens'), 'slides.php' => _('Slide shows')]));
}
$controls->addItem(new CSubmit('form', _('Create screen')));
$createForm = (new CForm('get'))->cleanItems();
if ($data['templateid']) {
    $createForm->addVar('templateid', $data['templateid']);
    $widget->addItem(get_header_host_table('screens', $data['templateid']));
} else {
    $controls->addItem((new CButton('form', _('Import')))->onClick('redirect("screen.import.php?rules_preset=screen")'));
}
$createForm->addItem($controls);
$widget->setControls($createForm);
// filter
if (!$data['templateid']) {
    $widget->addItem((new CFilter('web.screenconf.filter.state'))->addColumn((new CFormList())->addRow(_('Name like'), (new CTextBox('filter_name', $data['filter']['name']))->setWidth(ZBX_TEXTAREA_FILTER_STANDARD_WIDTH))));
}
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:31,代码来源:monitoring.screen.list.php

示例14: get_header_host_table

/**
 * Create CDiv with host/template information and references to it's elements
 *
 * @param string $currentElement
 * @param int $hostid
 * @param int $discoveryid
 *
 * @return object
 */
function get_header_host_table($currentElement, $hostid, $discoveryid = null)
{
    $elements = array('items' => 'items', 'triggers' => 'triggers', 'graphs' => 'graphs', 'applications' => 'applications', 'screens' => 'screens', 'discoveries' => 'discoveries');
    if (!empty($discoveryid)) {
        unset($elements['applications'], $elements['screens'], $elements['discoveries']);
    }
    $options = array('hostids' => $hostid, 'output' => API_OUTPUT_EXTEND, 'templated_hosts' => true);
    if (isset($elements['items'])) {
        $options['selectItems'] = API_OUTPUT_COUNT;
    }
    if (isset($elements['triggers'])) {
        $options['selectTriggers'] = API_OUTPUT_COUNT;
    }
    if (isset($elements['graphs'])) {
        $options['selectGraphs'] = API_OUTPUT_COUNT;
    }
    if (isset($elements['applications'])) {
        $options['selectApplications'] = API_OUTPUT_COUNT;
    }
    if (isset($elements['screens'])) {
        $options['selectScreens'] = API_OUTPUT_COUNT;
    }
    if (isset($elements['discoveries'])) {
        $options['selectDiscoveries'] = API_OUTPUT_COUNT;
    }
    // get hosts
    $dbHost = API::Host()->get($options);
    $dbHost = reset($dbHost);
    // get discoveries
    if (!empty($discoveryid)) {
        $options['itemids'] = $discoveryid;
        $options['output'] = array('name');
        unset($options['hostids'], $options['templated_hosts']);
        $dbDiscovery = API::DiscoveryRule()->get($options);
        $dbDiscovery = reset($dbDiscovery);
    }
    /*
     * Back
     */
    $list = new CList(null, 'objectlist');
    if ($dbHost['status'] == HOST_STATUS_TEMPLATE) {
        $list->addItem(array('&laquo; ', new CLink(_('Template list'), 'templates.php?templateid=' . $dbHost['hostid'] . url_param('groupid'))));
    } else {
        $list->addItem(array('&laquo; ', new CLink(_('Host list'), 'hosts.php?hostid=' . $dbHost['hostid'] . url_param('groupid'))));
    }
    /*
     * Name
     */
    $description = '';
    if ($dbHost['proxy_hostid']) {
        $proxy = get_host_by_hostid($dbHost['proxy_hostid']);
        $description .= $proxy['host'] . ': ';
    }
    $description .= $dbHost['name'];
    if ($dbHost['status'] == HOST_STATUS_TEMPLATE) {
        $list->addItem(array(bold(_('Template') . ': '), new CLink($description, 'templates.php?form=update&templateid=' . $dbHost['hostid'])));
    } else {
        switch ($dbHost['status']) {
            case HOST_STATUS_MONITORED:
                $status = new CSpan(_('Monitored'), 'off');
                break;
            case HOST_STATUS_NOT_MONITORED:
                $status = new CSpan(_('Not monitored'), 'on');
                break;
            default:
                $status = _('Unknown');
                break;
        }
        $list->addItem(array(bold(_('Host') . ': '), new CLink($description, 'hosts.php?form=update&hostid=' . $dbHost['hostid'])));
        $list->addItem($status);
        $list->addItem(getAvailabilityTable($dbHost));
    }
    if (!empty($dbDiscovery)) {
        $list->addItem(array('&laquo; ', new CLink(_('Discovery list'), 'host_discovery.php?hostid=' . $dbHost['hostid'] . url_param('groupid'))));
        $list->addItem(array(bold(_('Discovery') . ': '), new CLink($dbDiscovery['name'], 'host_discovery.php?form=update&itemid=' . $dbDiscovery['itemid'])));
    }
    /*
     * Rowcount
     */
    if (isset($elements['applications'])) {
        if ($currentElement == 'applications') {
            $list->addItem(_('Applications') . ' (' . $dbHost['applications'] . ')');
        } else {
            $list->addItem(array(new CLink(_('Applications'), 'applications.php?hostid=' . $dbHost['hostid']), ' (' . $dbHost['applications'] . ')'));
        }
    }
    if (isset($elements['items'])) {
        if (!empty($dbDiscovery)) {
            if ($currentElement == 'items') {
                $list->addItem(_('Item prototypes') . ' (' . $dbDiscovery['items'] . ')');
            } else {
//.........这里部分代码省略.........
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:101,代码来源:html.inc.php

示例15: show_messages

function show_messages($bool = TRUE, $okmsg = NULL, $errmsg = NULL)
{
    global $page, $ZBX_MESSAGES;
    if (!defined('PAGE_HEADER_LOADED')) {
        return;
    }
    if (defined('ZBX_API_REQUEST')) {
        return;
    }
    if (!isset($page['type'])) {
        $page['type'] = PAGE_TYPE_HTML;
    }
    $message = array();
    $width = 0;
    $height = 0;
    $img_space = null;
    if (!$bool && !is_null($errmsg)) {
        $msg = S_CONFIG_ERROR_HEAD . ': ' . $errmsg;
    } else {
        if ($bool && !is_null($okmsg)) {
            $msg = $okmsg;
        }
    }
    $api_errors = CZBXAPI::resetErrors();
    if (!empty($api_errors)) {
        error($api_errors);
    }
    if (isset($msg)) {
        switch ($page['type']) {
            case PAGE_TYPE_IMAGE:
                array_push($message, array('text' => $msg, 'color' => !$bool ? array('R' => 255, 'G' => 0, 'B' => 0) : array('R' => 34, 'G' => 51, 'B' => 68), 'font' => 2));
                $width = max($width, ImageFontWidth(2) * zbx_strlen($msg) + 1);
                $height += imagefontheight(2) + 1;
                break;
            case PAGE_TYPE_XML:
                echo htmlspecialchars($msg) . "\n";
                break;
                //				case PAGE_TYPE_JS: break;
            //				case PAGE_TYPE_JS: break;
            case PAGE_TYPE_HTML:
            default:
                $msg_tab = new CTable($msg, $bool ? 'msgok' : 'msgerr');
                $msg_tab->setCellPadding(0);
                $msg_tab->setCellSpacing(0);
                $row = array();
                $msg_col = new CCol(bold($msg), 'msg_main msg');
                $msg_col->setAttribute('id', 'page_msg');
                $row[] = $msg_col;
                if (isset($ZBX_MESSAGES) && !empty($ZBX_MESSAGES)) {
                    $msg_details = new CDiv(S_DETAILS, 'blacklink');
                    $msg_details->setAttribute('onclick', "javascript: ShowHide('msg_messages', IE?'block':'table');");
                    $msg_details->setAttribute('title', S_MAXIMIZE . '/' . S_MINIMIZE);
                    array_unshift($row, new CCol($msg_details, 'clr'));
                }
                $msg_tab->addRow($row);
                $msg_tab->show();
                $img_space = new CImg('images/general/tree/zero.gif', 'space', '100', '2');
                break;
        }
    }
    if (isset($ZBX_MESSAGES) && !empty($ZBX_MESSAGES)) {
        if ($page['type'] == PAGE_TYPE_IMAGE) {
            $msg_font = 2;
            foreach ($ZBX_MESSAGES as $msg) {
                if ($msg['type'] == 'error') {
                    array_push($message, array('text' => $msg['message'], 'color' => array('R' => 255, 'G' => 55, 'B' => 55), 'font' => $msg_font));
                } else {
                    array_push($message, array('text' => $msg['message'], 'color' => array('R' => 155, 'G' => 155, 'B' => 55), 'font' => $msg_font));
                }
                $width = max($width, imagefontwidth($msg_font) * zbx_strlen($msg['message']) + 1);
                $height += imagefontheight($msg_font) + 1;
            }
        } else {
            if ($page['type'] == PAGE_TYPE_XML) {
                foreach ($ZBX_MESSAGES as $msg) {
                    echo '[' . $msg['type'] . '] ' . $msg['message'] . "\n";
                }
            } else {
                $lst_error = new CList(null, 'messages');
                foreach ($ZBX_MESSAGES as $msg) {
                    $lst_error->addItem($msg['message'], $msg['type']);
                    $bool = $bool && 'error' != zbx_strtolower($msg['type']);
                }
                //message scroll if needed
                $msg_show = 6;
                $msg_count = count($ZBX_MESSAGES);
                if ($msg_count > $msg_show) {
                    $msg_count = $msg_show;
                    $msg_count = $msg_count * 16;
                    $lst_error->setAttribute('style', 'height: ' . $msg_count . 'px;');
                }
                $tab = new CTable(null, $bool ? 'msgok' : 'msgerr');
                $tab->setCellPadding(0);
                $tab->setCellSpacing(0);
                $tab->setAttribute('id', 'msg_messages');
                $tab->setAttribute('style', 'width: 100%;');
                if (isset($msg_tab) && $bool) {
                    $tab->setAttribute('style', 'display: none;');
                }
                $tab->addRow(new CCol($lst_error, 'msg'));
//.........这里部分代码省略.........
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:101,代码来源:config.inc.php


注:本文中的CList::addItem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。