コード例 #1
0
ファイル: GridViewWidget.php プロジェクト: dp-ifacesoft/micro
 /**
  * Render filters
  *
  * @access protected
  *
  * @return null|string
  */
 protected function renderFilters()
 {
     if (!$this->filters) {
         return null;
     }
     /** @var array $filtersData */
     $filtersData = $this->container->request->query($this->filterPrefix);
     $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();
 }
コード例 #2
0
ファイル: Form.php プロジェクト: dp-ifacesoft/micro
 /**
  * Render text field tag
  *
  * @access public
  *
  * @param IFormModel $model model
  * @param string $property model property
  * @param array $options attributes array
  *
  * @return string
  */
 public function textField(IFormModel $model, $property, array $options = [])
 {
     $element = $this->getField($model, $property);
     $options['id'] = $element['id'];
     return Html::textField($element['name'], $element['value'], $options);
 }
コード例 #3
0
ファイル: _form.php プロジェクト: dp-ifacesoft/micro
<?php

use Micro\web\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>