예제 #1
0
            <?php 
$form = ActiveForm::begin(['id' => 'login-form']);
?>


<?php 
echo $form->field($model, 'username')->icon('fa-user')->tooltip('lalala');
?>

                <?php 
echo $form->field($model, 'password')->passwordInput();
?>

                <div style="color: #999; margin: 1em 0">
                    If you forgot your password you can <?php 
echo Html::a('reset it', ['site/request-password-reset']);
?>
.
                </div>

			<div class="form-group">
                    <?php 
echo Html::submitButton('Login', ['class' => 'btn btn-primary', 'name' => 'login-button']);
?>
                </div>

            <?php 
ActiveForm::end();
?>
        </div>
	</div>
예제 #2
0
 /**
  * Formats the value as a hyperlink.
  * @param mixed $value the value to be formatted.
  * @param array $options the tag options in terms of name-value pairs. See [[Html::a()]].
  * @return string the formatted result.
  */
 public function asUrl($value, $options = [])
 {
     if ($value === null) {
         return $this->nullDisplay;
     }
     $url = $value;
     if (strpos($url, '://') === false) {
         $url = 'http://' . $url;
     }
     return Html::a(Html::encode($value), $url, $options);
 }
예제 #3
0
 /**
  * Initializes the default button rendering callbacks.
  */
 protected function initDefaultButtons()
 {
     if (!isset($this->buttons['view'])) {
         $this->buttons['view'] = function ($url, $model, $key) {
             $options = array_merge(['title' => Leaps::t('leaps', 'View'), 'aria-label' => Leaps::t('leaps', 'View'), 'data-pjax' => '0'], $this->buttonOptions);
             return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', $url, $options);
         };
     }
     if (!isset($this->buttons['update'])) {
         $this->buttons['update'] = function ($url, $model, $key) {
             $options = array_merge(['title' => Leaps::t('leaps', 'Update'), 'aria-label' => Leaps::t('leaps', 'Update'), 'data-pjax' => '0'], $this->buttonOptions);
             return Html::a('<span class="glyphicon glyphicon-pencil"></span>', $url, $options);
         };
     }
     if (!isset($this->buttons['delete'])) {
         $this->buttons['delete'] = function ($url, $model, $key) {
             $options = array_merge(['title' => Leaps::t('leaps', 'Delete'), 'aria-label' => Leaps::t('leaps', 'Delete'), 'data-confirm' => Leaps::t('leaps', 'Are you sure you want to delete this item?'), 'data-method' => 'post', 'data-pjax' => '0'], $this->buttonOptions);
             return Html::a('<span class="glyphicon glyphicon-trash"></span>', $url, $options);
         };
     }
 }
예제 #4
0
 /**
  * Renders a page button.
  * You may override this method to customize the generation of page buttons.
  * @param string $label the text label for the button
  * @param integer $page the page number
  * @param string $class the CSS class for the page button.
  * @param boolean $disabled whether this page button is disabled
  * @param boolean $active whether this page button is active
  * @return string the rendering result
  */
 protected function renderPageButton($label, $page, $class, $disabled, $active)
 {
     $options = ['class' => $class === '' ? null : $class];
     if ($active) {
         Html::addCssClass($options, $this->activePageCssClass);
     }
     if ($disabled) {
         Html::addCssClass($options, $this->disabledPageCssClass);
         return Html::tag('li', Html::tag('span', $label), $options);
     }
     $linkOptions = $this->linkOptions;
     $linkOptions['data-page'] = $page;
     return Html::tag('li', Html::a($label, $this->pagination->createUrl($page), $linkOptions), $options);
 }
예제 #5
0
 /**
  * Renders a single breadcrumb item.
  * @param array $link the link to be rendered. It must contain the "label" element. The "url" element is optional.
  * @param string $template the template to be used to rendered the link. The token "{link}" will be replaced by the link.
  * @return string the rendering result
  * @throws InvalidConfigException if `$link` does not have "label" element.
  */
 protected function renderItem($link, $template)
 {
     $encodeLabel = ArrayHelper::remove($link, 'encode', $this->encodeLabels);
     if (array_key_exists('label', $link)) {
         $label = $encodeLabel ? Html::encode($link['label']) : $link['label'];
     } else {
         throw new InvalidConfigException('The "label" element is required for each link.');
     }
     if (isset($link['template'])) {
         $template = $link['template'];
     }
     if (isset($link['url'])) {
         $options = $link;
         unset($options['template'], $options['label'], $options['url']);
         $link = Html::a($label, $link['url'], $options);
     } else {
         $link = $label;
     }
     return strtr($template, ['{link}' => $link]);
 }
예제 #6
0
 /**
  * Generates a hyperlink that links to the sort action to sort by the specified attribute.
  * Based on the sort direction, the CSS class of the generated hyperlink will be appended
  * with "asc" or "desc".
  * 
  * @param string $attribute the attribute name by which the data should be sorted by.
  * @param array $options additional HTML attributes for the hyperlink tag.
  *        There is one special attribute `label` which will be used as the label of the hyperlink.
  *        If this is not set, the label defined in [[attributes]] will be used.
  *        If no label is defined, [[\Leaps\Helper\Inflector::camel2words()]] will be called to get a label.
  *        Note that it will not be HTML-encoded.
  * @return string the generated hyperlink
  * @throws InvalidConfigException if the attribute is unknown
  */
 public function link($attribute, $options = [])
 {
     if (($direction = $this->getAttributeOrder($attribute)) !== null) {
         $class = $direction === SORT_DESC ? 'desc' : 'asc';
         if (isset($options['class'])) {
             $options['class'] .= ' ' . $class;
         } else {
             $options['class'] = $class;
         }
     }
     $url = $this->createUrl($attribute);
     $options['data-sort'] = $this->createSortParam($attribute);
     if (isset($options['label'])) {
         $label = $options['label'];
         unset($options['label']);
     } else {
         if (isset($this->attributes[$attribute]['label'])) {
             $label = $this->attributes[$attribute]['label'];
         } else {
             $label = Inflector::camel2words($attribute);
         }
     }
     return Html::a($label, $url, $options);
 }