예제 #1
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();
 }
예제 #2
0
<?php

echo \Micro\web\Html::openTag('div', ['class' => 'menu']);
echo implode(' ', $this->menu);
echo \Micro\web\Html::closeTag('div');
예제 #3
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');
 }
예제 #4
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');
예제 #5
0
파일: Form.php 프로젝트: dp-ifacesoft/micro
 /**
  * Render week field row
  *
  * @access public
  *
  * @param IFormModel $model model
  * @param string $property model property
  * @param array $options attribute array
  *
  * @return string
  */
 public function weekFieldRow(IFormModel $model, $property, array $options = [])
 {
     $element = $this->getField($model, $property);
     $options['id'] = $element['id'];
     return Html::openTag('div', $this->getBlock('block', $options)) . Html::label($model->getLabel($property), $element['id'], $this->getBlock('label', $options)) . $this->weekField($model, $property, $options) . Html::closeTag('div');
 }
예제 #6
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;
 }
예제 #7
0
 /**
  * Render form heading
  *
  * @access public
  * @return void
  */
 public function beginRender()
 {
     $this->form = $this->widget->init();
     if (!empty($this->config['legend'])) {
         echo Html::openTag('fieldset');
         echo Html::legend($this->config['legend']);
     }
     if (!empty($this->config['description'])) {
         echo Html::openTag('div', ['class' => 'description']), $this->config['description'], Html::closeTag('div');
     }
     if ($this->model) {
         $errors = $this->getModelErrors();
         if ($errors) {
             echo Html::openTag('div', ['class' => 'errors']);
             foreach ($errors as $error) {
                 echo Html::openTag('div', ['class' => 'error']), $error, Html::closeTag('div');
             }
             echo Html::closeTag('div');
         }
     }
 }
예제 #8
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');