Esempio n. 1
0












<div class="site-login">
	<h1><?php 
echo Html::encode($this->title);
?>
</h1>

	<p>Please fill out the following fields to login:</p>

	<div class="row">
		<div class="col-lg-5">
            <?php 
$form = ActiveForm::begin(['id' => 'login-form']);
?>


<?php 
echo $form->field($model, 'username')->icon('fa-user')->tooltip('lalala');
?>
Esempio n. 2
0
 /**
  * Normalizes the [[items]] property to remove invisible items and activate certain items.
  * @param array $items the items to be normalized.
  * @param boolean $active whether there is an active child menu item.
  * @return array the normalized menu items
  */
 protected function normalizeItems($items, &$active)
 {
     foreach ($items as $i => $item) {
         if (isset($item['visible']) && !$item['visible']) {
             unset($items[$i]);
             continue;
         }
         if (!isset($item['label'])) {
             $item['label'] = '';
         }
         $encodeLabel = isset($item['encode']) ? $item['encode'] : $this->encodeLabels;
         $items[$i]['label'] = $encodeLabel ? Html::encode($item['label']) : $item['label'];
         $hasActiveChild = false;
         if (isset($item['items'])) {
             $items[$i]['items'] = $this->normalizeItems($item['items'], $hasActiveChild);
             if (empty($items[$i]['items']) && $this->hideEmptyItems) {
                 unset($items[$i]['items']);
                 if (!isset($item['url'])) {
                     unset($items[$i]);
                     continue;
                 }
             }
         }
         if (!isset($item['active'])) {
             if ($this->activateParents && $hasActiveChild || $this->activateItems && $this->isItemActive($item)) {
                 $active = $items[$i]['active'] = true;
             } else {
                 $items[$i]['active'] = false;
             }
         } elseif ($item['active']) {
             $active = true;
         }
     }
     return array_values($items);
 }
Esempio n. 3
0
 /**
  * @inheritdoc
  */
 protected function renderHeaderCellContent()
 {
     if ($this->header !== null || $this->label === null && $this->attribute === null) {
         return parent::renderHeaderCellContent();
     }
     $provider = $this->grid->dataProvider;
     if ($this->label === null) {
         if ($provider instanceof ActiveDataProvider && $provider->query instanceof ActiveQueryInterface) {
             /* @var $model Model */
             $model = new $provider->query->modelClass();
             $label = $model->getAttributeLabel($this->attribute);
         } else {
             $models = $provider->getModels();
             if (($model = reset($models)) instanceof Model) {
                 /* @var $model Model */
                 $label = $model->getAttributeLabel($this->attribute);
             } else {
                 $label = Inflector::camel2words($this->attribute);
             }
         }
     } else {
         $label = $this->label;
     }
     if ($this->attribute !== null && $this->enableSorting && ($sort = $provider->getSort()) !== false && $sort->hasAttribute($this->attribute)) {
         return $sort->link($this->attribute, array_merge($this->sortLinkOptions, ['label' => $this->encodeLabel ? Html::encode($label) : $label]));
     } else {
         return $this->encodeLabel ? Html::encode($label) : $label;
     }
 }
Esempio n. 4
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);
 }
Esempio n. 5
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     if (!isset($this->options['id'])) {
         $this->options['id'] = $this->getId();
     }
     if ($this->requiresPjax()) {
         ob_start();
         ob_implicit_flush(false);
         $view = $this->getView();
         $view->clear();
         $view->beginPage();
         $view->head();
         $view->beginBody();
         if ($view->title !== null) {
             echo Html::tag('title', Html::encode($view->title));
         }
     } else {
         echo Html::beginTag('div', $this->options);
     }
 }
Esempio n. 6
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]);
 }