本文整理汇总了PHP中moodle_url::params方法的典型用法代码示例。如果您正苦于以下问题:PHP moodle_url::params方法的具体用法?PHP moodle_url::params怎么用?PHP moodle_url::params使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类moodle_url
的用法示例。
在下文中一共展示了moodle_url::params方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: question_edit_setup
/**
* Common setup for all pages for editing questions.
* @param string $edittab code for this edit tab
* @param boolean $requirecmid require cmid? default false
* @param boolean $requirecourseid require courseid, if cmid is not given? default true
* @return array $thispageurl, $contexts, $cmid, $cm, $module, $pagevars
*/
function question_edit_setup($edittab, $requirecmid = false, $requirecourseid = true)
{
global $COURSE, $QUESTION_EDITTABCAPS;
//$thispageurl is used to construct urls for all question edit pages we link to from this page. It contains an array
//of parameters that are passed from page to page.
$thispageurl = new moodle_url();
if ($requirecmid) {
$cmid = required_param('cmid', PARAM_INT);
} else {
$cmid = optional_param('cmid', 0, PARAM_INT);
}
if ($cmid) {
list($module, $cm) = get_module_from_cmid($cmid);
$courseid = $cm->course;
$thispageurl->params(compact('cmid'));
require_login($courseid, false, $cm);
$thiscontext = get_context_instance(CONTEXT_MODULE, $cmid);
} else {
$module = null;
$cm = null;
if ($requirecourseid) {
$courseid = required_param('courseid', PARAM_INT);
} else {
$courseid = optional_param('courseid', 0, PARAM_INT);
}
if ($courseid) {
$thispageurl->params(compact('courseid'));
require_login($courseid, false);
$thiscontext = get_context_instance(CONTEXT_COURSE, $courseid);
} else {
$thiscontext = null;
}
}
if ($thiscontext) {
$contexts = new question_edit_contexts($thiscontext);
$contexts->require_one_edit_tab_cap($edittab);
} else {
$contexts = null;
}
$pagevars['qpage'] = optional_param('qpage', -1, PARAM_INT);
//pass 'cat' from page to page and when 'category' comes from a drop down menu
//then we also reset the qpage so we go to page 1 of
//a new cat.
$pagevars['cat'] = optional_param('cat', 0, PARAM_SEQUENCE);
// if empty will be set up later
if ($category = optional_param('category', 0, PARAM_SEQUENCE)) {
if ($pagevars['cat'] != $category) {
// is this a move to a new category?
$pagevars['cat'] = $category;
$pagevars['qpage'] = 0;
}
}
if ($pagevars['cat']) {
$thispageurl->param('cat', $pagevars['cat']);
}
if ($pagevars['qpage'] > -1) {
$thispageurl->param('qpage', $pagevars['qpage']);
} else {
$pagevars['qpage'] = 0;
}
$pagevars['qperpage'] = optional_param('qperpage', -1, PARAM_INT);
if ($pagevars['qperpage'] > -1) {
$thispageurl->param('qperpage', $pagevars['qperpage']);
} else {
$pagevars['qperpage'] = DEFAULT_QUESTIONS_PER_PAGE;
}
$sortoptions = array('alpha' => 'name, qtype ASC', 'typealpha' => 'qtype, name ASC', 'age' => 'id ASC');
if ($sortorder = optional_param('qsortorder', '', PARAM_ALPHA)) {
$pagevars['qsortorderdecoded'] = $sortoptions[$sortorder];
$pagevars['qsortorder'] = $sortorder;
$thispageurl->param('qsortorder', $sortorder);
} else {
$pagevars['qsortorderdecoded'] = $sortoptions['typealpha'];
$pagevars['qsortorder'] = 'typealpha';
}
$defaultcategory = question_make_default_categories($contexts->all());
$contextlistarr = array();
foreach ($contexts->having_one_edit_tab_cap($edittab) as $context) {
$contextlistarr[] = "'{$context->id}'";
}
$contextlist = join($contextlistarr, ' ,');
if (!empty($pagevars['cat'])) {
$catparts = explode(',', $pagevars['cat']);
if (!$catparts[0] || FALSE !== array_search($catparts[1], $contextlistarr) || !count_records_select("question_categories", "id = '" . $catparts[0] . "' AND contextid = {$catparts['1']}")) {
print_error('invalidcategory', 'quiz');
}
} else {
$category = $defaultcategory;
$pagevars['cat'] = "{$category->id},{$category->contextid}";
}
if (($recurse = optional_param('recurse', -1, PARAM_BOOL)) != -1) {
$pagevars['recurse'] = $recurse;
$thispageurl->param('recurse', $recurse);
//.........这里部分代码省略.........
示例2: stdClass
function get_content()
{
global $CFG, $OUTPUT;
if ($this->content !== NULL) {
return $this->content;
}
$this->content = new stdClass();
$this->content->items = array();
$this->content->icons = array();
$this->content->footer = '';
if (!defined('FEEDBACK_BLOCK_LIB_IS_OK')) {
$this->content->items = array(get_string('missing_feedback_module', 'block_feedback'));
return $this->content;
}
$courseid = $this->page->course->id;
if ($courseid <= 0) {
$courseid = SITEID;
}
$icon = '<img src="' . $OUTPUT->pix_url('icon', 'feedback') . '" class="icon" alt="" />';
if (empty($this->instance->pageid)) {
$this->instance->pageid = SITEID;
}
if ($feedbacks = feedback_get_feedbacks_from_sitecourse_map($courseid)) {
$baseurl = new moodle_url('/mod/feedback/view.php');
foreach ($feedbacks as $feedback) {
$url = new moodle_url($baseurl);
$url->params(array('id' => $feedback->cmid, 'courseid' => $courseid));
$this->content->items[] = '<a href="' . $url->out() . '">' . $icon . $feedback->name . '</a>';
}
}
return $this->content;
}
示例3: destination_courses_selector
public function destination_courses_selector(moodle_url $nextstageurl, destination_courses_search $courses = null, $courseid)
{
$html = html_writer::start_tag('div', array('class' => 'import-course-selector backup-restore'));
$html .= html_writer::start_tag('form', array('method' => 'post', 'action' => $nextstageurl->out_omit_querystring()));
foreach ($nextstageurl->params() as $key => $value) {
$html .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => $key, 'value' => $value));
}
$html .= html_writer::start_tag('div', array('class' => 'ics-existing-group backup-section'));
$html .= $this->output->heading(get_string('selectgroups', 'local_syncgroups'), 2, array('class' => 'header'));
$html .= html_writer::start_tag('ul');
$groups = groups_get_all_groups($courseid, 0, 0, 'g.id, g.name');
foreach ($groups as $group) {
$html .= html_writer::start_tag('li') . html_writer::checkbox('groups[]', $group->id, false, $group->name) . html_writer::end_tag('li');
}
$html .= html_writer::end_tag('ul');
$html .= html_writer::end_tag('div');
// We only allow import adding for now. Enforce it here.
$html .= html_writer::start_tag('div', array('class' => 'ics-existing-course backup-section'));
$html .= $this->output->heading(get_string('syncgroupsto', 'local_syncgroups'), 2, array('class' => 'header'));
$html .= $this->backup_detail_pair(get_string('selectacourse', 'backup'), $this->render($courses));
$html .= $this->backup_detail_pair('', html_writer::empty_tag('input', array('type' => 'submit', 'value' => get_string('continue'))));
$html .= html_writer::end_tag('div');
$html .= html_writer::end_tag('form');
$html .= html_writer::end_tag('div');
return $html;
}
示例4: setup_page
/**
* set up the class for the view page
*
* @param string $baseurl the base url of the page
*/
public function setup_page($baseurl)
{
global $PAGE, $CFG, $DB;
$this->pagevars = array();
$this->pageurl = new \moodle_url($baseurl);
$this->pageurl->remove_all_params();
$id = optional_param('id', false, PARAM_INT);
$quizid = optional_param('quizid', false, PARAM_INT);
// get necessary records from the DB
if ($id) {
$cm = get_coursemodule_from_id('activequiz', $id, 0, false, MUST_EXIST);
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
$quiz = $DB->get_record('activequiz', array('id' => $cm->instance), '*', MUST_EXIST);
} else {
$quiz = $DB->get_record('activequiz', array('id' => $quizid), '*', MUST_EXIST);
$course = $DB->get_record('course', array('id' => $quiz->course), '*', MUST_EXIST);
$cm = get_coursemodule_from_instance('activequiz', $quiz->id, $course->id, false, MUST_EXIST);
}
$this->get_parameters();
// get the rest of the parameters and set them in the class
require_login($course->id, false, $cm);
$this->pageurl->param('id', $cm->id);
$this->pageurl->param('quizid', $quiz->id);
$this->pageurl->params($this->pagevars);
// add the page vars variable to the url
$this->pagevars['pageurl'] = $this->pageurl;
$this->RTQ = new \mod_activequiz\activequiz($cm, $course, $quiz, $this->pagevars);
$this->RTQ->require_capability('mod/activequiz:viewownattempts');
// set up renderer
$this->RTQ->get_renderer()->init($this->RTQ, $this->pageurl, $this->pagevars);
$PAGE->set_pagelayout('popup');
$PAGE->set_context($this->RTQ->getContext());
$PAGE->set_title(strip_tags($course->shortname . ': ' . get_string("modulename", "activequiz") . ': ' . format_string($quiz->name, true)));
$PAGE->set_heading($course->fullname);
$PAGE->set_url($this->pageurl);
}
示例5: array
$params = array('enrolid' => $ue->enrolid);
$course = $DB->get_record_sql($sql, $params, MUST_EXIST);
context_instance_preload($course);
if ($course->id == SITEID) {
redirect(new moodle_url('/'));
}
require_login($course);
require_capability("enrol/invitation:unenrol", context_course::instance($course->id, MUST_EXIST));
$manager = new course_enrolment_manager($PAGE, $course, $filter);
$table = new course_enrolment_users_table($manager, $PAGE);
// The URL of the enrolled users page for the course.
$usersurl = new moodle_url('/enrol/users.php', array('id' => $course->id));
// The URl to return the user too after this screen.
$returnurl = new moodle_url($usersurl, $manager->get_url_params() + $table->get_url_params());
// The URL of this page.
$url = new moodle_url('/enrol/invitation/unenroluser.php', $returnurl->params());
$url->param('ue', $ueid);
$PAGE->set_url($url);
$PAGE->set_pagelayout('admin');
navigation_node::override_active_url($usersurl);
list($instance, $plugin) = $manager->get_user_enrolment_components($ue);
if (!$plugin->allow_unenrol($instance) || $instance->enrol != 'invitation' || !$plugin instanceof enrol_invitation_plugin) {
print_error('erroreditenrolment', 'enrol');
}
// If the unenrolment has been confirmed and the sesskey is valid unenrol the user.
if ($confirm && confirm_sesskey() && $manager->unenrol_user($ue)) {
redirect($returnurl);
}
$yesurl = new moodle_url($PAGE->url, array('confirm' => 1, 'sesskey' => sesskey()));
$message = get_string('unenroluser', 'enrol_invitation', array('user' => fullname($user, true), 'course' => format_string($course->fullname)));
$fullname = fullname($user);
示例6: array
////////////////////////////////////////////////////////
if ($do_show == 'showentries') {
//print the link to analysis
if (has_capability('mod/feedback:viewreports', $context)) {
//get the effective groupmode of this course and module
if (isset($cm->groupmode) && empty($course->groupmodeforce)) {
$groupmode = $cm->groupmode;
} else {
$groupmode = $course->groupmode;
}
// $groupselect = groups_print_activity_menu($cm, $CFG->wwwroot . '/mod/feedback/show_entries.php?id=' . $cm->id.'&do_show=showentries', true);
$groupselect = groups_print_activity_menu($cm, $url->out(), true);
$mygroupid = groups_get_activity_group($cm);
// preparing the table for output
$baseurl = new moodle_url('/mod/feedback/show_entries.php');
$baseurl->params(array('id' => $id, 'do_show' => $do_show, 'showall' => $showall));
$tablecolumns = array('userpic', 'fullname', 'c.timemodified');
$tableheaders = array(get_string('userpic'), get_string('fullnameuser'), get_string('date'));
if (has_capability('mod/feedback:deletesubmissions', $context)) {
$tablecolumns[] = 'deleteentry';
$tableheaders[] = '';
}
$table = new flexible_table('feedback-showentry-list-' . $course->id);
$table->define_columns($tablecolumns);
$table->define_headers($tableheaders);
$table->define_baseurl($baseurl);
$table->sortable(true, 'lastname', SORT_DESC);
$table->set_attribute('cellspacing', '0');
$table->set_attribute('id', 'showentrytable');
$table->set_attribute('class', 'generaltable generalbox');
$table->set_control_variables(array(TABLE_VAR_SORT => 'ssort', TABLE_VAR_IFIRST => 'sifirst', TABLE_VAR_ILAST => 'silast', TABLE_VAR_PAGE => 'spage'));
示例7: display
/**
* Renders the process stage screen
*
* @throws restore_ui_exception
* @param core_backup_renderer $renderer renderer instance to use
* @return string HTML code
*/
public function display(core_backup_renderer $renderer)
{
global $PAGE;
$html = '';
$haserrors = false;
$url = new moodle_url($PAGE->url, array('restore' => $this->get_uniqueid(), 'stage' => restore_ui::STAGE_PROCESS, 'substage' => $this->substage, 'sesskey' => sesskey()));
$html .= html_writer::start_tag('form', array('action' => $url->out_omit_querystring(), 'class' => 'backup-restore', 'enctype' => 'application/x-www-form-urlencoded', 'method' => 'post'));
foreach ($url->params() as $name => $value) {
$html .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => $name, 'value' => $value));
}
switch ($this->substage) {
case self::SUBSTAGE_PRECHECKS:
$results = $this->ui->get_controller()->get_precheck_results();
$info = $this->ui->get_controller()->get_info();
$haserrors = !empty($results['errors']);
$html .= $renderer->precheck_notices($results);
if (!empty($info->role_mappings->mappings)) {
$context = context_course::instance($this->ui->get_controller()->get_courseid());
$assignableroles = get_assignable_roles($context, ROLENAME_ALIAS, false);
$html .= $renderer->role_mappings($info->role_mappings->mappings, $assignableroles);
}
break;
default:
throw new restore_ui_exception('backup_ui_must_execute_first');
}
$html .= $renderer->substage_buttons($haserrors);
$html .= html_writer::end_tag('form');
return $html;
}
示例8: helper_sortable_heading
/**
* Renders a text with icons to sort by the given column
*
* This is intended for table headings.
*
* @param string $text The heading text
* @param string $sortid The column id used for sorting
* @param string $sortby Currently sorted by (column id)
* @param string $sorthow Currently sorted how (ASC|DESC)
*
* @return string
*/
protected function helper_sortable_heading($text, $sortid = null, $sortby = null, $sorthow = null)
{
$out = html_writer::tag('span', $text, array('class' => 'text'));
if (!is_null($sortid)) {
if ($sortby !== $sortid || $sorthow !== 'ASC') {
$url = new moodle_url($this->page->url);
$url->params(array('sort' => $sortid, 'dir' => 'ASC'));
$out .= $this->output->action_icon($url, new pix_icon('t/sort_asc', get_string('sortbyx', 'core', s($text)), null, array('class' => 'iconsort')));
}
if ($sortby !== $sortid || $sorthow !== 'DESC') {
$url = new moodle_url($this->page->url);
$url->params(array('sort' => $sortid, 'dir' => 'DESC'));
$out .= $this->output->action_icon($url, new pix_icon('t/sort_desc', get_string('sortbyxreverse', 'core', s($text)), null, array('class' => 'iconsort')));
}
}
return $out;
}
示例9: array
$params = array('enrolid' => $ue->enrolid);
$course = $DB->get_record_sql($sql, $params, MUST_EXIST);
context_instance_preload($course);
if ($course->id == SITEID) {
redirect(new moodle_url('/'));
}
require_login($course);
require_capability("enrol/manual:unenrol", get_context_instance(CONTEXT_COURSE, $course->id, MUST_EXIST));
$manager = new course_enrolment_manager($PAGE, $course, $filter);
$table = new course_enrolment_users_table($manager, $PAGE);
// The URL of the enrolled users page for the course.
$usersurl = new moodle_url('/enrol/users.php', array('id' => $course->id));
// The URl to return the user too after this screen.
$returnurl = new moodle_url($usersurl, $manager->get_url_params() + $table->get_url_params());
// The URL of this page
$url = new moodle_url('/enrol/manual/unenroluser.php', $returnurl->params());
$url->param('ue', $ueid);
$PAGE->set_url($url);
$PAGE->set_pagelayout('admin');
navigation_node::override_active_url($usersurl);
list($instance, $plugin) = $manager->get_user_enrolment_components($ue);
if (!$plugin->allow_unenrol($instance) || $instance->enrol != 'manual' || !$plugin instanceof enrol_manual_plugin) {
print_error('erroreditenrolment', 'enrol');
}
// If the unenrolment has been confirmed and the sesskey is valid unenrol the user.
if ($confirm && confirm_sesskey() && $manager->unenrol_user($ue)) {
redirect($returnurl);
}
$yesurl = new moodle_url($PAGE->url, array('confirm' => 1, 'sesskey' => sesskey()));
$message = get_string('unenroluser', 'enrol_manual', array('user' => fullname($user, true), 'course' => format_string($course->fullname)));
$fullname = fullname($user);
示例10: forum_print_recent_mod_activity
/**
* Outputs the forum post indicated by $activity.
*
* @param object $activity the activity object the forum resides in
* @param int $courseid the id of the course the forum resides in
* @param bool $detail not used, but required for compatibilty with other modules
* @param int $modnames not used, but required for compatibilty with other modules
* @param bool $viewfullnames not used, but required for compatibilty with other modules
*/
function forum_print_recent_mod_activity($activity, $courseid, $detail, $modnames, $viewfullnames)
{
global $OUTPUT;
$content = $activity->content;
if ($content->parent) {
$class = 'reply';
} else {
$class = 'discussion';
}
$tableoptions = ['border' => '0', 'cellpadding' => '3', 'cellspacing' => '0', 'class' => 'forum-recent'];
$output = html_writer::start_tag('table', $tableoptions);
$output .= html_writer::start_tag('tr');
$post = (object) ['parent' => $content->parent];
$forum = (object) ['type' => $content->forumtype];
$authorhidden = forum_is_author_hidden($post, $forum);
// Show user picture if author should not be hidden.
if (!$authorhidden) {
$pictureoptions = ['courseid' => $courseid, 'link' => $authorhidden, 'alttext' => $authorhidden];
$picture = $OUTPUT->user_picture($activity->user, $pictureoptions);
$output .= html_writer::tag('td', $picture, ['class' => 'userpicture', 'valign' => 'top']);
}
// Discussion title and author.
$output .= html_writer::start_tag('td', ['class' => $class]);
if ($content->parent) {
$class = 'title';
} else {
// Bold the title of new discussions so they stand out.
$class = 'title bold';
}
$output .= html_writer::start_div($class);
if ($detail) {
$aname = s($activity->name);
$output .= html_writer::img($OUTPUT->pix_url('icon', $activity->type), $aname, ['class' => 'icon']);
}
$discussionurl = new moodle_url('/mod/forum/discuss.php', ['d' => $content->discussion]);
$discussionurl->set_anchor('p' . $activity->content->id);
$output .= html_writer::link($discussionurl, $content->subject);
$output .= html_writer::end_div();
$timestamp = userdate($activity->timestamp);
if ($authorhidden) {
$authornamedate = $timestamp;
} else {
$fullname = fullname($activity->user, $viewfullnames);
$userurl = new moodle_url('/user/view.php');
$userurl->params(['id' => $activity->user->id, 'course' => $courseid]);
$by = new stdClass();
$by->name = html_writer::link($userurl, $fullname);
$by->date = $timestamp;
$authornamedate = get_string('bynameondate', 'forum', $by);
}
$output .= html_writer::div($authornamedate, 'user');
$output .= html_writer::end_tag('td');
$output .= html_writer::end_tag('tr');
$output .= html_writer::end_tag('table');
echo $output;
}
示例11: array
echo html_writer::end_tag('form');
echo html_writer::empty_tag('br');
}
echo html_writer::start_tag('div', array('class' => 'buttons'));
if ($canmanage and $numcourses > 1 && empty($searchcriteria)) {
// Print button to re-sort courses by name.
$url = new moodle_url('/course/manage.php', array('categoryid' => $id, 'resort' => 'name', 'sesskey' => sesskey()));
echo $OUTPUT->single_button($url, get_string('resortcoursesbyname'), 'get');
}
if (has_capability('moodle/course:create', $context) && empty($searchcriteria)) {
// Print button to create a new course.
$url = new moodle_url('/course/edit.php');
if ($coursecat->id) {
$url->params(array('category' => $coursecat->id, 'returnto' => 'catmanage'));
} else {
$url->params(array('category' => $CFG->defaultrequestcategory, 'returnto' => 'topcatmanage'));
}
echo $OUTPUT->single_button($url, get_string('addnewcourse'), 'get');
}
if (!empty($CFG->enablecourserequests) && $id == $CFG->defaultrequestcategory) {
print_course_request_buttons(context_system::instance());
}
echo html_writer::end_tag('div');
echo $courserenderer->course_search_form();
echo $OUTPUT->footer();
示例12: wiki_print_subwiki_selector
public function wiki_print_subwiki_selector($wiki, $subwiki, $page, $pagetype = 'view') {
global $CFG, $USER;
require_once($CFG->dirroot . '/user/lib.php');
switch ($pagetype) {
case 'files':
$baseurl = new moodle_url('/mod/wiki/files.php');
break;
case 'view':
default:
$baseurl = new moodle_url('/mod/wiki/view.php');
break;
}
$cm = get_coursemodule_from_instance('wiki', $wiki->id);
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
// @TODO: A plenty of duplicated code below this lines.
// Create private functions.
switch (groups_get_activity_groupmode($cm)) {
case NOGROUPS:
if ($wiki->wikimode == 'collaborative') {
// No need to print anything
return;
} else if ($wiki->wikimode == 'individual') {
// We have private wikis here
$view = has_capability('mod/wiki:viewpage', $context);
$manage = has_capability('mod/wiki:managewiki', $context);
// Only people with these capabilities can view all wikis
if ($view && $manage) {
// @TODO: Print here a combo that contains all users.
$users = get_enrolled_users($context);
$options = array();
foreach ($users as $user) {
$options[$user->id] = fullname($user);
}
echo $this->output->container_start('wiki_right');
$params = array('wid' => $wiki->id, 'title' => $page->title);
if ($pagetype == 'files') {
$params['pageid'] = $page->id;
}
$baseurl->params($params);
$name = 'uid';
$selected = $subwiki->userid;
echo $this->output->single_select($baseurl, $name, $options, $selected);
echo $this->output->container_end();
}
return;
} else {
// error
return;
}
case SEPARATEGROUPS:
if ($wiki->wikimode == 'collaborative') {
// We need to print a select to choose a course group
$params = array('wid'=>$wiki->id, 'title'=>$page->title);
if ($pagetype == 'files') {
$params['pageid'] = $page->id;
}
$baseurl->params($params);
echo $this->output->container_start('wiki_right');
groups_print_activity_menu($cm, $baseurl->out());
echo $this->output->container_end();
return;
} else if ($wiki->wikimode == 'individual') {
// @TODO: Print here a combo that contains all users of that subwiki.
$view = has_capability('mod/wiki:viewpage', $context);
$manage = has_capability('mod/wiki:managewiki', $context);
// Only people with these capabilities can view all wikis
if ($view && $manage) {
$users = get_enrolled_users($context);
$options = array();
foreach ($users as $user) {
$groups = groups_get_all_groups($cm->course, $user->id);
if (!empty($groups)) {
foreach ($groups as $group) {
$options[$group->id][$group->name][$group->id . '-' . $user->id] = fullname($user);
}
} else {
$name = get_string('notingroup', 'wiki');
$options[0][$name]['0' . '-' . $user->id] = fullname($user);
}
}
} else {
$group = groups_get_group($subwiki->groupid);
$users = groups_get_members($subwiki->groupid);
foreach ($users as $user) {
$options[$group->id][$group->name][$group->id . '-' . $user->id] = fullname($user);
}
}
echo $this->output->container_start('wiki_right');
$params = array('wid' => $wiki->id, 'title' => $page->title);
if ($pagetype == 'files') {
$params['pageid'] = $page->id;
}
$baseurl->params($params);
//.........这里部分代码省略.........
示例13: array
// Obviously.
require_login($course);
// Make sure the user can manage invitation enrolments for this course.
require_capability("enrol/invitation:manage", context_course::instance($course->id, MUST_EXIST));
// Get the enrolment manager for this course.
$manager = new course_enrolment_manager($PAGE, $course, $filter);
// Get an enrolment users table object. Doign this will automatically retrieve the the URL params
// relating to table the user was viewing before coming here, and allows us to return the user to the
// exact page of the users screen they can from.
$table = new course_enrolment_users_table($manager, $PAGE);
// The URL of the enrolled users page for the course.
$usersurl = new moodle_url('/enrol/users.php', array('id' => $course->id));
// The URl to return the user too after this screen.
$returnurl = new moodle_url($usersurl, $manager->get_url_params() + $table->get_url_params());
// The URL of this page.
$url = new moodle_url('/enrol/invitation/editenrolment.php', $returnurl->params());
$PAGE->set_url($url);
$PAGE->set_pagelayout('admin');
navigation_node::override_active_url($usersurl);
list($instance, $plugin) = $manager->get_user_enrolment_components($ue);
if (!$plugin->allow_manage($instance) || $instance->enrol != 'invitation' || !$plugin instanceof enrol_invitation_plugin) {
print_error('erroreditenrolment', 'enrol');
}
$mform = new enrol_invitation_user_enrolment_form($url, array('user' => $user, 'course' => $course, 'ue' => $ue));
$mform->set_data($PAGE->url->params());
// Check the form hasn't been cancelled.
if ($mform->is_cancelled()) {
redirect($returnurl);
} else {
if ($mform->is_submitted() && $mform->is_validated() && confirm_sesskey()) {
// The forms been submit, validated and the sesskey has been checked ... edit the enrolment.
示例14: register_return_link
/**
* Set the action and parameters that can be used to return to the current page.
*
* @param string $action The action for the current page
* @param array $params An array of name value pairs which form the parameters
* to return to the current page.
* @return void
*/
public function register_return_link($action, $params) {
global $PAGE;
$params['action'] = $action;
$cm = $this->get_course_module();
if ($cm) {
$currenturl = new moodle_url('/mod/assign/view.php', array('id' => $cm->id));
} else {
$currenturl = new moodle_url('/mod/assign/index.php', array('id' => $this->get_course()->id));
}
$currenturl->params($params);
$PAGE->set_url($currenturl);
}
示例15: error
}
} else {
if (!($qcreate = get_record("qcreate", "id", $a))) {
error("Course module is incorrect");
}
if (!($course = get_record("course", "id", $qcreate->course))) {
error("Course is misconfigured");
}
if (!($cm = get_coursemodule_from_instance("qcreate", $qcreate->id, $course->id))) {
error("Course Module ID was incorrect");
}
}
$qcreate->cmidnumber = $cm->id;
$requireds = get_records('qcreate_required', 'qcreateid', $qcreate->id, 'qtype', 'qtype, no, id');
$thisurl = new moodle_url($CFG->wwwroot . '/mod/qcreate/view.php');
$thisurl->params(array('id' => $cm->id));
$modulecontext = get_context_instance(CONTEXT_MODULE, $cm->id);
//modedit.php forwards to this page after creating coursemodule record.
//this is the first chance we get to set capabilities in the newly created
//context.
qcreate_student_q_access_sync($qcreate, $modulecontext, $course);
require_login($course->id);
if (has_capability('mod/qcreate:grade', $modulecontext)) {
redirect($CFG->wwwroot . '/mod/qcreate/edit.php?cmid=' . $cm->id);
}
/// Print the page header
$strqcreates = get_string("modulenameplural", "qcreate");
$strqcreate = get_string("modulename", "qcreate");
$navlinks = array();
$navlinks[] = array('name' => $strqcreates, 'link' => "index.php?id={$course->id}", 'type' => 'activity');
$navlinks[] = array('name' => format_string($qcreate->name), 'link' => '', 'type' => 'activityinstance');