/**
  * Convert object to string
  *
  * @access public
  *
  * @return string
  */
 public function __toString()
 {
     $result = [];
     foreach ($this->buttons as $key => $row) {
         $result['{' . $key . '}'] = Html::href(!empty($row['text']) ? $row['text'] : $key, $this->params['link'] . (!empty($row['link']) ? $row['link'] : '/') . $this->params['pKey'], !empty($row['attributes']) ? $row['attributes'] : []);
     }
     return (string) str_replace(array_keys($result), array_values($result), $this->params['template']);
 }
 /**
  * Running widget
  *
  * @access public
  *
  * @return string
  */
 public function run()
 {
     $items = [];
     if ($this->totalPages > 0) {
         for ($i = 1; $i <= $this->totalPages; $i++) {
             $items[] = ['text' => Html::href($i, $this->url . ($i - 1), $this->attributesLink), 'attr' => array_merge($this->attributesElement, $i === (int) $this->currentPage + 1 ? ['class' => 'active'] : [])];
         }
     }
     return Html::lists($items, $this->attributes);
 }
Exemplo n.º 3
0
<?php

/** @var \App\Modules\Blog\Models\Blog $model */
use Micro\Web\Html\Html;
echo Html::href('Назад', '/blog/post');
echo Html::heading(1, $model->name);
echo Html::openTag('p'), $model->content, Html::closeTag('p');
Exemplo n.º 4
0
<?php

use Micro\Web\Html\Html;
use Micro\Web\Language;
/** @var App\Components\View $this */
/** @var array $blogs */
/** @var integer $page */
/** @var Language $lang */
$this->widget('App\\Modules\\Blog\\Widgets\\TopblogsWidget');
echo Html::href('Создать', '/blog/post/create');
?>

<?php 
echo $this->widget('\\Micro\\Widget\\ListViewWidget', ['data' => $blogs, 'page' => $page, 'pathView' => __DIR__ . '/_view.php', 'paginationConfig' => ['url' => '/blog/post/index/']]);
?>

<p><?php 
echo $lang->hello;
?>
</p>