Exemple #1
0
 } else {
     //show blog posts
     //if page num was changed at the url and exceeds pages number show the first page
     if ($page > ceil($num_posts / $posts_per_page) - 1) {
         $page = 0;
     }
     //retrieve blog posts
     $posts = $blog->getBlogPostsDB($page, $posts_per_page);
     /***blog posts area***/
     $tool_content .= "<div class='row'>";
     $tool_content .= "<div class='col-sm-9'>";
     foreach ($posts as $post) {
         $sharing_content = '';
         $rating_content = '';
         if ($sharing_allowed) {
             $sharing_content = $sharing_enabled ? print_sharing_links($urlServer . "modules/blog/index.php?course={$course_code}&amp;action=showPost&amp;pId=" . $post->getId(), $post->getTitle()) : '';
         }
         if ($ratings_enabled) {
             $rating = new Rating('up_down', 'blogpost', $post->getId());
             $rating_content = $rating->put($is_editor, $uid, $course_id);
         }
         if ($comments_enabled) {
             $comm = new Commenting('blogpost', $post->getId());
             $comment_content = "<a class='btn btn-primary btn-xs pull-right' href='{$_SERVER['SCRIPT_NAME']}?course={$course_code}&amp;action=showPost&amp;pId=" . $post->getId() . "#comments_title'>{$langComments} (" . $comm->getCommentsNum() . ")</a>";
         } else {
             $comment_content = "<div class=\"blog_post_empty_space\"></div>";
         }
         $tool_content .= "<div class='panel panel-action-btn-default'>\r\n                                <div class='panel-heading'>\r\n                                    <div class='pull-right'>\r\n                                        " . action_button(array(array('title' => $langModify, 'url' => "{$_SERVER['SCRIPT_NAME']}?course={$course_code}&amp;action=editPost&amp;pId=" . $post->getId(), 'icon' => 'fa-edit', 'show' => $post->permEdit($is_editor, $stud_allow_create, $uid)), array('title' => $langDelete, 'url' => "{$_SERVER['SCRIPT_NAME']}?course={$course_code}&amp;action=delPost&amp;pId=" . $post->getId(), 'icon' => 'fa-times', 'class' => 'delete', 'confirm' => $langSureToDelBlogPost, 'show' => $post->permEdit($is_editor, $stud_allow_create, $uid)))) . "\r\n                                    </div>\r\n                                    <h3 class='panel-title'>\r\n                                        <a href='{$_SERVER['SCRIPT_NAME']}?course={$course_code}&amp;action=showPost&amp;pId=" . $post->getId() . "'>" . q($post->getTitle()) . "</a>\r\n                                    </h3>                                    \r\n                                </div>\r\n                                <div class='panel-body'>\r\n                                    <div class='label label-success'>" . nice_format($post->getTime(), true) . "</div><small>" . $langBlogPostUser . display_user($post->getAuthor(), false, false) . "</small><br><br>" . standard_text_escape(ellipsize_html($post->getContent(), $num_chars_teaser_break, "<strong>&nbsp;...<a href='{$_SERVER['SCRIPT_NAME']}?course={$course_code}&amp;action=showPost&amp;pId=" . $post->getId() . "'> <span class='smaller'>[{$langMore}]</span></a></strong>")) . "\r\n                                    {$comment_content}\r\n                                </div>\r\n                                <div class='panel-footer'>\r\n                                    <div class='row'>\r\n                                        <div class='col-sm-6'>{$rating_content}</div>\r\n                                        <div class='col-sm-6 text-right'>{$sharing_content}</div>\r\n                                    </div>                                    \r\n                                </div>\r\n                             </div>";
     }
     //display navigation links
     $tool_content .= $blog->navLinksHTML($page, $posts_per_page);
Exemple #2
0
 //retrieve blog posts
 $posts = $blog->getBlogPostsDB($page, $posts_per_page);
         
 /***blog posts area***/
 $tool_content .= "<div class='row'>";
 $tool_content .= "<div class='col-sm-9'>";
 foreach ($posts as $post) {
     if ($blog_type == 'course_blog') {
         $allow_to_edit = $post->permEdit($is_editor, $stud_allow_create, $uid);
     } elseif ($blog_type == 'perso_blog') {
         $allow_to_edit = $is_blog_editor;
     }
     $sharing_content = '';
     $rating_content = '';
     if ($sharing_allowed) {
         $sharing_content = ($sharing_enabled) ? print_sharing_links($urlServer."modules/blog/index.php?$url_params&amp;action=showPost&amp;pId=".$post->getId(), $post->getTitle()) : '';
     }            
     if ($ratings_enabled) {
         $rating = new Rating('up_down', 'blogpost', $post->getId());
         if ($blog_type == 'course_blog') {
             $rating_content = $rating->put($is_editor, $uid, $course_id);
         } elseif ($blog_type == 'perso_blog') {
             //in this case send user_id as third argument instead of course_id which is 0
             //since we only need this info for identifying user's blog
             $rating_content = $rating->put(NULL, $uid, $user_id);
         }
     }
     if ($comments_enabled && ($post->getCommenting() == 1)) {
         $comm = new Commenting('blogpost', $post->getId());
         $comment_content = "<a class='btn btn-primary btn-xs pull-right' href='$_SERVER[SCRIPT_NAME]?$url_params&amp;action=showPost&amp;pId=".$post->getId()."#comments_title'>$langComments (".$comm->getCommentsNum().")</a>";
     } else {
Exemple #3
0
if (!empty($addon)) {
    $main_content .= "<div class='course_info'><h1>$langCourseAddon</h1><p>$addon</p></div>";
}
if (setting_get(SETTING_COURSE_COMMENT_ENABLE, $course_id) == 1) {
    commenting_add_js();
    $comm = new Commenting('course', $course_id);
    $main_content .= $comm->put($course_code, $is_editor, $uid);
}
if (setting_get(SETTING_COURSE_RATING_ENABLE, $course_id) == 1) {
    $rating = new Rating('fivestar', 'course', $course_id);
    $rating_content = $rating->put($is_editor, $uid, $course_id);
}
if (is_sharing_allowed($course_id)) {
    if (setting_get(SETTING_COURSE_SHARING_ENABLE, $course_id) == 1) {
        $social_content = print_sharing_links($urlServer."courses/$course_code", $currentCourseName);
    }
}
$panel_footer = "";
if(isset($rating_content) || isset($social_content)) {
    $panel_footer .= "                
                <div class='panel-footer'>
                    <div class='row'>";
    if(isset($rating_content)){
     $panel_footer .=
            "<div class='col-sm-6'>
                $rating_content
            </div>";       
    }
    if(isset($social_content)){
     $panel_footer .=