Exemple #1
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++;
    }
}
Exemple #2
0
            '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');
    }
    if (abuse_report_show_flag('forum_post', $myrow->id, $course_id, $is_editor)) {
        $flag_arr = abuse_report_action_button_flag('forum_post', $myrow->id, $course_id);
        
        $dyntools[] = $flag_arr[0]; //action button option
        $report_modal = $flag_arr[1]; //modal html code
    }
    if (!empty($dyntools)) {
        if (isset($report_modal)) {
            $tool_content .= "<td valign='center'>" . action_button($dyntools) . $report_modal . "</td>";
            unset($report_modal);
        } else {
            $tool_content .= "<td valign='center'>" . action_button($dyntools) . "</td>";
        }
    }
    $tool_content .= "</tr>";
    $count++;
}