예제 #1
0
require_capability('moodle/course:manageactivities', $context);
require_capability('mod/lti:addcoursetool', $context);
$redirecturl = null;
$returndata = null;
if (empty($errormsg) && !empty($items)) {
    try {
        $returndata = lti_tool_configuration_from_content_item($id, $messagetype, $version, $consumerkey, $items);
    } catch (moodle_exception $e) {
        $errormsg = $e->getMessage();
    }
}
$pageurl = new moodle_url('/mod/lti/contentitem_return.php');
$PAGE->set_url($pageurl);
$PAGE->set_pagelayout('popup');
echo $OUTPUT->header();
// Call JS module to redirect the user to the course page or close the dialogue on error/cancel.
$PAGE->requires->js_call_amd('mod_lti/contentitem_return', 'init', [$returndata]);
echo $OUTPUT->footer();
// Add messages to notification stack for rendering later.
if ($errormsg) {
    // Content item selection has encountered an error.
    \core\notification::error($errormsg);
} else {
    if (!empty($returndata)) {
        // Means success.
        if (!$msg) {
            $msg = get_string('successfullyfetchedtoolconfigurationfromcontent', 'lti');
        }
        \core\notification::success($msg);
    }
}
예제 #2
0
 /**
  * Finish displaying the regrade progress page.
  * @param moodle_url $nexturl where to send the user after the regrade.
  * @uses exit. This method never returns.
  */
 protected function finish_regrade($nexturl)
 {
     global $OUTPUT;
     \core\notification::success(get_string('regradecomplete', 'quiz_overview'));
     echo $OUTPUT->continue_button($nexturl);
     echo $OUTPUT->footer();
     die;
 }
예제 #3
0
파일: manage.php 프로젝트: evltuma/moodle
             redirect($PAGE->url);
         }
     }
     break;
 case 'renamecombine':
     // Allows to rename the tag and if the tag with the new name already exists these tags will be combined.
     if ($tagid && ($newname = required_param('newname', PARAM_TAG))) {
         require_sesskey();
         $tag = core_tag_tag::get($tagid, '*', MUST_EXIST);
         $targettag = core_tag_tag::get_by_name($tag->tagcollid, $newname, '*');
         if ($targettag) {
             $targettag->combine_tags(array($tag));
             \core\notification::success(get_string('combined', 'core_tag'));
         } else {
             $tag->update(array('rawname' => $newname));
             \core\notification::success(get_string('changessaved', 'core_tag'));
         }
     }
     redirect($PAGE->url);
     break;
 case 'addstandardtag':
     require_sesskey();
     $tagobjects = array();
     if ($tagcoll) {
         $tagslist = optional_param('tagslist', '', PARAM_RAW);
         $newtags = preg_split('/\\s*,\\s*/', trim($tagslist), -1, PREG_SPLIT_NO_EMPTY);
         $tagobjects = core_tag_tag::create_if_missing($tagcoll->id, $newtags, true);
     }
     foreach ($tagobjects as $tagobject) {
         if (!$tagobject->isstandard) {
             $tagobject->update(array('isstandard' => 1));
예제 #4
0
 /**
  * Test that session notifications are persisted across session clears.
  */
 public function test_session_persistance()
 {
     global $PAGE, $SESSION;
     // Initially there won't be any notifications.
     $this->assertCount(0, $SESSION->notifications);
     // Adding a notification should make one available to fetch.
     \core\notification::success('Notification created');
     $this->assertCount(1, $SESSION->notifications);
     // Re-creating the session will not empty the notification bag.
     \core\session\manager::init_empty_session();
     $this->assertCount(1, $SESSION->notifications);
 }
예제 #5
0
파일: complete.php 프로젝트: evltuma/moodle
        redirect(course_get_url($courseid ?: $course));
    } else {
        if ($form->is_submitted() && ($form->is_validated() || optional_param('gopreviouspage', null, PARAM_RAW))) {
            // Form was submitted (skip validation for "Previous page" button).
            $data = $form->get_submitted_data();
            if (!isset($SESSION->feedback->is_started) or !$SESSION->feedback->is_started == true) {
                print_error('error', '', $CFG->wwwroot . '/course/view.php?id=' . $course->id);
            }
            $feedbackcompletion->save_response_tmp($data);
            if (!empty($data->savevalues) || !empty($data->gonextpage)) {
                if (($nextpage = $feedbackcompletion->get_next_page($gopage)) !== null) {
                    redirect(new moodle_url($PAGE->url, array('gopage' => $nextpage)));
                } else {
                    $feedbackcompletion->save_response();
                    if (!$feedback->page_after_submit) {
                        \core\notification::success(get_string('entries_saved', 'feedback'));
                    }
                }
            } else {
                if (!empty($data->gopreviouspage)) {
                    $prevpage = $feedbackcompletion->get_previous_page($gopage);
                    redirect(new moodle_url($PAGE->url, array('gopage' => intval($prevpage))));
                }
            }
        }
    }
}
// Print the page header.
$strfeedbacks = get_string("modulenameplural", "feedback");
$strfeedback = get_string("modulename", "feedback");
echo $OUTPUT->header();