public function actionPrint()
 {
     $id = Yii::$app->request->get('id');
     $model = Project::find()->where(['id' => $id])->one();
     if ($id == '' || $model === null) {
         echo '找不到该数据!';
         Yii::$app->end();
     }
     $group = Group::find()->where(['user_id' => $model->user_id])->one();
     return $this->render('print', ['model' => $model, 'group' => $group]);
 }
Exemple #2
0
 public function search()
 {
     $page = Yii::$app->request->get('page', 0);
     $page = $page < 0 ? 0 : $page - 1;
     $limit = Yii::$app->request->get('limit', 25);
     $sorts = json_decode(trim(Yii::$app->request->get('sort')), true);
     $username = Yii::$app->request->get('username');
     $status = Yii::$app->request->get('status');
     $query = Group::find()->joinWith(['user', 'type'])->filterWhere(['username' => $username, 'status' => $status]);
     $countQuery = clone $query;
     $pagination = new Pagination(['totalCount' => $countQuery->count(), 'pageSize' => $limit]);
     if ($sorts != null) {
         foreach ($sorts as $sort) {
             $query->addOrderBy([$sort['property'] => $sort['direction'] == 'ASC' ? SORT_ASC : SORT_DESC]);
         }
     } else {
         $query->addOrderBy(['id' => SORT_DESC]);
     }
     //var_dump($query);exit;
     $model = $query->offset($pagination->offset)->limit($limit)->all();
     return ['count' => $countQuery->count(), 'model' => $model];
 }
 public function actionPrint()
 {
     $id = Yii::$app->request->get('id');
     $model = Group::find()->where(['`' . Group::tableName() . '`.id' => $id])->joinWith(['label', 'type', 'estimate'])->one();
     if ($id == '' || $model === null) {
         echo '找不到该数据!';
         Yii::$app->end();
     }
     return $this->render('print', ['model' => $model]);
 }