/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = ActivityCategory::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', 'create_user', $this->create_user])->andFilterWhere(['like', 'update_user', $this->update_user]); return $dataProvider; }
/* @var $model app\models\Activity */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="activity-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'name')->textInput(['style' => 'width:300px']); ?> <?php echo $form->field($model, 'category')->dropDownList(\app\models\ActivityCategory::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')->textInput(['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']]);
echo $data['activityModel']['recruit_count']; ?> </b>人 | 录取<b class="blue"><?php echo \app\models\ActivityUsers::getRecruitCount($data['trainModel']['train_id']); ?> </b>人 | 结业<b class="blue"><?php echo \app\models\TrainUsers::getPassCount($data['trainModel']['train_id']); ?> </b>人</td> </td> <td><?php echo date('Y-m-d', strtotime($data['activityModel']['sign_up_end_time'])); ?> </td> <td><?php echo \app\models\ActivityCategory::getNameById($data['activityModel']['category']); ?> </td> <td><?php echo date('Y-m-d', strtotime($data['activityModel']['begin_time'])); ?> 至<?php echo date('Y-m-d', strtotime($data['activityModel']['end_time'])); ?> </td> <td><b class="<?php if ($data['activityModel']['user_status'] == \app\models\ActivityUsers::NO_APPROVED) { ?> red<?php } elseif ($data['activityModel']['user_status'] == \app\models\ActivityUsers::END) { ?>
foreach ($data['activityListF'] as $key => $val) { ?> <tr> <td><?php echo $key + 1; ?> </td> <td><a href="<?php echo \yii\helpers\Url::to(['/user-center/my-activity-view', 'activityUserId' => $val['id']]); ?> "><?php echo $val['name']; ?> </a></td> <td><?php echo \app\models\ActivityCategory::getNameById($val['category']); ?> </td> <td><?php echo $val['begin_time']; ?> </td> <td><?php echo $val['address']; ?> </td> <td><?php echo $val['lesson']; ?> </td> <td><?php
/** * Finds the ActivityCategory model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return ActivityCategory the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = ActivityCategory::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }