Пример #1
0
 /**
  * @param LinkForm $form
  */
 public function formSubmitted(LinkForm $form)
 {
     try {
         $this->linkManager->update($form->getValues());
         $form->presenter->flashMessage('Link management was successful.', 'success');
     } catch (\Nette\InvalidArgumentException $ex) {
         $form->addError($ex->getMessage());
     }
 }
Пример #2
0
        $course_to_crsind = $evals[0]->get_course_code() != null && $targetcat[0]->get_course_code() == null;
        if (!($course_to_crsind && !isset($_GET['confirm']))) {
            $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;
api_block_anonymous_users();
GradebookUtils::block_students();
$courseCode = isset($_GET['course_code']) ? Security::remove_XSS($_GET['course_code']) : null;
$course_info = api_get_course_info($courseCode);
$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());