$evals[0]->move_to_cat($targetcat[0]); header('Location: ' . api_get_self() . '?evaluationmoved=&selectcat=' . Security::remove_XSS($_GET['selectcat'])); exit; } unset($targetcat); } unset($evals); } //move a link if (isset($_GET['movelink'])) { GradebookUtils::block_students(); $get_move_link = Security::remove_XSS($_GET['movelink']); $link = LinkFactory::load($get_move_link); $move_form = new LinkForm(LinkForm::TYPE_MOVE, null, $link[0], 'move_link_form', null, api_get_self() . '?movelink=' . $get_move_link . '&selectcat=' . Security::remove_XSS($_GET['selectcat'])); if ($move_form->validate()) { $targetcat = Category::load($move_form->exportValue('move_cat')); $link[0]->move_to_cat($targetcat[0]); unset($link); header('Location: ' . api_get_self() . '?linkmoved=&selectcat=' . Security::remove_XSS($_GET['selectcat'])); exit; } } //parameters for categories if (isset($_GET['visiblecat'])) { GradebookUtils::block_students(); if (isset($_GET['set_visible'])) { $visibility_command = 1; } else { $visibility_command = 0; } $cats = Category::load($_GET['visiblecat']);
$tbl_forum_thread = Database::get_course_table(TABLE_FORUM_THREAD); $tbl_link = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK); $session_id = api_get_session_id(); $typeSelected = isset($_GET['typeselected']) ? intval($_GET['typeselected']) : null; if ($session_id == 0) { $all_categories = Category::load(null, null, api_get_course_id(), null, null, $session_id); } else { $all_categories = Category::load_session_categories(null, $session_id); } $category = Category::load($_GET['selectcat']); $url = api_get_self() . '?selectcat=' . Security::remove_XSS($_GET['selectcat']) . '&newtypeselected=' . $typeSelected . '&course_code=' . api_get_course_id() . '&' . api_get_cidreq(); $typeform = new LinkForm(LinkForm::TYPE_CREATE, $category[0], null, 'create_link', null, $url, $typeSelected); // if user selected a link type if ($typeform->validate() && isset($_GET['newtypeselected'])) { // reload page, this time with a parameter indicating the selected type header('Location: ' . api_get_self() . '?selectcat=' . Security::remove_XSS($_GET['selectcat']) . '&typeselected=' . $typeform->exportValue('select_link') . '&course_code=' . Security::remove_XSS($_GET['course_code']) . '&' . api_get_cidreq()); exit; } // link type selected, show 2nd form to retrieve the link data if (isset($typeSelected) && $typeSelected != '0') { $url = api_get_self() . '?selectcat=' . Security::remove_XSS($_GET['selectcat']) . '&typeselected=' . $typeSelected . '&course_code=' . $courseCode . '&' . api_get_cidreq(); $addform = new LinkAddEditForm(LinkAddEditForm::TYPE_ADD, $all_categories, $typeSelected, null, 'add_link', $url); if ($addform->validate()) { $addvalues = $addform->exportValues(); $link = LinkFactory::create($typeSelected); $link->set_user_id(api_get_user_id()); $link->set_course_code(api_get_course_id()); $link->set_category_id($addvalues['select_gradebook']); if ($link->needs_name_and_description()) { $link->set_name($addvalues['name']); } else {