Example #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]);
 }
Example #2
0
 public function actionIndex2()
 {
     $id = Yii::$app->request->get("id");
     // p($id);
     $articleModel = new MirArticle();
     $jishu = $articleModel::findOne(["article_id" => $id]);
     $tuijiannews = $articleModel->find()->where(["article_class" => '3'])->orderBy("article_id desc")->limit(10)->all();
     // p($tuijiannews);
     // p($jishu);
     return $this->render('index2', ['model' => $jishu, 'newMeetings' => $tuijiannews]);
 }
Example #3
0
 public function actionIndex2()
 {
     $id = Yii::$app->request->get("id");
     $model = MirArticle::findOne(["article_id" => $id]);
     // p($model);
     return $this->render('index2', ['model' => $model]);
 }
Example #4
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = MirArticle::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(['article_id' => $this->article_id, 'article_date' => $this->article_date, 'article_istop' => $this->article_istop, 'article_rank' => $this->article_rank]);
     $query->andFilterWhere(['like', 'article_title', $this->article_title])->andFilterWhere(['like', 'article_titile_e', $this->article_titile_e])->andFilterWhere(['like', 'article_class', $this->article_class])->andFilterWhere(['like', 'article_contents', $this->article_contents])->andFilterWhere(['like', 'article_contents_e', $this->article_contents_e])->andFilterWhere(['like', 'article_makerid', $this->article_makerid])->andFilterWhere(['like', 'article_pic', $this->article_pic])->andFilterWhere(['like', 'article_zy', $this->article_zy])->andFilterWhere(['like', 'article_source', $this->article_source])->orderBy("article_id desc");
     return $dataProvider;
 }
Example #5
0
 public function actionIndex()
 {
     $classifyModel = new Classify();
     $dafenlei = $classifyModel->find()->where(["ParentID" => '0'])->limit(8)->all();
     // p($dafenlei);
     $articleModel = new MirArticle();
     $jobs = $articleModel->articleToIndex(5);
     //技术分享
     $jishus = $articleModel->articleToIndex(3);
     $productModel = new MirProduct();
     //ivd 五个广告图
     $adModel = new MirAd();
     $ads = $adModel->find()->orderBy("ad_rank desc,id desc")->limit(5)->all();
     // p($ads);
     // p($fourPic);
     // P($ivdList);
     // p(count($ivdList));
     //产品照片显示
     $mainClass = $productModel->mainClass();
     foreach ($mainClass as $k => $v) {
         $mainClassId[] = $k;
     }
     for ($i = 0; $i < count($mainClassId) - 1; $i++) {
         $products[] = MirProduct::find()->where(['product_mainclass' => $mainClassId[$i]])->orderBy("product_rank desc,product_id desc")->limit(9)->all();
         $data = $productModel->find()->where(["product_mainclass" => $mainClassId[$i]]);
         $pages = new Pagination(['totalCount' => $data->count(), 'pageSize' => '10']);
         $dataShow = $data->offset($pages->offset)->limit($pages->limit)->orderBy("product_rank desc,product_id desc")->all();
         $pagesArray[] = $pages;
         $productArray[] = $dataShow;
     }
     // p(count($products[1]));
     // p($pagesArray);
     // p($productArray);
     $mainClass = array_values($mainClass);
     return $this->render('index', ['dafenlei' => $dafenlei, 'jobs' => $jobs, 'jishus' => $jishus, 'ivdList' => $ivdList, 'mainClass' => $mainClass, 'products' => $products, 'productArray' => $productArray, 'pagesArray' => $pagesArray, 'ads' => $ads]);
 }
Example #6
0
 public function actionIndex3()
 {
     $articleModel = new MirArticle();
     $data = MirArticle::find()->select("article_pic,article_id")->all();
     for ($i = 0; $i < count($data); $i++) {
         $pics[$i]['id'] = $data[$i]->article_id;
         $pics[$i]['pic'] = $data[$i]->article_pic;
     }
     for ($i = 0; $i < count($pics); $i++) {
         if ($pics[$i]['pic'] == 'nopic.gif') {
             $model = MirArticle::find()->where(["article_id" => $pics[$i]['id']])->one();
             $model->article_pic = "moren.png";
             $model->save();
         }
     }
     echo "ok";
 }
Example #7
0
 /**
  * Finds the MirArticle model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return MirArticle the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = MirArticle::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }