예제 #1
0
 /**
  * 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']);
 }
예제 #2
0
 /**
  * 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);
 }
예제 #3
0
<?php

use Micro\web\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>
예제 #4
0
파일: view.php 프로젝트: dp-ifacesoft/micro
<?php

/** @var \App\modules\blog\models\Blog $model */
use Micro\web\Html;
echo Html::href('Назад', '/blog/post');
echo Html::heading(1, $model->name);
echo Html::openTag('p'), $model->content, Html::closeTag('p');