Example #1
0
 public function actionIndex()
 {
     $query = Publication::find();
     $pagination = new Pagination(['defaultPageSize' => 5, 'totalCount' => $query->count()]);
     $publications = $query->orderBy('title')->offset($pagination->offset)->limit($pagination->limit)->all();
     return $this->render('index', ['publications' => $publications, 'pagination' => $pagination]);
 }
Example #2
0
 /**
  * Show the application dashboard to the user.
  *
  * @return Response
  */
 public function index()
 {
     $images = Gallery::slide();
     $news = News::latest(4);
     $pubs = Publication::latest();
     $trainings = Training::latest();
     $bio = Biography::orderBy('created_at', 'DESC')->first();
     return view('index', compact('images', 'news', 'pubs', 'bio', 'trainings'));
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Publication::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]);
     $query->andFilterWhere(['like', 'title_en', $this->title_en])->andFilterWhere(['like', 'title_pt', $this->title_pt])->andFilterWhere(['like', 'summary_en', $this->summary_en])->andFilterWhere(['like', 'summary_pt', $this->summary_pt])->andFilterWhere(['like', 'content_en', $this->content_en])->andFilterWhere(['like', 'content_pt', $this->content_pt]);
     return $dataProvider;
 }
Example #4
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Publication::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'date' => $this->date]);
     $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'descriptoin', $this->descriptoin])->andFilterWhere(['like', 'text', $this->text]);
     return $dataProvider;
 }
Example #5
0
 public static function search($term)
 {
     $count = 0;
     $l = Session::get('locale');
     $fields = "title_{$l},' ',content_{$l},' ',summary_{$l}";
     $results['results']['news'] = News::select(DB::raw("*,concat('news/',slug) as link"))->where(DB::raw("concat({$fields})"), 'like', "%{$term}%")->get();
     $count += count($results['results']['news']);
     $fields = "title_{$l},' ',content_{$l},' ',summary_{$l}";
     $results['results']['pages'] = Page::select(DB::raw("*,concat('pages/',slug) as link"))->where(DB::raw("concat({$fields})"), 'like', "%{$term}%")->get();
     $count += count($results['results']['pages']);
     $fields = "title_{$l}";
     $results['results']['publications'] = Publication::select(DB::raw("*,file_{$l} as link"))->where(DB::raw("concat({$fields})"), 'like', "%{$term}%")->get();
     $count += count($results['results']['publications']);
     $fields = "title_{$l},' ',content_{$l},' ',summary_{$l}";
     $results['results']['trainings'] = Training::select(DB::raw("*,concat('trainings/',slug) as link"))->where(DB::raw("concat({$fields})"), 'like', "%{$term}%")->get();
     $count += count($results['results']['trainings']);
     $fields = "title_{$l},' ',content_{$l},' ',summary_{$l}";
     $results['results']['vacancies'] = Vacancy::select(DB::raw("*,concat('vacancies/',slug) as link"))->where(DB::raw("concat({$fields})"), 'like', "%{$term}%")->get();
     $count += count($results['results']['vacancies']);
     $results['count'] = $count;
     return $results;
 }
 /**
  * Finds the Publication model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Publication the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Publication::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int $facultyId 
  * @param  int  $id
  * @return Response
  */
 public function destroy($facultyId, $id)
 {
     $publication = Publication::find($id);
     $publication->researchArea()->sync([]);
     $publication->delete();
     Flash::success('Publication created successfully');
     return redirect("/admin/faculty/{$facultyId}");
 }
Example #8
0
 public static function latest($n = 6)
 {
     return Publication::orderBy('created_at', 'DESC')->limit($n)->get();
 }
 /**
  * Display the specified Conference.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $active = 'research';
     $conference = Publication::with(['researchArea', 'faculty'])->where('type', 'conference')->findOrFail($id);
     return view('frontend.conference.show', compact('active', 'conference'));
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function publish($id)
 {
     $pub = Publication::find($id);
     $pub->update(['is_published' => $pub->is_published ? 0 : 1]);
     return Redirect::route('publications.admin');
 }