Example #1
0
 public function index()
 {
     $status = 'Approve';
     $data['result'] = Model\Portal\Comment::latest('date')->get();
     $data['status'] = $status;
     $this->template->build('index', $data);
 }
Example #2
0
 /**
  * Index Page for this controller.
  *
  * Maps to the following URL
  *      http://example.com/index.php/welcome
  *  - or -
  *      http://example.com/index.php/welcome/index
  *  - or -
  * Since this controller is set as the default controller in
  * config/routes.php, it's displayed at http://example.com/
  *
  * So any other public methods not prefixed with an underscore will
  * map to /index.php/welcome/<method_name>
  * @see http://codeigniter.com/user_guide/general/urls.html
  */
 public function index()
 {
     $visitor = new Library\Visitor\Visitor();
     $data = ['visitor' => $visitor, 'visitor_today' => $visitor->countVisitorToday(), 'visitor_week' => $visitor->countVisitorByWeek(), 'visitor_month' => $visitor->countVisitorByMonth(), 'new_visitor_unique' => $visitor->getVisitorToday()->count(), 'popular_post' => Model\Portal\Article::popular()->get(), 'latest_comment' => Model\Portal\Comment::latest('date')->get()];
     $this->template->inject_partial('script', '<script src="' . base_url('assets/admin/js/analytic.js') . '"></script>');
     $this->template->build('dashboard', $data);
 }
Example #3
0
 public function indexDraft()
 {
     $status = 'Draft';
     $data['result'] = Model\Portal\Comment::onlyDrafts()->latest('date')->get();
     $data['status'] = $status;
     $this->template->build('index', $data);
 }
Example #4
0
 public function store()
 {
     $article = Model\Portal\Article::withPrivate()->findOrFail(set_value('article_id'));
     $this->form_validation->set_rules('name', 'Name', 'required');
     $this->form_validation->set_rules('email', 'Email', 'required|valid_email');
     $this->form_validation->set_rules('content', 'Komentar', 'required');
     $this->form_validation->set_rules('article_id', 'Artikel', 'required');
     if ($this->form_validation->run() == FALSE) {
         if ($this->request->isXmlHttpRequest()) {
             $response = new Response();
             $response->setContent(json_encode(['status' => 'error', 'data' => $this->form_validation->error_array()]));
             $response->headers->set('Content-Type', 'application/json');
         } else {
             keepValidationErrors();
             redirect($article->link . '#comments', 'refresh');
         }
     } else {
         $data = array('content' => set_value('content'), 'nama' => set_value('name'), 'email' => set_value('email'), 'artikel_id' => set_value('article_id'), 'parent' => set_value('parent', 0), 'status' => 'draft', 'date' => Carbon::now());
         $comment = Model\Portal\Comment::create($data);
         if ($user = auth()->check()) {
             $comment->user()->associate($user->id);
             if ($user->inRole(['su', 'adm', 'edt', 'ins', 'mdr'])) {
                 $comment->status = 'publish';
             } else {
                 $comment->status = 'draft';
             }
             $comment->save();
         }
         if ($this->request->isXmlHttpRequest()) {
             $response = new Response();
             $response->setContent(json_encode(['status' => 'success', 'data' => $comment]));
             $response->headers->set('Content-Type', 'application/json');
         } else {
             if ($comment->status == 'publish') {
                 set_message_success('Komentar Anda sudah ditampilkan.');
                 redirect($article->link . '#comment-' . $comment->id, 'refresh');
             } else {
                 set_message_success('Komentar Anda akan tampil setelah dimoderasi.');
                 redirect($article->link . '#comments', 'refresh');
             }
         }
     }
 }
Example #5
0
                    <?php 
}
?>
                </div>
            </div>
        </div>
    </div>

    <div class="widget">
        <div class="widget-heading">
            <h3>Komentar Terkini</h3>
        </div>
        <div class="widget-content">
            <div class="row">
                <?php 
$comments = Model\Portal\Comment::latest('date')->get();
?>
                <?php 
if ($comments->count()) {
    ?>
                    <?php 
    foreach ($comments as $comment) {
        ?>
                    <div class="box-komentar-widget">
                        <div class="col-sm-3 col-xs-4">
                            <div class="box-komentar-widget-img">
                                <img src="<?php 
        echo $comment->avatar;
        ?>
" alt="">
                            </div>
                    <?php 
}
?>
                </div>
            </div>
        </div>
    </div>

    <div class="widget">
        <div class="widget-heading">
            <h3>KOMENTAR TERKINI</h3>
        </div>
        <div class="widget-content">
            <?php 
foreach (Model\Portal\Comment::whereHas('article', function ($query) {
    return $query->where('type', 'private');
})->latest('date')->get() as $comment) {
    ?>
            <div class="row">
                <div class="box-komentar-widget">
                    <div class="col-sm-3 col-xs-4">
                        <div class="box-komentar-widget-img">
                            <img src="<?php 
    echo $comment->avatar;
    ?>
" alt="">
                        </div>
                    </div>
                    <div class="col-sm-9 col-xs-8">
                        <div class="box-komentar-widget-title">
                            <p><strong><a href="#"><?php 
Example #7
0
?>
</div>
        <div class="title">Visitors Today</div>
    </li>
    <li>
        <i class="icon-user-follow"></i>
        <div class="number"><?php 
echo $new_visitor_unique;
?>
</div>
        <div class="title">New Visitor Unique</div>
    </li>
    <li>
        <i class="icon-speech"></i>
        <div class="number"><?php 
echo Model\Portal\Comment::all()->count();
?>
</div>
        <div class="title">New comments</div>
    </li>
</ul>

<div class="panel panel-default">
    <div class="panel-body">
        <ul>
            <li>Visitor Today : <?php 
echo $visitor_today;
?>
</li>
            <li>Visitor this Week : <?php 
echo $visitor_week;
Example #8
0
                    <?php 
}
?>
                </div>
            </div>
        </div>
    </div>

    <div class="widget">
        <div class="widget-heading">
            <h3>LATEST KOMENTAR</h3>
        </div>
        <div class="widget-content">
            <div class="row">
                <?php 
foreach (Model\Portal\Comment::latest('date')->get() as $comment) {
    ?>
                <div class="box-komentar-widget">
                    <div class="col-sm-3 col-xs-4">
                        <div class="box-komentar-widget-img">
                            <img src="<?php 
    echo $comment->avatar;
    ?>
" alt="">
                        </div>
                    </div>
                    <div class="col-sm-9 col-xs-8">
                        <div class="box-komentar-widget-title">
                            <p><strong><a href="#"><?php 
    echo $comment->nama;
    ?>