Exemple #1
0
 public static function checkbox($name, $value = NULL, $checked = FALSE, array $attributes = NULL)
 {
     if (!isset($attributes['id']) and self::$auto_id) {
         $attributes['id'] = 'field-' . $name . '-' . url::title($value);
     }
     return parent::checkbox($name, $value, $checked, $attributes) . PHP_EOL;
 }
Exemple #2
0
 /**
  * Creates a checkbox form input.
  * @param string $name
  * @param null $value
  * @param bool $checked
  * @param array $attributes
  * @return string
  */
 public static function checkbox($name, $value = null, $checked = false, array $attributes = null)
 {
     if (isset($attributes['uncheck'])) {
         // Add a hidden field so that if the radio button is not selected, it still submits a value
         $hidden = Form::hidden($name, $attributes['uncheck']);
         unset($attributes['uncheck']);
     } else {
         $hidden = '';
     }
     return $hidden . parent::checkbox($name, $value, $checked, $attributes);
 }
Exemple #3
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) {
Exemple #4
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)
 {
     $this->load_values($name, $value, $attributes);
     return '<li>' . Kohana_Form::checkbox($name, $value, $checked, $attributes) . $this->addAlertSpan(isset($this->errors[$name]) ? $this->errors[$name] : NULL, $attributes) . '</li>';
 }
 /**
  * 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)
 {
     $this->load_values($name, $value, $attributes);
     $result = '<li>' . Kohana_Form::checkbox($name, $value, $checked, $attributes);
     // add error span
     if (isset($this->errors[$name])) {
         $result .= '<span class="' . $this->error_class . '">' . ucfirst($this->errors[$name]) . '</span>';
     } else {
         if (isset($attributes['info'])) {
             // else add info span
             $result .= '<span class="' . $this->info_class . '">' . $attributes['info'] . '</span>';
         }
     }
     $result .= '</li>';
     return $result;
 }
Exemple #6
0
 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);
 }