本文整理汇总了PHP中CTable::setHeader方法的典型用法代码示例。如果您正苦于以下问题:PHP CTable::setHeader方法的具体用法?PHP CTable::setHeader怎么用?PHP CTable::setHeader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTable
的用法示例。
在下文中一共展示了CTable::setHeader方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: BodyToString
function BodyToString($destroy = true)
{
$table = new CTable(null, 'setup_wizard');
$table->setAlign('center');
$table->setHeader(array(new CCol(S_ZABBIX_VER, 'left'), SPACE), 'header');
$table->addRow(array(SPACE, new CCol($this->stage[$this->getStep()]['title'], 'right')), 'title');
$table->addRow(array(new CCol($this->getList(), 'left'), new CCol($this->getState(), 'right')), 'center');
$next = new CButton('next[' . $this->getStep() . ']', S_NEXT . ' >>');
if ($this->DISABLE_NEXT_BUTTON) {
$next->setEnabled(false);
}
$table->setFooter(array(new CCol(new CButton('cancel', S_CANCEL), 'left'), new CCol(array(isset($this->stage[$this->getStep() - 1]) ? new CButton('back[' . $this->getStep() . ']', '<< ' . S_PREVIOUS) : null, isset($this->stage[$this->getStep() + 1]) ? $next : new CButton('finish', S_FINISH)), 'right')), 'footer');
return parent::BodyToString($destroy) . $table->ToString();
}
示例2: import_map_form
function import_map_form($rules)
{
global $USER_DETAILS;
$form = new CFormTable(S_IMPORT, null, 'post', 'multipart/form-data');
$form->addRow(S_IMPORT_FILE, new CFile('import_file'));
$table = new CTable();
$table->setHeader(array(S_ELEMENT, S_UPDATE . SPACE . S_EXISTING, S_ADD . SPACE . S_MISSING), 'bold');
$titles = array('maps' => S_MAP);
if ($USER_DETAILS['type'] == USER_TYPE_SUPER_ADMIN) {
$titles += array('icons' => S_ICON, 'background' => S_BACKGROUND);
}
foreach ($titles as $key => $title) {
$cbExist = new CCheckBox('rules[' . $key . '][exist]', isset($rules[$key]['exist']));
if ($key != 'maps') {
$cbExist->setAttribute('onclick', 'javascript: if(this.checked) return confirm(\'Images for all maps will be updated\')');
}
$cbMissed = new CCheckBox('rules[' . $key . '][missed]', isset($rules[$key]['missed']));
$table->addRow(array($title, $cbExist, $cbMissed));
}
$form->addRow(S_RULES, $table);
$form->addItemToBottomRow(new CButton('import', S_IMPORT));
return $form;
}
示例3: CFormTable
}
//------------------------ </ACTIONS> --------------------------
//------------------------ <FORM> ---------------------------
$frm_test = new CFormTable(_('Test'), 'tr_testexpr.php');
$frm_test->setHelp('web.testexpr.service.php');
$frm_test->setTableClass('formlongtable formtable');
$frm_test->addVar('form_refresh', get_request('form_refresh', 1));
$frm_test->addVar('expression', $expression);
/* test data */
$frm_test->addRow(_('Test data'), $data_table);
/* result */
$res_table = new CTable(null, 'tableinfo');
$res_table->setAttribute('id', 'result_list');
$res_table->setOddRowClass('even_row');
$res_table->setEvenRowClass('even_row');
$res_table->setHeader(array(_('Expression'), _('Result')));
ksort($rplcts, SORT_NUMERIC);
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 = '-';
示例4: getPermissionsFormList
function getPermissionsFormList($rights = array(), $user_type = USER_TYPE_ZABBIX_USER, $rightsFormList = null)
{
// group
$lists['group']['label'] = _('Host groups');
$lists['group']['read_write'] = new CListBox('groups_write', null, 15);
$lists['group']['read_only'] = new CListBox('groups_read', null, 15);
$lists['group']['deny'] = new CListBox('groups_deny', null, 15);
$groups = get_accessible_groups_by_rights($rights, $user_type, PERM_DENY);
foreach ($groups as $group) {
switch ($group['permission']) {
case PERM_READ:
$list_name = 'read_only';
break;
case PERM_READ_WRITE:
$list_name = 'read_write';
break;
default:
$list_name = 'deny';
}
$lists['group'][$list_name]->addItem($group['groupid'], $group['name']);
}
unset($groups);
// host
$lists['host']['label'] = _('Hosts');
$lists['host']['read_write'] = new CListBox('hosts_write', null, 15);
$lists['host']['read_only'] = new CListBox('hosts_read', null, 15);
$lists['host']['deny'] = new CListBox('hosts_deny', null, 15);
$hosts = get_accessible_hosts_by_rights($rights, $user_type, PERM_DENY);
foreach ($hosts as $host) {
switch ($host['permission']) {
case PERM_READ:
$list_name = 'read_only';
break;
case PERM_READ_WRITE:
$list_name = 'read_write';
break;
default:
$list_name = 'deny';
}
if (HOST_STATUS_PROXY_ACTIVE == $host['status'] || HOST_STATUS_PROXY_PASSIVE == $host['status']) {
$host['host_name'] = $host['host'];
}
$lists['host'][$list_name]->addItem($host['hostid'], $host['host_name']);
}
unset($hosts);
// display
if (empty($rightsFormList)) {
$rightsFormList = new CFormList('rightsFormList');
}
$isHeaderDisplayed = false;
foreach ($lists as $list) {
$sLabel = '';
$row = new CRow();
foreach ($list as $class => $item) {
if (is_string($item)) {
$sLabel = $item;
} else {
$row->addItem(new CCol($item, $class));
}
}
$table = new CTable(_('No accessible resources'), 'right_table calculated');
if (!$isHeaderDisplayed) {
$table->setHeader(array(_('Read-write'), _('Read only'), _('Deny')), 'header');
$isHeaderDisplayed = true;
}
$table->addRow($row);
$rightsFormList->addRow($sLabel, $table);
}
return $rightsFormList;
}
示例5: CCheckBox
} else {
$multiplierCheckBox = new CCheckBox('multiplier', $this->data['multiplier'] == 1 ? 'yes' : 'no', 'var editbx = document.getElementById(\'formula\'); if (editbx) { editbx.disabled = !this.checked; }', 1);
$multiplier[] = $multiplierCheckBox;
$multiplier[] = SPACE;
$formulaTextBox = new CTextBox('formula', $this->data['formula'], ZBX_TEXTBOX_SMALL_SIZE);
$formulaTextBox->setAttribute('style', 'text-align: right;');
$multiplier[] = $formulaTextBox;
}
$itemFormList->addRow(_('Use custom multiplier'), $multiplier, false, 'row_multiplier');
}
$itemFormList->addRow(_('Update interval (in sec)'), new CNumericBox('delay', $this->data['delay'], 5), false, 'row_delay');
// append delay flex to form list
$delayFlexTable = new CTable(_('No flexible intervals defined.'), 'formElementTable');
$delayFlexTable->setAttribute('style', 'min-width: 310px;');
$delayFlexTable->setAttribute('id', 'delayFlexTable');
$delayFlexTable->setHeader(array(_('Interval'), _('Period'), _('Action')));
$i = 0;
$this->data['maxReached'] = false;
foreach ($this->data['delay_flex'] as $delayFlex) {
if (!isset($delayFlex['delay']) && !isset($delayFlex['period'])) {
continue;
}
$itemForm->addVar('delay_flex[' . $i . '][delay]', $delayFlex['delay']);
$itemForm->addVar('delay_flex[' . $i . '][period]', $delayFlex['period']);
$row = new CRow(array($delayFlex['delay'], $delayFlex['period'], new CButton('remove', _('Remove'), 'javascript: removeDelayFlex(' . $i . ');', 'link_menu')));
$row->setAttribute('id', 'delayFlex_' . $i);
$delayFlexTable->addRow($row);
// limit count of intervals, 7 intervals by 30 symbols = 210 characters, db storage field is 256
$i++;
if ($i == 7) {
$this->data['maxReached'] = true;
示例6: bodyToString
public function bodyToString()
{
$res = parent::bodyToString();
$tbl = new CTable(null, $this->tableclass);
$tbl->setCellSpacing(0);
$tbl->setCellPadding(1);
$tbl->setAlign($this->align);
// add first row
if (!is_null($this->title)) {
$col = new CCol(null, 'form_row_first');
$col->setColSpan(2);
if (isset($this->help)) {
$col->addItem($this->help);
}
if (isset($this->title)) {
$col->addItem($this->title);
}
$tbl->setHeader($col);
}
// add last row
$tbl->setFooter($this->bottom_items);
// add center rows
foreach ($this->center_items as $item) {
$tbl->addRow($item);
}
return $res . $tbl->toString();
}
示例7: CTable
** This program is free software; you can redistribute it and/or modify
** 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.
**/
$rulesTable = new CTable(null, 'formElementTable');
$rulesTable->setHeader(array(SPACE, _('Update existing'), _('Add missing')), 'bold');
$titles = array('groups' => _('Groups'), 'hosts' => _('Hosts'), 'templates' => _('Templates'), 'templateScreens' => _('Template screens'), 'templateLinkage' => _('Template linkage'), 'items' => _('Items'), 'discoveryRules' => _('Discovery rules'), 'triggers' => _('Triggers'), 'graphs' => _('Graphs'), 'screens' => _('Screens'), 'maps' => _('Maps'), 'images' => _('Images'));
$rules = $this->get('rules');
foreach ($titles as $key => $title) {
$cbExist = $cbMissed = SPACE;
if (isset($rules[$key]['updateExisting'])) {
$cbExist = new CCheckBox('rules[' . $key . '][updateExisting]', $rules[$key]['updateExisting'], null, 1);
if ($key == 'images') {
if (CWebUser::$data['type'] != USER_TYPE_SUPER_ADMIN) {
continue;
}
$cbExist->setAttribute('onclick', 'if (this.checked) return confirm(\'' . _('Images for all maps will be updated!') . '\')');
}
}
if (isset($rules[$key]['createMissing'])) {
$cbMissed = new CCheckBox('rules[' . $key . '][createMissing]', $rules[$key]['createMissing'], null, 1);
示例8: define
define('ZBX_PAGE_NO_MENU', 1);
}
$refresh_rate = 30;
//seconds
$fields = array('warning_msg' => array(T_ZBX_STR, O_OPT, NULL, NULL, NULL), 'message' => array(T_ZBX_STR, O_OPT, NULL, NULL, NULL), 'retry' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, NULL, NULL), 'cancel' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, NULL, NULL));
check_fields($fields, false);
if (isset($_REQUEST['cancel'])) {
zbx_unsetcookie('ZBX_CONFIG');
redirect('index.php');
}
// clear_messages();
$USER_DETAILS['refresh'] = $refresh_rate;
include_once 'include/page_header.php';
unset($USER_DETAILS);
$table = new CTable(null, 'warning');
$table->setAlign('center');
$table->setAttribute('style', 'width: 480px; margin-top: 100px;');
$table->setHeader(array(new CCol(S_ZABBIX . SPACE . ZABBIX_VERSION, 'left')), 'header');
$table->addRow(SPACE);
$warning_msg = isset($_REQUEST['warning_msg']) ? $_REQUEST['warning_msg'] : S_ZABBIX_IS_UNAVAILABLE . '!';
$img = new CImg('./images/general/warning16r.gif', 'warning', 16, 16, 'img');
$img->setAttribute('style', 'border-width: 0px; vertical-align: bottom;');
$msg = new CSpan(bold(SPACE . $warning_msg));
$msg->setAttribute('style', 'line-height: 20px; vertical-align: top;');
$table->addRow(new CCol(array($img, $msg), 'center'));
$table->addRow(SPACE);
$table->setFooter(new CCol(new CButton('retry', S_RETRY, 'javascript: document.location.reload();'), 'left'), 'footer');
$table->show();
zbx_add_post_js('setTimeout("document.location.reload();",' . $refresh_rate * 1000 . ');');
echo SBR;
include_once 'include/page_footer.php';
示例9: DBstart
if ($config == 1) {
if (isset($_FILES['import_file'])) {
include_once 'include/import.inc.php';
DBstart();
$importer = new CZabbixXMLImport();
$importer->setRules($rules['host'], $rules['template'], $rules['item'], $rules['trigger'], $rules['graph']);
$result = $importer->Parse($_FILES['import_file']['tmp_name']);
unset($importer);
$result = DBend($result);
show_messages($result, S_IMPORTED . SPACE . S_SUCCESSEFULLY_SMALL, S_IMPORT . SPACE . S_FAILED_SMALL);
}
$form = new CFormTable($frm_title, null, 'post', 'multipart/form-data');
$form->addVar('config', $config);
$form->addRow(S_IMPORT_FILE, new CFile('import_file'));
$table = new CTable();
$table->setHeader(array(S_ELEMENT, S_EXISTING, S_MISSING), 'bold');
foreach (array('host' => S_HOST, 'template' => S_TEMPLATE, 'item' => S_ITEM, 'trigger' => S_TRIGGER, 'graph' => S_GRAPH) as $key => $title) {
$cmbExist = new CComboBox('rules[' . $key . '][exist]', $rules[$key]['exist']);
$cmbExist->addItem(0, S_UPDATE);
$cmbExist->addItem(1, S_SKIP);
$cmbMissed = new CComboBox('rules[' . $key . '][missed]', $rules[$key]['missed']);
if ($key != 'template') {
$cmbMissed->addItem(0, S_ADD);
}
$cmbMissed->addItem(1, S_SKIP);
$table->addRow(array($title, $cmbExist, $cmbMissed));
}
$form->addRow(S_RULES, $table);
$form->addItemToBottomRow(new CButton('import', S_IMPORT));
$form->Show();
} else {
示例10: insert_map_link_form
function insert_map_link_form()
{
$frmCnct = new CFormTable('New connector', 'sysmap.php');
$frmCnct->setHelp('web.sysmap.connector.php');
$frmCnct->addVar('sysmapid', $_REQUEST['sysmapid']);
if (isset($_REQUEST['linkid']) && !isset($_REQUEST['form_refresh'])) {
$frmCnct->addVar('linkid', $_REQUEST['linkid']);
$db_links = DBselect('SELECT * FROM sysmaps_links WHERE linkid=' . $_REQUEST['linkid']);
$db_link = DBfetch($db_links);
$selementid1 = $db_link['selementid1'];
$selementid2 = $db_link['selementid2'];
$triggers = array();
$drawtype = $db_link['drawtype'];
$color = $db_link['color'];
$res = DBselect('SELECT * FROM sysmaps_link_triggers WHERE linkid=' . $_REQUEST['linkid']);
while ($rows = DBfetch($res)) {
$triggers[] = $rows;
}
} else {
if (isset($_REQUEST['linkid'])) {
$frmCnct->addVar('linkid', $_REQUEST['linkid']);
}
$selementid1 = get_request('selementid1', 0);
$selementid2 = get_request('selementid2', 0);
$triggers = get_request('triggers', array());
$drawtype = get_request('drawtype', 0);
$color = get_request('color', 0);
}
/* START comboboxes preparations */
$cmbElements1 = new CComboBox('selementid1', $selementid1);
$cmbElements2 = new CComboBox('selementid2', $selementid2);
$map_elements = array();
$sql = 'SELECT selementid,label,elementid,elementtype ' . ' FROM sysmaps_elements ' . ' WHERE sysmapid=' . $_REQUEST['sysmapid'];
$db_elements = DBselect($sql);
while ($db_element = DBfetch($db_elements)) {
$map_elements[$db_element['selementid']] = $db_element;
}
order_result($map_elements, 'label');
foreach ($map_elements as $selementid => $db_selement) {
$label = $db_selement['label'];
if ($db_selement['elementtype'] == SYSMAP_ELEMENT_TYPE_HOST) {
$db_host = get_host_by_hostid($db_selement['elementid']);
$label .= ':' . $db_host['host'];
} else {
if ($db_selement['elementtype'] == SYSMAP_ELEMENT_TYPE_MAP) {
$db_map = get_sysmap_by_sysmapid($db_selement['elementid']);
$label .= ':' . $db_map['name'];
} else {
if ($db_selement['elementtype'] == SYSMAP_ELEMENT_TYPE_TRIGGER) {
if ($db_selement['elementid'] > 0) {
$label .= ':' . expand_trigger_description($db_selement['elementid']);
}
} else {
if ($db_selement['elementtype'] == SYSMAP_ELEMENT_TYPE_HOST_GROUP) {
if ($db_selement['elementid'] > 0) {
$db_group = DBfetch(DBselect('SELECT name FROM groups WHERE groupid=' . $db_selement['elementid']));
$label .= ':' . $db_group['name'];
}
}
}
}
}
$cmbElements1->addItem($db_selement['selementid'], $label);
$cmbElements2->addItem($db_selement['selementid'], $label);
}
$cmbType = new CComboBox('drawtype', $drawtype);
foreach (map_link_drawtypes() as $i) {
$value = map_link_drawtype2str($i);
$cmbType->addItem($i, $value);
}
/* END preparation */
$frmCnct->addRow(S_ELEMENT_1, $cmbElements1);
$frmCnct->addRow(S_ELEMENT_2, $cmbElements2);
//trigger links
foreach ($triggers as $id => $trigger) {
if (isset($trigger['triggerid'])) {
$triggers[$id]['description'] = expand_trigger_description($trigger['triggerid']);
}
}
$table = new CTable();
$table->SetClass('tableinfo');
$table->setOddRowClass('even_row');
$table->setEvenRowClass('even_row');
$table->attributes['cellpadding'] = 3;
$table->attributes['cellspacing'] = 1;
$table->headerClass = 'header';
$table->footerClass = 'footer';
$table->setHeader(array(new CCheckBox('all_triggers', null, "checkAll('" . $frmCnct->getName() . "','all_triggers','triggers');"), S_TRIGGERS, S_TYPE, S_COLOR));
$table->setAttribute('id', 'link_triggers');
foreach ($triggers as $id => $trigger) {
if (!isset($trigger['triggerid'])) {
continue;
}
$colorbox = new CSpan(SPACE . SPACE . SPACE);
$colorbox->setAttribute('style', 'text-decoration: none; outline-color: black; outline-style: solid; outline-width: 1px; background-color: #' . $trigger['color'] . ';');
$link_desc = new CSpan($trigger['description'], 'link');
$link_desc->setAttribute('onclick', "javascript: openWinCentered('popup_link_tr.php?form=1&dstfrm=" . $frmCnct->GetName() . "&triggerid=" . $trigger['triggerid'] . url_param('linkid') . "','ZBX_Link_Indicator',560,260,'scrollbars=1, toolbar=0, menubar=0, resizable=0');");
$table->addRow(array(array(new CCheckBox('triggers[' . $trigger['triggerid'] . '][triggerid]', null, null, $trigger['triggerid']), new CVar('triggers[' . $trigger['triggerid'] . '][triggerid]', $trigger['triggerid'])), array($link_desc, new CVar('triggers[' . $trigger['triggerid'] . '][description]', $trigger['description'])), array(map_link_drawtype2str($trigger['drawtype']), new CVar('triggers[' . $trigger['triggerid'] . '][drawtype]', $trigger['drawtype'])), array($colorbox, new CVar('triggers[' . $trigger['triggerid'] . '][color]', $trigger['color']))));
}
$btnadd = new CButton('btn1', S_ADD, "javascript: openWinCentered('popup_link_tr.php?form=1&dstfrm=" . $frmCnct->GetName() . url_param('linkid') . "','ZBX_Link_Indicator',560,180,'scrollbars=1, toolbar=0, menubar=0, resizable=0');", 'T');
//.........这里部分代码省略.........
示例11: CButton
$frmService->AddVar('parentid', $parentid);
$cb = new CButton('select_parent', S_CHANGE);
$cb->SetType('button');
$cb->SetAction("javascript: openWinCentered('services_form.php?pservices=1" . url_param('serviceid') . "','ZBX_Services_List',740,420,'scrollbars=1, toolbar=0, menubar=0, resizable=1, dialog=0');");
$frmService->AddRow('Parent Service', array($ctb, $cb));
//----------
//child links
$table = new CTable();
$table->setClass('tableinfo');
$table->setOddRowClass('even_row');
$table->setEvenRowClass('even_row');
$table->attributes['cellpadding'] = 3;
$table->attributes['cellspacing'] = 1;
$table->headerClass = 'header';
$table->footerClass = 'footer';
$table->setHeader(array(new CCheckBox('all_child_services', null, "check_childs('" . $frmService->GetName() . "','childs','all_child_services');"), S_SERVICES, S_SOFT, S_TRIGGER));
$table->setAttribute('id', 'service_childs');
foreach ($childs as $id => $child) {
$prefix = null;
$trigger = '-';
$description = new CLink($child['name'], 'services_form.php?sform=1&serviceid=' . $child['serviceid'], 'action');
if (isset($child['triggerid']) && !empty($child['triggerid'])) {
$trigger = expand_trigger_description($child['triggerid']);
}
$table->AddRow(array(array(new CCheckBox('childs_to_del[' . $child['serviceid'] . '][serviceid]', null, null, $child['serviceid']), new CVar('childs[' . $child['serviceid'] . '][serviceid]', $child['serviceid'])), array($description, new CVar('childs[' . $child['serviceid'] . '][name]', $child['name'])), new CCheckBox('childs[' . $child['serviceid'] . '][soft]', isset($child['soft']) && !empty($child['soft']) ? 'checked' : 'no', null, isset($child['soft']) && !empty($child['soft']) ? 1 : 0), array($trigger, new CVar('childs[' . $child['serviceid'] . '][triggerid]', isset($child['triggerid']) ? $child['triggerid'] : ''))));
}
$cb = new CButton('add_child_service', S_ADD);
$cb->SetType('button');
$cb->SetAction("javascript: openWinCentered('services_form.php?cservices=1" . url_param('serviceid') . "','ZBX_Services_List',640,520,'scrollbars=1, toolbar=0, menubar=0, resizable=0');");
$cb2 = new CButton('del_child_service', S_REMOVE);
$cb2->SetType('button');
示例12: CFormTable
//------------------------ </ACTIONS> --------------------------
//------------------------ <FORM> ---------------------------
$frm_test = new CFormTable(S_TEST, 'tr_testexpr.php');
$frm_test->setHelp('web.testexpr.service.php');
$frm_test->setTableClass('formlongtable formtable');
$frm_test->addVar('form_refresh', get_request('form_refresh', 1));
$frm_test->addVar('expression', urlencode($expression));
/* test data */
$frm_test->addRow(S_TEST_DATA, $data_table);
/* result */
$res_table = new CTable();
$res_table->setClass('tableinfo');
$res_table->setAttribute('id', 'result_list');
$res_table->setOddRowClass('even_row');
$res_table->setEvenRowClass('even_row');
$res_table->setHeader(array(S_EXPRESSION, S_RESULT));
ksort($rplcts, SORT_NUMERIC);
//$exprs = make_disp_tree($tree, $map);
foreach ($eHTMLTree as $e) {
//if(!isset($e['expression']))
//continue;
$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);
示例13: getPermissionsFormList
function getPermissionsFormList($rights = array(), $user_type = USER_TYPE_ZABBIX_USER, $rightsFormList = null)
{
// nodes
if (ZBX_DISTRIBUTED) {
$lists['node']['label'] = _('Nodes');
$lists['node']['read_write'] = new CListBox('nodes_write', null, 10);
$lists['node']['read_only'] = new CListBox('nodes_read', null, 10);
$lists['node']['deny'] = new CListBox('nodes_deny', null, 10);
$lists['node']['read_write']->setAttribute('style', 'background: #EBEFF2;');
$lists['node']['read_only']->setAttribute('style', 'background: #EBEFF2;');
$lists['node']['deny']->setAttribute('style', 'background: #EBEFF2;');
$nodes = get_accessible_nodes_by_rights($rights, $user_type, PERM_DENY, PERM_RES_DATA_ARRAY);
foreach ($nodes as $node) {
switch ($node['permission']) {
case PERM_READ_ONLY:
$list_name = 'read_only';
break;
case PERM_READ_WRITE:
$list_name = 'read_write';
break;
default:
$list_name = 'deny';
}
$lists['node'][$list_name]->addItem($node['nodeid'], $node['name']);
}
unset($nodes);
}
// group
$lists['group']['label'] = _('Host groups');
$lists['group']['read_write'] = new CListBox('groups_write', null, 15);
$lists['group']['read_only'] = new CListBox('groups_read', null, 15);
$lists['group']['deny'] = new CListBox('groups_deny', null, 15);
$lists['group']['read_write']->setAttribute('style', 'background: #EBEFF2;');
$lists['group']['read_only']->setAttribute('style', 'background: #EBEFF2;');
$lists['group']['deny']->setAttribute('style', 'background: #EBEFF2;');
$groups = get_accessible_groups_by_rights($rights, $user_type, PERM_DENY, PERM_RES_DATA_ARRAY, get_current_nodeid(true));
foreach ($groups as $group) {
switch ($group['permission']) {
case PERM_READ_ONLY:
$list_name = 'read_only';
break;
case PERM_READ_WRITE:
$list_name = 'read_write';
break;
default:
$list_name = 'deny';
}
$lists['group'][$list_name]->addItem($group['groupid'], (empty($group['node_name']) ? '' : $group['node_name'] . ':') . $group['name']);
}
unset($groups);
// host
$lists['host']['label'] = _('Hosts');
$lists['host']['read_write'] = new CListBox('hosts_write', null, 15);
$lists['host']['read_only'] = new CListBox('hosts_read', null, 15);
$lists['host']['deny'] = new CListBox('hosts_deny', null, 15);
$lists['host']['read_write']->setAttribute('style', 'background: #EBEFF2;');
$lists['host']['read_only']->setAttribute('style', 'background: #EBEFF2;');
$lists['host']['deny']->setAttribute('style', 'background: #EBEFF2;');
$hosts = get_accessible_hosts_by_rights($rights, $user_type, PERM_DENY, PERM_RES_DATA_ARRAY, get_current_nodeid(true));
foreach ($hosts as $host) {
switch ($host['permission']) {
case PERM_READ_ONLY:
$list_name = 'read_only';
break;
case PERM_READ_WRITE:
$list_name = 'read_write';
break;
default:
$list_name = 'deny';
}
if (HOST_STATUS_PROXY_ACTIVE == $host['status'] || HOST_STATUS_PROXY_PASSIVE == $host['status']) {
$host['host_name'] = $host['host'];
}
$lists['host'][$list_name]->addItem($host['hostid'], (empty($host['node_name']) ? '' : $host['node_name'] . ':') . $host['host_name']);
}
unset($hosts);
// display
if (empty($rightsFormList)) {
$rightsFormList = new CFormList('rightsFormList');
}
$isHeaderDisplayed = false;
foreach ($lists as $list) {
$sLabel = '';
$row = new CRow();
foreach ($list as $class => $item) {
if (is_string($item)) {
$sLabel = $item;
} else {
$row->addItem(new CCol($item, $class));
}
}
$table = new CTable(_('No accessible resources'), 'right_table');
if (!$isHeaderDisplayed) {
$table->setHeader(array(_('Read-write'), _('Read only'), _('Deny')), 'header');
$isHeaderDisplayed = true;
}
$table->addRow($row);
$rightsFormList->addRow($sLabel, $table);
}
return $rightsFormList;
//.........这里部分代码省略.........
示例14: dirname
** 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.
**/
include dirname(__FILE__) . '/js/conf.import.js.php';
$rulesTable = new CTable(null, 'formElementTable');
$rulesTable->setHeader(array(SPACE, _('Update existing'), _('Create new'), _('Delete missing')), 'bold');
$titles = array('groups' => _('Groups'), 'hosts' => _('Hosts'), 'templates' => _('Templates'), 'templateScreens' => _('Template screens'), 'templateLinkage' => _('Template linkage'), 'applications' => _('Applications'), 'items' => _('Items'), 'discoveryRules' => _('Discovery rules'), 'triggers' => _('Triggers'), 'graphs' => _('Graphs'), 'screens' => _('Screens'), 'maps' => _('Maps'), 'images' => _('Images'));
$rules = $this->get('rules');
foreach ($titles as $key => $title) {
$cbExist = null;
$cbMissed = null;
$cbDeleted = null;
if (isset($rules[$key]['updateExisting'])) {
$cbExist = new CCheckBox('rules[' . $key . '][updateExisting]', $rules[$key]['updateExisting'], null, 1);
if ($key == 'images') {
if (CWebUser::$data['type'] != USER_TYPE_SUPER_ADMIN) {
continue;
}
$cbExist->setAttribute('onclick', 'if (this.checked) return confirm(\'' . _('Images for all maps will be updated!') . '\')');
}
}
示例15: bodyToString
public function bodyToString()
{
parent::bodyToString();
$tbl = new CTable(NULL, $this->tableclass);
$tbl->setOddRowClass('form_odd_row');
$tbl->setEvenRowClass('form_even_row');
$tbl->setCellSpacing(0);
$tbl->setCellPadding(1);
$tbl->setAlign($this->align);
// add first row
$col = new CCol(NULL, 'form_row_first');
$col->setColSpan(2);
if (isset($this->help)) {
$col->addItem($this->help);
}
if (isset($this->title)) {
$col->addItem($this->title);
}
foreach ($this->top_items as $item) {
$col->addItem($item);
}
$tbl->setHeader($col);
// add last row
$tbl->setFooter($this->bottom_items);
// add center rows
foreach ($this->center_items as $item) {
$tbl->addRow($item);
}
return $tbl->toString();
}