Пример #1
0
 /**
  * Running widget
  *
  * @access public
  *
  * @return void
  */
 public function run()
 {
     $result = Html::endForm();
     if ($this->client) {
         $result .= Html::script($this->client);
     }
     echo $result;
 }
Пример #2
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']);
 }
Пример #3
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);
 }
Пример #4
0
 public function actionError()
 {
     $result = null;
     /** @var \Micro\base\Exception $error */
     if ($error = $this->container->request->post('error')) {
         $result .= Html::heading(3, $error->getMessage(), ['class' => 'text-danger bg-danger']);
     }
     $v = new View($this->container);
     $v->data = $result ?: 'undefined error';
     return $v;
 }
Пример #5
0
<?php

echo \Micro\web\Html::heading(1, 'Hello, world!');
Пример #6
0
<html>
<head>
    <?php 
echo Html::charset('utf-8');
?>
    <?php 
echo Html::meta('language', 'ru');
?>
    <?php 
echo Html::favicon('/favicon.ico');
?>
    <?php 
echo Html::meta('viewport', 'width=device-width, initial-scale=1.0');
?>
    <?php 
echo Html::title($this->title);
?>
</head>
<body>
<div id="container">
    <div id="top">
        <span><?php 
echo $this->container->company;
?>
</span> <?php 
echo $this->container->slogan;
?>
    </div>
    <div id="content">
        <?php 
echo $this->widget('\\App\\widgets\\MenubarWidget', ['links' => $this->menu]);
Пример #7
0
 /**
  * Finish form render
  *
  * @access public
  * @return void
  */
 public function endRender()
 {
     if (!empty($this->config['legend'])) {
         echo Html::closeTag('fieldset');
     }
     $this->widget->run();
 }
Пример #8
0
 /**
  * Get elements
  *
  * @access protected
  *
  * @return string
  */
 protected function getElements()
 {
     if (!$this->rows) {
         return Html::openTag('div', $this->attributesEmpty) . $this->emptyText . Html::closeTag('div');
     }
     ob_start();
     echo Html::openTag('ul', $this->attributes);
     /** @noinspection PhpUnusedLocalVariableInspection */
     foreach ($this->rows as $element) {
         echo Html::openTag('li', $this->attributesElement);
         /** @noinspection PhpIncludeInspection */
         include $this->pathView;
         echo Html::closeTag('li');
     }
     echo Html::closeTag('ul');
     return ob_get_clean();
 }
Пример #9
0
<?php

echo \Micro\web\Html::heading(2, 'Одно или несколько регистрационных полей заполнены неверно.');
Пример #10
0
<?php

echo \Micro\web\Html::openTag('div', ['class' => 'menu']);
echo implode(' ', $this->menu);
echo \Micro\web\Html::closeTag('div');
Пример #11
0
<?php

use Micro\web\Html;
return ['description' => Html::heading(2, 'Входилка'), 'elements' => ['login' => ['type' => 'textFieldRow'], 'password' => ['type' => 'passwordFieldRow']], 'buttons' => ['login' => ['type' => 'submit', 'label' => 'Войти']]];
Пример #12
0
<?php

use Micro\web\Html;
/** @var App\components\View $this */
/** @var App\models\User $model */
echo Html::heading(2, 'Регистрация');
/** @var \Micro\form\Form $form */
$form = $this->beginWidget('\\Micro\\widget\\FormWidget', ['method' => 'post', 'action' => '/register/post', 'client' => $model->getClient()]);
echo $form->textFieldRow($model, 'email');
echo $form->textFieldRow($model, 'login');
echo $form->passwordFieldRow($model, 'pass');
echo $form->textFieldRow($model, 'fio');
echo Html::submitButton('Зарегистрироваться');
$this->endWidget('\\Micro\\widget\\FormWidget');
Пример #13
0
 /**
  * Render rows
  *
  * @access protected
  *
  * @return null|string
  */
 protected function renderRows()
 {
     $result = null;
     if (0 === count($this->rows)) {
         return Html::openTag('tr') . Html::openTag('td', ['cols' => count($this->fields)]) . $this->emptyText . Html::closeTag('td') . Html::closeTag('tr');
     }
     foreach ($this->rows as $data) {
         $result .= Html::openTag('tr');
         foreach ($this->tableConfig as $key => $row) {
             $result .= Html::openTag('td', $row['attributes']);
             if (!empty($row['class']) && is_subclass_of($row['class'], '\\Micro\\widget\\GridColumn')) {
                 $primaryKey = $data->{!empty($row['key']) ? $row['key'] : 'id'};
                 $result .= (string) new $row['class']($row + ['str' => null === $data ?: $data, 'pKey' => $primaryKey]);
             } elseif (!empty($row['value'])) {
                 $result .= eval('return ' . $row['value'] . ';');
             } else {
                 $result .= property_exists($data, $key) ? $data->{$key} : null;
             }
             $result .= Html::closeTag('td');
         }
         $result .= Html::closeTag('tr');
     }
     return $result;
 }
Пример #14
0
/** @var \App\modules\Blog\models\Blog $model */
echo Html::beginForm('');
?>

    <div class="row">
        <?php 
echo Html::label('Название');
?>
        <?php 
echo Html::textField('Blog[name]', $model->name, ['required' => true]);
?>
    </div>

    <div class="row">
        <?php 
echo Html::label('Описание');
?>
        <?php 
echo Html::textArea('Blog[content]', $model->content, ['required' => true]);
?>
    </div>

    <div class="row actions">
        <?php 
echo Html::submitButton($model->isNewRecord() ? 'Создать' : 'Обновить');
?>
    </div>

<?php 
echo Html::endForm();
Пример #15
0
<?php

use Micro\web\Html;
/** @var \App\components\View $this */
$this->title .= ' - Главная';
echo Html::heading(1, 'Simple app');
echo Html::openTag('p');
?>
This site is a simple<?php 
echo Html::closeTag('p');
Пример #16
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>
Пример #17
0
 /**
  * Render week field tag
  *
  * @access public
  *
  * @param IFormModel $model model
  * @param string $property model property
  * @param array $options attributes array
  *
  * @return string
  */
 public function weekField(IFormModel $model, $property, array $options = [])
 {
     $element = $this->getField($model, $property);
     $options['id'] = $element['id'];
     return Html::weekField($element['name'], $element['value'], $options);
 }
Пример #18
0
 /**
  * Run drawing
  *
  * @access public
  *
  * @return void
  */
 public function run()
 {
     $result = Html::openTag('dl', $this->attributes);
     foreach ($this->columns as $key => $val) {
         $result .= Html::openTag('dt', $this->attributesElement);
         $result .= $val['title'];
         $result .= Html::closeTag('dt');
         $result .= Html::openTag('dd', $this->attributesValue);
         $buffer = '';
         /** @noinspection DegradedSwitchInspection */
         switch ($val['type']) {
             case 'raw':
                 /** @noinspection OnlyWritesOnParameterInspection */
                 /** @noinspection PhpUnusedLocalVariableInspection */
                 $data = $this->data;
                 // for eval
                 $buffer .= eval('return ' . $val['value']);
                 break;
             default:
                 if (property_exists($this->data, $val['value'])) {
                     $buffer .= htmlspecialchars($this->data->{$val['value']});
                 } else {
                     $buffer .= htmlspecialchars($val['value']);
                 }
         }
         $result .= (strlen($buffer) ? $buffer : '&nbsp;') . Html::closeTag('dd');
     }
     echo $result, Html::closeTag('dl');
 }
Пример #19
0
<?php

/** @var \App\models\User $user */
?>

    <h1>Личный кабинет (<?php 
echo $user->login;
?>
)
        <small><?php 
echo $user->fio;
?>
</small>
    </h1>

<?php 
echo \Micro\web\Html::beginForm('', 'post', ['name' => 'Setup_form']);
?>
    <p><label for="Setup_fio">ФИО</label><input id="Setup_fio" type="text" name="Setup[fio]"/></p>

    <p><label for="Setup_pass">Новый пароль</label><input id="Setup_pass" type="password" name="Setup[pass]"/></p>

    <p><?php 
echo \Micro\web\Html::submitButton('Обновить');
?>
</p>
<?php 
echo \Micro\web\Html::endForm();
Пример #20
0
<?php

/** @var \Micro\mvc\models\Model $model */
echo \Micro\web\Html::heading(1, 'Создание статьи');
echo $this->renderPartial('_form');
Пример #21
0
 /**
  * Insert styles and scripts into cache
  *
  * @access protected
  *
  * @param string $cache cache of generated page
  *
  * @return string
  */
 protected function insertStyleScripts($cache)
 {
     $heads = '';
     $ends = '';
     $result = '';
     foreach ($this->styleScripts as $element) {
         if ($element['isHead']) {
             $heads .= $element['body'];
         } else {
             $ends .= $element['body'];
         }
     }
     $positionHead = strpos($cache, Html::closeTag('head'));
     $positionBody = strpos($cache, Html::closeTag('body'), $positionHead);
     $result .= substr($cache, 0, $positionHead);
     $result .= $heads;
     $result .= substr($cache, $positionHead, $positionBody);
     $result .= $ends;
     $result .= substr($cache, $positionHead + $positionBody);
     return $result;
 }
Пример #22
0
<?php

echo \Micro\web\Html::heading(2, 'Регистрация удачно завершена.');
Пример #23
0
<?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');