Ejemplo n.º 1
0
                 'url' => "$_SERVER[SCRIPT_NAME]?$url_params&action=showBlog",
                 'icon' => 'fa-reply',
                 'level' => 'primary-label')
 ));
 $post = new BlogPost();
 if ($post->loadFromDB($pId)) {
     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;
     }
     $post->incViews();
     $sharing_content = '';
     $rating_content = '';
     if ($sharing_allowed) {
         $sharing_content = ($sharing_enabled) ? print_sharing_links($urlServer."modules/blog/index.php?$url_params&action=showPost&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);
         }
     }        
     $tool_content .= "<div class='panel panel-action-btn-default'>
                         <div class='panel-heading'>
                             <div class='pull-right'>
                                 ". action_button(array(
Ejemplo n.º 2
0
    }
    redirect_to_home_page("modules/blog/index.php?course={$course_code}");
}
if (isset($message) && $message) {
    $tool_content .= $message . "<br/>";
}
//show blog post
if ($action == "showPost") {
    $tool_content .= action_bar(array(array('title' => $langBack, 'url' => "{$_SERVER['SCRIPT_NAME']}?course={$course_code}&amp;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}&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);
        }
        $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                                    " . 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}");
    }
}