本文整理汇总了PHP中CTag::addItem方法的典型用法代码示例。如果您正苦于以下问题:PHP CTag::addItem方法的具体用法?PHP CTag::addItem怎么用?PHP CTag::addItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTag
的用法示例。
在下文中一共展示了CTag::addItem方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addItem
public function addItem($value)
{
if (is_object($value) && zbx_strtolower(get_class($value)) != 'carea') {
return $this->error('Incorrect value for addItem "' . $value . '".');
}
return parent::addItem($value);
}
示例2: addItem
public function addItem($value, $caption = '', $selected = null, $enabled = true, $class = null)
{
if ($value instanceof CComboItem || $value instanceof COptGroup) {
parent::addItem($value);
} else {
if (is_null($selected)) {
$selected = 'no';
if (is_array($this->value)) {
if (str_in_array($value, $this->value)) {
$selected = 'yes';
}
} elseif (strcmp($value, $this->value) == 0) {
$selected = 'yes';
}
} else {
$selected = 'yes';
}
$citem = new CComboItem($value, $caption, $selected, $enabled);
if ($class !== null) {
$citem->addClass($class);
}
parent::addItem($citem);
}
return $this;
}
示例3: addItem
public function addItem($value)
{
if (strtolower(get_class($value)) != 'carea') {
return $this->error('Incorrect value for addItem [' . $value . ']');
}
return parent::addItem($value);
}
示例4: addItem
public function addItem($value, $class = null, $id = null)
{
if (!is_null($value) && $this->emptyList) {
$this->emptyList = false;
$this->items = array();
}
parent::addItem($this->prepareItem($value, $class, $id));
}
示例5: addItemsInGroup
public function addItemsInGroup($label, $items)
{
$group = new COptGroup($label);
foreach ($items as $value => $caption) {
$selected = (int) ($value == $this->value);
$group->addItem(new CComboItem($value, $caption, $selected));
}
parent::addItem($group);
}
示例6: addItem
public function addItem($value, $class = null)
{
if (is_array($value)) {
foreach ($value as $el) {
parent::addItem($this->prepareItem($el, $class));
}
} else {
parent::addItem($this->prepareItem($value, $class));
}
}
示例7: addItem
public function addItem($value, $class = null, $id = null)
{
if (!is_null($value) && $this->emptyList) {
$this->emptyList = false;
$this->items = [];
}
if ($value instanceof CListItem) {
parent::addItem($value);
} else {
parent::addItem($this->prepareItem($value, $class, $id));
}
return $this;
}
示例8: addItem
public function addItem($item)
{
if (is_object($item) && strtolower(get_class($item)) === 'ccol') {
parent::addItem($item);
} elseif (is_array($item)) {
foreach ($item as $el) {
if (is_object($el) && strtolower(get_class($el)) === 'ccol') {
parent::addItem($el);
} elseif (!is_null($el)) {
parent::addItem(new CCol($el));
}
}
} elseif (!is_null($item)) {
parent::addItem(new CCol($item));
}
}
示例9: italic
function italic($str)
{
if (is_array($str)) {
foreach ($str as $key => $val) {
if (is_string($val)) {
$em = new CTag('em', true);
$em->addItem($val);
$str[$key] = $em;
}
}
} elseif (is_string($str)) {
$em = new CTag('em', true, '');
$em->addItem($str);
$str = $em;
}
return $str;
}
示例10: __construct
public function __construct($tagname = NULL, $paired = 'no', $body = NULL, $class = null)
{
parent::__construct();
$this->options = array();
if (!is_string($tagname)) {
return $this->error('Incorrect tagname for CTag [' . $tagname . ']');
}
$this->tagname = $tagname;
$this->paired = $paired;
$this->tag_start = $this->tag_end = $this->tag_body_start = $this->tag_body_end = '';
if (is_null($body)) {
$this->tag_end = $this->tag_body_start = "\n";
} else {
CTag::addItem($body);
}
$this->setClass($class);
}
示例11: bold
function bold($str)
{
if (is_array($str)) {
foreach ($str as $key => $val) {
if (is_string($val)) {
$b = new CTag('strong', 'yes');
$b->addItem($val);
$str[$key] = $b;
}
}
} else {
$b = new CTag('strong', 'yes', '');
$b->addItem($str);
$str = $b;
}
return $str;
}
示例12: addItem
public function addItem($value, $caption = '', $selected = NULL, $enabled = 'yes')
{
// if($enabled=='no') return; /* disable item method 1 */
if (strtolower(get_class($value)) == 'ccomboitem') {
parent::addItem($value);
} else {
if (is_null($selected)) {
$selected = 'no';
if (is_array($this->value)) {
if (str_in_array($value, $this->value)) {
$selected = 'yes';
}
} else {
if (strcmp($value, $this->value) == 0) {
$selected = 'yes';
}
}
}
parent::addItem(new CComboItem($value, $caption, $selected, $enabled));
}
}
示例13: 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;
}
示例14: reset
$profileIdx = 'web.item.graph';
$profileIdx2 = reset($this->data['itemids']);
$updateProfile = $this->data['action'] != HISTORY_BATCH_GRAPH;
}
// create history screen
$screen = CScreenBuilder::getScreen(array('resourcetype' => SCREEN_RESOURCE_HISTORY, 'action' => $this->data['action'], 'items' => $this->data['items'], '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']) {
$plaintextSpan = new CSpan(null, 'textblackwhite');
foreach ($headerPlaintext as $text) {
$plaintextSpan->addItem(array(new CJsScript($text), BR()));
}
$screen = $screen->get();
$pre = new CTag('pre', true);
foreach ($screen as $text) {
$pre->addItem(new CJsScript($text));
}
$plaintextSpan->addItem($pre);
$historyWidget->addItem($plaintextSpan);
} else {
$right = new CTable();
$right->addRow($header['right']);
$historyWidget->addPageHeader($header['left'], $right);
$historyWidget->addItem(BR());
if (isset($this->data['iv_string'][$this->data['value_type']])) {
$historyWidget->addFlicker($filterForm, CProfile::get('web.history.filter.state', 1));
}
$historyTable = new CTable(null, 'maxwidth');
$historyTable->addRow($screen->get());
$historyWidget->addItem($historyTable);
if (in_array($this->data['action'], array(HISTORY_VALUES, HISTORY_GRAPH, HISTORY_BATCH_GRAPH))) {
示例15: addItem
public function addItem($value, $caption = '', $selected = null, $enabled = 'yes')
{
if ($value instanceof CComboItem || $value instanceof COptGroup) {
parent::addItem($value);
} else {
$title = false;
// if caption is too long ( > 44 symbols), we add new class - 'selectShorten',
// so that the select box would not stretch
if (zbx_strlen($caption) > 44 && !$this->hasClass('selectShorten')) {
$this->setAttribute('class', $this->getAttribute('class') . ' selectShorten');
$title = true;
}
if (is_null($selected)) {
$selected = 'no';
if (is_array($this->value)) {
if (str_in_array($value, $this->value)) {
$selected = 'yes';
}
} elseif (strcmp($value, $this->value) == 0) {
$selected = 'yes';
}
} else {
$selected = 'yes';
}
$citem = new CComboItem($value, $caption, $selected, $enabled);
if ($title) {
$citem->setTitle($caption);
}
parent::addItem($citem);
}
}