public function index()
 {
     $poster = new Poster();
     $coming_soon = $poster->getDates()->first();
     $releasing_date = $coming_soon->release_date;
     $latestResources = Resource::latestPublished()->get();
     $comingSoon = Resource::comingSoon()->get();
     $latestPosts = Post::latestPosts()->get();
     $popularResources = Viewable::popularResource();
     if (Auth::user()->role == 'admin' || Auth::user()->role == 'teacher') {
         return View::make('dashboard.index_backup')->with(array('popularResources' => $popularResources, 'latestPosts' => $latestPosts, 'latestResources' => $latestResources, 'comingSoon' => $comingSoon, 'releasing_date' => $releasing_date));
     } else {
         return View::make('dashboard.index')->with('latestRes', $latestResources)->with('comingSoon', $comingSoon)->with('latestPosts', $latestPosts);
     }
 }
Esempio n. 2
0
 public function showWelcome()
 {
     $posters = Poster::where('daily_id', '=', 0)->get();
     $topics = Topic::where('topic_url', '!=', '')->orderBy('created_at', 'desc')->get();
     $daily = poster::where('daily_id', '=', 1)->get();
     foreach ($daily as $recommend) {
         $gift = Gift::find($recommend->info_url);
         $recommend->content = $gift->content;
         $recommend->scan_num = $gift->scan_num;
         $recommend->focus_num = $gift->focus_num;
     }
     foreach ($posters as $poster) {
         $poster->photo_url = StaticController::imageWH($poster->photo_url);
     }
     foreach ($topics as $topic) {
         $topic->topic_url = StaticController::imageWH($topic->topic_url);
     }
     foreach ($daily as $day) {
         $day->photo_url = StaticController::imageWH($day->photo_url);
     }
     if (Request::wantsJson()) {
         return Response::json(array('errCode' => 0, 'message' => '返回首页首页数据', 'posters' => $posters, 'topics' => $topics, 'recommendations' => $daily));
     }
     return View::make('index.home')->with(array('posters' => $posters, 'topics' => $topics, 'recommendations' => $daily));
 }
Esempio n. 3
0
 public function deletePoster()
 {
     $image_id = Input::get('image_id');
     $image = Poster::find($image_id);
     if (!$image->delete()) {
         return Response::json(array('errCode' => '1', 'message' => '删除失败!'));
     }
     return Response::json(array('errCode' => 0, 'message' => '删除成功!'));
 }
Esempio n. 4
0
 public function home()
 {
     $scroll_imgs = ScrollImg::all();
     //话题
     $topics = Topic::where('topic_url', '!=', '')->orderBy('created_at', 'desc')->get();
     $topics = StaticController::page(12, 1, $topics);
     //每日推荐
     $daily = Poster::where('daily_id', '=', 1)->get();
     //每日推
     $daily = StaticController::page(16, 1, $daily);
     // $user = Sentry::findUserById(4);
     // Sentry::login($user,false);
     // Sentry::logout();
     if (Sentry::check()) {
         foreach ($daily as $recommend) {
             $gift = Gift::find($recommend->info_url);
             $recommend->title = $gift->title;
             $recommend->price = $gift->price;
             $recommend->taobao_url = $gift->taobao_url;
             $gift_focus = GiftFocus::where('gift_id', '=', $recommend->info_url)->where('user_id', '=', Sentry::getUser()->id)->first();
             /* 2015-09-16 hyy fix */
             if (isset($gift_focus)) {
                 $recommend->focus = 1;
             } else {
                 $recommend->focus = 0;
             }
         }
     } else {
         foreach ($daily as $recommend) {
             $gift = Gift::find($recommend->info_url);
             $recommend->title = $gift->title;
             $recommend->price = $gift->price;
             $recommend->taobao_url = $gift->taobao_url;
             $recommend->focus = 0;
         }
     }
     //精选话题
     $articles = DB::table('articles')->orderBy('focus_num', 'desc')->get();
     $articles = StaticController::page(12, 1, $articles);
     if ($articles) {
         foreach ($articles as $article) {
             $article_url = ArticlePart::where('article_id', '=', $article->id)->where('type', '=', 'url')->first();
             // dd($article_url->content);
             if (isset($article)) {
                 $article->url = $article_url->content;
             } else {
                 $article->url = null;
             }
         }
     }
     return View::make('pc.home')->with(array('topics' => $topics, 'gifts' => $daily, 'articles' => $articles, 'scroll_imgs' => $scroll_imgs));
 }
Esempio n. 5
0
 public function showWelcome()
 {
     $posters = Poster::all();
     $columns = EnlightenColumn::orderBy('created_at', 'desc')->take(8)->get();
     $backstages = BackStage::orderBy('created_at', 'desc')->take(8)->get();
     $contacts = ContactUs::all();
     if (count($contacts) != 0) {
         $contact = $contacts[0];
         return View::make('home.home', array('posters' => $posters, 'columns' => $columns, 'backstages' => $backstages, 'contact' => $contact, 'links' => $this->link()));
     } else {
         return View::make('home.home', array('posters' => $posters, 'columns' => $columns, 'backstages' => $backstages, 'links' => $this->link()));
     }
 }
Esempio n. 6
0
 public function poster()
 {
     $images = Poster::paginate(3);
     return View::make('首页海报')->with('images', $images);
 }
Esempio n. 7
0
 public function run()
 {
     $i = 0;
     for ($i = 0; $i < 200; $i++) {
         Poster::create(['photo_url' => 'http://7xl6gj.com1.z0.glb.clouddn.com/19.2.jpg', 'info_url' => $i + 1, 'daily_id' => '1']);
     }
     // Poster::create([
     // 	'photo_url' =>  'http://7xl6gj.com1.z0.glb.clouddn.com/19.3.jpg',
     // 	'info_url'=> '2',
     // 	'daily_id'=> '1'
     // ]);
     // Poster::create([
     // 	'photo_url' =>  'http://7xl6gj.com1.z0.glb.clouddn.com/19.4.jpg',
     // 	'info_url'=> '3',
     // 	'daily_id'=> '1'
     // ]);
     // Poster::create([
     // 	'photo_url' => 'http://7xl6gj.com1.z0.glb.clouddn.com/19.5.jpg',
     // 	'info_url'=> '4',
     // 	'daily_id'=> '1'
     // ]);
     // Poster::create([
     // 	'photo_url' => 'http://7xl6gj.com1.z0.glb.clouddn.com/19.5.jpg',
     // 	'info_url'=> '5',
     // 	'daily_id'=> '1'
     // ]);
     // Poster::create([
     // 	'photo_url' =>  'http://7xl6gj.com1.z0.glb.clouddn.com/19.2.jpg',
     // 	'info_url'=> '6',//id 号
     // 	'daily_id'=> '1'
     // ]);
     // Poster::create([
     // 	'photo_url' =>  'http://7xl6gj.com1.z0.glb.clouddn.com/19.3.jpg',
     // 	'info_url'=> '7',
     // 	'daily_id'=> '1'
     // ]);
     // Poster::create([
     // 	'photo_url' =>  'http://7xl6gj.com1.z0.glb.clouddn.com/19.4.jpg',
     // 	'info_url'=> '8',
     // 	'daily_id'=> '1'
     // ]);
     // Poster::create([
     // 	'photo_url' => 'http://7xl6gj.com1.z0.glb.clouddn.com/19.5.jpg',
     // 	'info_url'=> '9',
     // 	'daily_id'=> '1'
     // ]);
     // Poster::create([
     // 	'photo_url' => 'http://7xl6gj.com1.z0.glb.clouddn.com/19.5.jpg',
     // 	'info_url'=> '10',
     // 	'daily_id'=> '1'
     // ]);
     // Poster::create([
     // 	'photo_url' =>  'http://7xl6gj.com1.z0.glb.clouddn.com/19.2.jpg',
     // 	'info_url'=> '11',//id 号
     // 	'daily_id'=> '1'
     // ]);
     // Poster::create([
     // 	'photo_url' =>  'http://7xl6gj.com1.z0.glb.clouddn.com/19.3.jpg',
     // 	'info_url'=> '12',
     // 	'daily_id'=> '1'
     // ]);
     // Poster::create([
     // 	'photo_url' =>  'http://7xl6gj.com1.z0.glb.clouddn.com/19.4.jpg',
     // 	'info_url'=> '13',
     // 	'daily_id'=> '1'
     // ]);
     // Poster::create([
     // 	'photo_url' => 'http://7xl6gj.com1.z0.glb.clouddn.com/19.5.jpg',
     // 	'info_url'=> '14',
     // 	'daily_id'=> '1'
     // ]);
     // Poster::create([
     // 	'photo_url' => 'http://7xl6gj.com1.z0.glb.clouddn.com/19.5.jpg',
     // 	'info_url'=> '15',
     // 	'daily_id'=> '1'
     // ]);
 }
Esempio n. 8
0
 public static function dumbAuthenticate()
 {
     $url = URLBuilder::buildAuth($_REQUEST);
     try {
         $data = Poster::post($_SESSION['openid']['server'], $url);
     } catch (Exception $ex) {
         return false;
     }
     $valid = false;
     foreach (explode("\n", $data) as $line) {
         if (substr($line, 0, 9) == 'is_valid:') {
             $valid = (bool) substr($line, 9);
         }
     }
     return $valid;
 }
Esempio n. 9
0
 public function getIndex()
 {
     $posters = Poster::orderBy('created_at', 'DESC')->get();
     return View::make('index', array('posters' => $posters));
 }
Esempio n. 10
0
 public function sortPosters($direction)
 {
     $posters = Poster::orderBy('created_at', $direction)->get();
     return View::make('posters/all_previews', array('posters' => $posters));
 }
Esempio n. 11
0
 public function run()
 {
     Poster::create(['image' => 'http://7xk6xh.com1.z0.glb.clouddn.com/home_page.png', 'link' => 'http://www.baidu.com']);
     Poster::create(['image' => 'http://7xk6xh.com1.z0.glb.clouddn.com/home_page.png', 'link' => 'http://www.baidu.com']);
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $poster = Poster::find($id);
     if ($poster->delete()) {
         return Redirect::back();
     }
 }