예제 #1
0
 public function index()
 {
     $cat_1 = config('homepage_category_1');
     $cat_2 = config('homepage_category_2');
     $cat_3 = config('homepage_category_3');
     $cat_4 = config('homepage_category_4');
     $homepage_category_1_title = Model\Portal\Category::find($cat_1);
     $homepage_category_1 = Model\Portal\Article::categoryId($cat_1);
     $homepage_category_2_title = Model\Portal\Category::find($cat_2);
     $homepage_category_2_a = Model\Portal\Article::categoryId($cat_2);
     $homepage_category_2_b = Model\Portal\Article::categoryId($cat_2);
     $homepage_category_3_title = Model\Portal\Category::find($cat_3);
     $homepage_category_3 = Model\Portal\Article::categoryId($cat_3);
     $homepage_category_4_title = Model\Portal\Category::find($cat_4);
     $homepage_category_4 = Model\Portal\Article::categoryId($cat_4);
     $data = array('homepage_category_1_title' => $homepage_category_1_title ? $homepage_category_1_title->name : 'No Category', 'homepage_category_1' => $homepage_category_1->count() ? $homepage_category_1->take(10)->latest('date')->get() : collect([]), 'homepage_category_1_link' => $homepage_category_1_title ? portal_url('category/show/' . $homepage_category_1_title->name) : portal_url(), 'homepage_category_2_title' => $homepage_category_2_title ? $homepage_category_2_title->name : 'No Category', 'homepage_category_2_a' => $homepage_category_2_a->count() ? $homepage_category_2_a->take(10)->latest('date')->get() : collect([]), 'homepage_category_2_b' => $homepage_category_2_b->count() ? $homepage_category_2_b->take(2)->skip(2)->latest('date')->get() : collect([]), 'homepage_category_2_link' => $homepage_category_2_title ? portal_url('category/show/' . $homepage_category_2_title->name) : portal_url(), 'homepage_category_3_title' => $homepage_category_3_title ? $homepage_category_3_title->name : 'No Category', 'homepage_category_3' => $homepage_category_3->count() ? $homepage_category_3->take(5)->latest('date')->get() : collect([]), 'homepage_category_3_link' => $homepage_category_3_title ? portal_url('category/show/' . $homepage_category_3_title->name) : portal_url(), 'homepage_category_4_title' => $homepage_category_4_title ? $homepage_category_4_title->name : 'No Category', 'homepage_category_4' => $homepage_category_4->count() ? $homepage_category_4->take(10)->latest('date')->get() : collect([]), 'homepage_category_4_link' => $homepage_category_4_title ? portal_url('category/show/' . $homepage_category_4_title->name) : portal_url(), 'links' => $this->Mod_link->read(), 'latest' => Model\Portal\Article::latest('date')->limit(10)->get());
     $this->template->set('slider', true);
     $this->template->set('railnews', true);
     $this->template->set('sidebar', true);
     $this->template->set('sidebarCategory', false);
     $this->template->build('index', $data);
 }
예제 #2
0
 public function index()
 {
     $request = Request::createFromGlobals();
     $articles = Model\Portal\Article::published()->latest('date');
     $status = 'publish';
     if ($request->query->has('status')) {
         $status = $request->query->get('status');
         if ($status === 'draft') {
             $this->indexDraft();
             return;
         } elseif ($status === 'schedule') {
             $articles = Model\Portal\Article::withDrafts()->scheduled()->latest('date');
         } elseif ($status === 'all') {
             $articles = Model\Portal\Article::latest('date');
         }
     }
     if (sentinel()->inRole(['edt'])) {
         $articles = $articles->onlyAllowEditor();
     }
     $data['artikel'] = $articles->get();
     $data['status'] = $status;
     $this->template->build('index', $data);
 }
예제 #3
0
                            </div>
                        </div>
                        <?php 
    }
    ?>
                    <?php 
} else {
    ?>
                        <p class="alert alert-warning">Tidak ada artikel yang ditampilkan.</p>
                    <?php 
}
?>
                </div>
                <div class="tab-pane fade" id="latest-post" role="tabpanel" aria-labelledby="latest-post-tab" aria-expanded="false">
                    <?php 
$latest = Model\Portal\Article::latest('date')->limit(4)->get();
?>
                    <?php 
if ($latest->count()) {
    ?>
                        <?php 
    foreach ($latest as $article) {
        ?>
                        <div class="box-articles-widget">
                            <div class="row">
                                <div class="col-sm-4 col-xs-6">
                                    <div class="box-articles-widget-img">
                                        <a href="<?php 
        echo $article->link;
        ?>
"><img src="<?php 
예제 #4
0
<!-- start:rails news -->
<div class="rails-news">
    <div class="row">
        <div class="col-md-2 col-sm-2 col-xs-2">
            <div class="btn-group btn-group-sm" role="group" aria-label="Small button group">
                <button type="button" class="btn btn-secondary" href="#carousel-rails-news" role="button" data-slide="prev"><i class="fa fa-chevron-left"></i></button>
                <button type="button" class="btn btn-secondary" href="#carousel-rails-news" role="button" data-slide="next"><i class="fa fa-chevron-right"></i></button>
            </div>
        </div>
        <div class="col-md-10 col-sm-10 col-xs-10">
            <div id="carousel-rails-news" class="carousel slide" data-ride="carousel">
                <div class="carousel-inner" role="listbox">
                    <?php 
$i = 0;
$railnews = Model\Portal\Article::latest('date')->take(3)->get();
foreach ($railnews as $article) {
    ?>
                        <div class="carousel-item <?php 
    echo $i == 0 ? 'active' : '';
    ?>
">
                            <p><a href="<?php 
    echo $article->link;
    ?>
"><?php 
    echo $article->title;
    ?>
</a> - <?php 
    echo $article->date->format('d M Y');
    ?>
</p>
예제 #5
0
<?php

$sliders = Model\Portal\Article::latest('date')->slider()->take(3)->get();
?>
<section id="header-main">
    <div class="container">
        <div class="row">
            <div class="col-lg-8 col-md-8 col-sm-12 col-xs-12">
                <div id="carousel-slider-top" class="carousel slide" data-ride="carousel">
                    <ol class="carousel-indicators">
                        <?php 
if ($sliders->count() > 0) {
    ?>
                            <?php 
    $i = 0;
    foreach ($sliders as $slider) {
        ?>
                                <li data-target="#carousel-slider-top" data-slide-to="<?php 
        echo $i;
        ?>
"<?php 
        echo $i == 0 ? ' class="active"' : '';
        ?>
></li>
                            <?php 
        $i++;
    }
    ?>
                        <?php 
} else {
    ?>
예제 #6
0
    ?>
"><?php 
    echo $article->title;
    ?>
</a></h4>
                                </div>
                            </div>
                        </div>
                    </div>
                    <?php 
}
?>
                </div>
                <div class="tab-pane fade" id="latest-post" role="tabpanel" aria-labelledby="latest-post-tab" aria-expanded="false">
                    <?php 
foreach (Model\Portal\Article::latest('date')->limit(5)->get() as $article) {
    ?>
                    <div class="box-articles-widget">
                        <div class="row">
                            <div class="col-sm-4 col-xs-6">
                                <div class="box-articles-widget-img">
                                    <a href="<?php 
    echo $article->link;
    ?>
"><img src="<?php 
    echo $article->featured_image;
    ?>
" alt=""></a>
                                </div>
                            </div>
                            <div class="col-sm-8 col-xs-6">