本文整理汇总了PHP中HC_Html_Factory::widget方法的典型用法代码示例。如果您正苦于以下问题:PHP HC_Html_Factory::widget方法的具体用法?PHP HC_Html_Factory::widget怎么用?PHP HC_Html_Factory::widget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HC_Html_Factory
的用法示例。
在下文中一共展示了HC_Html_Factory::widget方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
示例2: 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();
}
示例3: 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());
}
示例4: render
function render()
{
$model = $this->model();
$start_link = $this->start_link();
if (!$start_link) {
// $start_link = 'availability';
$start_link = 'admin/users/zoom/index/id/' . $model->user_id . '/tab/availability/_pass';
}
$href = HC_Lib::link($start_link . '/zoom/index', array('id' => $model->id));
$nolink = $this->nolink();
$new_window = $this->new_window();
$wide = $this->wide();
$a_link = HC_Html_Factory::widget('titled', 'a')->add_attr('href', $href);
if (!$new_window) {
$a_link->add_attr('class', 'hc-flatmodal-loader');
} else {
$a_link->add_attr('target', '_blank');
$a_link->add_attr('class', 'hc-parent-loader');
}
if ($wide === 'mini') {
$out = HC_Html_Factory::element('div');
if (!$nolink) {
$title = clone $a_link;
$title->add_child($model->present_title(HC_PRESENTER::VIEW_HTML_ICON));
} else {
$title = $model->present_title(HC_PRESENTER::VIEW_HTML_ICON);
}
$out->add_child($title);
} elseif ($wide) {
$out = HC_Html_Factory::widget('grid');
if (!$nolink) {
$present_title = clone $a_link;
$present_title->add_child($model->present_title());
} else {
$present_title = $model->present_title();
}
if (!$nolink) {
$present_date = clone $a_link;
$present_date->add_child($model->present_date());
} else {
$present_date = $model->present_date();
}
$out->add_item($present_title, 6);
$out->add_item($present_date, 6);
} else {
$out = HC_Html_Factory::element('div');
if (!$nolink) {
$title = clone $a_link;
$title->add_child($model->present_title());
} else {
$title = $model->present_title(HC_PRESENTER::VIEW_HTML_ICON);
}
$out->add_child($title);
$out->add_attr('class', array('text-smaller'))->add_attr('class', array('text-muted'));
}
$out->add_attr('class', 'hc-common-link-parent')->add_attr('class', 'hc-no-underline');
return $out->render();
}
示例5: 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;
}
示例6: 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;
}
示例7: 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();
}
示例8: render
function render()
{
$name = $this->name();
$value = $this->value();
$id = 'nts-' . $name;
$t = HC_Lib::time();
$value ? $t->setDateDb($value) : $t->setNow();
$value = $t->formatDate_Db();
$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;
$datepicker_format = $t->formatToDatepicker();
$display_value = $t->formatDate();
$text = HC_Html_Factory::input('text')->set_name($display_name)->set_value($display_value)->set_id($display_id)->add_attr('data-date-format', $datepicker_format)->add_attr('data-date-week-start', $t->weekStartsOn)->add_attr('style', 'width: 8em')->add_attr('class', 'hc-datepicker');
$out->add_item($text);
$return = $this->decorate($out->render());
return $return;
}
示例9: 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);
$attr = $this->attr();
foreach ($attr as $k => $v) {
if (!in_array($k, array('disabled', 'readonly'))) {
continue;
}
$hidden->add_attr($k, $v);
}
$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)->add_attr('class', 'hc-timepicker');
if (strlen($value)) {
$display_value = $t->formatTime();
$text->set_value($display_value);
}
foreach ($attr as $k => $v) {
$text->add_attr($k, $v);
}
$out->add_item($text);
$return = $this->decorate($out->render());
return $return;
}
示例10: array
</div>
<?php
}
?>
</div>
<?php
}
?>
<?php
if ($error) {
?>
<div>
<?php
$danger = HC_Html_Factory::widget('alert')->add_attr('class', 'alert-danger')->set_items($error);
echo $danger->render();
?>
</div>
<?php
}
?>
<?php
if (isset($debug_message) && $debug_message) {
if (!is_array($debug_message)) {
$debug_message = array($debug_message);
}
$debug_message = HC_Html_Factory::widget('list')->add_attr('class', 'list-unstyled')->add_attr('class', 'list-separated')->add_attr('class', 'list-bordered')->set_items($debug_message);
$debug = HC_Html_Factory::widget('alert')->add_attr('class', 'alert-warning-o')->set_items($debug_message);
echo $debug->render();
}
示例11: foreach
<?php
$t = HC_Lib::time();
$out = HC_Html_Factory::widget('list')->add_attr('class', 'list-unstyled')->add_attr('class', 'list-separated');
foreach ($entries as $e) {
$view = HC_Html_Factory::widget('availability_view');
$view->set_model($e);
if (isset($state['wide'])) {
$view->set_wide($state['wide']);
}
$view->set_start_link('availability');
$out->add_item($view);
/*
$out->add_item(
HC_Html_Factory::widget('titled', 'span')
->add_child( $e->present_title() )
->add_attr('class', 'text-success')
->add_attr('class', 'text-smaller')
);
*/
}
echo $out->render();
示例12: array
<?php
$this->layout->set_partial('header', HC_Html::page_header(HC_Html_Factory::element('h2')->add_child(HCM::__('Log In'))));
$app_conf = HC_App::app_conf();
if ($app_conf->get('login_with') == 'username') {
$identity_label = HCM::__('Username');
} else {
$identity_label = HCM::__('Email');
}
$display_form = HC_Html_Factory::widget('form')->add_attr('action', HC_Lib::link('auth/login')->url())->add_attr('class', 'form-horizontal')->add_attr('class', 'form-condensed');
$display_form->add_item(HC_Html_Factory::widget('label_row')->set_label($identity_label)->set_content($form->input('identity')->add_attr('placeholder', $identity_label))->set_error($form->input('identity')->error()));
$display_form->add_item(HC_Html_Factory::widget('label_row')->set_label(HCM::__('Password'))->set_content($form->input('password')->add_attr('placeholder', HCM::__('Password')))->set_error($form->input('password')->error()));
$display_form->add_item(HC_Html_Factory::widget('label_row')->set_content(HC_Html_Factory::element('input')->add_attr('type', 'submit')->add_attr('class', array('btn', 'btn-default'))->add_attr('title', HCM::__('Log In'))->add_attr('value', HCM::__('Log In'))));
$out = HC_Html_Factory::widget('list')->add_attr('class', 'list-unstyled')->add_attr('class', 'list-separated');
$out->add_item($display_form);
$out->add_item(HC_Html_Factory::widget('titled', 'a')->add_attr('href', HC_Lib::link('auth/forgot_password'))->add_child(HCM::__('Lost your password?')));
echo $out->render();
示例13: array
<?php
if (!$count) {
return;
}
$temp_shift = HC_App::model('shift');
$linkto = HC_Lib::link('list/index', array('filter' => 'draft'));
$title = HC_Html_Factory::widget('list')->add_attr('class', 'list-inline')->add_attr('class', 'list-separated')->add_item('title', HC_Html_Factory::widget('titled', 'a')->add_attr('href', $linkto)->add_child(HCM::__('Draft Shifts')))->add_item('count', HC_Html_Factory::element('span')->add_attr('class', 'badge')->add_child($count));
$out = HC_Html_Factory::element('div')->add_attr('class', 'alert')->add_attr('class', 'alert-default-o')->add_child($title);
//$color = Hc_lib::random_html_color( 2 );
$color = '#dff0d8';
$color1 = HC_Lib::adjust_color_brightness($color, 0);
$color2 = HC_Lib::adjust_color_brightness($color, 20);
$out->add_attr('style', "background: repeating-linear-gradient(\r\n\t\t-45deg,\r\n\t\t{$color1},\r\n\t\t{$color1} 6px,\r\n\t\t{$color2} 6px,\r\n\t\t{$color2} 12px\r\n\t\t);\r\n\t");
echo $out->render();
示例14: foreach
$time_input = $form->input('time');
}
$display_form->add_item(HC_Html_Factory::widget('grid')->add_item(HC_Html_Factory::widget('label_row')->set_label(HCM::__('Time'))->set_content($time_input)->set_error($form->input('time')->error()), 7)->add_item(HC_Html_Factory::widget('label_row')->set_label(HCM::__('Date'))->set_content($form->input('date'))->set_error($form->input('date')->error()), 5));
/* STAFF */
$display_form->add_item($form->input('user'));
$staff_view = HC_Html_Factory::widget('module')->set_url('shifts/zoom/form')->pass_arg($object)->pass_arg('user')->set_self_target(TRUE)->set_skip_src(TRUE);
$display_form->add_item(HC_Html_Factory::widget('label_row')->set_label(HCM::__('Staff'))->set_content($staff_view));
/* STATUS */
$display_form->add_item(HC_Html_Factory::widget('label_row')->set_label(HCM::__('Status'))->set_content($form->input('status')->set_inline(TRUE)->add_option($object->_const('STATUS_DRAFT'), $object->set('status', $object->_const('STATUS_DRAFT'))->present_status())->add_option($object->_const('STATUS_ACTIVE'), $object->set('status', $object->_const('STATUS_ACTIVE'))->present_status())->render())->set_error($form->input('status')->error()));
/* ADD NOTE IF POSSIBLE */
$extensions = HC_App::extensions();
$more_content = $extensions->run('shifts/zoom/confirm');
if ($more_content) {
$more_holder = HC_Html_Factory::widget('list')->add_attr('class', 'list-unstyled')->add_attr('class', 'list-separated2');
foreach ($more_content as $mc) {
$more_holder->add_item($mc);
}
$display_form->add_item($more_holder);
}
$display_form->add_item(HC_Html_Factory::widget('label_row')->set_content($buttons)->add_attr('class', 'padded2')->add_attr('style', 'border-top: #eee 1px solid; margin-top: 1em;'));
// echo $display_form->render();
$out = HC_Html_Factory::widget('flatmodal');
$out->set_content($display_form);
/*
$out->set_closer(
HC_Html_Factory::element('a')
->add_child( HC_Html::icon('arrow-left') . HCM::__('Cancel') )
->add_attr('class', array('btn', 'btn-info-o'))
);
*/
echo $out->render();
示例15: get_admin_url
} else {
$user_title .= $user->email;
}
$user_title .= ']';
$link_profile = 'auth/profile';
$nav->add_item(HC_Html_Factory::widget('titled', 'a')->add_attr('href', HC_Lib::link($link_profile))->add_child($user_title));
$auth_user = $this->auth->user();
$acl = HC_App::acl();
$acl_user = $acl->user();
$ri = HC_Lib::ri();
if ($auth_user->id != $acl_user->id) {
if ($ri == 'wordpress') {
if ($auth_user->level >= $auth_user->_const('LEVEL_MANAGER')) {
$nav->add_divider();
$app = HC_App::app();
$admin_url = get_admin_url() . 'admin.php?page=' . $app;
$nav->add_item(HC_Html_Factory::widget('titled', 'a')->add_attr('href', $admin_url)->add_child(HC_Html::icon('cogs'))->add_child(HC_Html_Factory::element('span')->add_attr('class', 'hidden-xs')->add_child(HCM::__('Admin Area'))));
}
}
}
$nav->add_divider();
$nav->add_item(HC_Html_Factory::widget('titled', 'a')->add_attr('href', HC_Lib::link('auth/logout'))->add_child(HC_Html_Factory::element('span')->add_attr('class', 'hidden-xs')->add_child(HCM::__('Log Out')))->add_child(HC_Html::icon('sign-out')));
} else {
if ($this_method != 'login') {
$nav->add_item(HC_Html_Factory::widget('titled', 'a')->add_attr('href', HC_Lib::link('auth/login'))->add_child(HC_Html::icon('sign-in'))->add_child(HC_Html_Factory::element('span')->add_attr('class', 'hidden-xs')->add_child(HCM::__('Log In'))));
} else {
$nav->add_item(HC_Html_Factory::widget('titled', 'a')->add_attr('href', HC_Lib::link())->add_child(HC_Html::icon('arrow-left'))->add_child(HCM::__('Back To Start Page')));
}
}
$out->add_child($nav);
echo $out->render();