本文整理汇总了PHP中CRow::setId方法的典型用法代码示例。如果您正苦于以下问题:PHP CRow::setId方法的具体用法?PHP CRow::setId怎么用?PHP CRow::setId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRow
的用法示例。
在下文中一共展示了CRow::setId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepareRow
public function prepareRow($item, $class = null, $id = null)
{
if ($item === null) {
return null;
}
if (is_object($item) && strtolower(get_class($item)) === 'ccol') {
if (isset($this->header) && !isset($item->attributes['colspan'])) {
$item->attributes['colspan'] = $this->colnum;
}
}
if (!is_object($item) || strtolower(get_class($item)) !== 'crow') {
$item = new CRow($item);
if ($id !== null) {
$item->setId($id);
}
}
if ($class !== null) {
$item->addClass($class);
}
return $item;
}
示例2: CForm
// append host summary to widget header
$triggersWidget->addItem(get_header_host_table('trigger_prototypes', $data['hostid'], $data['parent_discoveryid']));
$triggersForm = (new CForm())->setName('triggersForm')->addVar('action', $data['action'])->addVar('parent_discoveryid', $data['parent_discoveryid']);
foreach ($data['g_triggerid'] as $triggerid) {
$triggersForm->addVar('g_triggerid[' . $triggerid . ']', $triggerid);
}
$triggersFormList = (new CFormList('triggersFormList'))->addRow([_('Severity'), SPACE, (new CVisibilityBox('visible[priority]', 'priority_div', _('Original')))->setChecked(isset($data['visible']['priority']))], (new CDiv(new CSeverity(['name' => 'priority', 'value' => $data['priority']])))->setId('priority_div'));
// append dependencies to form list
$dependenciesTable = (new CTable())->setAttribute('style', 'width: 100%;')->setHeader([_('Name'), _('Action')]);
foreach ($data['dependencies'] as $dependency) {
$triggersForm->addVar('dependencies[]', $dependency['triggerid'], 'dependencies_' . $dependency['triggerid']);
$depTriggerDescription = CHtml::encode(implode(', ', zbx_objectValues($dependency['hosts'], 'name')) . NAME_DELIMITER . $dependency['description']);
if ($dependency['flags'] == ZBX_FLAG_DISCOVERY_PROTOTYPE) {
$description = (new CLink($depTriggerDescription, 'trigger_prototypes.php?form=update' . url_param('parent_discoveryid') . '&triggerid=' . $dependency['triggerid']))->setAttribute('target', '_blank');
} elseif ($dependency['flags'] == ZBX_FLAG_DISCOVERY_NORMAL) {
$description = (new CLink($depTriggerDescription, 'triggers.php?form=update&triggerid=' . $dependency['triggerid']))->setAttribute('target', '_blank');
}
$row = new CRow([$description, (new CCol((new CButton('remove', _('Remove')))->onClick('javascript: removeDependency(\'' . $dependency['triggerid'] . '\');')->addClass(ZBX_STYLE_BTN_LINK)))->addClass(ZBX_STYLE_NOWRAP)]);
$row->setId('dependency_' . $dependency['triggerid']);
$dependenciesTable->addRow($row);
}
$dependenciesDiv = (new CDiv([$dependenciesTable, new CHorList([(new CButton('add_dep_trigger', _('Add')))->onClick('return PopUp("popup.php?dstfrm=massupdate&dstact=add_dependency&reference=deptrigger' . '&dstfld1=new_dependency&srctbl=triggers&objname=triggers&srcfld1=triggerid&multiselect=1' . '&with_triggers=1&normal_only=1&noempty=1");')->addClass(ZBX_STYLE_BTN_LINK), (new CButton('add_dep_trigger_prototype', _('Add prototype')))->onClick('return PopUp("popup.php?dstfrm=massupdate&dstact=add_dependency&reference=deptrigger' . '&dstfld1=new_dependency&srctbl=trigger_prototypes&objname=triggers&srcfld1=triggerid' . url_param('parent_discoveryid') . '&multiselect=1");')->addClass(ZBX_STYLE_BTN_LINK)])]))->addClass(ZBX_STYLE_TABLE_FORMS_SEPARATOR)->setAttribute('style', 'min-width: ' . ZBX_TEXTAREA_BIG_WIDTH . 'px;')->setId('dependencies_div');
$triggersFormList->addRow([_('Replace dependencies'), SPACE, (new CVisibilityBox('visible[dependencies]', 'dependencies_div', _('Original')))->setChecked(isset($data['visible']['dependencies']))], $dependenciesDiv);
$triggersTab = new CTabView();
$triggersTab->addTab('triggersTab', _('Mass update'), $triggersFormList);
// append buttons to form
$triggersTab->setFooter(makeFormFooter(new CSubmit('massupdate', _('Update')), [new CButtonCancel(url_param('parent_discoveryid'))]));
// append tabs to form
$triggersForm->addItem($triggersTab);
$triggersWidget->addItem($triggersForm);
return $triggersWidget;
示例3: foreach
foreach ($expressions as $id => $expr) {
$imgup = (new CImg('images/general/arrow_up.png', 'up', 12, 14))->onClick('javascript: element_up("logtr' . $id . '");')->onMouseover('javascript: this.style.cursor = "pointer";')->addClass('updown');
$imgdn = (new CImg('images/general/arrow_down.png', 'down', 12, 14))->onClick('javascript: element_down("logtr' . $id . '");')->onMouseover('javascript: this.style.cursor = "pointer";')->addClass('updown');
$row = new CRow([htmlspecialchars($expr['value']), $expr['type'] == CTextTriggerConstructor::EXPRESSION_TYPE_MATCH ? _('Include') : _('Exclude'), [$imgup, ' ', $imgdn], (new CCol((new CButton(null, _('Remove')))->addClass(ZBX_STYLE_BTN_LINK)->onClick('javascript: remove_expression("logtr' . $id . '");')))->addClass(ZBX_STYLE_NOWRAP)]);
$row->setId('logtr' . $id);
$table->addRow($row);
$form->addVar('expressions[' . $id . '][value]', $expr['value']);
$form->addVar('expressions[' . $id . '][type]', $expr['type']);
$maxId = max($maxId, $id);
}
zbx_add_post_js('logexpr_count=' . ($maxId + 1) . ';');
zbx_add_post_js('processExpressionList();');
$maxId = 0;
foreach ($keys as $id => $val) {
$row = new CRow([htmlspecialchars($val['value']), $val['type'], (new CCol((new CButton(null, _('Remove')))->addClass(ZBX_STYLE_BTN_LINK)->onClick('javascript: remove_keyword("keytr' . $id . '");')))->addClass(ZBX_STYLE_NOWRAP)]);
$row->setId('keytr' . $id);
$keyTable->addRow($row);
$form->addVar('keys[' . $id . '][value]', $val['value']);
$form->addVar('keys[' . $id . '][type]', $val['type']);
$maxId = max($maxId, $id);
}
zbx_add_post_js('key_count=' . ($maxId + 1) . ';');
$form_list->addRow(null, (new CDiv($keyTable))->addClass(ZBX_STYLE_TABLE_FORMS_SEPARATOR)->setAttribute('style', 'min-width: ' . ZBX_TEXTAREA_BIG_WIDTH . 'px;'));
$form_list->addRow(null, (new CDiv($table))->addClass(ZBX_STYLE_TABLE_FORMS_SEPARATOR)->setAttribute('style', 'min-width: ' . ZBX_TEXTAREA_BIG_WIDTH . 'px;'));
$sev_select = new CComboBox('priority', $priority);
$config = select_config();
$severityNames = [];
for ($severity = TRIGGER_SEVERITY_NOT_CLASSIFIED; $severity < TRIGGER_SEVERITY_COUNT; $severity++) {
$severityNames[] = getSeverityName($severity, $config);
}
$sev_select->addItems($severityNames);
示例4: dowHrMinToStr
$from = dowHrMinToStr($serviceTime['ts_from']);
$to = dowHrMinToStr($serviceTime['ts_to'], true);
break;
case SERVICE_TIME_TYPE_DOWNTIME:
$type = (new CSpan(_('Downtime')))->addClass('disabled');
$from = dowHrMinToStr($serviceTime['ts_from']);
$to = dowHrMinToStr($serviceTime['ts_to'], true);
break;
case SERVICE_TIME_TYPE_ONETIME_DOWNTIME:
$type = (new CSpan(_('One-time downtime')))->addClass('disabled');
$from = zbx_date2str(DATE_TIME_FORMAT, $serviceTime['ts_from']);
$to = zbx_date2str(DATE_TIME_FORMAT, $serviceTime['ts_to']);
break;
}
$row = new CRow([[$type, new CVar('times[' . $i . '][type]', $serviceTime['type']), new CVar('times[' . $i . '][ts_from]', $serviceTime['ts_from']), new CVar('times[' . $i . '][ts_to]', $serviceTime['ts_to']), new CVar('times[' . $i . '][note]', $serviceTime['note'])], $from . ' - ' . $to, htmlspecialchars($serviceTime['note']), (new CCol((new CButton('remove', _('Remove')))->onClick('javascript: removeTime(\'' . $i . '\');')->addClass(ZBX_STYLE_BTN_LINK)))->addClass(ZBX_STYLE_NOWRAP)]);
$row->setId('times_' . $i);
$servicesTimeTable->addRow($row);
$i++;
}
$servicesTimeFormList->addRow(_('Service times'), (new CDiv($servicesTimeTable))->addClass(ZBX_STYLE_TABLE_FORMS_SEPARATOR)->setAttribute('style', 'min-width: ' . ZBX_TEXTAREA_BIG_WIDTH . 'px;'));
// create service time table
$serviceTimeTable = (new CTable())->addRow([_('Period type'), new CComboBox('new_service_time[type]', $this->data['new_service_time']['type'], 'submit()', [SERVICE_TIME_TYPE_UPTIME => _('Uptime'), SERVICE_TIME_TYPE_DOWNTIME => _('Downtime'), SERVICE_TIME_TYPE_ONETIME_DOWNTIME => _('One-time downtime')])]);
if ($this->data['new_service_time']['type'] == SERVICE_TIME_TYPE_ONETIME_DOWNTIME) {
// downtime since
if (isset($_REQUEST['new_service_time']['from'])) {
$fromYear = getRequest('new_service_time_from_year');
$fromMonth = getRequest('new_service_time_from_month');
$fromDay = getRequest('new_service_time_from_day');
$fromHours = getRequest('new_service_time_from_hour');
$fromMinutes = getRequest('new_service_time_from_minute');
$fromDate = ['y' => $fromYear, 'm' => $fromMonth, 'd' => $fromDay, 'h' => $fromHours, 'i' => $fromMinutes];