本文整理汇总了PHP中CMS::items_for_select方法的典型用法代码示例。如果您正苦于以下问题:PHP CMS::items_for_select方法的具体用法?PHP CMS::items_for_select怎么用?PHP CMS::items_for_select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMS
的用法示例。
在下文中一共展示了CMS::items_for_select方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preprocess
protected function preprocess($template, $name, $data)
{
$t = parent::preprocess($template, $name, $data);
$items = isset($data['__items']) ? $data['__items'] : CMS::items_for_select($data['items']);
$empty_value = isset($data['empty_value']) ? $data['empty_value'] : null;
$outs = $this->process_items($items, $data);
$t->with(array('wrap' => $wrap = !isset($data['text-wrap']) ? 'none' : $data['text-wrap'], 'node_wrap_class' => "text-wrap_" . $wrap . "_node", 'caption_wrap_class' => "text-wrap_" . $wrap . "_caption", 'selectioner_wrap_class' => "text-wrap_" . $wrap . "_selectioner", 'container_style' => isset($data['container_style']) ? $data['container_style'] : null, 'level_up' => !isset($data['level_up']) ? 1 : $data['level_up'], 'empty_value' => $empty_value));
return $t->with('flat_items', $outs[1], 'items', $outs[0]);
}
示例2: get_items
protected function get_items($name, $data)
{
$items = array();
if (isset($data['__items'])) {
$items = $data['__items'];
} else {
$items = CMS::items_for_select($data['items']);
}
return $items;
}
示例3: render
public function render()
{
if (!$this->type->access($this->name, $this->data, 'container_render', $this->item, $this)) {
return '';
}
$value = '';
$values = $this->as_array();
$items = CMS::items_for_select($this->data['items']);
foreach ($values as $v) {
$value .= ($value ? ', ' : '') . $items[$v];
}
return $value;
}
示例4: items_for_select
public function items_for_select($s)
{
if (is_string($s) && ($m = Core_Regexps::match_with_results('/^:(.+)$/', $s))) {
$method = trim($m[1]);
if ($m = Core_Regexps::match_with_results('/^(.+)\\((.*)\\)$/', $method)) {
$method = trim($m[1]);
$parms = explode(',', trim($m[2]));
foreach ($parms as $k => $v) {
$v = trim($v);
$parms[$k] = $v;
}
return call_user_func_array(array($this, $method), $parms);
}
return $this->{$method}();
}
return CMS::items_for_select($s);
}
示例5: action
public function action($name, $data, $action, $item = false, $fields = array())
{
$args = func_get_args();
$res = Net_HTTP::Response();
$res->content_type('application/json');
$query = WS::env()->request['query'];
$ents = CMS::items_for_select(Core::invoke($data['search'], array($query)));
$values = array();
$empty = $this->get_empty($data);
if ($empty && empty($query)) {
$values[] = $empty;
}
foreach ($ents as $k => $e) {
$values[] = array('id' => (int) $k, 'title' => (string) $e);
}
$res->body(json_encode(array('data' => $values)));
return $res;
}
示例6: tie
public function tie($tags)
{
$id = (int) $this->item->id();
if ($id == 0) {
return;
}
if (!is_array($tags)) {
$tags = array($tags);
}
$items = isset($this->data['items']) ? CMS::items_for_select($this->data['items']) : false;
$table = $this->item->mapper->options['table'][0];
$table_rels = CMS_Fields_Types_Tags::table_rels($table, $this->name);
$table_tags = CMS_Fields_Types_Tags::table_tags($table, $this->name);
foreach ($tags as $tag_id) {
$tag_id = (int) $tag_id;
if ($tag_id > 0) {
if ($items && isset($items[$tag_id])) {
CMS_Fields_Types_Tags::check_tag_title($tag_id, $items[$tag_id], $table_tags);
}
CMS::orm()->connection->prepare("INSERT INTO {$table_rels} SET item_id=:item_id, tag_id=:tag_id")->bind(array('item_id' => $id, 'tag_id' => $tag_id))->execute();
}
}
}
示例7: assign_to_object
public function assign_to_object($object, Forms_Form $form, $name, $parms)
{
$values = array();
$items = CMS::items_for_select($parms['items']);
foreach ($items as $key => $data) {
$fname = $name . $key;
if ($form[$fname]) {
$values[] = $key;
}
}
$object->{$name} = implode(',', $values);
}
示例8: preprocess
protected function preprocess($template, $name, $data)
{
$t = parent::preprocess($template, $name, $data);
return $t->with('items', isset($data['__items']) ? $data['__items'] : CMS::items_for_select($data['items']));
}
示例9: items_for_select
protected function items_for_select($items)
{
return CMS::items_for_select($items);
}