Example #1
0
 public function makeDropDown()
 {
     global $data;
     $data = array();
     $parents = TblAmphur::find()->all();
     $data[''] = Yii::t('app', 'Select Amphoe');
     $_lang = \app\components\langs::getLang();
     foreach ($parents as $parent) {
         $data[$parent->id] = $_lang == 'thai' ? $parent->names : $parent->names_eng;
     }
     return $data;
 }
Example #2
0
 public function actionIndex()
 {
     $langs = \app\components\langs::getLang();
     $model = new tblGallery();
     $query = tblGallery::find()->where(['langs' => $langs, 'published' => 0]);
     if ($model->load(Yii::$app->request->post())) {
         $request = Yii::$app->request->post('tblGallery');
         $query->andWhere(['amphur' => $request['amphur']]);
     }
     $query->orderBy('rand()');
     $countQuery = clone $query;
     $pages = new Pagination(['totalCount' => $countQuery->count(), 'defaultPageSize' => 30]);
     $list = $query->offset($pages->offset)->limit($pages->limit)->all();
     return $this->render('index', ['model' => $model, 'list' => $list, 'pages' => $pages]);
 }
Example #3
0
 public function actionIndex($cid = 1)
 {
     $search = new TblGuides();
     $langs = \app\components\langs::getLang();
     $query = TblGuides::find()->where(['cid' => $cid, 'langs' => $langs, 'published' => 1]);
     $amp = Yii::$app->getRequest()->getQueryParam('amp');
     if ($amp) {
         $query->andWhere(['amphur' => $amp]);
     }
     if ($search->load(Yii::$app->request->post())) {
         $request = Yii::$app->request->post('TblGuides');
         $s = $request['search'];
         //$query->orWhere([['LIKE', 'titls', "%$s%"],['LIKE', 'fulltexts', "%$s%"]]);
         //$query->orWhere('LIKE', 'titles', "%$s%");
         $query->andFilterWhere(['or', ['like', 'titles', $s], ['like', 'fulltexts', $s]]);
     }
     $query->orderBy('rand()');
     $countQuery = clone $query;
     $pages = new Pagination(['totalCount' => $countQuery->count(), 'defaultPageSize' => 10]);
     $list = $query->offset($pages->offset)->limit($pages->limit)->all();
     return $this->render('index', ['search' => $search, 'model' => $list, 'cid' => $cid, 'pages' => $pages]);
 }
Example #4
0
 public function searchCalendarAll()
 {
     $arr = array();
     $langs = \app\components\langs::getLang();
     $_lan = [$langs, 'english', 'thai'];
     //ค้นหาข่าวในภาษานั้น ๆ ก่อนถ้าไม่เจอข่าว ให้ค้นหาในภาษาอังกฤษ ภาษาไทย ตามลำดับ
     $cat = ['thai' => 3, 'english' => 8];
     foreach ($_lan as $l) {
         $cid = $cat[$l];
         $query = Article::find()->where(['cid' => $cid, 'langs' => $l, 'published' => 1]);
         $query->orderBy('startdate ASC');
         $result = $query->all();
         //ถ้าเจอข่าวมากกว่า 1 ออกจากการค้นหาข่าว
         if (count($result) > 0) {
             break;
         }
     }
     foreach ($result as $r) {
         $arr[] = array('title' => $r->title, 'start' => $r->startdate, 'end' => $r->finishdate, 'url' => \yii\helpers\Url::to(['site/view', 'id' => $r->id]), 'allDay' => false);
     }
     return $arr;
 }
Example #5
0
                                    <address>
                                        <strong>ที่ตั้ง:</strong><br>
                                        ศูนย์ราชการ ถนนมิตรภาพหนองคาย - อุดรธานี 
                                        ตำบลหนองกอมเกาะ อำเภอเมือง 
                                        จังหวัดหนองคาย 43000
                                    </address>
                                    <abbr title="Phone Number"><strong>Phone:</strong></abbr> 042-412678 ต่อ 46148<br>
                                    <abbr title="Email Address"><strong>Email:</strong></abbr> wilaiwan_tan@moi.go.th
                                </div>
                            </div>
                        </div>

                        <div class="col_one_fifth">

                            <?php 
$ques = \app\models\Menus::find()->where(['parent_id' => 0, 'published' => 1, 'langs' => \app\components\langs::getlang()])->orderBy('ordering');
$rows = $ques->all();
$r = $rows[0];
?>
                            <div class="widget widget_links clearfix">

                                <h4><?php 
echo $r->names;
?>
</h4>
                                <ul>
                                    <?php 
$que = \app\models\Menus::find()->where(['parent_id' => $r->id, 'published' => 1])->orderBy('ordering');
$row = $que->all();
foreach ($row as $s) {
    ?>