public function actionTrain() { $levelId = Yii::$app->request->get('level_id'); $imgNews = News::getImgRecommendNewsByCategory(3, 5); $teachersCount = Teachers::getTeachersCount(); $trainCount = Train::getTrainCount(); $trainTeachers = Teachers::getAllTeachersForNewsTrain(); $trainWind = News::getTrainWindByLevelId($levelId, 8); $trainLand = TrainLand::getAllDataByCount(4); $data = ['imgNews' => $imgNews, 'teachersCount' => $teachersCount, 'trainTeachers' => $trainTeachers, 'levelId' => $levelId, 'trainWind' => $trainWind, 'trainCount' => $trainCount, 'trainLand' => $trainLand]; return $this->render('train', ['data' => $data]); // return $this->render('build', ['data' => $data]); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = TrainLand::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->andFilterWhere(['id' => $this->id, 'create_time' => $this->create_time, 'update_time' => $this->update_time]); $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'address', $this->address])->andFilterWhere(['like', 'contacts', $this->contacts])->andFilterWhere(['like', 'contact_phone', $this->contact_phone])->andFilterWhere(['like', 'site_type', $this->site_type])->andFilterWhere(['like', 'bus', $this->bus])->andFilterWhere(['like', 'site', $this->site])->andFilterWhere(['like', 'content', $this->content])->andFilterWhere(['like', 'create_user', $this->create_user])->andFilterWhere(['like', 'update_use', $this->update_user]); return $dataProvider; }
echo $val->name; ?> 第<?php echo $val->period_num; ?> 期</td> <td><?php echo \app\models\Train::$categoryList[$val->category]; ?> </td> <td><?php echo $val->begin_time; ?> </td> <td><?php echo \app\models\TrainLand::getNameById($val->train_land_id); ?> </td> <td>招<?php echo $val->recruit_count; ?> 人 ( <b>已录取 <?php echo $val->already_recruit_count; ?> 人</b> )</td> <?php if ($val['status'] == \app\models\Train::BEGIN_SIGN_UP) { ?> <td><b><a href="<?php echo \yii\helpers\Url::to(['/train/apply', 'id' => $val->id]); ?>
</span> 块 | 其它<span> <?php echo \app\models\TrainLand::getAllCountBySiteType(4); ?> </span> 块 ] </div> <h3 class="jjfc_set2"><span class="fl">培训地点分布</span></h3> <div class="box_table1 ClearFix" style="width:100%;float:left;"> <ul class="list_uls1"> <?php foreach (\app\models\TrainLand::$districtList as $key => $val) { ?> <li><a href="javascript:;"><?php echo $val; ?> (<?php echo \app\models\TrainLand::getAllCountByDistrict($key); ?> )</a></li> <?php } ?> </ul> </div> <div style="clear:both;height:1px;"></div> <h3 class="jjfc_set1"><span class="fl">培训地点列表</span></h3> <ul class="ClearFix h390"> <?php if (!empty($data['models'])) { ?> <?php foreach ($data['models'] as $key => $val) {
public function actionView() { $id = Yii::$app->request->get('id'); $trainLandInfo = TrainLand::findOne($id); return $this->render('view', ['trainLandInfo' => $trainLandInfo]); }
echo $val['name']; ?> 第<?php echo $val['period_num']; ?> 期</a></td> <td><?php echo \app\models\Train::getCategoryName($val['category']); ?> </td> <td><?php echo date('Y年m月d日', strtotime($val['begin_time'])); ?> </td> <td><?php echo \app\models\TrainLand::getNameById($val['train_land_id']); ?> </td> <td> <b class="<?php if ($val['status'] == \app\models\TrainUsers::NO_APPROVED || $val['status'] == \app\models\TrainUsers::SIGN) { ?> red<?php } elseif ($val['status'] == \app\models\TrainUsers::END) { ?> gray<?php } else { ?> green<?php } ?>
<?php if (!$model->isNewRecord) { ?> <div class="form-group field-train-category required"> <label for="train-category" class="control-label">培训班次</label> <input type="text" style="width:300px" value="<?php echo $model['code']; ?> " name="Train[name]" disabled class="form-control" id="train-name"> <div class="help-block"></div> </div> <?php } ?> <?php echo $form->field($model, 'train_land_id')->dropDownList(\app\models\TrainLand::getAll(), ['style' => 'width:300px']); ?> <?php echo $form->field($model, 'level_id')->dropDownList(ArrayHelper::map(\app\models\Level::getAll(), 'id', 'name'), ['style' => 'width:100px']); ?> <?php echo $form->field($model, 'recruit_count')->dropDownList(\app\models\Train::getRecruitCount(), ['style' => 'width:100px']); ?> <?php if ($model->isNewRecord) { ?> <?php echo $form->field($model, 'sign_up_begin_time')->widget(DatePicker::className(), ['dateFormat' => 'yyyy-MM-dd', 'options' => ['style' => '500px']]);
/** * Finds the TrainLand model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return TrainLand the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = TrainLand::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }