예제 #1
0
 public static function select($name, array $options = NULL, $selected = NULL, array $attributes = NULL)
 {
     if (static::$model) {
         if (isset(static::$model->table_columns()[$name])) {
             $selected = static::$model->{$name};
             $attributes['id'] = static::$model_name . '_' . URL::title($name);
             $name = static::$model_name . '[' . $name . ']';
         }
     }
     return parent::select($name, $options, $selected, $attributes);
 }
예제 #2
0
echo __('login');
?>
</h1>
      <div class="content">
<?php 
echo $form->open('user/login');
echo '<table><tr><td style="vertical-align: top;">';
echo '<ul>';
echo '<li>' . $form->label('username', __('email.or.username')) . '</li>';
echo $form->input('username', null, array('class' => 'text twothirds'));
echo '<li>' . $form->label('password', __('password'), array('style' => 'display: inline; margin-right:10px;')) . '<small> ' . Html::anchor('user/forgot', __('?forgot.password')) . '<br></small>' . '</li>';
echo $form->password('password', null, array('class' => 'text twothirds'));
$authClass = new ReflectionClass(get_class(Auth::instance()));
//set a valid salt in useradmin config or your bootstrap.php
if ($authClass->hasMethod('auto_login') and Cookie::$salt) {
    echo '<li>' . Kohana_Form::checkbox('remember', 'remember', false, array('style' => 'margin-right: 10px', 'id' => 'remember')) . $form->label('remember', __('remember.me'), array('style' => 'display: inline')) . $form->submit(NULL, __('login'), array('style' => 'float: right;')) . '</li>';
    echo '</ul>';
} else {
    echo '</ul>';
    echo $form->submit(NULL, __('login'));
}
echo $form->close();
echo '</td><td width="5" style="border-right: 1px solid #DDD;">&nbsp;</td><td><td style="padding-left: 2px; vertical-align: top;">';
$registerEnabled = Kohana::$config->load('useradmin.register_enabled');
if ($registerEnabled || !empty($providers)) {
    echo '<ul>';
    if ($registerEnabled) {
        echo '<li style="height: 61px">' . __('?dont.have.account') . '<br />' . Html::anchor('user/register', __('register.new.account')) . '.</li>';
    }
    if (!empty($providers)) {
        if ($registerEnabled) {
예제 #3
0
 /**
  * Creates a form label.
  *
  * @param   string  target input
  * @param   string  label text
  * @param   array   html attributes
  * @return  string
  */
 public function label($input, $text = NULL, array $attributes = NULL)
 {
     return Kohana_Form::label($input, $text, $attributes);
 }
예제 #4
0
파일: form.php 프로젝트: TdroL/hurtex
 public static function label($input, $text = NULL, array $attributes = NULL)
 {
     return parent::label($input, $text, $attributes) . PHP_EOL;
 }
예제 #5
0
파일: Form.php 프로젝트: eok8177/shopCMS
 /**
  * Creates a form input. If no type is specified, a "text" type input will be returned.
  * Added id attribute.
  *
  *     echo Form::input('username', $username);
  *
  * @param   string  $name       input name
  * @param   string  $value      input value
  * @param   array   $attributes html attributes
  * @param   array   $special
  * @return  string
  * @uses    HTML::attributes
  */
 public static function input($name, $value = NULL, array $attributes = NULL, $special = NULL)
 {
     if (!isset($attributes['id'])) {
         $attributes['id'] = $name;
     }
     if (isset($attributes['type']) and $attributes['type'] == 'hidden') {
         unset($attributes['id']);
     }
     return parent::input($name, $value, $attributes);
 }
예제 #6
0
 /**
  * Creates a checkbox form input.
  *
  * @param   string   input name
  * @param   string   input value
  * @param   boolean  checked status
  * @param   array    html attributes
  * @return  string
  */
 public function checkbox($name, $value = NULL, $checked = FALSE, array $attributes = NULL)
 {
     $attributes['id'] = $name;
     $this->load_values($name, $value, $attributes);
     return Kohana_Form::checkbox($name, $value, $checked, $attributes) . $this->addAlertSpan(isset($this->errors[$name]) ? $this->errors[$name] : NULL, $attributes);
 }
예제 #7
0
파일: Form.php 프로젝트: ariol/adminshop
 public static function checkbox($name, $value = NULL, $checked = FALSE, array $attributes = NULL)
 {
     return '<div style="display: none;">' . form::hidden($name, 0) . '</div>' . parent::checkbox($name, $value, (bool) $checked, $attributes);
 }