Ejemplo n.º 1
0
 /**
  * 演讲展示页面
  */
 public function actionIndex()
 {
     //菜单权限检测
     Yii::$app->util->adminAuth() ? '' : $this->redirect('/admin/login');
     $options = Yii::$app->request->get();
     $orderMapping = ['0' => '默认', '1' => '最新更新'];
     $options['page'] = isset($options['page']) ? intval($options['page']) : 1;
     $options['order'] = isset($options['order']) ? intval($options['order']) : 0;
     $options['order'] = in_array($options['order'], array_keys($orderMapping)) ? $options['order'] : 0;
     $options['title'] = isset($options['title']) ? urldecode($options['title']) : '';
     $mSpeech = new Speech();
     $speech = $mSpeech->search($options);
     $pages = new Pagination(['totalCount' => $speech->count(), 'pageSize' => Speech::PAGE_SIZE]);
     $speeches = $speech->asArray()->all();
     // print_r($speeches);exit;
     return $this->render('index', ['speeches' => $speeches, 'pages' => $pages, 'options' => $options]);
 }
Ejemplo n.º 2
0
 /**
  * 演讲集管理
  */
 public function actionSpeech()
 {
     //菜单权限检测
     Yii::$app->util->adminAuth() ? '' : $this->redirect('/admin/login');
     $options = Yii::$app->request->get();
     $orderMapping = ['0' => '默认', '1' => '最新更新'];
     $options['page'] = isset($options['page']) ? intval($options['page']) : 1;
     $options['order'] = isset($options['order']) ? intval($options['order']) : 0;
     $options['order'] = in_array($options['order'], array_keys($orderMapping)) ? $options['order'] : 0;
     $options['title'] = isset($options['title']) ? urldecode($options['title']) : '';
     $mSpeech = new Speech();
     $speech = $mSpeech->search($options);
     $pages = new Pagination(['totalCount' => $speech->count(), 'pageSize' => Speech::PAGE_SIZE]);
     //推送演讲集数据
     $mPageCustomBlock = new PageCustomBlock();
     $data = $mPageCustomBlock->block(['customId' => 'main_page_speeches']);
     $speeches = $speech->asArray()->all();
     return $this->render('speech', ['speeches' => $speeches, 'pages' => $pages, 'options' => $options, 'data' => $data]);
 }