示例#1
0
function drawItem($d)
{
    $html = [];
    $html[] = Html::img(\Yii::$app->assetManager->getBundle('app\\assets\\Maya\\Asset')->baseUrl . "/images/stamp/{$d['stamp']}.jpg", ['height' => 40, 'alt' => \cs\models\Calendar\Maya::$stampRows[$d['stamp'] - 1][0], 'title' => \cs\models\Calendar\Maya::$stampRows[$d['stamp'] - 1][0], 'class' => 'js-stamp']);
    $html[] = Html::tag('span', $d['day'] . '.' . $d['month'], ['class' => 'js-stamp', 'title' => GsssHtml::dateString($d['date'])]);
    $html[] = Html::tag('br');
    $html[] = 'kin: ' . $d['kin'];
    $html[] = $d['nearPortal'] == 0 ? 'п' : '';
    return join('', $html);
}
示例#2
0
 public static function articleItem($row, $category)
 {
     if (!is_array($row)) {
         $id = $row;
         $item = \app\models\Article::find($id);
         if (is_null($item)) {
             return '';
         }
         $row = $item->getFields();
     }
     // Заголовок
     $html[] = Html::tag('div', Html::tag('h4', $row['header']), ['class' => 'header']);
     // ссылка
     $item2 = ['id' => $row['id_string'], 'year' => substr($row['date_insert'], 0, 4), 'month' => substr($row['date_insert'], 5, 2), 'day' => substr($row['date_insert'], 8, 2), 'category' => $category];
     $link = "/category/{$item2['category']}/article/{$item2['year']}/{$item2['month']}/{$item2['day']}/{$item2['id']}";
     // картинка с ссылкой
     $html[] = Html::tag('p', Html::a(Html::img($row['image'], ['width' => '100%', 'class' => 'thumbnail']), $link));
     // Описание
     $content = $row['description'];
     if ($content . '' == '') {
         $content = self::getMiniText($row['content']);
     } else {
         $content = self::getMiniText($content);
     }
     $html[] = Html::tag('p', $content);
     return Html::tag('div', join('', $html), ['class' => 'col-lg-4 articleItem']);
 }