Example #1
1
 function detail($title_none = NULL)
 {
     $cat_news_url = $this->uri->segment(1);
     $cat_news = new Newscatalogue();
     $cat_news->where(array('name_none' => $cat_news_url))->get();
     if (!$cat_news->exists()) {
         show_404();
     }
     $dis['cat_news'] = $cat_news;
     $cat = $this->uri->segment(2);
     $category = new Newscatalogue();
     $category->where(array('name_none' => $cat, 'parentcat_id' => $cat_news->id))->get();
     if (!$category->exists()) {
         show_404();
     }
     $dis['category'] = $category;
     $title_none = geturlfromuri($this->uri->segment(3));
     $news = new Article();
     $news->where(array('title_none' => $title_none, 'newscatalogue_id' => $category->id));
     $news->get();
     if (!$news->exists()) {
         redirect(base_url() . $this->uri->segment(1, '') . '/' . $this->uri->segment(2, ''));
         die;
     }
     $dis['news'] = $news;
     $tag = $news->tag;
     $dis['tag'] = explode(',', $tag);
     $news->view_count = $news->view_count + 1;
     $news->save();
     //related news
     $related_news = new Article();
     $related_news->where('recycle', 0);
     $related_news->where('newscatalogue_id', $news->newscatalogue_id);
     $related_news->where("id !=", $news->id);
     $related_news->order_by('created', 'DESC');
     $related_news->get_paged(0, 15, TRUE);
     $dis['related_news'] = $related_news;
     $arrayCateNewsId = array();
     foreach ($this->guideCate as $row) {
         $arrayCateNewsId[] = $row->id;
     }
     $arrayCateNewsId = array();
     foreach ($this->guideCate as $row) {
         $arrayCateNewsId[] = $row->id;
     }
     // get news view most
     $newViewMost = new Article();
     $newViewMost->where('recycle', 0);
     $newViewMost->where_in('newscatalogue_id', $arrayCateNewsId);
     $newViewMost->order_by('view_count', 'desc');
     $newViewMost->get(5);
     $dis['newViewMost'] = $newViewMost;
     // get news view most
     $newView = new Article();
     $newView->where('recycle', 0);
     $newView->where_in('newscatalogue_id', $arrayCateNewsId);
     $newView->order_by('created', 'desc');
     $newView->get(5);
     $dis['newView'] = $newView;
     $this->page_title = $news->{'title_vietnamese'} . ' | SotayNhadat.vn';
     $this->page_description = $news->short_vietnamese;
     $this->page_keyword = $news->tag;
     $this->url = base_url() . substr($this->uri->uri_string, 1, strlen($this->uri->uri_string));
     $this->isRobotFollow = 1;
     $dis['base_url'] = base_url();
     $dis['view'] = 'front/guides/news_de';
     $this->viewfront($dis);
 }
Example #2
0
 function detail($title_none = NULL)
 {
     $title_none = $this->uri->segment(3);
     $arrTitle = explode('.', $title_none);
     if ($arrTitle[1] == '' || $arrTitle[1] != 'html') {
         redirect('');
     }
     $title_none = $arrTitle[0];
     $news = new Article();
     $news->where('title_none', $title_none);
     $news->get();
     //print_r($this->db->last_query());exit();
     if (!$news->exists()) {
         show_404();
     }
     $dis['news'] = $news;
     //related news
     $related_news = new Article();
     $related_news->where('recycle', 0);
     $related_news->where('newscatalogue_id', $news->newscatalogue_id);
     $related_news->where("id !=", $news->id);
     $related_news->order_by('created', 'DESC');
     $related_news->get_paged(0, 10, TRUE);
     $dis['related_news'] = $related_news;
     $category = new Newscatalogue($news->newscatalogue_id);
     $dis['category'] = $category;
     $this->page_title = $news->{'title_vietnamese'};
     $this->page_description = $news->short_vietnamese;
     $this->page_keyword = $news->tag;
     $dis['base_url'] = base_url();
     $dis['link'] = base_url() . $_SERVER['REQUEST_URI'];
     $dis['view'] = 'front/services/news_de';
     $this->viewfront($dis);
 }
Example #3
0
 function detail($url)
 {
     $urlcat = $this->uri->segment(1);
     $category = new Newscatalogue();
     $category->where(array('recycle' => 0, 'name_none' => $urlcat))->get();
     if (!$category->exists()) {
         show_404();
     }
     $dis['category'] = $category;
     $url = geturlfromuri($this->uri->segment(2));
     $news = new Article();
     $news->where(array('title_none' => $url, 'recycle' => 0));
     $news->get();
     if (!$news->exists()) {
         show_404();
     }
     $dis['news'] = $news;
     $this->page_title = $news->title_vietnamese;
     $this->page_description = $news->short_vietnamese;
     $this->page_keyword = $news->tag;
     //related news
     $related_news = new Article();
     $related_news->where('recycle', 0);
     $related_news->where('newscatalogue_id', $news->newscatalogue_id);
     $related_news->where("id !=", $news->id);
     $related_news->order_by('created', 'DESC');
     $related_news->get_paged(0, 10, TRUE);
     $dis['related_news'] = $related_news;
     $dis['base_url'] = base_url();
     $dis['view'] = 'front/newsother/news_de';
     $this->viewfront($dis);
 }
Example #4
0
function getNewsByCategory($categoryID)
{
    $CI =& get_instance();
    $cat_news = new Article();
    $cat_news->where(array('recycle' => 0));
    $cat_news->where('newscatalogue_id', $categoryID);
    $cat_news->order_by('created', 'desc');
    $cat_news->get(4);
    return $cat_news;
}
 /**
  * Show article
  * @param  string $slug Article abbreviated name
  * @return response
  */
 public function show($slug)
 {
     $article = Article::where('slug', $slug)->where('post_status', 'open')->first();
     is_null($article) and App::abort(404);
     $categories = Category::orderBy('sort_order')->get();
     return View::make('article.show')->with(compact('article', 'categories'));
 }
 /**
  * 提交评论
  * @param  string $slug 文章缩略名
  * @return response
  */
 public function postBlogComment($slug)
 {
     // 获取评论内容
     $content = e(Input::get('content'));
     // 字数检查
     if (mb_strlen($content) < 3) {
         return Redirect::back()->withInput()->withErrors($this->messages->add('content', '评论不得少于3个字符。'));
     }
     // 查找对应文章
     $article = Article::where('slug', $slug)->first();
     // 创建文章评论
     $comment = new Comment();
     $comment->content = $content;
     $comment->article_id = $article->id;
     $comment->user_id = Auth::user()->id;
     if ($comment->save()) {
         // 创建成功
         // 更新评论数
         $article->comments_count = $article->comments->count();
         $article->save();
         // 返回成功信息
         return Redirect::back()->with('success', '评论成功。');
     } else {
         // 创建失败
         return Redirect::back()->withInput()->with('error', '评论失败。');
     }
 }
 public function getIndex($page = 1)
 {
     $newses = \Article::where('status', '=', '1')->where('category', '=', '3')->where('open_at', '<=', date('Y-m-d'))->orderBy('sort', 'desc')->orderBy('created_at', 'desc')->skip(0)->take(10)->get(array('id', 'title', 'open_at'));
     if ($newses === null) {
         $newses = array();
     }
     return \View::make('aesthetics.index.index', array('newses' => &$newses));
 }
Example #8
0
 public static function boot()
 {
     parent::boot();
     //删除时先删除相关文档、单页
     self::deleting(function (User $user) {
         Article::where('uid', '=', $user->id)->delete();
         Page::where('uid', '=', $user->id)->delete();
     });
 }
Example #9
0
 public function get_index($authorname)
 {
     $user = User::where('username', '=', $authorname)->first();
     //get the article limit size
     $articles = Article::where('author_id', '=', $user->id)->paginate(Setting::find(2)->value);
     $dbquery = $articles;
     $articles = cmsHelper::bakeArticleForViewers($articles->results);
     return View::make('visitor.index', array("articles" => $articles, 'dbquery' => $dbquery, 'message' => 'Showing all articles by ' . $user->displayname));
 }
Example #10
0
 public function searcharticles(Request $request)
 {
     if ($request->ajax()) {
         if ($request->has('articlestat')) {
             $searcharticles = Article::where('stat', '=', $request->input('articlestat'))->get();
             $scontent = view(athr . '.searcharticles', ['allarticles' => $searcharticles])->render();
             return response()->json($scontent);
         }
     }
 }
Example #11
0
 function article_unique_title($str)
 {
     $this->form_validation->set_message('article_unique_title', 'Es existier bereits ein Artikel mit diesem Titel.');
     $article = new Article();
     $article->where('title', $str)->get();
     if ($article->exists()) {
         return FALSE;
     }
     return TRUE;
 }
Example #12
0
 function index($category_id = FALSE)
 {
     $articles = new Article();
     if ($category_id) {
         $category = new Category($category_id);
         $articles->where("category_id in (select id from categories where lft >= " . $category->lft . " and rgt <= " . $category->rgt . " and module = '" . $category->module . "')");
     }
     $data['articles'] = $articles->order_by('id', 'desc')->get_page(limit());
     $this->template->append_metadata(js_lightbox());
     $this->template->build('admin/article_index', $data);
 }
 public function getIndex()
 {
     $boards = \Board::where('status', '=', '1')->orderBy('created_at', 'desc')->skip(0)->take(10)->get(array('id', 'name', 'topic', 'count_num', \DB::raw("date_format(created_at,'%Y-%m-%d') as d")));
     if ($boards === null) {
         $boards = array();
     }
     $newses = \Article::where('status', '=', '1')->where('category', '=', '3')->where('open_at', '<=', date('Y-m-d'))->orderBy('sort', 'desc')->orderBy('open_at', 'desc')->orderBy('created_at', 'desc')->skip(0)->take(10)->get(array('id', 'title', 'open_at'));
     if ($newses === null) {
         $newses = array();
     }
     return \View::make('aesthetics.index.index', array('boards' => &$boards, 'newses' => &$newses));
 }
Example #14
0
 public function post_view()
 {
     $deletedIds = Input::get('delete');
     $search = Input::get('search');
     $i = 0;
     if (isset($deletedIds)) {
         foreach ($deletedIds as $delete) {
             Article::where('id', '=', $delete)->first()->delete() && ++$i;
         }
         return Redirect::to('/admin/articles/view')->with('message', $i . " article(s) deleted");
     }
     if (strlen($search) > 1) {
         return Redirect::to('/admin/articles/view?filterby=search&value=' . $search);
     }
     Input::flush();
     return Redirect::to('/admin/articles/view')->with('message', ' [no action performed]');
 }
Example #15
0
 /**
  * Return a string with the feed data
  *
  * @return string
  */
 protected function buildRssData()
 {
     $now = Carbon::now();
     $feed = new Feed();
     $channel = new Channel();
     $channel->title(config('blog.title'))->description(config('blog.description'))->url(url())->language('en')->copyright('Copyright (c) ' . config('blog.author'))->lastBuildDate($now->timestamp)->appendTo($feed);
     $articles = Article::where('published_date', '<=', $now)->orderBy('published_date', 'desc')->take(config('blog.rss_size'))->get();
     foreach ($articles as $article) {
         $item = new Item();
         $item->title($article->title)->tumnail_url($article->thumnail_url)->url($article->url())->pubDate($article->published_date->timestamp)->guid($article->url(), true)->appendTo($channel);
     }
     $feed = (string) $feed;
     // Replace a couple items to make the feed more compliant
     $feed = str_replace('<rss version="2.0">', '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">', $feed);
     $feed = str_replace('<channel>', '<channel>' . "\n" . '    <atom:link href="' . url('/rss') . '" rel="self" type="application/rss+xml" />', $feed);
     return $feed;
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($full_permalink, $id)
 {
     $article = Article::where('full_permalink', '=', $full_permalink)->firstOrFail();
     $image = ArticleImage::findOrFail($id);
     $data = \Input::all();
     $data['blog_article_id'] = $article->id;
     $data['featured'] = \Input::has('featured') ? true : false;
     $data['active'] = \Input::has('active') ? true : false;
     $validator = \Validator::make($data, $this->rules);
     if ($validator->fails()) {
         return \Redirect::back()->withErrors($validator)->withInput();
     }
     if ($image->update($data)) {
         $data = ['article' => $article, 'image' => $image];
         return \View::make('blog::partials.image', $data);
     }
 }
Example #17
0
 public function showWelcome()
 {
     $gethealth = Category::where('category', 'Health')->first()->id;
     $getEntertainment = Category::where('category', 'Entertainment')->first()->id;
     $entertainmentArticles = Article::where('category_id', $getEntertainment)->orderBy('created_at', 'DESC')->get();
     $healthArticles = Article::where('category_id', $gethealth)->orderBy('created_at', 'DESC')->get();
     $getlifstyle = Category::where('category', 'Lifestyle')->first()->id;
     $latestArticles = Article::orderBy('created_at', 'DESC')->take(10)->get();
     $articles = Article::where('category_id', $getlifstyle)->orderBy('created_at', 'DESC')->take(10)->get();
     $entertainmentHeader = $entertainmentArticles->take(1);
     $eArticles = $entertainmentArticles->take(4)->slice(1);
     $slides = $latestArticles->take(4);
     $related = $articles->take(2);
     $small = $articles->slice(2)->take(6);
     $gethealthArticle = $healthArticles->take(1);
     $smallHealthArticles = $healthArticles->take(4)->slice(1);
     return View::make('home')->with('slides', $slides)->with('latestArticles', $latestArticles)->with('related', $related)->with('articles', $articles)->with('small', $small)->with('gethealthArticle', $gethealthArticle)->with('smallHealthArticles', $smallHealthArticles)->with('entertainmentHeader', $entertainmentHeader)->with('eArticles', $eArticles);
 }
Example #18
0
 public function joinArticle()
 {
     if (!Sentry::check()) {
         return Response::json(array('errCode' => 10, 'message' => '请登录'));
     }
     $user = Sentry::getUser();
     // $user = User::find(1);
     //分页
     $per_page = Input::get('per_page');
     $page = Input::get('page');
     $article_joins = ArticleJoin::where('user_id', '=', $user->id)->orderBy('created_at', 'desc')->get();
     //总页数
     $total = ceil(count($article_joins) / $per_page);
     //参与话题
     $article_joins = StaticController::page($per_page, $page, $article_joins);
     if ($article_joins == false) {
         return Response::json(array('errCode' => 0, 'message' => '没有参与话题', 'articles' => array(), 'total' => 0));
     }
     //根据用户参与的话题取到官方话题
     $articles = array();
     foreach ($article_joins as $article_join) {
         $article = Article::where('id', '=', $article_join->article_id)->first();
         array_push($articles, $article);
     }
     //去掉重复值
     array_unique($articles);
     //取到每个话题的图片和首段文字
     foreach ($articles as $article) {
         $article_url = ArticlePart::where('article_id', '=', $article->id)->where('type', '=', 'url')->orderBy('id', 'asc')->first();
         if (isset($article_url)) {
             $article->img = StaticController::imageWH($article_url->content);
         }
         $article_text = ArticlePart::where('article_id', '=', $article->id)->where('type', '=', 'text')->orderBy('id', 'asc')->first();
         if (isset($article_text)) {
             $article->content = $article_text->content;
         }
     }
     return Response::json(array('errCode' => 0, 'message' => '返回参与话题的内容!', 'articles' => $articles, 'total' => $total));
 }
Example #19
0
 public function hotArticle()
 {
     $per_page = Input::get('per_page');
     $page = Input::get('page');
     $time = time();
     $articles = Article::where('hot_offical', '!=', 0)->orderBy('focus_num', 'desc')->with(['parts' => function ($query) {
         $query->orderBy('created_at', 'asc');
     }])->get();
     if (count($articles) == 0) {
         return Response::json(array('errCode' => 0, 'message' => '返回热门话题', 'articles' => array(), 'total' => 0));
     }
     // dd(count($articles));
     foreach ($articles as $article) {
         $parts = $article->parts;
         foreach ($parts as $part) {
             if ($part->type == 'text') {
                 $article->text = $part->content;
             }
             if (isset($article->text)) {
                 break;
             }
         }
         foreach ($parts as $part) {
             if ($part->type == 'url') {
                 // dd($part->content);
                 $article->img = StaticController::imageWH($part->content);
             }
             if (isset($article->img)) {
                 break;
             }
         }
         unset($article->parts);
     }
     //总页数
     $total = ceil(count($articles) / $per_page);
     //文章
     $articles = StaticController::page($per_page, $page, $articles);
     return Response::json(array('errCode' => 0, 'message' => '返回热门话题', 'articles' => $articles, 'total' => $total));
     // $time = time();
     // $articles = DB::table('articles')->where('hot_offical','!=',0)->orderBy('focus_num', 'desc')->get();
     // // 总页数
     // $total = ceil(count($articles)/$per_page);
     // //文章
     // $articles = StaticController::page($per_page, $page, $articles);
     // if( $articles )
     // {	foreach( $articles as $article)
     // 	{
     // 		$article_url = ArticlePart::where('article_id', '=', $article->id)
     // 					->where('type','=', 'url')->first();
     // 		if(isset($article_url))
     // 		{
     // 			$article->img = StaticController::imageWH($article_url->content);
     // 		}
     // 		$article_text = ArticlePart::where('article_id', '=', $article->id)
     // 					->where('type','=', 'text')->first();
     // 		if(isset($article_text))
     // 		{
     // 			$article->text = $article_text->content;
     // 		}
     // 	}
     // // 	return Response::json(array('errCode'=>(time()-$time), 'message'=>'返回热门话题','articles'=>$articles,'total'=>$total));
     // }
     // return Response::json(array('errCode'=>(time()-$time), 'message'=>'返回热门话题','articles'=>$articles,'total'=>$total));
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($full_permalink)
 {
     $category = Category::where('full_permalink', '=', $full_permalink)->firstOrFail();
     $data = \Input::all();
     $data['active'] = \Input::has('active') ? true : false;
     $rules = $this->rules;
     if ($category->permalink == 'articles') {
         unset($rules['permalink']);
     } else {
         $rules['blog_category_id'] = 'required|not_in:' . $category->id;
         $rules['permalink'] = 'required|unique:blog_categories,permalink,' . $category->id . ',id,blog_category_id,' . $data['blog_category_id'] . ',deleted_at,NULL|unique:blog_articles,permalink,' . $category->id . ',id,blog_category_id, ' . $data['blog_category_id'] . ',deleted_at,NULL';
     }
     $validator = \Validator::make($data, $rules);
     if ($validator->fails()) {
         return \Redirect::route('article.category.edit', $full_permalink)->withErrors($validator)->withInput();
     }
     $category_id = $category->blog_category_id;
     if ($category->update($data)) {
         //if the category has moved
         if (isset($data['blog_category_id']) && $category_id != $data['blog_category_id']) {
             $category->order = Category::where('blog_category_id', '=', $category->blog_category_id)->count();
             $category->save();
             $categories = Category::where('blog_category_id', '=', $category->blog_category_id)->orderBy('order', 'asc')->get();
             $i = 1;
             foreach ($categories as $category) {
                 $category->order = $i;
                 $i++;
                 $category->save();
             }
             $articles = Article::where('blog_category_id', '=', $category->blog_category_id)->orderBy('order', 'asc')->get();
             $i = 1;
             foreach ($articles as $article) {
                 $article->order = $i;
                 $i++;
                 $article->save();
             }
         }
         //Update images
         foreach ($this->image_labels as $key => $image_label) {
             if (\Input::has($image_label)) {
                 $data = array('order' => $key + 1, 'src' => \Input::get($image_label), 'featured' => $image_label == 'featured_responsive_filemanager_url' ? true : false);
                 $image = $category->images()->where('order', '=', $key + 1)->first();
                 if ($image) {
                     $image->update($data);
                 } else {
                     $image = new CategoryImage($data);
                     $category->images()->save($image);
                 }
             }
         }
         \Session::flash('message', 'Category successfully updated!');
         return \Redirect::to('articles');
     }
 }
Example #21
0
        ?>
                            </p>
                        </a>
                    </div>
                </div>
                <?php 
    }
}
?>
            </div>
            <!-- end cotphainoibat-->
        </div>
        <?php 
foreach ($this->newsCate as $row) {
    $news = new Article();
    $news->where(array('recycle' => 0, 'newscatalogue_id' => $row->id));
    $news->order_by('id', 'desc');
    $news->get(5);
    $newsFirst = $news->limit(1);
    ?>
            <!--tin con 1 -->
            <div class="tinthitruong">
                <p style="font-size:16px; font-weight:bold; color:#FFFFFF; margin-left:12px; margin-top:8px;">
                    <a style="color: #FFF;" href="<?php 
    echo $base_url . 'tin-tuc/' . $row->name_none;
    ?>
">
                        <?php 
    echo $row->name_vietnamese;
    ?>
                    </a>
 /**
  * Reorder items
  *
  * @param items list
  * @return items from @param
  */
 public function getReorder(ReorderRequest $request)
 {
     $list = $request->list;
     $items = explode(",", $list);
     $order = 1;
     foreach ($items as $value) {
         if ($value != '') {
             Article::where('id', '=', $value)->update(array('position' => $order));
             $order++;
         }
     }
     return $list;
 }
Example #23
0
 function getProject()
 {
     //$type = new Estatetype($this->input->post('typeId'));
     //$category = new Estatecatalogue($type->estatecatalogue_id);
     $o = new Article();
     $o->where('recycle', 0);
     $o->where('estatecity_id', $this->input->post('provincesId'));
     $o->order_by('title_vietnamese', 'asc');
     $o->get();
     $option = '<option value="">Chọn Dự án</option>';
     foreach ($o as $row) {
         if ($row->id == $this->input->post('priceSelected')) {
             $option .= '<option selected="selected" value=' . $row->id . '>' . $row->title_vietnamese . '</option>';
         } else {
             $option .= '<option value=' . $row->id . '>' . $row->title_vietnamese . '</option>';
         }
     }
     echo $option;
     die;
 }
Example #24
0
 private function arrange_position_home()
 {
     $o = new Article();
     $o->where('home_hot', 1);
     $o->order_by('home_hot_position', 'asc');
     $o->get();
     $c = $o->count();
     $i = 1;
     foreach ($o as $row) {
         $i++;
         $row->home_hot_position = $i;
         $row->save();
     }
 }
Example #25
0
 static function getAllArticlesByCategoryUrl($cateogoryUrl, &$message, $orderby = "id")
 {
     $category = Category::where('curl', '=', $cateogoryUrl)->first();
     $articles = array();
     $articles = Article::where('category_id', '=', $category->id);
     if (is_null($category->parent_id)) {
         $parentCategory = $category->InnerCategory()->get();
         foreach ($parentCategory as $temp) {
             $articles = $articles->or_where('category_id', '=', $temp->id);
         }
     }
     //If user is not admin, show only his articles
     if (Auth::user()->type != 1) {
         $articles = $articles->where('author_id', '=', Auth::user()->id);
     }
     $message = "Showing all Articles of Category named " . $category->getCategoryFullName();
     return $articles;
 }
Example #26
0
 function isolate_list_by_cat($catalogue_id = 0, $offset = 0, $limit = 20)
 {
     $newscatalogue = new newscatalogue($catalogue_id);
     $news = new article();
     $news->where('newscatalogue_id', $catalogue_id);
     $news->where(array('recycle' => 0));
     $news->order_by('id', 'desc');
     $news->get_paged($offset, $limit, TRUE);
     $total = count($news);
     setPagination($this->admin . 'cnews/isolate_list_by_cat/' . $catalogue_id, $news->paged->total_rows, $limit, 5);
     if (!$newscatalogue->exists()) {
         show_404();
     }
     $dis['base_url'] = base_url();
     $dis['view'] = 'news/isolate_list';
     $dis['news'] = $news;
     $dis['title_table'] = "Trang hiện tại:" . $news->paged->current_page . '/' . $news->paged->total_pages;
     $dis['title'] = "Tin danh mục \"{$newscatalogue->name_vietnamese}\"";
     $n = new Article();
     $n->where('newscatalogue_id', $catalogue_id);
     $n->where(array('recycle' => 1));
     $count_recycle = $n->count();
     $dis['nav_menu'] = array(array("type" => "add", "text" => "Thêm tin mới", "link" => "{$this->admin_url}cnews/isolate_edit/" . $catalogue_id, "onclick" => ""));
     if ($this->logged_in_user->adminrole->id == 1) {
         array_push($dis['nav_menu'], array("type" => "recycle", "text" => "Thùng rác <span style='color:red'>(" . $count_recycle . ") </span>", "link" => "{$this->admin_url}cnews/list_recycle_by_cat/" . $catalogue_id, "onclick" => ""));
     }
     $this->session->set_userdata(array(config_item('session_admin') . 'menu_current' => $newscatalogue->navigation));
     if (empty($newscatalogue->menu_active)) {
         $dis['menu_active'] = $newscatalogue->name_vietnamese;
     } else {
         $dis['menu_active'] = $newscatalogue->menu_active;
     }
     $this->viewadmin($dis);
 }
Example #27
0
 function helpCenter()
 {
     $news = new Article();
     $news->where('newscatalogue_id', 65);
     $news->order_by('id', 'desc');
     $news->get_iterated();
     $dis['news'] = $news;
     $this->page_title = "Trợ giúp - " . $this->page_title;
     $dis['base_url'] = base_url();
     $dis['view'] = 'helpCenter';
     $this->viewfront($dis);
 }
<?php

// Home page
Route::get('/', array('as' => 'home', function () {
    return View::make('site::index')->with('entry', Page::where('slug', 'welcome')->first());
}));
// Article list
Route::get('blog', array('as' => 'article.list', function () {
    return View::make('site::articles')->with('entries', Article::orderBy('created_at', 'desc')->get());
}));
// Single article
Route::get('blog/{slug}', array('as' => 'article', function ($slug) {
    $article = Article::where('slug', $slug)->first();
    if (!$article) {
        App::abort(404, 'Article not found');
    }
    return View::make('site::article')->with('entry', $article);
}));
// Single page
Route::get('{slug}', array('as' => 'page', function ($slug) {
    $page = Page::where('slug', $slug)->first();
    if (!$page) {
        App::abort(404, 'Page not found');
    }
    return View::make('site::page')->with('entry', $page);
}))->where('slug', '^((?!admin).)*$');
// 404 Page
App::missing(function ($exception) {
    return Response::view('site::404', array(), 404);
});
                    </li>
                    <li>
                        <a href="{{ route('timeline') }}"><i class="fa fa-angle-right"></i> 我的时光印记</a>
                    </li>
                    <li>
                        <a href="{{ route('account.settings') }}"><i class="fa fa-angle-right"></i> 前往偏好设置</a>
                    </li>
                </ul>
            </div>
            {{-- /Categories Widget --}}

            {{-- Text Widget --}}
            <div class="widget">
                <?php 
$announce_category = Category::where('cat_status', 'open')->where('name', '站内简讯')->first();
$announce = Article::where('post_status', 'open')->where('category_id', $announce_category->id)->orderBy('created_at', 'desc')->first();
?>
                @if($announce)
                <div class="widget-title">
                    <h4><a href="{{ route('article.category'), $announce_category->id }}">站内简讯</a></h4>
                </div>
                <p>{{ $announce->excerpt }}</p>
                @else
                <div class="widget-title">
                    <h4>站内简讯</h4>
                </div>
                <p>
                    暂无站内简讯
                </p>
                @endif
            </div>
Example #30
0
 public function getMenuItems($category_id)
 {
     return Article::where('category_id', $category_id)->where('active', true)->where('menu_item', true)->whereNull('deleted_at')->whereRaw('(live_at <= now() or live_at is null)')->whereRaw('(down_at >= now() or down_at is null)')->get();
 }