Example #1
0
 public function insert($fieldsCols = null)
 {
     $row = parent::insert(['beforeInsert' => function ($fields) {
         $fields['date_insert'] = gmdate('YmdHis');
         $fields['id_string'] = Str::rus2translit($fields['header']);
         $fields['date'] = gmdate('Y-m-d');
         return $fields;
     }]);
     $item = new \app\models\Article($row);
     $fields = [];
     if ($this->is_add_image) {
         $fields = ['content' => Html::tag('p', Html::img(\cs\Widget\FileUpload2\FileUpload::getOriginal($item->getImage()), ['class' => 'thumbnail', 'style' => 'width:100%;', 'alt' => $item->getField('header')])) . $item->getField('content')];
     }
     if ($item->getField('description', '') == '') {
         $fields['description'] = GsssHtml::getMiniText($item->getField('content', ''));
     }
     $item->update($fields);
     return $item;
 }
Example #2
0
<div class="intro">
        <?php 
echo $this->title;
?>
</div>

<!-- Begin Blog Grid -->
<div class="blog-wrap">
    <!-- Begin Blog -->
    <div class="blog-grid">

        <?php 
foreach ($list as $item) {
    ?>
            <?php 
    $article = new \app\models\Article($item);
    ?>
            <?php 
    if ($article->getField('video')) {
        ?>
                <div class="post format-video box">
                    <div class="video frame">
                        <iframe width="100%" height="281" src="<?php 
        echo $article->getField('video');
        ?>
"
                                frameborder="0" allowfullscreen></iframe>
                    </div>
                    <h2 class="title"><a href="<?php 
        echo $article->getLink();
        ?>
Example #3
0
        <div id="slider-arrow-left"><i class="icon-angle-left"></i></div>
        <div id="slider-arrow-right"><i class="icon-angle-right"></i></div>
    </div>
    <a href="#" data-scrollto="#content" data-offset="100" class="dark one-page-arrow"><i class="icon-angle-down infinite animated fadeInDown"></i></a>

</section>

<!-- Content
            ============================================= -->
<section id="content">

    <div class="content-wrap">
        <div class="container clearfix">

        <?php 
$Welcome = app\models\Article::find()->where(['cid' => 11, 'published' => 1])->limit(1)->all();
foreach ($Welcome as $r) {
    $cont = new app\components\Ncontent($r->fulltexts);
    $txt = trim($cont->getLimitText());
    $allImg = $cont->getAllImg();
    $secondImg = $allImg[1][1];
    ?>
            <div class="row clearfix">
                <div class="col-lg-6">
                    <div class="topmargin">
                        <h1><?php 
    echo Yii::t('app', 'Welcome');
    ?>
</h1>
                    </div>
                    <p class="lead" style="word-wrap: break-word;"><?php 
Example #4
0
                <?php 
echo Html::resetButton('<i class="glyphicon glyphicon-remove"></i> ยกเลิก', ['class' => 'btn']);
?>
            </div>
        </div>
    </div>
    <br/>
    <div class="dashboard_box" style="padding-top: 15px;">
        <div class="row">
            <div class="col-sm-8">
                <?php 
echo $form->field($model, 'names')->input('text');
?>
                <?php 
if ($type == 'article') {
    echo $form->field($model, 'urls')->widget(Select2::classname(), ['data' => array_merge(["" => ""], app\models\Article::makeLink($model->langs)), 'options' => ['placeholder' => 'เลือกเนื้อหาเว็บไซต์ หรือ บทความ', 'class' => 'form-control'], 'pluginOptions' => ['allowClear' => true]]);
} else {
    if ($type == 'links') {
        echo $form->field($model, 'urls')->input('text', ['placeholder' => 'เช่น http://www.nongkhai.go.th']);
    }
}
?>
                <?php 
echo $form->field($model, 'description')->textarea();
?>
            </div>
            <div class="col-sm-4">
                <?php 
echo $form->field($model, 'langs')->dropDownList(\app\models\tblLangs::makeDropDown(), ['style' => 'width: 150px;']);
echo $form->field($model, 'type')->widget(Select2::classname(), ['data' => \app\models\TblMenutype::makeDropDown($model->langs), 'hideSearch' => true, 'options' => ['placeholder' => 'เลือก...', 'class' => 'form-control ', 'multiple' => false, 'style' => 'width: 98%;']]);
echo $form->field($model, 'parent_id')->widget(DepDrop::classname(), ['type' => DepDrop::TYPE_SELECT2, 'data' => [$model->parent_id => ''], 'options' => ['style' => 'width: 98%;'], 'select2Options' => ['hideSearch' => true], 'pluginOptions' => ['depends' => [Html::getInputId($model, 'type')], 'placeholder' => 'เลือก...', 'url' => Url::to(["getsubmenu"]), 'initialize' => true]]);
Example #5
0
       
            <h4>
                <strong><?php 
echo Html::encode($this->title);
?>
</strong></h4>
        </div>
        <div class="col-md-3" align="right">
            <a href="/download/<?php 
echo $article->id;
?>
" class="btn btn-success"><i class="fa fa-fw fa-download"></i> Download PDF</a>

            <?php 
if (!Yii::$app->user->isGuest) {
    $user = app\models\Article::findOne($article->id)->user;
    if (Yii::$app->user->identity->id == $user->id) {
        echo Html::a('<i class="fa fa-fw fa-ban"></i> Delete', ['delete', 'id' => $article->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => 'Are you sure you want to delete this item?', 'method' => 'post']]);
    }
}
?>

        </div>
    </div></div>
    <div class="panel-body">
   
  
    <div class="row post-content">
        <div class="col-md-12 thumbnail-image" title="<?php 
echo $article->image_tag;
?>
Example #6
0
@extends('layouts')

<?php 
$row = app\models\Article::find(9);
?>
@section('content')
<div class="row" style="min-height:500px">
	<div class="col-md-12">
		<h1>{{$row->title}}</h1>
		<div class="col-md-12" style="background:#eee;border-radius:8px">
			<p>{{$row->description}}</p>
		</div>
	</div>
</div>	
@stop