本文整理汇总了PHP中CTag::addOption方法的典型用法代码示例。如果您正苦于以下问题:PHP CTag::addOption方法的具体用法?PHP CTag::addOption怎么用?PHP CTag::addOption使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTag
的用法示例。
在下文中一共展示了CTag::addOption方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: explode_exp
function explode_exp($expression, $html, $template = false)
{
// echo "EXPRESSION:",$expression,"<Br>";
$functionid = '';
if (0 == $html) {
$exp = '';
} else {
$exp = array();
}
$state = '';
for ($i = 0, $max = strlen($expression); $i < $max; $i++) {
if ($expression[$i] == '{') {
$functionid = '';
$state = 'FUNCTIONID';
continue;
}
if ($expression[$i] == '}') {
$state = '';
if ($functionid == "TRIGGER.VALUE") {
if (0 == $html) {
$exp .= '{' . $functionid . '}';
} else {
array_push($exp, '{' . $functionid . '}');
}
} else {
if (is_numeric($functionid) && ($function_data = DBfetch(DBselect('SELECT h.host,i.key_,f.function,f.parameter,i.itemid,i.value_type' . ' FROM items i,functions f,hosts h' . ' WHERE f.functionid=' . $functionid . ' AND i.itemid=f.itemid ' . ' AND h.hostid=i.hostid')))) {
if ($template) {
$function_data["host"] = '{HOSTNAME}';
}
if ($html == 0) {
$exp .= '{' . $function_data['host'] . ':' . $function_data['key_'] . '.' . $function_data['function'] . '(' . $function_data['parameter'] . ')}';
} else {
$link = new CLink($function_data['host'] . ':' . $function_data['key_'], 'history.php?action=' . ($function_data['value_type'] == ITEM_VALUE_TYPE_FLOAT || $function_data['value_type'] == ITEM_VALUE_TYPE_UINT64 ? 'showgraph' : 'showvalues') . '&itemid=' . $function_data['itemid']);
array_push($exp, array('{', $link, '.', bold($function_data['function'] . '('), $function_data['parameter'], bold(')'), '}'));
}
} else {
if (1 == $html) {
$font = new CTag('font', 'yes');
$font->addOption('color', '#AA0000');
$font->addItem('*ERROR*');
array_push($exp, $font);
} else {
$exp .= '*ERROR*';
}
}
}
continue;
}
if ($state == "FUNCTIONID") {
$functionid = $functionid . $expression[$i];
continue;
}
if (1 == $html) {
array_push($exp, $expression[$i]);
} else {
$exp .= $expression[$i];
}
}
# echo "EXP:",$exp,"<Br>";
return $exp;
}
示例2: makeSImgStr
private function makeSImgStr($id)
{
$tr = new CRow();
$td = new CCol();
$count = isset($this->tree[$id]['nodeimg']) ? strlen($this->tree[$id]['nodeimg']) : 0;
for ($i = 0; $i < $count; $i++) {
switch ($this->tree[$id]['nodeimg'][$i]) {
case 'O':
$td->addOption('style', 'width: 22px');
$img = new CImg('images/general/tree/zero.gif', 'o', '22', '14');
break;
case 'I':
$td->addOption('style', 'width:22px; background-image:url(images/general/tree/pointc.gif);');
$img = new CImg('images/general/tree/zero.gif', 'i', '22', '14');
break;
case 'L':
$td->addOption('valign', 'top');
// $td->addOption('style','width:22px; background-image:url(images/general/tree/pointc.gif);');
$div = new CTag('div', 'yes');
$div->addOption('style', 'height: 10px; width:22px; background-image:url(images/general/tree/pointc.gif);');
if ($this->tree[$id]['nodetype'] == 2) {
$img = new CImg('images/general/tree/plus.gif', 'y', '22', '14');
$img->addOption('onclick', 'javascript: tree.closeSNodeX(' . $id . ',this);');
$img->addOption('id', 'idi_' . $id);
$img->setClass('imgnode');
} else {
$img = new CImg('images/general/tree/pointl.gif', 'y', '22', '14');
}
$div->addItem($img);
$img = $div;
break;
case 'T':
$td->addOption('valign', 'top');
if ($this->tree[$id]['nodetype'] == 2) {
$td->addOption('style', 'width:22px; background-image:url(images/general/tree/pointc.gif);');
$img = new CImg('images/general/tree/plus.gif', 't', '22', '14');
$img->addOption('onclick', 'javascript: tree.closeSNodeX(' . $id . ',this);');
$img->addOption('id', 'idi_' . $id);
$img->setClass('imgnode');
} else {
$td->addOption('style', 'width:22px; background-image:url(images/general/tree/pointc.gif);');
$img = new CImg('images/general/tree/pointl.gif', 't', '22', '14');
}
break;
}
$td->addItem($img);
$tr->addItem($td);
$td = new CCol();
}
// echo $txt.' '.$this->tree[$id]['Name'].'<br />';
return $tr;
}
示例3: get_timeperiod_form
//.........这里部分代码省略.........
$tblPeriod->addItem(new Cvar('new_timeperiod[month]', bindec($bit_month)));
$tblPeriod->addItem(new Cvar('new_timeperiod[day]', $new_timeperiod['day']));
$tblPeriod->addItem(new Cvar('new_timeperiod[date]', $new_timeperiod['date']));
$tblPeriod->addItem(new Cvar('new_timeperiod[month_date_type]', $new_timeperiod['month_date_type']));
$tblPeriod->addRow(array(S_EVERY_DAY_S, new CNumericBox('new_timeperiod[every]', $new_timeperiod['every'], 3)));
} else {
if ($new_timeperiod['timeperiod_type'] == TIMEPERIOD_TYPE_WEEKLY) {
$tblPeriod->addItem(new Cvar('new_timeperiod[month]', bindec($bit_month)));
$tblPeriod->addItem(new Cvar('new_timeperiod[day]', $new_timeperiod['day']));
$tblPeriod->addItem(new Cvar('new_timeperiod[date]', $new_timeperiod['date']));
$tblPeriod->addItem(new Cvar('new_timeperiod[month_date_type]', $new_timeperiod['month_date_type']));
$tblPeriod->addRow(array(S_EVERY_WEEK_S, new CNumericBox('new_timeperiod[every]', $new_timeperiod['every'], 2)));
$tabDays = new CTable();
$tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_mo]', $dayofweek[0], null, 1), S_MONDAY));
$tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_tu]', $dayofweek[1], null, 1), S_TUESDAY));
$tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_we]', $dayofweek[2], null, 1), S_WEDNESDAY));
$tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_th]', $dayofweek[3], null, 1), S_THURSDAY));
$tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_fr]', $dayofweek[4], null, 1), S_FRIDAY));
$tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_sa]', $dayofweek[5], null, 1), S_SATURDAY));
$tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_su]', $dayofweek[6], null, 1), S_SUNDAY));
$tblPeriod->addRow(array(S_DAY_OF_WEEK, $tabDays));
} else {
if ($new_timeperiod['timeperiod_type'] == TIMEPERIOD_TYPE_MONTHLY) {
$tblPeriod->addItem(new Cvar('new_timeperiod[date]', $new_timeperiod['date']));
$tabMonths = new CTable();
$tabMonths->addRow(array(new CCheckBox('new_timeperiod[month_jan]', $month[0], null, 1), S_JANUARY, SPACE, SPACE, new CCheckBox('new_timeperiod[month_jul]', $month[6], null, 1), S_JULY));
$tabMonths->addRow(array(new CCheckBox('new_timeperiod[month_feb]', $month[1], null, 1), S_FEBRUARY, SPACE, SPACE, new CCheckBox('new_timeperiod[month_aug]', $month[7], null, 1), S_AUGUST));
$tabMonths->addRow(array(new CCheckBox('new_timeperiod[month_mar]', $month[2], null, 1), S_MARCH, SPACE, SPACE, new CCheckBox('new_timeperiod[month_sep]', $month[8], null, 1), S_SEPTEMBER));
$tabMonths->addRow(array(new CCheckBox('new_timeperiod[month_apr]', $month[3], null, 1), S_APRIL, SPACE, SPACE, new CCheckBox('new_timeperiod[month_oct]', $month[9], null, 1), S_OCTOBER));
$tabMonths->addRow(array(new CCheckBox('new_timeperiod[month_may]', $month[4], null, 1), S_MAY, SPACE, SPACE, new CCheckBox('new_timeperiod[month_nov]', $month[10], null, 1), S_NOVEMBER));
$tabMonths->addRow(array(new CCheckBox('new_timeperiod[month_jun]', $month[5], null, 1), S_JUNE, SPACE, SPACE, new CCheckBox('new_timeperiod[month_dec]', $month[11], null, 1), S_DECEMBER));
$tblPeriod->addRow(array(S_MONTH, $tabMonths));
$radioDaily = new CTag('input');
$radioDaily->addOption('type', 'radio');
$radioDaily->addOption('name', 'new_timeperiod[month_date_type]');
$radioDaily->addOption('value', '0');
$radioDaily->addOption('onclick', 'submit()');
$radioDaily2 = new CTag('input');
$radioDaily2->addOption('type', 'radio');
$radioDaily2->addOption('name', 'new_timeperiod[month_date_type]');
$radioDaily2->addOption('value', '1');
$radioDaily2->addOption('onclick', 'submit()');
if ($new_timeperiod['month_date_type']) {
$radioDaily2->addOption('checked', 'checked');
} else {
$radioDaily->addOption('checked', 'checked');
}
$tblPeriod->addRow(array(S_DATE, array($radioDaily, S_DAY, SPACE, SPACE, $radioDaily2, S_DAY_OF_WEEK)));
if ($new_timeperiod['month_date_type'] > 0) {
$tblPeriod->addItem(new Cvar('new_timeperiod[day]', $new_timeperiod['day']));
$cmbCount = new CComboBox('new_timeperiod[every]', $new_timeperiod['every']);
$cmbCount->addItem(1, S_FIRST);
$cmbCount->addItem(2, S_SECOND);
$cmbCount->addItem(3, S_THIRD);
$cmbCount->addItem(4, S_FOURTH);
$cmbCount->addItem(5, S_LAST);
$td = new CCol($cmbCount);
$td->setColSpan(2);
$tabDays = new CTable();
$tabDays->addRow($td);
$tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_mo]', $dayofweek[0], null, 1), S_MONDAY));
$tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_tu]', $dayofweek[1], null, 1), S_TUESDAY));
$tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_we]', $dayofweek[2], null, 1), S_WEDNESDAY));
$tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_th]', $dayofweek[3], null, 1), S_THURSDAY));
$tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_fr]', $dayofweek[4], null, 1), S_FRIDAY));
$tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_sa]', $dayofweek[5], null, 1), S_SATURDAY));
示例4: CCol
//--
$table->addRow(array($show_event_col ? SPACE : NULL, new CCol(get_severity_description($row['priority']), get_severity_style($row['priority'], $row['value'])), $value, new CLink(zbx_date2str(S_DATE_FORMAT_YMDHMS, $row['lastchange']), 'events.php?triggerid=' . $row['triggerid'] . '&nav_time=' . $row['lastchange'], 'action'), get_node_name_by_elid($row['triggerid']), $host, $tr_desc, $actions, $show_event_col ? SPACE : NULL, new CLink(zbx_empty($row['comments']) ? S_ADD : S_SHOW, 'tr_comments.php?triggerid=' . $row['triggerid'], 'action')));
$event_limit = 0;
foreach ($row['events'] as $eventid => $row_event) {
$value = new CSpan(trigger_value2str($row_event['value']), get_trigger_value_style($row_event['value']));
if ($config['event_ack_enable']) {
if ($row_event['acknowledged'] == 1) {
$acks_cnt = DBfetch(DBselect('SELECT COUNT(*) as cnt FROM acknowledges WHERE eventid=' . $row_event['eventid']));
$ack = array(new CSpan(S_YES, 'off'), SPACE . '(' . $acks_cnt['cnt'] . SPACE, new CLink(S_SHOW, 'acknow.php?eventid=' . $row_event['eventid'], 'action'), ')');
} else {
$ack = new CLink(S_NOT_ACKNOWLEDGED, 'acknow.php?eventid=' . $row_event['eventid'], 'on');
}
}
$description = expand_trigger_description_by_data(array_merge($row, array('clock' => $row_event['clock'])), ZBX_FLAG_EVENT);
$font = new CTag('font', 'yes');
$font->addOption('color', '#808080');
$font->addItem(array(' - ', $description));
$description = $font;
$description = new CCol($description);
$description->addOption('style', 'white-space: normal; width: 90%;');
$table->addRow(array($config['event_ack_enable'] ? $row_event['acknowledged'] == 1 ? SPACE : new CCheckBox('events[' . $row_event['eventid'] . ']', 'no', NULL, $row_event['eventid']) : NULL, new CCol(get_severity_description($row['priority']), get_severity_style($row['priority'], $row_event['value'])), $value, new CLink(zbx_date2str(S_DATE_FORMAT_YMDHMS, $row_event['clock']), 'tr_events.php?triggerid=' . $row['triggerid'] . '&eventid=' . $row_event['eventid'], 'action'), get_node_name_by_elid($row['triggerid']), $host, $description, $actions, $config['event_ack_enable'] ? new CCol($ack, 'center') : NULL, new CLink($row['comments'] == '' ? S_ADD : S_SHOW, 'tr_comments.php?triggerid=' . $row['triggerid'], 'action')));
$event_limit++;
if ($event_limit >= $config['event_show_max']) {
break;
}
}
unset($row, $description, $actions);
}
$table->setFooter(new CCol(array($config['event_ack_enable'] ? new CButton('bulkacknowledge', S_BULK_ACKNOWLEDGE, 'javascript: submit();') : SPACE)));
$m_form->addItem($table);
unset($table);