Example #1
0
 /**
  * @param $comments
  * @param $likes
  * TODO:
  * Статик ссылку заменить на реальный аватар
  * Сделать кнопку  "ответить"
  * Убрать всетаки бб коды
  * Не пеерносфятся строки в визуальном редакторе
  */
 public static function comments($comments, $likes)
 {
     $result = '';
     if (!App::$user->isGuest) {
         $result = '<a href="#comment-form" class="comment-scroll">Комментировать</a>';
     }
     if (!empty($likes)) {
         $likes = array_flip($likes);
     }
     foreach ($comments as $key => $comment) {
         if (isset($likes[$comment->comment_id])) {
             $liked = 'liked';
         }
         if ($key == 0) {
             $result .= '<li class="comment first">';
         } else {
             $result .= '<li class="comment">';
         }
         $result .= '<article id="comment-' . $comment->comment_id . '"><img class="comment-avatar" src="/images/test.jpg" width="60">';
         $result .= '<div class="comment-meta">';
         $result .= '<a class="by-author" href="/user/' . $comment->comment_author_id . '">' . $comment->username . '</a> ';
         $result .= '<span class="by-date">';
         $result .= ' написал <a href="#comment-' . $comment->comment_id . '">' . ViewHelper::date($comment->comment_date) . '</a>';
         $result .= '</span>';
         if (app::$user->id != $comment->comment_author_id and !app::$user->isGuest) {
             $result .= '<a href="#reply" class="comment-reply" data-tip="Ответить"><i class="icon-reply"></i></a>';
         }
         $result .= '</div>';
         $result .= '<div class="comment-content">' . nl2br($comment->comment_text) . '</div>';
         $result .= '<div class="comment-like-box">';
         if (app::$user->id != $comment->comment_author_id and !app::$user->isGuest) {
             if (isset($liked)) {
                 $result .= '<a class="comment-like ' . $liked . '" href="#" data-comment-id="' . $comment->comment_id . '"><i class="icon-heart"></i></a>';
             } else {
                 $result .= '<a class="comment-like" href="#" data-tip="Мне нравится" data-comment-id="' . $comment->comment_id . '"><i class="icon-heart"></i></a>';
             }
         }
         if ($comment->comment_count_likes) {
             $result .= '<span class="comment-like-count">' . $comment->comment_count_likes . '</span>';
         }
         $result .= '</div>';
         $result .= '</article>';
         $result .= '</li>';
         $liked = null;
     }
     $result = '<ol class="commentlist">' . $result . '</ol>';
     print $result;
 }
Example #2
0
 public static function links($per_page = null)
 {
     if ($per_page === null) {
         $per_page = app::$request->pagination['per_page'];
     }
     $path = '/' . App::$request->controller . '/' . App::$request->action;
     $links = '<div class="page-numbers">';
     $active = App::$request->pagination['page'] / $per_page + 1;
     $del = app::$request->pagination['count'] / $per_page;
     $pages = ceil($del);
     $limiter = 0;
     $links .= ViewHelper::url($path . '/' . App::$request->pagination['key'] . '/' . 1, 'В начало');
     for ($i = 1; $i <= $pages; $i++) {
         $limiter++;
         if ($active == $i) {
             $links .= ViewHelper::url($path . '/' . App::$request->pagination['key'] . '/' . $i, $i, ['class' => $active]);
         } else {
             $links .= ViewHelper::url($path . '/' . App::$request->pagination['key'] . '/' . $i, $i);
         }
         if (App::$config['pagination']['pager_limit'] == $limiter) {
             break;
         }
     }
     if (App::$config['pagination']['pager_limit'] < $pages) {
         if ($active == $pages) {
             $links .= '... ' . ViewHelper::url($path . '/' . App::$request->pagination['key'] . '/' . $pages, $pages, ['class' => $active]);
         } else {
             $links .= '... ' . ViewHelper::url($path . '/' . App::$request->pagination['key'] . '/' . $pages, $pages);
         }
         $links .= ViewHelper::url($path . '/' . App::$request->pagination['key'] . '/' . $pages, 'В конец');
     }
     $links .= '</div>';
     if (app::$request->pagination['count'] > app::$request->pagination['per_page']) {
         print $links;
     }
 }
Example #3
0
<?php

use Catrina\Widget\ViewHelper;
?>
<!DOCTYPE html>
<html>
<head>
    <title><?php 
echo $title = "Вход";
?>
</title>
    <?php 
ViewHelper::addCss('/assets/css/backend.css');
ViewHelper::addJs('/assets/js/jquery-1.11.3.min.js');
ViewHelper::addJs('/assets/js/jquery.liTranslit.js');
ViewHelper::addJs('/assets/js/backend.js');
?>
    <meta charset="utf-8">
</head>
<body>
<?php 
echo $this->view;
?>
</body>
</html>

Example #4
0
?>

</head>
<body>
<div class="container <?php 
echo app::$request->controller;
?>
">
    <div class="row">
        <div class="col-md-12">
            <nav>
                <?php 
Navigation::render([['label' => 'Главная', 'link' => '/']]);
?>
            </nav>
        </div>
    </div>
    <?php 
echo $this->view;
?>
    <footer>
        <div class="copyright">
            <span>Catrina framework &copy; 2015</span>
        </div>
    </footer>
</div>
<?php 
ViewHelper::printJs();
?>
</body>
</html>