本文整理汇总了PHP中HC_Html_Factory::element方法的典型用法代码示例。如果您正苦于以下问题:PHP HC_Html_Factory::element方法的具体用法?PHP HC_Html_Factory::element怎么用?PHP HC_Html_Factory::element使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HC_Html_Factory
的用法示例。
在下文中一共展示了HC_Html_Factory::element方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
function render()
{
$folded = array();
$items = $this->items();
foreach ($items as $item) {
list($item, $folding_key) = $item;
if (!isset($folded[$folding_key])) {
$folded[$folding_key] = array();
}
$folded[$folding_key][] = $item;
}
$out = HC_Html_Factory::element('ul')->add_attr('class', 'list-unstyled')->add_attr('class', 'collapse-panel');
$attr = $this->attr();
foreach ($attr as $k => $v) {
$out->add_attr($k, $v);
}
reset($folded);
foreach ($folded as $fk => $items) {
$collapser = HC_Html_Factory::element('a')->add_attr('href', '#')->add_attr('class', 'hc-collapse-next')->add_attr('class', 'display-block')->add_child('HAHA');
$out->add_child(HC_Html_Factory::element('li')->add_child($collapser));
$subout = HC_Html_Factory::widget('list');
foreach ($items as $item) {
$subout->add_item($item);
}
$out->add_child(HC_Html_Factory::element('li')->add_attr('class', 'collapse')->add_child($subout));
}
return $out->render();
}
示例2: title
function title($model, $vlevel = HC_PRESENTER::VIEW_HTML)
{
$return = array();
$label = $this->label($model, $vlevel);
if (strlen($label)) {
$return[] = $label;
}
switch ($vlevel) {
case HC_PRESENTER::VIEW_TEXT:
$return[] = ': ';
break;
}
switch ($vlevel) {
case HC_PRESENTER::VIEW_HTML_ICON:
break;
default:
if ($model->exists()) {
$return[] = $model->name;
} else {
$return[] = HCM::__('Unknown');
}
break;
}
$return = join('', $return);
switch ($vlevel) {
case HC_PRESENTER::VIEW_HTML:
$color = $model->present_color();
$color = HC_Lib::adjust_color_brightness($color, -30);
$return = HC_Html_Factory::element('span')->add_attr('class', 'label')->add_attr('class', 'label-success')->add_attr('class', 'label-lg')->add_child($return)->add_attr('style', 'background-color: ' . $color . ';');
break;
}
return $return;
}
示例3: render
function render()
{
/* tabs */
$id = $this->id();
if (!$id) {
$id = 'nts' . hc_random();
}
$tabs = HC_Html_Factory::widget('list')->add_attr('class', array('nav'))->add_attr('class', array('nav-tabs'))->add_attr('class', array('hc-tab-links'))->add_attr('id', $id);
$my_tabs = $this->tabs();
reset($my_tabs);
foreach ($my_tabs as $key => $tab_array) {
list($tab_label, $tab_content) = $tab_array;
$tabs->add_item($key, HC_Html_Factory::widget('titled', 'a')->add_attr('href', '#' . $key)->add_attr('class', 'tab-toggler')->add_attr('data-toggle-tab', $key)->add_child($tab_label));
}
$active = $this->active();
$tabs->add_item_attr($active, 'class', 'active');
/* content */
$content = HC_Html_Factory::element('div')->add_attr('class', 'hc-tab-content')->add_attr('style', 'overflow: visible;');
reset($my_tabs);
foreach ($my_tabs as $key => $tab_array) {
list($tab_label, $tab_content) = $tab_array;
$tab = HC_Html_Factory::element('div')->add_attr('class', 'hc-tab-pane')->add_attr('id', $key)->add_attr('data-tab-id', $key);
if ($active == $key) {
$tab->add_attr('class', 'active');
}
$tab->add_child($tab_content);
$content->add_child($tab);
}
/* javascript */
/* out */
$out = HC_Html_Factory::widget('list')->add_attr('class', array('list-unstyled'))->add_attr('class', array('hc-tabs'));
$out->add_item($tabs);
$out->add_item($content);
return $out->render();
}
示例4: render
function render()
{
$error = $this->error();
$label = $this->label();
$content = $this->content();
$div = HC_Html_Factory::element('div')->add_attr('class', 'form-group');
if ($error) {
$div->add_attr('class', 'has-error');
}
$attr = $this->attr();
foreach ($attr as $k => $v) {
$div->add_attr($k, $v);
}
if ($label) {
$label_c = HC_Html_Factory::element('label')->add_attr('class', 'control-label')->add_child($label);
$div->add_child($label_c);
}
$content_holder = HC_Html_Factory::element('div')->add_attr('class', 'control-holder');
if ($this->content_static()) {
$content_holder->add_attr('class', 'form-control-static');
}
foreach ($content as $cont) {
$content_holder->add_child($cont);
}
$div->add_child($content_holder);
return $div->render();
}
示例5: title
function title($model, $vlevel = HC_PRESENTER::VIEW_HTML)
{
$return = array();
switch ($vlevel) {
case HC_PRESENTER::VIEW_HTML:
case HC_PRESENTER::VIEW_HTML_ICON:
$icon = HC_Html::icon(HC_App::icon_for('conflict'));
$icon->add_attr('class', 'text-danger');
$span = HC_Html_Factory::element('span')->add_attr('title', $model->present_title(HC_PRESENTER::VIEW_TEXT))->add_child($icon)->add_child($model->present_title(HC_PRESENTER::VIEW_TEXT));
$return[] = $span;
break;
case HC_PRESENTER::VIEW_TEXT:
$return[] = HCM::__('Conflict');
$return[] = ': ';
$return[] = $model->type;
$return[] = ': ';
$return[] = $model->details;
break;
case HC_PRESENTER::VIEW_RAW:
$return[] = $model->type;
$return[] = ': ';
$return[] = $model->details;
break;
}
$return = join('', $return);
return $return;
}
示例6: render
function render()
{
$slim = $this->slim();
$out = HC_Html_Factory::element('div');
$out->add_attr('class', 'row');
if ($slim) {
$out->add_attr('class', 'row-slim');
}
$attr = $this->attr();
foreach ($attr as $k => $v) {
$out->add_attr($k, $v);
}
$scale = $this->scale();
$items = $this->items();
foreach ($items as $item) {
list($item, $width, $more_attr) = $item;
$slot = HC_Html_Factory::element('div')->add_attr('class', 'col-' . $scale . '-' . $width);
if ($more_attr) {
foreach ($more_attr as $k => $v) {
$slot->add_attr($k, $v);
}
}
$slot->add_child($item);
$out->add_child($slot);
}
return $out->render();
}
示例7: render
function render()
{
$out = array();
/* build trigger */
$title = $this->title();
if (($active = $this->active()) && $this->item($active)) {
$title = $this->item($active);
$this->remove_item($active);
}
if (is_object($title) && $title->tag() == 'a') {
$trigger = $title;
} else {
$full_title = $title;
$title = strip_tags($title);
$title = trim($title);
$trigger = HC_Html_Factory::element('a')->add_attr('title', $title)->add_child($full_title);
}
$trigger->add_attr('href', '#')->add_attr('class', 'dropdown-toggle')->add_attr('data-toggle', 'dropdown');
if (!$this->no_caret()) {
$trigger->add_child(' ')->add_child(HC_Html_Factory::element('b')->add_attr('class', 'caret'));
}
$out[] = $trigger->render();
$this->add_attr('class', 'dropdown-menu');
$out[] = parent::render();
$return = '';
foreach ($out as $o) {
$return .= $o;
}
if ($this->wrap()) {
$wrap = HC_Html_Factory::element('div')->add_attr('class', 'dropdown')->add_child($return);
$return = $wrap->render();
}
return $return;
}
示例8: render
function render()
{
$wrap = HC_Html_Factory::element('div')->add_attr('class', 'hc-ajax-parent');
$container = HC_Html_Factory::element('div')->add_attr('class', 'hc-ajax-container');
$list = parent::render();
$wrap->add_child($list);
$wrap->add_child($container);
return $wrap->render();
}
示例9: render
function render()
{
$closer = $this->closer();
if (!$closer) {
$closer = HC_Html_Factory::element('a')->add_child('Back')->add_attr('class', array('btn btn-warning-o'));
$closer = HC_Html_Factory::element('a')->add_child(HC_Html::icon('times')->add_attr('class', array('text-muted')))->add_attr('title', HCM::__('Back'))->add_attr('class', array('close'));
}
$closer->add_attr('class', array('hc-flatmodal-closer'))->add_attr('href', '#')->add_attr('style', 'display: none;')->add_attr('style', 'margin-bottom: 1em;');
$out = HC_Html_Factory::element('div')->add_attr('class', 'hc-flatmodal-parent')->add_child($closer)->add_child(HC_Html_Factory::element('div')->add_attr('class', array('hc-flatmodal-container', 'hc-ajax-container')))->add_child($this->content());
$return = $out->render();
return $return;
}
示例10: render
function render()
{
$name = $this->name();
$value = $this->value();
$id = 'nts-' . $name;
$t = HC_Lib::time();
$t->setNow();
$t->setStartDay();
if ($value) {
$t->modify('+' . $value . ' seconds');
// $value = $t->formatTime();
}
$out = HC_Html_Factory::widget('container');
/* hidden field to store our value */
$hidden = HC_Html_Factory::input('hidden')->set_name($name)->set_value($value)->set_id($id);
$out->add_item($hidden);
/* text field to display */
$display_name = $name . '_display';
$display_id = 'nts-' . $display_name;
$text = HC_Html_Factory::input('text')->set_name($display_name)->set_id($display_id)->add_attr('size', 7);
if (strlen($value)) {
$display_value = $t->formatTime();
$text->set_value($display_value);
}
$out->add_item($text);
$time_format = $t->timeFormat();
$script = HC_Html_Factory::element('script');
$script->add_attr('language', 'JavaScript');
$js_code = <<<EOT
jQuery("#{$display_id}").timepicker(
{
\t'appendTo' : '#nts',
\t'timeFormat' :'{$time_format}',
\t'step' : 5,
}
);
jQuery("#{$display_id}").on('change', function(){
\tvar dbTime = jQuery(this).timepicker('getSecondsFromMidnight');
\tjQuery('#{$id}').val( dbTime );
});
EOT;
$script->add_child($js_code);
$out->add_item($script);
$return = $this->decorate($out->render());
return $return;
}
示例11: render
function render()
{
$out = HC_Html_Factory::element('div')->add_attr('class', 'alert')->add_attr('class', 'display-block');
$attr = $this->attr();
foreach ($attr as $k => $v) {
$out->add_attr($k, $v);
}
$items = $this->items();
if (count($items) > 1) {
$list = HC_Html_Factory::widget('list')->add_attr('class', 'list-unstyled');
$list->set_items($items);
$out->add_child($list);
} else {
$out->add_child($items);
}
return $out->render();
}
示例12: id
function id($model, $vlevel = HC_PRESENTER::VIEW_HTML)
{
$return = array();
switch ($vlevel) {
case HC_PRESENTER::VIEW_HTML:
$return = 'id:' . $model->id;
$return = HC_Html_Factory::element('span')->add_attr('class', 'text-muted')->add_attr('class', 'text-smaller2')->add_attr('class', 'squeeze-in')->add_child($return);
break;
case HC_PRESENTER::VIEW_TEXT:
$return = 'id:' . $model->id;
break;
case HC_PRESENTER::VIEW_RAW:
$return = $model->id;
break;
}
return $return;
}
示例13: render
function render()
{
list($csrf_name, $csrf_value) = HC_App::csrf();
$out = HC_Html_Factory::element('form')->add_attr('method', $this->method())->add_attr('accept-charset', 'utf-8')->add_attr('id', $this->id());
$attr = $this->attr();
foreach ($attr as $k => $v) {
$out->add_attr($k, $v);
}
/* add csrf */
if ($this->method() != 'get') {
if (strlen($csrf_name) && strlen($csrf_value)) {
$hidden = HC_Html_Factory::input('hidden', $csrf_name)->set_value($csrf_value);
$out->add_child(HC_Html_Factory::element('div')->add_attr('style', 'display:none')->add_child($hidden));
}
}
$out->add_child(parent::render());
return $out->render();
}
示例14: render
function render()
{
$left = HC_Html_Factory::element('li')->add_attr('class', 'squeeze-in')->add_attr('class', 'pull-left')->add_attr('style', 'width: 50%;')->add_child($this->left());
$right = HC_Html_Factory::element('li')->add_attr('class', 'squeeze-in')->add_attr('class', 'pull-right')->add_attr('style', 'width: 50%;')->add_child($this->right());
if ($this->align_right) {
$right->add_attr('class', 'text-right');
}
$clearfix = HC_Html_Factory::element('div')->add_attr('class', 'clearfix')->add_child('');
$out = HC_Html_Factory::element('ul')->add_attr('class', 'list-inline')->add_child($left)->add_child($right);
$total = array();
$total[] = $out;
$total[] = $clearfix;
$return = '';
foreach ($total as $t) {
$return .= $t->render();
}
return $return;
}
示例15: render
function render()
{
$out = array();
/* build trigger */
$title = $this->title();
if (is_object($title) && $title->tag() == 'a') {
$trigger = $title;
} else {
$full_title = $title;
$title = strip_tags($title);
$title = trim($title);
$trigger = HC_Html_Factory::element('a')->add_attr('title', $title)->add_child($full_title);
}
$trigger->add_attr('class', 'hc-ajax-loader');
$wrap = HC_Html_Factory::element('div')->add_attr('class', 'hc-ajax-parent');
$container = HC_Html_Factory::element('div')->add_attr('class', 'hc-ajax-container');
$wrap->add_child($trigger);
$wrap->add_child($container);
return $wrap->render();
}