Exemplo n.º 1
0
 public function actionIndex()
 {
     //友情链接
     $friendLink = new FriendLink();
     $friendLinks = $friendLink->getFriendLinks();
     $num = ceil(count($friendLinks) / 8);
     for ($i = 0; $i < count($friendLinks); $i++) {
         $newFriendLinks[floor($i / 8)][] = $friendLinks[$i];
     }
     // p($newFriendLinks[0][1]);
     //学术会议和展览展会
     $meetingModel = new MirMeeting();
     $xueshuMeetings = $meetingModel->find()->select("meeting_id,meeting_name,meeting_bdate")->where(["meeting_class" => '1'])->orderBy('meeting_id desc')->limit(5)->all();
     $zhanhuiMeetings = $meetingModel->find()->select("meeting_id,meeting_name,meeting_bdate")->where(["meeting_class" => '2'])->orderBy('meeting_id desc')->limit(5)->all();
     $meetingModel = new MirMeeting();
     //新闻中心
     $articleModel = new MirArticle();
     $news = $articleModel->articleToIndex(0);
     //招标公告
     $zhaobiao = $articleModel->articleToIndex(2);
     //技术分享
     $jishus = $articleModel->articleToIndex(3);
     // p($zhaobiao);
     //临床医学
     $ivdModel = new MirIvd();
     $linchuangyixues = $ivdModel->getIvdlist(3);
     $pinpaililiang = $ivdModel->getIvdlist(1);
     $zhutizhuanfang = $ivdModel->getIvdlist(2);
     $zhuanjiazhuanlan = $ivdModel->getIvdlist(4);
     // p($linchuangyixues);
     // 把主题专访  四个合并成一个
     $firstData[] = $linchuangyixues;
     $firstData[] = $zhutizhuanfang;
     $firstData[] = $zhuanjiazhuanlan;
     $firstData[] = $pinpaililiang;
     // p($firstData);
     // p($linchuangyixues);
     // IVD展厅
     $porduct = new MirProduct();
     $porducts = MirProduct::find()->orderBy("product_id desc")->limit(5)->all();
     // p($porducts[0]->product_pic);
     //索刊
     $mgzModel = new MirMgz();
     $mgz = $mgzModel->find()->orderBy("mgz_id desc")->groupBy("mgz_year,mgz_num")->all();
     for ($i = 0; $i < count($mgz); $i++) {
         $mgzYear[] = $mgz[$i]->mgz_year;
         $mgzNum[] = $mgz[$i]->mgz_num;
     }
     $fourPic = $porduct->find()->andWhere(["!=", "product_pic", "productnopic.gif"])->orderBy("product_id desc")->limit(4)->all();
     // p($fourPic);
     //获得视屏中心的照片
     $videoModel = new MirVideo();
     $videos = $videoModel->find()->orderBy("video_id desc")->all();
     return $this->render('index', ['newFriendLinks' => $newFriendLinks, 'zhanhuiMeetings' => $zhanhuiMeetings, 'xueshuMeetings' => $xueshuMeetings, 'news' => $news, 'zhaobiao' => $zhaobiao, 'jishus' => $jishus, 'firstData' => $firstData, 'porducts' => $porducts, 'mgzYear' => $mgzYear, 'mgzNum' => $mgzNum, 'fourPic' => $fourPic, 'videos' => $videos]);
 }
Exemplo n.º 2
0
 public function actionIndex()
 {
     $mgzModel = new MirMgz();
     $mgz_year = Yii::$app->request->get("mgzYear");
     $mgz_num = Yii::$app->request->get("mgzNum");
     if (!empty($mgz_year) && !empty($mgz_num)) {
         $newMgz = $mgzModel->find()->where(["mgz_year" => $mgz_year, 'mgz_num' => $mgz_num])->all();
     } else {
         $mgz = $mgzModel->find()->orderBy("mgz_id desc")->limit(1)->all();
         $newMgz = $mgzModel->find()->where(["mgz_year" => $mgz[0]->mgz_year, 'mgz_num' => $mgz[0]->mgz_num])->all();
     }
     $mgzList = $mgzModel->find()->orderBy("mgz_id desc")->groupBy("mgz_year,mgz_num")->all();
     for ($i = 0; $i < count($mgzList); $i++) {
         $mgzYear[] = $mgzList[$i]->mgz_year;
         $mgzNum[] = $mgzList[$i]->mgz_num;
     }
     // p($newMgz);
     return $this->render('index', ['newMgz' => $newMgz, 'mgzYear' => $mgzYear, 'mgzNum' => $mgzNum]);
 }
Exemplo n.º 3
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = MirMgz::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['mgz_id' => $this->mgz_id, 'mgz_page' => $this->mgz_page, 'mgz_year' => $this->mgz_year, 'mgz_num' => $this->mgz_num, 'mgz_isfirst' => $this->mgz_isfirst, 'mgz_znum' => $this->mgz_znum]);
     $query->andFilterWhere(['like', 'mgz_pic', $this->mgz_pic])->orderBy("mgz_id desc");
     return $dataProvider;
 }
Exemplo n.º 4
0
 /**
  * Finds the MirMgz model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return MirMgz the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = MirMgz::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }