示例#1
0
 $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 {
         $comment_content = "<div class=\"blog_post_empty_space\"></div>";
     }            
     $tool_content .= "<div class='panel panel-action-btn-default'>
                         <div class='panel-heading'>
                             <div class='pull-right'>
示例#2
0
     $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);
 $tool_content .= "</div>";
 /***end of blog posts area***/
 /***sidebar area***/
 $tool_content .= "<div class='col-sm-3'>";
示例#3
0
         $user_stats[$myrow->poster_id] = '';
     }
 }
 $tool_content .= "<td valign='top'>" . display_user($myrow->poster_id) . $user_stats[$myrow->poster_id] . "</td>";
 $message = $myrow->post_text;
 // support for math symbols
 $message = mathfilter($message, 12, "../../courses/mathimg/");
 if ($count == 0) {
     $postTitle = "<b>{$langPostTitle}: </b>" . q($topic_subject);
 } else {
     $postTitle = "";
 }
 $rate_str = "";
 if (setting_get(SETTING_FORUM_RATING_ENABLE, $course_id)) {
     $rating = new Rating('thumbs_up', 'forum_post', $myrow->id);
     $rate_str = $rating->put($is_editor, $uid, $course_id);
 }
 $anchor_link = "<a href='{$_SERVER['SCRIPT_NAME']}?course={$course_code}&amp;topic={$topic}&amp;forum={$forum}&amp;post_id={$myrow->id}#{$myrow->id}'>#{$myrow->id}</a><br/>";
 if ($myrow->parent_post_id == -1) {
     $parent_post_link = "<br/>{$langForumPostParentDel}";
 } elseif ($myrow->parent_post_id != 0) {
     $parent_post_link = "{$langForumPostParent}<a href='viewtopic.php?course={$course_code}&amp;topic={$topic}&amp;forum={$forum}&amp;post_id={$myrow->parent_post_id}#{$myrow->parent_post_id}'>#{$myrow->parent_post_id}</a><br/><br/>";
 } else {
     $parent_post_link = "";
 }
 $tool_content .= "<td>\n\t  <div>\n\t    <a name='" . $myrow->id . "'></a>" . $anchor_link;
 $tool_content .= "<b>{$langSent}: </b>" . $myrow->post_time . "<br>{$postTitle}\n\t  </div>\n\t  <br />{$message}<br />" . $parent_post_link . $rate_str . "\n\t</td>";
 $dyntools = !$is_editor ? array() : array(array('title' => $langModify, 'url' => "editpost.php?course={$course_code}&amp;post_id=" . $myrow->id . "&amp;topic={$topic}&amp;forum={$forum}", 'icon' => 'fa-edit'), array('title' => $langDelete, 'url' => "{$_SERVER['SCRIPT_NAME']}?course={$course_code}&amp;post_id={$myrow->id}&amp;topic={$topic}&amp;forum={$forum}&amp;delete=on", 'icon' => 'fa-times', 'class' => 'delete', 'confirm' => $langConfirmDelete));
 if ($topic_locked != 1) {
     $dyntools[] = array('title' => $langForumPostReply, 'url' => "reply.php?course={$course_code}&amp;topic={$topic}&amp;forum={$forum}&amp;parent_post={$myrow->id}", 'icon' => 'fa-reply');
 }
示例#4
0
/**
 * @brief display links of category
 * @global type $is_editor
 * @global type $course_id
 * @global type $urlview
 * @global type $tool_content
 * @global type $urlServer
 * @global type $course_code
 * @global type $langLinkDelconfirm
 * @global type $langDelete
 * @global type $langUp
 * @global type $langDown
 * @global type $langEditChange
 * @global type $is_in_tinymce
 * @param type $catid
 */
function showlinksofcategory($catid) {
    global $is_editor, $course_id, $urlview, $socialview_param, $tool_content,
    $urlServer, $course_code,
    $langLinkDelconfirm, $langDelete, $langUp, $langDown,
    $langEditChange, $is_in_tinymce, $links_num, $langLinkSubmittedBy;

    $tool_content .= "<tr>";
    $result = Database::get()->queryArray("SELECT * FROM `link`
                                   WHERE course_id = ?d AND category = ?d
                                   ORDER BY `order`", $course_id, $catid);
    $numberoflinks = count($result);
    $links_num = 1;    
    foreach ($result as $myrow) {
        $title = empty($myrow->title) ? $myrow->url : $myrow->title;        
        $aclass = ($is_in_tinymce) ? " class='fileURL' " : '';
        $tool_content .= "<td class='nocategory-link'><a href='" . q($myrow->url) . "' $aclass target='_blank'>" . q($title) . "&nbsp;&nbsp;<i class='fa fa-external-link' style='color:#444'></i></a>";
        if ($catid == -2 && $myrow->user_id != 0) {
            $tool_content .= "<small> - $langLinkSubmittedBy ".display_user($myrow->user_id, false, false)."</small>";
        }
        if (!empty($myrow->description)) {
            $tool_content .= "<br />" . standard_text_escape($myrow->description);
        }
        if ($catid == -2) { //social bookmarks can be rated
            global $uid;
            $rating = new Rating('thumbs_up', 'link', $myrow->id);
            $tool_content .= $rating->put($is_editor, $uid, $course_id);
        }
        $tool_content .= "</td>";
        
        if ($is_editor && !$is_in_tinymce) {   
            $tool_content .= "<td class='option-btn-cell'>";
            $editlink = "$_SERVER[SCRIPT_NAME]?course=$course_code&amp;action=editlink&amp;id=" . getIndirectReference($myrow->id) . "&amp;urlview=$urlview".$socialview_param;
            if (isset($category)) {
                $editlink .= "&amp;category=" . getIndirectReference($category);
            }
            $tool_content .= action_button(array(
                array('title' => $langEditChange,
                      'icon' => 'fa-edit',
                      'url' => $editlink),
                array('title' => $langUp,
                      'level' => 'primary',
                      'icon' => 'fa-arrow-up',
                      'disabled' => $links_num == 1,
                      'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&amp;urlview=$urlview&amp;up=" . getIndirectReference($myrow->id) . $socialview_param,
                      ),
                array('title' => $langDown,
                      'level' => 'primary',
                      'icon' => 'fa-arrow-down',
                      'disabled' => $links_num >= $numberoflinks,
                      'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&amp;urlview=$urlview&amp;down=" . getIndirectReference($myrow->id) . $socialview_param,
                      ),
                array('title' => $langDelete,
                      'icon' => 'fa-times',
                      'class' => 'delete',
                      'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&amp;action=deletelink&amp;id=" . getIndirectReference($myrow->id) . "&amp;urlview=$urlview".$socialview_param,
                      'confirm' => $langLinkDelconfirm)
            ));
            $tool_content .= "</td>";
        } elseif ($catid == -2 && !$is_in_tinymce) {
            if (isset($_SESSION['uid'])) {
                if (is_link_creator($myrow->id)) {
                    $tool_content .= "<td class='option-btn-cell'>";
                    $editlink = "$_SERVER[SCRIPT_NAME]?course=$course_code&amp;action=editlink&amp;id=" . getIndirectReference($myrow->id) . "&amp;urlview=$urlview".$socialview_param;
                    $tool_content .= action_button(array(
                            array('title' => $langEditChange,
                                    'icon' => 'fa-edit',
                                    'url' => $editlink),
                            array('title' => $langDelete,
                                    'icon' => 'fa-times',
                                    'class' => 'delete',
                                    'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&amp;action=deletelink&amp;id=" . getIndirectReference($myrow->id) . "&amp;urlview=$urlview".$socialview_param,
                                    'confirm' => $langLinkDelconfirm)
                    ));
                    $tool_content .= "</td>";
                } else {
                    if (abuse_report_show_flag('link', $myrow->id , $course_id, $is_editor)) {
                        $flag_arr = abuse_report_action_button_flag('link', $myrow->id, $course_id);
                    
                        $tool_content .= "<td class='option-btn-cell'>".action_button(array($flag_arr[0])).$flag_arr[1]."</td>"; //action button option
                    } else {
                        $tool_content .= "<td>&nbsp;</td>";
                    }
                }
            }
        }
        
        $tool_content .= "</tr>";
        $links_num++;
    }
}
示例#5
0
function showgroupsofcategory($catid) {
    global $is_editor, $course_id, $urlview, $socialview_param, $tool_content,
    $course_code, $langGroupDelconfirm, $langDelete, $langUp, $langDown,
    $langEditChange, $is_in_tinymce, $groups_num;

    $tool_content .= "<tr>";
    $result = Database::get()->queryArray("SELECT * FROM `group`
                                   WHERE course_id = ?d AND category_id = ?d
                                   ORDER BY `id`", $course_id, $catid);
  
    foreach ($result as $myrow) {
        $name = empty($myrow->name) ? $myrow->description : $myrow->name;        
        $tool_content .= "<td class='nocategory-link'>" . q($name) . "&nbsp;&nbsp;";

        if (!empty($myrow->description)) {
            $tool_content .= "<br />" . standard_text_escape($myrow->description);
        }
        if ($catid == -2) { 
            global $uid;
            $rating = new Rating('thumbs_up', 'group', $myrow->id);
            $tool_content .= $rating->put($is_editor, $uid, $course_id);
        }
        $tool_content .= "</td>";
        
        if ($is_editor && !$is_in_tinymce) {   
            $tool_content .= "<td class='option-btn-cell'>";
            $tool_content .= action_button(array(
                array('title' => $langEditChange,
                      'icon' => 'fa-edit',
                      'url' => "group_edit.php?course=$course_code&amp;category=$catid&amp;group_id=$myrow->id"),
                array('title' => $langDelete,
                      'icon' => 'fa-times',
                      'class' => 'delete',
                      'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&amp;deletegroup=1&amp;id=$myrow->id",
                      'confirm' => $langGroupDelconfirm)
            ));
            $tool_content .= "</td>";
        } /*elseif ($catid == -2 && !$is_in_tinymce) {
            if (isset($_SESSION['uid'])) {
                if (is_link_creator($myrow->id)) {
                    $tool_content .= "<td class='option-btn-cell'>";
                    $editgroup = "$_SERVER[SCRIPT_NAME]?course=$course_code&amp;action=editgroup&amp;id=" . getIndirectReference($myrow->id) . "&amp;urlview=$urlview".$socialview_param;
                    $tool_content .= action_button(array(
                            array('title' => $langEditChange,
                                    'icon' => 'fa-edit',
                                    'url' => $editgroup),
                            array('title' => $langDelete,
                                    'icon' => 'fa-times',
                                    'class' => 'delete',
                                    'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&amp;action=deletegroup&amp;id=" . getIndirectReference($myrow->id) . "&amp;urlview=$urlview".$socialview_param,
                                    'confirm' => $langGroupDelconfirm)
                    ));
                    $tool_content .= "</td>";
                } else {
                    if (abuse_report_show_flag('group', $myrow->id , $course_id, $is_editor)) {
                        $flag_arr = abuse_report_action_button_flag('group', $myrow->id, $course_id);
                    
                        $tool_content .= "<td class='option-btn-cell'>".action_button(array($flag_arr[0])).$flag_arr[1]."</td>"; //action button option
                    } else {
                        $tool_content .= "<td>&nbsp;</td>";
                    }
                }
            }
        }*/
        
        $tool_content .= "</tr>";
    }
}