Exemple #1
0
<?php

use Micro\Web\Html\Html;
/** @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>
 /**
  * Initialize widget
  *
  * @access public
  *
  * @return Form
  */
 public function init()
 {
     $this->attributes['type'] = $this->type;
     echo Html::beginForm($this->action, $this->method, $this->attributes);
     return new Form();
 }
Exemple #3
0
<?php

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

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

<?php 
echo \Micro\Web\Html\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\Html::submitButton('Обновить');
?>
</p>
<?php 
echo \Micro\Web\Html\Html::endForm();
 /**
  * Render filters
  *
  * @access protected
  *
  * @return null|string
  * @throws Exception
  */
 protected function renderFilters()
 {
     if (!$this->filters) {
         return null;
     }
     /** @var array $filtersData */
     $query = (new RequestInjector())->build()->getQueryParams();
     $filtersData = array_key_exists($this->filterPrefix, $query) ? $query[$this->filterPrefix] : null;
     $result = Html::beginForm(null, 'get', $this->attributesFilterForm);
     $result .= Html::openTag('tr', $this->attributesFilter);
     foreach ($this->tableConfig as $key => $row) {
         $result .= Html::openTag('td', $row['attributesFilter']);
         if (array_key_exists('filter', $row) && $row['filter'] === false) {
             continue;
         }
         if (!empty($row['filter'])) {
             $result .= $row['filter'];
         } else {
             $buffer = is_array($row) ? $key : $row;
             $fieldName = $this->filterPrefix . '[' . $buffer . ']';
             $fieldId = $this->filterPrefix . '_' . $buffer;
             $val = !empty($filtersData[$buffer]) ? $filtersData[$buffer] : '';
             $result .= Html::textField($fieldName, $val, ['id' => $fieldId]);
         }
         $result .= Html::closeTag('td');
     }
     return $result . Html::closeTag('tr') . Html::endForm();
 }