), array( 'title' => $langDelete, 'url' => "$_SERVER[SCRIPT_NAME]?$url_params&action=delPost&pId=".$post->getId(), 'icon' => 'fa-times', 'class' => 'delete', 'confirm' => $langSureToDelBlogPost, 'show' => $allow_to_edit ) ))." </div> <h3 class='panel-title'> ".q($post->getTitle())." </h3> </div> <div class='panel-body'><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($post->getContent())."</div> <div class='panel-footer'> <div class='row'> <div class='col-sm-6'>$rating_content</div> <div class='col-sm-6 text-right'>$sharing_content</div> </div> </div> </div>"; if ($comments_enabled) { if ($post->getCommenting() == 1) { commenting_add_js(); //add js files needed for comments $comm = new Commenting('blogpost', $post->getId()); if ($blog_type == 'course_blog') { $tool_content .= $comm->put($course_code, $is_editor, $uid, true); } elseif ($blog_type == 'perso_blog') {
//show blog post if ($action == "showPost") { $tool_content .= action_bar(array(array('title' => $langBack, 'url' => "{$_SERVER['SCRIPT_NAME']}?course={$course_code}&action=showBlog", 'icon' => 'fa-reply', 'level' => 'primary-label', 'show' => $blog->permCreate($is_editor, $stud_allow_create, $uid)))); $post = new BlogPost(); if ($post->loadFromDB($pId)) { $post->incViews(); $sharing_content = ''; $rating_content = ''; if ($sharing_allowed) { $sharing_content = $sharing_enabled ? print_sharing_links($urlServer . "modules/blog/index.php?course={$course_code}&action=showPost&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); } $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}&action=editPost&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}&action=delPost&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 " . q($post->getTitle()) . "\r\n </h3>\r\n </div>\r\n <div class='panel-body'><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($post->getContent()) . "</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>"; if ($comments_enabled) { $comm = new Commenting('blogpost', $post->getId()); $tool_content .= $comm->put($course_code, $is_editor, $uid, true); } } else { Session::Messages($langBlogPostNotFound); redirect_to_home_page("modules/blog/index.php?course={$course_code}"); } } //show all blog posts if ($action == "showBlog") { $tool_content .= action_bar(array(array('title' => $langBlogAddPost, 'url' => "{$_SERVER['SCRIPT_NAME']}?course={$course_code}&action=createPost", 'icon' => 'fa-plus-circle', 'level' => 'primary-label', 'button-class' => 'btn-success', 'show' => $blog->permCreate($is_editor, $stud_allow_create, $uid)), array('title' => $langConfig, 'url' => "{$_SERVER['SCRIPT_NAME']}?course={$course_code}&action=settings", 'icon' => 'fa-gear', 'level' => 'primary', 'show' => $is_editor && $blog->permCreate($is_editor, $stud_allow_create, $uid)))); $num_posts = $blog->blogPostsNumber(); if ($num_posts == 0) { //no blog posts