$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Forum') . ' ' . Security::remove_XSS($current_forum['forum_title'])); } else { $interbreadcrumb[] = array('url' => $forumUrl . 'index.php?search=' . Security::remove_XSS($my_search), 'name' => get_lang('ForumCategories')); $interbreadcrumb[] = array('url' => $forumUrl . 'viewforumcategory.php?forumcategory=' . $current_forum_category['cat_id'] . '&search=' . Security::remove_XSS(urlencode($my_search)), 'name' => prepare4display($current_forum_category['cat_title'])); $interbreadcrumb[] = array('url' => '#', 'name' => Security::remove_XSS($current_forum['forum_title'])); } if ($origin == 'learnpath') { Display::display_reduced_header(); } else { // The last element of the breadcrumb navigation is already set in interbreadcrumb, so give empty string. Display::display_header(''); } /* Actions */ // Change visibility of a forum or a forum category. if (($my_action == 'invisible' or $my_action == 'visible') and isset($_GET['content']) and isset($_GET['id']) and api_is_allowed_to_edit(false, true) && api_is_allowed_to_session_edit(false, true)) { $message = change_visibility($_GET['content'], $_GET['id'], $_GET['action']); // Note: This has to be cleaned first. } // Locking and unlocking. if (($my_action == 'lock' or $my_action == 'unlock') and isset($_GET['content']) and isset($_GET['id']) and api_is_allowed_to_edit(false, true) && api_is_allowed_to_session_edit(false, true)) { $message = change_lock_status($_GET['content'], $_GET['id'], $my_action); // Note: This has to be cleaned first. } // Deleting. if ($my_action == 'delete' and isset($_GET['content']) and isset($_GET['id']) and api_is_allowed_to_edit(false, true) && api_is_allowed_to_session_edit(false, true)) { $locked = api_resource_is_locked_by_gradebook($_GET['id'], LINK_FORUM_THREAD); if ($locked == false) { $message = delete_forum_forumcategory_thread($_GET['content'], $_GET['id']); // Note: This has to be cleaned first. // Delete link require_once api_get_path(SYS_CODE_PATH) . 'gradebook/lib/gradebook_functions.inc.php';
// Here we delete a category break; case 'editlink': editlinkcategory('link'); // Here we edit a link break; case 'editcategory': editlinkcategory('category'); // Here we edit a category break; case 'visible': change_visibility($_GET['id'], $_GET['scope']); // Here we edit a category break; case 'invisible': change_visibility($_GET['id'], $_GET['scope']); // Here we edit a category break; } Security::clear_token(); } } $token = Security::get_token(); /* Introduction section */ Display::display_introduction_section(TOOL_LINK); if (api_is_allowed_to_edit(null, true) && isset($_GET['action'])) { echo '<div class="actions">'; if (!empty($_GET['lp_id']) || !empty($_POST['lp_id'])) { if (!empty($_POST['lp_id'])) { $lp_id = Security::remove_XSS($_POST['lp_id']); } else {
/** * This function handles all the forum and forum categories actions. This is a wrapper for the * forum and forum categories. All this code code could go into the section where this function is * called but this make the code there cleaner. * @param int $lp_id Learning path Id * * @return void * @author Patrick Cool <*****@*****.**>, Ghent University * @author Juan Carlos Raña Trabado (return to lp_id) * @version may 2011, Chamilo 1.8.8 */ function handle_forum_and_forumcategories($lp_id = null) { $action_forum_cat = isset($_GET['action']) ? $_GET['action'] : ''; $get_content = isset($_GET['content']) ? $_GET['content'] : ''; $post_submit_cat = isset($_POST['SubmitForumCategory']) ? true : false; $post_submit_forum = isset($_POST['SubmitForum']) ? true : false; $get_id = isset($_GET['id']) ? intval($_GET['id']) : ''; $forum_categories_list = get_forum_categories(); //Verify if forum category exists if (empty($forum_categories_list)) { $get_content = 'forumcategory'; } // Adding a forum category if ($action_forum_cat == 'add' && $get_content == 'forumcategory' || $post_submit_cat) { show_add_forumcategory_form(array(), $lp_id); //$lp_id when is called from learning path } // Adding a forum if (($action_forum_cat == 'add' || $action_forum_cat == 'edit') && $get_content == 'forum' || $post_submit_forum) { if ($action_forum_cat == 'edit' && $get_id || $post_submit_forum) { $inputvalues = get_forums($get_id); } else { $inputvalues = array(); } show_add_forum_form($inputvalues, $lp_id); } // Edit a forum category if ($action_forum_cat == 'edit' && $get_content == 'forumcategory' || isset($_POST['SubmitEditForumCategory']) ? true : false) { $forum_category = get_forum_categories($get_id); show_edit_forumcategory_form($forum_category); } // Delete a forum category if ($action_forum_cat == 'delete') { $id_forum = intval($get_id); $list_threads = get_threads($id_forum); for ($i = 0; $i < count($list_threads); $i++) { deleteForumCategoryThread('thread', $list_threads[$i]['thread_id']); $link_info = GradebookUtils::is_resource_in_course_gradebook(api_get_course_id(), 5, intval($list_threads[$i]['thread_id']), api_get_session_id()); if ($link_info !== false) { GradebookUtils::remove_resource_from_course_gradebook($link_info['id']); } } $return_message = deleteForumCategoryThread($get_content, $get_id); Display::display_confirmation_message($return_message, false); } // Change visibility of a forum or a forum category. if ($action_forum_cat == 'invisible' || $action_forum_cat == 'visible') { $return_message = change_visibility($get_content, $get_id, $action_forum_cat); Display::display_confirmation_message($return_message, false); } // Change lock status of a forum or a forum category. if ($action_forum_cat == 'lock' || $action_forum_cat == 'unlock') { $return_message = change_lock_status($get_content, $get_id, $action_forum_cat); Display::display_confirmation_message($return_message, false); } // Move a forum or a forum category. if ($action_forum_cat == 'move' && isset($_GET['direction'])) { $return_message = move_up_down($get_content, $_GET['direction'], $get_id); Display::display_confirmation_message($return_message, false); } }
$response = load_tab($data); break; case 'change_title_tab': $response = change_title_tab($data); break; case 'save_tabs_order': $response = save_tabs_order($conn, $data); break; case 'set_layout': $response = set_layout($data); break; case 'save_widgets': $response = save_widgets_order($conn, $data); break; case 'change_visibility': $response = change_visibility($data); break; case 'set_default_tab': $response = set_default_tab($data); break; case 'delete_widget': $response = delete_widget($data); break; case 'clone_tab': $response = clone_tab($data); break; case 'add_tab': $response = add_tab($data); break; case 'delete_tab': $response = delete_tab($data);
/** * This function handles all the forum and forumcategories actions. This is a wrapper for the * forum and forum categories. All this code code could go into the section where this function is * called but this make the code there cleaner. * @param int Learning path ID * @return void * @author Patrick Cool <*****@*****.**>, Ghent University * @author Juan Carlos Raña Trabado (return to lp_id) * @version may 2011, Chamilo 1.8.8 */ function handle_forum_and_forumcategories($lp_id = null) { $action_forum_cat = isset($_GET['action']) ? $_GET['action'] : ''; $post_submit_cat = isset($_POST['SubmitForumCategory']) ? true : false; $post_submit_forum = isset($_POST['SubmitForum']) ? true : false; $get_id = isset($_GET['id']) ? $_GET['id'] : ''; // Adding a forum category if ($action_forum_cat == 'add' && $_GET['content'] == 'forumcategory' || $post_submit_cat) { show_add_forumcategory_form(array(), $lp_id); //$lp_id when is called from learning path } // Adding a forum if (($action_forum_cat == 'add' || $action_forum_cat == 'edit') && $_GET['content'] == 'forum' || $post_submit_forum) { if ($action_forum_cat == 'edit' && $get_id || $post_submit_forum) { $inputvalues = get_forums(intval($get_id)); // Note: This has to be cleaned first. } else { $inputvalues = array(); } show_add_forum_form($inputvalues, $lp_id); } // Edit a forum category if ($action_forum_cat == 'edit' && $_GET['content'] == 'forumcategory' && isset($_GET['id']) || isset($_POST['SubmitEditForumCategory']) ? true : false) { $forum_category = get_forum_categories(strval(intval($_GET['id']))); // Note: This has to be cleaned first. show_edit_forumcategory_form($forum_category); } // Delete a forum category if (isset($_GET['action']) && $_GET['action'] == 'delete' && isset($_GET['content']) && $get_id) { $id_forum = intval($get_id); $list_threads = get_threads($id_forum); for ($i = 0; $i < count($list_threads); $i++) { delete_forum_forumcategory_thread('thread', $list_threads[$i]['thread_id']); require_once api_get_path(SYS_CODE_PATH) . 'gradebook/lib/gradebook_functions.inc.php'; $link_info = is_resource_in_course_gradebook(api_get_course_id(), 5, intval($list_threads[$i]['thread_id']), api_get_session_id()); if ($link_info !== false) { remove_resource_from_course_gradebook($link_info['id']); } } $return_message = delete_forum_forumcategory_thread($_GET['content'], $_GET['id']); Display::display_confirmation_message($return_message, false); } // Change visibility of a forum or a forum category. if (($action_forum_cat == 'invisible' || $action_forum_cat == 'visible') && isset($_GET['content']) && isset($_GET['id'])) { $return_message = change_visibility($_GET['content'], $_GET['id'], $_GET['action']); // Note: This has to be cleaned first. Display::display_confirmation_message($return_message, false); } // Change lock status of a forum or a forum category. if (($action_forum_cat == 'lock' || $action_forum_cat == 'unlock') && isset($_GET['content']) && isset($_GET['id'])) { $return_message = change_lock_status($_GET['content'], $_GET['id'], $_GET['action']); // Note: This has to be cleaned first. Display::display_confirmation_message($return_message, false); } // Move a forum or a forum category. if ($action_forum_cat == 'move' && isset($_GET['content']) && isset($_GET['id']) && isset($_GET['direction'])) { $return_message = move_up_down($_GET['content'], $_GET['direction'], $_GET['id']); // Note: This has to be cleaned first. Display::display_confirmation_message($return_message, false); } }
/** * Makes an agenda item visible or invisible for a student * @author Patrick Cool <*****@*****.**>, Ghent University * @param integer id the id of the agenda item we are changing the visibility of */ function showhide_agenda_item($id) { global $nameTools; /* SHOW / HIDE A CALENDAR ITEM */ // and $_GET['isStudentView']<>"false" is added to prevent that the visibility is changed after you do the following: // change visibility -> studentview -> course manager view if ((api_is_allowed_to_edit(false, true) or api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous()) and $_GET['isStudentView'] != "false") { if (isset($_GET['id']) && isset($_GET['action']) && $_GET['action'] == "showhide") { $id = intval($_GET['id']); if (isset($_GET['next_action']) && $_GET['next_action'] == strval(intval($_GET['next_action']))) { $visibility = $_GET['next_action']; change_visibility($nameTools, $id, $visibility); return Display::return_message(get_lang("VisibilityChanged"), 'confirmation'); } } } }
function add_new_item(element, kat_id) { window.location = 'napojak.php?add_item&kat=' + kat_id + '&val=' + element.value; return false; } </script> EOL; $content .= xmltransform(getXmlNapojak(), XSLT_NAPOJAK_EDIT); } else { $content .= xmltransform(getXmlNapojak(), XSLT_NAPOJAK); } return $content; } if (isset($_GET['chng_vis'])) { echo change_visibility($_GET['chng_vis'], $_GET['en']); } else { if (isset($_GET['chng_name'])) { if (empty($_GET['val']) || !($val = trim($_GET['val']))) { return; } strenc_todb($val); echo change_name($_GET['chng_name'], $val); } else { if (isset($_GET['chng_desc'])) { if (empty($_GET['val']) || !($val = trim($_GET['val']))) { return; } strenc_todb($val); echo change_desc($_GET['chng_desc'], $val); } else {
/** * Makes an agenda item visible or invisible for a student * @author Patrick Cool <*****@*****.**>, Ghent University * @param integer id the id of the agenda item we are changing the visibility of */ function showhide_agenda_item($id) { global $nameTools; /*================================================== SHOW / HIDE A CALENDAR ITEM ==================================================*/ // and $_GET['isStudentView']<>"false" is added to prevent that the visibility is changed after you do the following: // change visibility -> studentview -> course manager view if (api_is_allowed_to_edit() && !api_is_anonymous() and $_GET['isStudentView'] != "false") { if (isset($_GET['id']) && $_GET['id'] && isset($_GET['action']) && $_GET['action'] == "showhide") { $id = (int) addslashes($_GET['id']); change_visibility($nameTools, $id); Display::display_normal_message(get_lang("VisibilityChanged")); } } }