本文整理汇总了PHP中HC_Html_Factory::input方法的典型用法代码示例。如果您正苦于以下问题:PHP HC_Html_Factory::input方法的具体用法?PHP HC_Html_Factory::input怎么用?PHP HC_Html_Factory::input使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HC_Html_Factory
的用法示例。
在下文中一共展示了HC_Html_Factory::input方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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;
}
示例4: __construct
function __construct($name = '')
{
parent::__construct($name);
$name = $this->name();
$this->fields['recurring'] = HC_Html_Factory::input('hidden', $name . '_recurring')->set_value('single');
$this->fields['datesingle'] = HC_Html_Factory::input('date', $name . '_datesingle');
$this->fields['datestart'] = HC_Html_Factory::input('date', $name . '_datestart');
$this->fields['dateend'] = HC_Html_Factory::input('date', $name . '_dateend');
$this->fields['repeat'] = HC_Html_Factory::input('radio', $name . '_repeat')->set_value('daily');
$this->fields['weeklycustom'] = HC_Html_Factory::input('checkbox_set', $name . '_weeklycustom');
$this->fields['biweeklycustom1'] = HC_Html_Factory::input('checkbox_set', $name . '_biweeklycustom1');
$this->fields['biweeklycustom2'] = HC_Html_Factory::input('checkbox_set', $name . '_biweeklycustom2');
$this->fields['inoutin'] = HC_Html_Factory::input('text', $name . '_inoutin');
$this->fields['inoutout'] = HC_Html_Factory::input('text', $name . '_inoutout');
}
示例5: 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();
}
示例6: 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;
}
示例7: render_one
function render_one($value, $decorate = TRUE)
{
$options = $this->options();
$full_value = $this->value();
$label = $options[$value];
$sub_el = HC_Html_Factory::input('checkbox', $this->name() . '[]')->set_my_value($value);
if ($this->readonly($value)) {
$sub_el->set_readonly();
}
if (strlen($label)) {
$sub_el->set_label($label);
}
if (in_array($value, $full_value)) {
$sub_el->set_value(1);
}
if ($decorate) {
$return = $this->decorate($sub_el->render());
} else {
$return = $sub_el->render($decorate);
}
return $return;
}
示例8: 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;
}
示例9: date
public function date($model, $vlevel = HC_PRESENTER::VIEW_HTML)
{
$input = HC_Html_Factory::input('recurring_date');
$value = $input->unserialize($model->details, 'no-dates');
$value['datestart'] = $model->date_start;
$value['dateend'] = $model->date_end;
$input->set_value($value);
$dates_datails = $input->dates_details();
switch ($vlevel) {
case HC_PRESENTER::VIEW_HTML:
$return = HC_Html_Factory::widget('list')->add_attr('class', 'list-unstyled');
for ($di = 0; $di < count($dates_datails); $di++) {
$return->add_item('dd_' . $di, $dates_datails[$di]);
if ($di > 0) {
$return->add_item_attr('dd_' . $di, 'class', 'text-muted');
$return->add_item_attr('dd_' . $di, 'class', 'text-smaller');
}
}
break;
default:
$return = join(', ', $dates_datails);
break;
}
return $return;
}
示例10: 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');
$out->add_item($text);
/* JavaScript to make it work */
$js_options = array();
$options = $this->options();
foreach ($options as $k => $v) {
switch ($k) {
case 'startDate':
if ($v > $value) {
$value = $v;
}
$t->setDateDb($v);
$v = $t->formatDate();
break;
}
$js_options[] = "{$k}: \"{$v}\"";
}
$js_options[] = "weekStart: " . $t->weekStartsOn;
$js_options = join(",\n", $js_options);
$script = HC_Html_Factory::element('script');
$script->add_attr('language', 'JavaScript');
$cal_language = array('days' => array(HCM::__('Sun'), HCM::__('Mon'), HCM::__('Tue'), HCM::__('Wed'), HCM::__('Thu'), HCM::__('Fri'), HCM::__('Sat'), HCM::__('Sun')), 'daysShort' => array(HCM::__('Sun'), HCM::__('Mon'), HCM::__('Tue'), HCM::__('Wed'), HCM::__('Thu'), HCM::__('Fri'), HCM::__('Sat'), HCM::__('Sun')), 'daysMin' => array(HCM::__('Sun'), HCM::__('Mon'), HCM::__('Tue'), HCM::__('Wed'), HCM::__('Thu'), HCM::__('Fri'), HCM::__('Sat'), HCM::__('Sun')), 'months' => array(HCM::__('Jan'), HCM::__('Feb'), HCM::__('Mar'), HCM::__('Apr'), HCM::__('May'), HCM::__('Jun'), HCM::__('Jul'), HCM::__('Aug'), HCM::__('Sep'), HCM::__('Oct'), HCM::__('Nov'), HCM::__('Dec')), 'monthsShort' => array(HCM::__('Jan'), HCM::__('Feb'), HCM::__('Mar'), HCM::__('Apr'), HCM::__('May'), HCM::__('Jun'), HCM::__('Jul'), HCM::__('Aug'), HCM::__('Sep'), HCM::__('Oct'), HCM::__('Nov'), HCM::__('Dec')), 'today' => 'Today', 'clear' => 'Clear');
$cal_language_js_code = array();
foreach ($cal_language as $k => $v) {
$cal_language_js_code_line = '';
$cal_language_js_code_line .= $k . ': ';
if (is_array($v)) {
$cal_language_js_code_line .= '[';
$cal_language_js_code_line .= join(', ', array_map(create_function('$v', 'return "\\"" . $v . "\\"";'), $v));
$cal_language_js_code_line .= ']';
} else {
$cal_language_js_code_line .= '"' . $v . '"';
}
$cal_language_js_code[] = $cal_language_js_code_line;
}
$cal_language_js_code = join(",\n", $cal_language_js_code);
// echo $cal_language_js_code;
$js_code = <<<EOT
;(function(\$){
\t\$.fn.datepicker.dates['en'] = {
\t\t{$cal_language_js_code}
\t};
}(jQuery));
jQuery('#{$display_id}').datepicker({
\t{$js_options},
\tdateFormat: '{$datepicker_format}',
\tautoclose: true,
\t})
\t.on('changeDate', function(ev)
\t\t{
\t\tvar dbDate =
\t\t\tev.date.getFullYear()
\t\t\t+ "" +
\t\t\t("00" + (ev.date.getMonth()+1) ).substr(-2)
\t\t\t+ "" +
\t\t\t("00" + ev.date.getDate()).substr(-2);
\t\tjQuery('#{$id}').val( dbDate );
\t\t});
EOT;
$script->add_child($js_code);
$out->add_item($script);
$return = $this->decorate($out->render());
return $return;
}
示例11: array
*/
break;
case 'location':
if ($params->get('type') == SHIFT_HC_MODEL::TYPE_TIMEOFF) {
break;
}
$model->from_array(array('location' => $params->get('location')));
$item = HC_Html_Factory::widget('list')->add_attr('class', 'list-unstyled')->add_attr('class', 'list-separated');
$item->add_item('location', HC_Html_Factory::widget('label_row')->set_label(HCM::__('Location'))->set_content(HC_Html_Factory::element('div')->add_attr('class', array('alert'))->add_attr('class', array('alert-default-o'))->add_child($model->present_location())));
break;
case 'start':
$item = HC_Html_Factory::widget('grid');
/* time */
$item->add_item(HC_Html_Factory::widget('label_row')->set_label(HCM::__('Time'))->set_content(HC_Html_Factory::element('div')->add_attr('class', array('alert'))->add_attr('class', array('alert-default-o'))->add_child($model->present_time())), 4);
/* date */
$date_input = HC_Html_Factory::input('recurring_date');
$date_input->set_value($params->get('date'));
$dates = $date_input->dates();
$dates_datails = $date_input->dates_details();
$dates_details_view = HC_Html_Factory::widget('list')->add_attr('class', 'list-unstyled');
for ($di = 0; $di < count($dates_datails); $di++) {
$dates_details_view->add_item('dd_' . $di, $dates_datails[$di]);
if ($di > 0) {
$dates_details_view->add_item_attr('dd_' . $di, 'class', 'text-muted');
$dates_details_view->add_item_attr('dd_' . $di, 'class', 'text-smaller');
}
}
/* now draw the calendar */
if (count($dates) > 1) {
$dates_calendar = HC_Html_Factory::widget('calendar2')->set_date($dates[0])->set_end_date($dates[count($dates) - 1]);
$default_date_view = HC_Html_Factory::element('div')->add_attr('class', array('text-center'))->add_attr('class', array('alert'))->add_attr('class', array('alert-condensed2'))->add_attr('class', array('alert-flat'))->add_attr('class', array('alert-archive'));
示例12: render
function render($decorate = TRUE)
{
$label = $this->label();
$value = $this->value();
$my_value = $this->my_value();
$el = HC_Html_Factory::element('input')->add_attr('type', 'checkbox')->add_attr('id', $this->id())->add_attr('name', $this->name())->add_attr('value', $this->my_value());
$attr = $this->attr();
foreach ($attr as $k => $v) {
$el->add_attr($k, $v);
}
if ($this->readonly()) {
// $el->add_attr('readonly', 'readonly' );
$el->add_attr('disabled', 'disabled');
}
if ($value) {
$el->add_attr('checked', 'checked');
}
$el = HC_Html_Factory::widget('container')->add_item($el);
if (strlen($label)) {
$el->add_item($label);
}
if ($this->readonly()) {
$hidden = HC_Html_Factory::input('hidden', $this->name());
if ($value) {
$hidden->set_value($my_value);
} else {
$hidden->set_value('');
}
$el->add_item($hidden);
}
if ($decorate) {
$out = HC_Html_Factory::element('div')->add_attr('class', 'checkbox')->add_attr('style', 'margin: 0 0;')->add_attr('style', 'display: block;')->add_child(HC_Html_Factory::element('label')->add_child($el));
$return = $this->decorate($out->render());
} else {
$return = $el->render();
}
return $return;
}
示例13: input
/**
* input
*
* Outputs HTML code for input
*
* @param array $input ('value', 'error', 'type', 'name')
* @return string
*/
static function input($input_array, $more = array())
{
$return = '';
$value = isset($input_array['value']) ? $input_array['value'] : '';
$el = HC_Html_Factory::input($input_array['type'], $input_array['name'], $value, $more);
$error = isset($input_array['error']) ? $input_array['error'] : '';
if ($error) {
$el->set_error($error);
}
return $el->render();
}
示例14: __construct
function __construct($name)
{
$this->fields['start'] = HC_Html_Factory::input('timepicker', $name . '_start');
$this->fields['end'] = HC_Html_Factory::input('timepicker', $name . '_end');
}