public function actionList() { $canPublishNews = Yii::$app->user->can('tpbs.pond.approve'); $request = Yii::$app->request; $op = $request->post('op', ''); if (empty($op)) { $op = $request->get('op', ''); } switch ($op) { case 'delete': $this->pondDelete(); break; } $status = $request->post('status', ''); if (empty($status)) { $status = $request->get('status', ''); } $pondType = $request->post('pondType', 0); if (empty($pondType)) { $pondType = $request->get('pondType', 0); } $categoryId = $request->post('categoryId', 0); if (empty($categoryId)) { $categoryId = $request->get('categoryId', 0); } $dateStart = $request->post('dateStart', 0); if (empty($dateStart)) { $dateStart = $request->get('dateStart', 0); } $dateEnd = $request->post('dateEnd', 0); if (empty($dateEnd)) { $dateEnd = $request->get('dateEnd', 0); } $order = $request->post('order', 0); if (empty($order)) { $order = $request->get('order', 0); } $q = $request->post('q', ''); if (empty($q)) { $q = $request->get('q', ''); } $query = pond::find(); if (!empty($status)) { $query->andWhere('status=:status', [':status' => $status]); } if (!empty($pondType)) { $query->andWhere('type=:type', [':type' => $pondType]); } if (!empty($datetStart) && empty($datetEnd)) { $query->andWhere(['LIKE', 'createTime', $datetStart]); } if (!empty($dateStart) && !empty($dateEnd)) { $query->andWhere(['between', 'createTime', $dateStart, $dateEnd]); } if (!empty($categoryId) && $categoryId != 0) { switch ($pondType) { case pond::TYPE_ONLINE_NEWS: $type = 'news'; break; case pond::TYPE_ARTICLE: $type = 'column'; break; default: $type = 'news'; break; } $node = CategoryTree::getNode($categoryId); $query->andWhere(['in', 'categoryId', $node->getChildren($type, true)]); } if ($op == "search") { if (!empty($_REQUEST['type'])) { $type = $_REQUEST['type']; if ($type != 0) { $query->andWhere('type=:type', [':type' => $type]); } } if (!empty($_REQUEST['q'])) { $item = $_REQUEST['q']; $query->andWhere(['LIKE', 'title', '%' . $item . '%', false]); } } $query->orderBy('lastUpdateTime DESC'); if (!empty($q)) { $query->andWhere(['LIKE', 'title', $q]); } $pagination = new Pagination(['defaultPageSize' => Yii::$app->params['ui']['defaultPageSize'], 'totalCount' => $query->count()]); $query->offset($pagination->offset); $query->limit($pagination->limit); $lst = $query->all(); $pagination->params = ['page' => $pagination->page, 'status' => $status, 'pondType' => $pondType, 'categoryId' => $categoryId, 'order' => $order, 'q' => $q]; $arrUserId = []; $arrUser = []; $arrPond = []; if ($lst) { foreach ($lst as $fields) { if ($fields->lastUpdateBy) { array_push($arrUserId, $fields->lastUpdateBy); } else { array_push($arrUserId, $fields->createBy); } } } $query = User::find(); if (!empty($arrUserId)) { $query->andWhere(['in', 'id', $arrUserId]); } $user = $query->all(); if ($user) { foreach ($user as $object) { $arrUser[$object->id] = $object->firstName . ' - ' . $object->lastName; } } $query = Typelist::find(); $query->orderBy(['id' => SORT_ASC]); $objTypelist = $query->all(); $arrTypelist = []; foreach ($objTypelist as $dataTypelist) { $arrTypelist[$dataTypelist->id] = $dataTypelist->name; } //var_dump($arrTypelist); exit(); echo $this->render('list', ['lst' => $lst, 'arrUser' => $arrUser, 'status' => $status, 'pondType' => $pondType, 'categoryId' => $categoryId, 'order' => $order, 'q' => $q, 'pagination' => $pagination, 'canPublishNews' => $canPublishNews, 'arrTypelist' => $arrTypelist]); }