/** * @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) . " <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&action=editlink&id=" . getIndirectReference($myrow->id) . "&urlview=$urlview".$socialview_param; if (isset($category)) { $editlink .= "&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&urlview=$urlview&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&urlview=$urlview&down=" . getIndirectReference($myrow->id) . $socialview_param, ), array('title' => $langDelete, 'icon' => 'fa-times', 'class' => 'delete', 'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&action=deletelink&id=" . getIndirectReference($myrow->id) . "&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&action=editlink&id=" . getIndirectReference($myrow->id) . "&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&action=deletelink&id=" . getIndirectReference($myrow->id) . "&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> </td>"; } } } } $tool_content .= "</tr>"; $links_num++; } }
'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code", 'icon' => 'fa-reply', 'level' => 'primary-label'))); } else { $ext = (isset($urlview)? "&urlview=$urlview": ''); $tool_content .= action_bar(array( array('title' => $langLinkAdd, 'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&action=addlink$ext", 'icon' => 'fa-plus-circle', 'button-class' => 'btn-success', 'level' => 'primary-label'))); } if (in_array($action, array('addlink', 'editlink'))) { if ((isset($id) && is_link_creator($id)) || !isset($id)) { $navigation[] = array('url' => "$_SERVER[SCRIPT_NAME]?course=$course_code", 'name' => $langLinks); $tool_content .= "<div class = 'form-wrapper'>"; $tool_content .= "<form class='form-horizontal' role='form' method='post' action='$_SERVER[SCRIPT_NAME]?course=$course_code&urlview=$urlview' onsubmit=\"return checkrequired(this, 'urllink');\">"; if ($action == 'editlink') { $tool_content .= "<input type='hidden' name='id' value='" . getIndirectReference($id) . "' />"; link_form_defaults($id); $form_legend = $langLinkModify; $submit_label = $langLinkModify; } else { $form_url = $form_title = $form_description = ''; $form_legend = $langLinkAdd; $submit_label = $langAdd; } $tool_content .= "<fieldset> <div class='form-group'>