本文整理汇总了PHP中HC_Html_Factory类的典型用法代码示例。如果您正苦于以下问题:PHP HC_Html_Factory类的具体用法?PHP HC_Html_Factory怎么用?PHP HC_Html_Factory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HC_Html_Factory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
示例2: 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();
}
示例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: 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;
}
示例5: 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;
}
示例6: 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();
}
示例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::widget('list')->add_attr('class', array('list-inline', 'list-separated'));
$wrap->add_item($this->fields['start']);
$wrap->add_item(' - ');
$wrap->add_item($this->fields['end']);
return $this->decorate($wrap->render());
}
示例9: 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();
}
示例10: get_dates
public function get_dates()
{
$date_input = HC_Html_Factory::input('recurring_date');
$date_value = $date_input->unserialize($this->details, 'no-dates');
$date_value['datestart'] = $this->date_start;
$date_value['dateend'] = $this->date_end;
$date_input->set_value($date_value);
$return = $date_input->dates();
return $return;
}
示例11: set_input
function set_input($name, $type, $convert = array())
{
$input = HC_Html_Factory::input($type, $name);
$this->inputs[$name] = $input;
if ($convert) {
foreach ($convert as $kmodel => $kform) {
$this->convert[$kmodel] = $name . '.' . $kform;
}
}
return $this;
}
示例12: 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;
}
示例13: 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;
}
示例14: details
function details($model, $vlevel = HC_PRESENTER::VIEW_HTML)
{
$conflicting_one = HC_App::model('availability');
$conflicting_one->where('id', $model->details)->get();
switch ($vlevel) {
case HC_PRESENTER::VIEW_HTML:
$return = HC_Html_Factory::widget('availability_view')->set_new_window(TRUE)->set_wide(TRUE);
$return->set_model($conflicting_one);
break;
case HC_PRESENTER::VIEW_TEXT:
case HC_PRESENTER::VIEW_RAW:
$return = $conflicting_one->present_details($vlevel);
break;
}
return $return;
}
示例15: 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();
}