コード例 #1
0
 protected function findModel($id)
 {
     if (($model = Services::find()->where(['id' => $id])->one()) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('Запрошенная страница не найдена.');
     }
 }
コード例 #2
0
ファイル: SiteController.php プロジェクト: alexanderkuz/stoi
 public function actionIndex()
 {
     /*  $dataProvider = new ActiveDataProvider([
             'query' => Categories::find()->where(['id_parent'=>0]),
             /*'pagination' => [
                 'pageSize' => 10,
             ],
             'pagination' => false,
         ]);*/
     $dataProvider = new ActiveDataProvider(['query' => Services::find()->where(['active' => Services::ACTIVE, 'parent_id' => 0])->orderBy('sort asc'), 'pagination' => false]);
     return $this->render('index', ['dataProvider' => $dataProvider]);
 }
コード例 #3
0
ファイル: ServicesSearch.php プロジェクト: alexanderkuz/stoi
 public function search2($params, $id)
 {
     $query = Services::find();
     $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['sort' => SORT_ASC]]]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'parent_id' => $id, 'sort' => $this->sort, 'created_date' => $this->created_date, 'updated_date' => $this->updated_date]);
     $query->andFilterWhere(['like', 'type', $this->type])->andFilterWhere(['like', 'active', $this->active])->andFilterWhere(['like', 'code', $this->code])->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'picture', $this->picture])->andFilterWhere(['like', 'path_picture', $this->path_picture])->andFilterWhere(['like', 'preview_text', $this->preview_text])->andFilterWhere(['like', 'detail_text', $this->detail_text])->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'keywords', $this->keywords])->andFilterWhere(['like', 'description', $this->description]);
     return $dataProvider;
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Services::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->where('service_status=\'Y\'');
     $query->andFilterWhere(['service_id' => $this->service_id, 'service_price' => $this->service_price]);
     $query->andFilterWhere(['like', 'service_name', $this->service_name])->andFilterWhere(['like', 'service_status', $this->service_status]);
     return $dataProvider;
 }
コード例 #5
0
 /**
  * Lists all Services models.
  * @return mixed
  */
 public function actionIndex($id = 0)
 {
     if ($id == 0) {
         $count = 1;
     } else {
         $count = Services::find()->where(['id' => $id, 'type' => 'catalog'])->count();
     }
     if ($count != 0) {
         $searchModel = new ServicesSearch();
         $dataProvider = $searchModel->search2(Yii::$app->request->queryParams, $id);
         $Services = Services::getParentID($id);
         return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'id' => $id, 'Services' => $Services]);
     } else {
         throw new NotFoundHttpException(Yii::t('app', 'The requested page does not exist.'));
     }
 }
コード例 #6
0
 /**
  * Lists all Services models.
  * @return mixed
  */
 public function actionIndex()
 {
     $dataProvider = new ActiveDataProvider(['query' => Services::find()]);
     return $this->render('index', ['dataProvider' => $dataProvider]);
 }
コード例 #7
0
echo date('d/m/Y', strtotime($model->trans_date));
?>
" type="text" class="form-control datepicker" id="transactions-trans_date" name="Transactions[trans_date]"/>
					</div>
				</div>
			</div>
		</div>
		
		<div class="col-md-6">
			<div class="row">
				<div class="col-md-12">
					<div class="form-group required">
						<label class="col-sm-3 control-label required" for="itemcode">Pilih Layanan</label>
						<div class="col-sm-9">
							<?php 
$services = Services::find()->all();
?>
							<select id="itemcode" class="form-control select2" name="itemcode">
								<option value="">Pilih Layanan</option>
								<?php 
foreach ($services as $s) {
    ?>
									<option price="<?php 
    echo $s->service_price;
    ?>
" value="<?php 
    echo $s->service_id;
    ?>
"><?php 
    echo $s->service_name;
    ?>