本文整理汇总了PHP中HC_Lib::form方法的典型用法代码示例。如果您正苦于以下问题:PHP HC_Lib::form方法的具体用法?PHP HC_Lib::form怎么用?PHP HC_Lib::form使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HC_Lib
的用法示例。
在下文中一共展示了HC_Lib::form方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct()
{
parent::__construct(USER_HC_MODEL::LEVEL_MANAGER);
$this->forms = array();
$this->forms['edit'] = HC_Lib::form()->set_input('first_name', 'text')->set_input('last_name', 'text')->set_input('email', 'text')->set_input('username', 'text')->set_input('level', 'select');
$this->forms['password'] = HC_Lib::form()->set_input('password', 'password')->set_input('confirm_password', 'password');
}
示例2: forgot_password
function forgot_password()
{
$post = $this->input->post();
$form = HC_Lib::form();
$form->set_inputs(array('email' => 'text'));
$validator = new HC_Validator();
$validator->set_rules('email', 'required');
if ($post && $validator->run($post) == TRUE) {
$form->grab($post);
$values = $form->values();
$forgotten = $this->auth->forgotten_password($values['email']);
if ($forgotten) {
//if there were no errors
$this->session->set_flashdata('message', HCM::__('Password reset message has been sent to your email'));
$this->redirect('auth/login');
} else {
$this->session->set_flashdata('error', $this->auth->error);
$this->redirect('auth/forgot_password');
}
}
$errors = $validator->error();
$form->set_values($post);
$form->set_errors($errors);
$this->layout->set_partial('content', $this->render('auth/forgot_password', array('form' => $form)));
$this->layout();
}
示例3: _content_password
private function _content_password($model)
{
$form = HC_Lib::form()->set_input('password', 'password')->set_input('confirm_password', 'password');
if ($ri = HC_Lib::ri()) {
$form->set_readonly();
}
// $form->set_values( $model->to_array() );
$form->set_errors($model->errors());
return $this->render('admin/users/zoom/password', array('form' => $form, 'object' => $model));
}
示例4: __construct
function __construct()
{
parent::__construct();
$this->form_add_time = HC_Lib::form()->set_input('time', 'timeframe', array('start' => 'start', 'end' => 'end'))->set_input('date', 'recurring_date');
if ($this->hc_modules->exists('shift_groups')) {
$this->form_add_time->input_call('date', 'set_enabled', array(array('single', 'recurring')));
} else {
$this->form_add_time->input_call('date', 'set_enabled', array(array('single')));
}
$this->form_confirm = HC_Lib::form()->set_input('status', 'radio');
}
示例5: add_form_inputs
function add_form_inputs($parent_object = NULL)
{
$acl = HC_App::acl();
if ($parent_object) {
if (!$acl->set_object($parent_object)->can('notification_email::skip')) {
return;
}
}
$form = HC_Lib::form();
$form->set_inputs(array('notifications_email_skip' => 'checkbox'));
return $this->render('notifications_email/add_form_inputs', array('form' => $form));
}
示例6: __construct
function __construct()
{
parent::__construct();
$this->form = HC_Lib::form();
$wum = HC_App::model('wordpress_user');
$wordpress_roles = $wum->wp_roles();
foreach ($wordpress_roles as $role_value => $role_name) {
$field_name = 'role_' . $role_value;
$this->form->set_input($field_name, 'dropdown');
}
$this->form->set_input('append_role_name', 'checkbox');
}
示例7: __construct
function __construct()
{
parent::__construct();
if (($test_user = $this->auth->user()) && $test_user->id) {
} else {
$this->fix['filter'] = NULL;
}
$acl = HC_App::acl();
if ($this->hc_modules->exists('shift_groups')) {
$this->form = HC_Lib::form()->set_input('action', 'hidden')->set_input('id', 'checkbox_set')->set_input('ids', 'hidden');
}
}
示例8: __construct
function __construct()
{
parent::__construct(USER_HC_MODEL::LEVEL_ADMIN);
$fields = $this->config->items('settings');
$defaults = array();
$this->form = HC_Lib::form();
$app_conf = HC_App::app_conf();
foreach ($fields as $fn => $f) {
$defaults[$fn] = $app_conf->get($fn);
$this->form->set_input($fn, $f['type']);
}
$this->form->set_values($defaults);
}
示例9: __construct
function __construct()
{
parent::__construct(USER_HC_MODEL::LEVEL_ADMIN);
$this->form = HC_Lib::form();
$defaults = array();
$app_conf = HC_App::app_conf();
$wum = HC_App::model('wordpress_user');
$wordpress_roles = $wum->wp_roles();
foreach ($wordpress_roles as $role_value => $role_name) {
$field_name = 'role_' . $role_value;
$this->form->set_input($field_name, 'dropdown');
$default = $app_conf->get('wordpress_' . $field_name);
$defaults[$field_name] = $default;
}
$this->form->set_input('append_role_name', 'checkbox');
$this->form->set_values($defaults);
}
示例10: add_form_inputs
function add_form_inputs($parent_object = NULL)
{
$acl = HC_App::acl();
if ($parent_object) {
if (!$acl->set_object($parent_object)->can('notification_email::skip')) {
return;
}
}
$form = HC_Lib::form();
$form->set_inputs(array('notifications_email_skip' => 'checkbox'));
$default_values = array('notifications_email_skip' => 0);
/* extensions */
$extensions = HC_App::extensions();
$change_values = $extensions->run('notifications_email/insert/defaults');
foreach ($change_values as $change_array) {
foreach ($change_array as $k => $v) {
$default_values[$k] = $v;
}
}
$form->set_values($default_values);
return $this->render('notifications_email/add_form_inputs', array('form' => $form));
}
示例11: __construct
function __construct()
{
parent::__construct();
$this->form_add = HC_Lib::form()->set_input('user', 'hidden')->set_input('type', 'radio')->set_input('date', 'recurring_date', array('date_start' => 'date', 'date_end' => 'date', 'details' => 'date'))->set_input('time', 'timeframe', array('start' => 'start', 'end' => 'end'));
}
示例12: render
function render($readonly = FALSE)
{
if (!$readonly && !($link = $this->link())) {
return 'HC_Html_Widget_Date_Nav: link is not set!';
}
$t = HC_Lib::time();
$nav_title = $this->_nav_title($readonly);
if ($readonly) {
$return = HC_Html_Factory::element('span')->add_attr('class', array('btn', 'btn-default'))->add_child($nav_title);
return $return;
}
switch ($this->range()) {
case 'all':
$t->setNow();
$start_date = $end_date = 0;
// $start_date = $end_date = $t->formatDate_Db();
break;
case 'upcoming':
$t->setNow();
$start_date = $end_date = 0;
break;
case 'custom':
list($start_date, $end_date) = explode('_', $this->date());
$t->setDateDb($start_date)->modify('-1 day');
$before_date = $t->formatDate_Db();
$t->setDateDb($end_date)->modify('+1 day');
$after_date = $t->formatDate_Db();
break;
case 'day':
$t->setDateDb($this->date());
$start_date = $end_date = $t->formatDate_Db();
$t->modify('-1 day');
$before_date = $t->formatDate_Db();
$t->setDateDb($this->date());
$t->modify('+1 day');
$after_date = $t->formatDate_Db();
break;
case 'week':
$t->setDateDb($this->date());
$start_date = $t->setStartWeek()->formatDate_Db();
$end_date = $t->setEndWeek()->formatDate_Db();
$t->setDateDb($this->date());
$t->modify('-1 week');
$t->setStartWeek();
$before_date = $t->formatDate_Db();
$t->setDateDb($this->date());
$t->setEndWeek();
$t->modify('+1 day');
$after_date = $t->formatDate_Db();
break;
case 'month':
$t->setDateDb($this->date());
$start_date = $t->setStartMonth()->formatDate_Db();
$end_date = $t->setEndMonth()->formatDate_Db();
$month_view = $t->getMonthName() . ' ' . $t->getYear();
$t->setDateDb($this->date());
$t->modify('-1 month');
$t->setStartMonth();
$before_date = $t->formatDate_Db();
$t->setDateDb($this->date());
$t->setEndMonth();
$t->modify('+1 day');
$after_date = $t->formatDate_Db();
break;
}
// $this->add_attr('class', array('nav', 'nav-pills'));
$this->add_attr('class', array('list-inline', 'list-separated'));
$wrap_nav_title = HC_Html_Factory::element('a')->add_attr('class', array('btn', 'btn-default'))->add_child($nav_title);
$current_nav = HC_Html_Factory::widget('dropdown')->set_title($wrap_nav_title);
$range_options = array();
/* week */
$this_params = array($this->range_param() => 'week', $this->date_param() => $start_date ? $start_date : NULL);
$range_options['week'] = HC_Html_Factory::element('a')->add_child(HCM::__('Week'))->add_attr('href', $link->url($this_params));
/* month */
$this_params = array($this->range_param() => 'month', $this->date_param() => $start_date ? $start_date : NULL);
$range_options['month'] = HC_Html_Factory::element('a')->add_child(HCM::__('Month'))->add_attr('href', $link->url($this_params));
/* day */
$this_params = array($this->range_param() => 'day', $this->date_param() => $start_date ? $start_date : NULL);
$range_options['day'] = HC_Html_Factory::element('a')->add_child(HCM::__('Day'))->add_attr('href', $link->url($this_params));
/* custom */
$date_param = '';
if ($start_date && $end_date) {
$date_param = $start_date . '_' . $end_date;
} elseif ($start_date) {
$date_param = $start_date;
}
$this_params = array($this->range_param() => 'custom', $this->date_param() => $date_param ? $date_param : NULL);
$range_options['custom'] = HC_Html_Factory::element('a')->add_child(HCM::__('Custom Range'))->add_attr('href', $link->url($this_params));
/* upcoming */
$this_params = array($this->range_param() => 'upcoming', $this->date_param() => NULL);
$range_options['upcoming'] = HC_Html_Factory::element('a')->add_child(HCM::__('Upcoming'))->add_attr('href', $link->url($this_params));
/* all */
$this_params = array($this->range_param() => 'all', $this->date_param() => NULL);
$range_options['all'] = HC_Html_Factory::element('a')->add_child(HCM::__('All Time'))->add_attr('href', $link->url($this_params));
$enabled = $this->enabled();
foreach ($range_options as $k => $v) {
if (!in_array($k, $enabled)) {
continue;
}
if ($k != $this->range()) {
//.........这里部分代码省略.........
示例13: __construct
function __construct()
{
parent::__construct(USER_HC_MODEL::LEVEL_ADMIN);
$this->form = HC_Lib::form()->set_input('name', 'text')->set_input('time', 'timeframe', array('start' => 'start', 'end' => 'end'));
}
示例14: __construct
function __construct()
{
parent::__construct();
$this->form = HC_Lib::form()->set_input('first_name', 'text')->set_input('last_name', 'text')->set_input('email', 'text')->set_input('password', 'password')->set_input('confirm_password', 'password');
}
示例15: __construct
function __construct()
{
parent::__construct();
$this->form = HC_Lib::form()->set_input('status', 'radio')->set_input('end', 'timepicker')->set_input('start', 'timepicker')->set_input('ids', 'hidden');
}