/** * Prints the page header. */ function print_header() { global $CFG, $USER, $PAGE; require_once $CFG->libdir . '/blocklib.php'; require_once $CFG->dirroot . '/course/lib.php'; require_once $CFG->dirroot . '/my/pagelib.php'; /// My Moodle arguments: $edit = optional_param('edit', -1, PARAM_BOOL); $blockaction = optional_param('blockaction', '', PARAM_ALPHA); $mymoodlestr = get_string('mymoodle', 'my'); if (isguest()) { $wwwroot = $CFG->wwwroot . '/login/index.php'; if (!empty($CFG->loginhttps)) { $wwwroot = str_replace('http:', 'https:', $wwwroot); } print_header($mymoodlestr); notice_yesno(get_string('noguest', 'my') . '<br /><br />' . get_string('liketologin'), $wwwroot, $CFG->wwwroot); print_footer(); die; } /// Add curriculum stylesheets... if (file_exists($CFG->dirroot . '/curriculum/styles.css')) { $CFG->stylesheets[] = $CFG->wwwroot . '/curriculum/styles.css'; } /// Fool the page library into thinking we're in My Moodle. $CFG->pagepath = $CFG->wwwroot . '/my/index.php'; $PAGE = page_create_instance($USER->id); if ($section = optional_param('section', '', PARAM_ALPHAEXT)) { $PAGE->section = $section; } $this->pageblocks = blocks_setup($PAGE, BLOCKS_PINNED_BOTH); /// Make sure that the curriculum block is actually on this /// user's My Moodle page instance. if ($cablockid = get_field('block', 'id', 'name', 'curr_admin')) { if (!record_exists('block_pinned', 'blockid', $cablockid, 'pagetype', 'my-index')) { blocks_execute_action($PAGE, $this->pageblocks, 'add', (int) $cablockid, true, false); } } if ($edit != -1 and $PAGE->user_allowed_editing()) { $USER->editing = $edit; } //$PAGE->print_header($mymoodlestr); $title = $this->get_title(); print_header($title, $title, build_navigation($this->get_navigation())); echo '<table border="0" cellpadding="3" cellspacing="0" width="100%" id="layout-table">'; echo '<tr valign="top">'; $blocks_preferred_width = bounded_number(180, blocks_preferred_width($this->pageblocks[BLOCK_POS_LEFT]), 210); if (blocks_have_content($this->pageblocks, BLOCK_POS_LEFT) || $PAGE->user_is_editing()) { echo '<td style="vertical-align: top; width: ' . $blocks_preferred_width . 'px;" id="left-column">'; blocks_print_group($PAGE, $this->pageblocks, BLOCK_POS_LEFT); echo '</td>'; } echo '<td valign="top" id="middle-column">'; if (blocks_have_content($this->pageblocks, BLOCK_POS_CENTRE) || $PAGE->user_is_editing()) { blocks_print_group($PAGE, $this->pageblocks, BLOCK_POS_CENTRE); } }
/** * Prints the entry form/page for this enrolment * * This is only called from course/enrol.php * Most plugins will probably override this to print payment * forms etc, or even just a notice to say that manual enrolment * is disabled * * @param course current course object */ function print_entry($course) { global $CFG, $USER, $SESSION, $THEME; $strloginto = get_string('loginto', '', $course->shortname); $strcourses = get_string('courses'); /// Automatically enrol into courses without password $context = get_context_instance(CONTEXT_SYSTEM, SITEID); if ($course->password == '') { // no password, so enrol if (has_capability('moodle/legacy:guest', $context, $USER->id, false)) { add_to_log($course->id, 'course', 'guest', 'view.php?id=' . $course->id, getremoteaddr()); } else { if (empty($_GET['confirm']) && empty($_GET['cancel'])) { print_header($strloginto, $course->fullname, "<a href=\".\">{$strcourses}</a> -> {$strloginto}"); echo '<br />'; notice_yesno(get_string('enrolmentconfirmation'), "enrol.php?id={$course->id}&confirm=1", "enrol.php?id={$course->id}&cancel=1"); print_footer(); exit; } else { if (!empty($_GET['confirm'])) { if (!enrol_into_course($course, $USER, 'manual')) { print_error('couldnotassignrole'); } if (!empty($SESSION->wantsurl)) { $destination = $SESSION->wantsurl; unset($SESSION->wantsurl); } else { $destination = "{$CFG->wwwroot}/course/view.php?id={$course->id}"; } redirect($destination); } else { if (!empty($_GET['cancel'])) { unset($SESSION->wantsurl); if (!empty($SESSION->enrolcancel)) { $destination = $SESSION->enrolcancel; unset($SESSION->enrolcancel); } else { $destination = $CFG->wwwroot; } redirect($destination); } } } } } // if we get here we are going to display the form asking for the enrolment key // and (hopefully) provide information about who to ask for it. if (!isset($password)) { $password = ''; } print_header($strloginto, $course->fullname, "<a href=\".\">{$strcourses}</a> -> {$strloginto}", "form.password"); print_course($course, "80%"); include "{$CFG->dirroot}/enrol/manual/enrol.html"; print_footer(); }
if (!get_user_preferences('message_usehtmleditor', 0)) { $CFG->htmleditor = ''; } $msgform = new user_message_form('user_bulk_message.php'); if ($msgform->is_cancelled()) { redirect($return); } else { if ($formdata = $msgform->get_data()) { $options = new object(); $options->para = false; $options->newlines = true; $options->smiley = false; $msg = format_text($formdata->messagebody, $formdata->format, $options); $in = implode(',', $SESSION->bulk_users); $userlist = $DB->get_records_select_menu('user', "id IN ({$in})", null, 'fullname', 'id,' . $DB->sql_fullname() . ' AS fullname'); $usernames = implode(', ', $userlist); $optionsyes = array(); $optionsyes['confirm'] = 1; $optionsyes['sesskey'] = sesskey(); $optionsyes['msg'] = $msg; admin_externalpage_print_header(); print_heading(get_string('confirmation', 'admin')); print_box($msg, 'boxwidthnarrow boxaligncenter generalbox', 'preview'); notice_yesno(get_string('confirmmessage', 'bulkusers', $usernames), 'user_bulk_message.php', 'user_bulk.php', $optionsyes, NULL, 'post', 'get'); admin_externalpage_print_footer(); die; } } admin_externalpage_print_header(); $msgform->display(); admin_externalpage_print_footer();
if (!($course = get_record('course', 'id', $courseid))) { error('Course ID was incorrect'); } $group = new object(); $group->courseid = $course->id; } require_login($course); $context = get_context_instance(CONTEXT_COURSE, $course->id); require_capability('moodle/course:managegroups', $context); $returnurl = $CFG->wwwroot . '/group/index.php?id=' . $course->id . '&group=' . $id; if ($id and $delete) { if (!$confirm) { print_header(get_string('deleteselectedgroup', 'group'), get_string('deleteselectedgroup', 'group')); $optionsyes = array('id' => $id, 'delete' => 1, 'courseid' => $courseid, 'sesskey' => sesskey(), 'confirm' => 1); $optionsno = array('id' => $courseid); notice_yesno(get_string('deletegroupconfirm', 'group', $group->name), 'group.php', 'index.php', $optionsyes, $optionsno, 'get', 'get'); print_footer(); die; } else { if (confirm_sesskey()) { if (groups_delete_group($id)) { // MDL-9983 $eventdata = new object(); $eventdata->group = $id; $eventdata->course = $courseid; events_trigger('group_deleted', $eventdata); redirect('index.php?id=' . $course->id); } else { print_error('erroreditgroup', 'group', $returnurl); } }
echo '<form id="form" method="post" action="view.php">'; choice_show_form($choice, $USER, $cm); echo '</form>'; $choiceformshown = true; } else { $choiceformshown = false; } if (!$choiceformshown) { $sitecontext = get_context_instance(CONTEXT_SYSTEM); if (has_capability('moodle/legacy:guest', $sitecontext, NULL, false)) { // Guest on whole site $wwwroot = $CFG->wwwroot . '/login/index.php'; if (!empty($CFG->loginhttps)) { $wwwroot = str_replace('http:', 'https:', $wwwroot); } notice_yesno(get_string('noguestchoose', 'choice') . '<br /><br />' . get_string('liketologin'), $wwwroot, $_SERVER['HTTP_REFERER']); } else { if (has_capability('moodle/legacy:guest', $context, NULL, false)) { // Guest in this course only $SESSION->wantsurl = $FULLME; $SESSION->enrolcancel = $_SERVER['HTTP_REFERER']; print_simple_box_start('center', '60%', '', 5, 'generalbox', 'notice'); echo '<p align="center">' . get_string('noguestchoose', 'choice') . '</p>'; echo '<div class="continuebutton">'; print_single_button($CFG->wwwroot . '/course/enrol.php?id=' . $course->id, NULL, get_string('enrolme', '', format_string($course->shortname)), 'post', $CFG->framename); echo '</div>' . "\n"; print_simple_box_end(); } } } // print the results at the bottom of the screen
<?php // $Id: confirmdelete.php,v 1.6 2007/10/09 21:43:30 iarenaza Exp $ /** * Action for confirming the deletion of a page * * @version $Id: confirmdelete.php,v 1.6 2007/10/09 21:43:30 iarenaza Exp $ * @license http://www.gnu.org/copyleft/gpl.html GNU Public License * @package lesson **/ confirm_sesskey(); $pageid = required_param('pageid', PARAM_INT); if (!($thispage = get_record("lesson_pages", "id", $pageid))) { error("Confirm delete: the page record not found"); } print_heading(get_string("deletingpage", "lesson", format_string($thispage->title))); // print the jumps to this page if ($answers = get_records_select("lesson_answers", "lessonid = {$lesson->id} AND jumpto = {$pageid} + 1")) { print_heading(get_string("thefollowingpagesjumptothispage", "lesson")); echo "<p align=\"center\">\n"; foreach ($answers as $answer) { if (!($title = get_field("lesson_pages", "title", "id", $answer->pageid))) { error("Confirm delete: page title not found"); } echo $title . "<br />\n"; } } notice_yesno(get_string("confirmdeletionofthispage", "lesson"), "lesson.php?action=delete&id={$cm->id}&pageid={$pageid}&sesskey=" . $USER->sesskey, "view.php?id={$cm->id}");
} } clearfilelist(); displaydir($wdir); html_footer(); } else { html_header($course, $wdir); if (setfilelist($_POST)) { echo "<p align=center>" . get_string("deletecheckwarning") . ":</p>"; print_simple_box_start("center"); printfilelist($USER->filelist); print_simple_box_end(); echo "<br />"; $frameold = $CFG->framename; $CFG->framename = "ibrowser"; notice_yesno(get_string("deletecheckfiles"), "coursefiles.php?id={$id}&wdir={$wdir}&action=delete&confirm=1&sesskey={$USER->sesskey}", "coursefiles.php?id={$id}&wdir={$wdir}&action=cancel"); $CFG->framename = $frameold; } else { displaydir($wdir); } html_footer(); } break; case "move": html_header($course, $wdir); if ($count = setfilelist($_POST) and confirm_sesskey()) { $USER->fileop = $action; $USER->filesource = $wdir; echo "<p align=\"center\">"; print_string("selectednowmove", "moodle", $count); echo "</p>";
if (!empty($delete)) { // admin_externalpage_print_header(); $instance = repository::get_instance($delete); //if you try to delete an instance set as readonly, display an error message if ($instance->readonly) { throw new repository_exception('readonlyinstance', 'repository'); } if ($sure) { if (!confirm_sesskey()) { print_error('confirmsesskeybad', '', $baseurl); } if ($instance->delete()) { $deletedstr = get_string('instancedeleted', 'repository'); print_heading($deletedstr); redirect($baseurl, $deletedstr, 3); } else { print_error('instancenotdeleted', 'repository', $baseurl); } exit; } notice_yesno(get_string('confirmdelete', 'repository', $instance->name), $baseurl . '&delete=' . $delete . '&sure=yes', $baseurl); $return = false; } else { repository::display_instances_list($context); $return = false; } } if (!empty($return)) { redirect($baseurl); } print_footer($course);
error(get_string("couldnotdeletereplies", "forum"), forum_go_back_to("discuss.php?d={$post->discussion}")); } print_header(); notice_yesno(get_string("deletesureplural", "forum", $replycount + 1), "post.php?delete={$delete}&confirm={$delete}&sesskey=" . sesskey(), $CFG->wwwroot . '/mod/forum/discuss.php?d=' . $post->discussion . '#p' . $post->id); forum_print_post($post, $course->id, $ownpost = false, $reply = false, $link = false); if (empty($post->edit)) { if (forum_tp_can_track_forums($forum) && forum_tp_is_tracked($forum)) { $user_read_array = forum_tp_get_discussion_read_records($USER->id, $discussion->id); } else { $user_read_array = array(); } forum_print_posts_nested($post->id, $course->id, false, false, $user_read_array, $forum->id); } } else { print_header(); notice_yesno(get_string("deletesure", "forum", $replycount), "post.php?delete={$delete}&confirm={$delete}&sesskey=" . sesskey(), $CFG->wwwroot . '/mod/forum/discuss.php?d=' . $post->discussion . '#p' . $post->id); forum_print_post($post, $forum->course, $ownpost = false, $reply = false, $link = false); } } print_footer($course); die; } else { if (!empty($prune)) { // Pruning if (!($post = forum_get_post_full($prune))) { error("Post ID was incorrect"); } if (!($discussion = get_record("forum_discussions", "id", $post->discussion))) { error("This post is not part of a discussion!"); } if (!($forum = get_record("forum", "id", $discussion->forum))) {
} if (empty($CFG->enablenotes)) { print_error('notesdisabled', 'notes'); } if (data_submitted() && confirm_sesskey()) { //if data was submitted and is valid, then delete note $returnurl = $CFG->wwwroot . '/notes/index.php?course=' . $course->id . '&user='******'notes', 'delete', 'index.php?course=' . $note->courseid . '&user='******'#note-' . $note->id, 'delete note'); } else { print_error('cannotdeletepost', 'notes', $returnurl); } redirect($returnurl); } else { // if data was not submitted yet, then show note data with a delete confirmation form $strnotes = get_string('notes', 'notes'); $optionsyes = array('id' => $noteid, 'sesskey' => sesskey()); $optionsno = array('course' => $course->id, 'user' => $note->userid); // output HTML if (has_capability('moodle/course:viewparticipants', $context) || has_capability('moodle/site:viewparticipants', get_context_instance(CONTEXT_SYSTEM))) { $nav[] = array('name' => get_string('participants'), 'link' => $CFG->wwwroot . '/user/index.php?id=' . $course->id, 'type' => 'misc'); } $nav[] = array('name' => fullname($user), 'link' => $CFG->wwwroot . '/user/view.php?id=' . $user->id . '&course=' . $course->id, 'type' => 'misc'); $nav[] = array('name' => get_string('notes', 'notes'), 'link' => $CFG->wwwroot . '/notes/index.php?course=' . $course->id . '&user='******'type' => 'misc'); $nav[] = array('name' => get_string('delete'), 'link' => '', 'type' => 'activity'); print_header($course->shortname . ': ' . $strnotes, $course->fullname, build_navigation($nav)); notice_yesno(get_string('deleteconfirm', 'notes'), 'delete.php', 'index.php', $optionsyes, $optionsno, 'post', 'get'); echo '<br />'; note_print($note, NOTES_SHOW_BODY | NOTES_SHOW_HEAD); print_footer(); }
// something is wrong here, try again } $updatedcomment = new object(); $updatedcomment->id = $formadata->commentid; $updatedcomment->content = $formadata->content; $updatedcomment->format = $formadata->format; $updatedcomment->modified = time(); if ($DB->update_record('data_comments', $updatedcomment)) { redirect('view.php?rid=' . $record->id . '&page=' . $page); } else { print_error('cannotsavecomment'); } break; case 'delete': //deletes single comment from db if ($confirm and confirm_sesskey() and $comment) { $DB->delete_records('data_comments', array('id' => $comment->id)); redirect('view.php?rid=' . $record->id . '&page=' . $page, get_string('commentdeleted', 'data')); } else { //print confirm delete form print_header(); data_print_comment($data, $comment, $page); notice_yesno(get_string('deletecomment', 'data'), 'comment.php?rid=' . $record->id . '&commentid=' . $comment->id . '&page=' . $page . '&sesskey=' . sesskey() . '&mode=delete&confirm=1', 'view.php?rid=' . $record->id . '&page=' . $page); print_footer(); } die; break; } print_header(); data_print_comments($data, $record, $page, $mform); print_footer();
} if (!($site = get_site())) { redirect("index.php"); } /// Turn off time limits, sometimes upgrades can be slow. @set_time_limit(0); @ob_implicit_flush(true); while (@ob_end_flush()) { } /// Print header $strupgradinglogs = get_string("upgradinglogs", "admin"); admin_externalpage_print_header($adminroot); print_heading($strupgradinglogs); if (!data_submitted() or empty($confirm) or !confirm_sesskey()) { $optionsyes = array('confirm' => '1', 'sesskey' => sesskey()); notice_yesno(get_string('upgradeforumreadinfo', 'admin'), 'upgradelogs.php', 'index.php', $optionsyes, NULL, 'post', 'get'); admin_externalpage_print_footer($adminroot); exit; } /// Try and extract as many cmids as possible from the existing logs if ($coursemodules = get_records_sql("SELECT cm.*, m.name\n FROM {$CFG->prefix}course_modules cm,\n {$CFG->prefix}modules m\n WHERE cm.module = m.id")) { $cmcount = count($coursemodules); $count = 0; $starttime = time(); $sleeptime = 0; $LIKE = sql_ilike(); if ($cmcount > 10) { print_simple_box('This process may take a very long time ... please be patient and let it finish.', 'center', '', '#ffcccc'); $sleeptime = 1; } foreach ($coursemodules as $cm) {
function delete_file() { global $CFG; $file = required_param('file', PARAM_FILE); $userid = required_param('userid', PARAM_INT); $confirm = optional_param('confirm', 0, PARAM_BOOL); $mode = optional_param('mode', '', PARAM_ALPHA); $offset = optional_param('offset', 0, PARAM_INT); require_login($this->course->id, false, $this->cm); if (empty($mode)) { $urlreturn = 'view.php'; $optionsreturn = array('id' => $this->cm->id); $returnurl = 'view.php?id=' . $this->cm->id; } else { $urlreturn = 'submissions.php'; $optionsreturn = array('id' => $this->cm->id, 'offset' => $offset, 'mode' => $mode, 'userid' => $userid); $returnurl = "submissions.php?id={$this->cm->id}&offset={$offset}&mode={$mode}&userid={$userid}"; } if (!($submission = $this->get_submission($userid)) or !$this->can_delete_files($submission)) { // can not delete $this->view_header(get_string('delete')); notify(get_string('cannotdeletefiles', 'assignment')); print_continue($returnurl); $this->view_footer(); die; } $dir = $this->file_area_name($userid); if (!data_submitted('nomatch') or !$confirm or !confirm_sesskey()) { $optionsyes = array('id' => $this->cm->id, 'file' => $file, 'userid' => $userid, 'confirm' => 1, 'sesskey' => sesskey(), 'mode' => $mode, 'offset' => $offset, 'sesskey' => sesskey()); if (empty($mode)) { $this->view_header(get_string('delete')); } else { print_header(get_string('delete')); } print_heading(get_string('delete')); notice_yesno(get_string('confirmdeletefile', 'assignment', $file), 'delete.php', $urlreturn, $optionsyes, $optionsreturn, 'post', 'get'); if (empty($mode)) { $this->view_footer(); } else { print_footer('none'); } die; } $filepath = $CFG->dataroot . '/' . $dir . '/' . $file; if (file_exists($filepath)) { if (@unlink($filepath)) { $updated = new object(); $updated->id = $submission->id; $updated->timemodified = time(); if (update_record('assignment_submissions', $updated)) { add_to_log($this->course->id, 'assignment', 'upload', 'view.php?a=' . $this->assignment->id, $this->assignment->id, $this->cm->id); $submission = $this->get_submission($userid); $this->update_grade($submission); } redirect($returnurl); } } // print delete error if (empty($mode)) { $this->view_header(get_string('delete')); } else { print_header(get_string('delete')); } notify(get_string('deletefilefailed', 'assignment')); print_continue($returnurl); if (empty($mode)) { $this->view_footer(); } else { print_footer('none'); } die; }
} else { displaydir($wdir); } html_footer(); break; case "restore": html_header($course, $wdir); if ($file != '' and confirm_sesskey()) { echo "<p align=\"center\">" . get_string("youaregoingtorestorefrom") . ":</p>"; print_simple_box_start("center"); echo $file; print_simple_box_end(); echo "<br />"; echo "<p align=\"center\">" . get_string("areyousuretorestorethisinfo") . "</p>"; $restore_path = "{$CFG->wwwroot}/backup/restore.php"; notice_yesno(get_string("areyousuretorestorethis"), $restore_path . "?id=" . $id . "&file=" . cleardoubleslashes($id . $wdir . "/" . $file) . "&method=manual", "index.php?id={$id}&wdir={$wdir}&action=cancel"); } else { displaydir($wdir); } html_footer(); break; case "cancel": clearfilelist(); default: html_header($course, $wdir); displaydir($wdir); html_footer(); break; } /// FILE FUNCTIONS /////////////////////////////////////////////////////////// function setfilelist($VARS)
$USER->policyagreed = 1; if (!empty($SESSION->wantsurl)) { $wantsurl = $SESSION->wantsurl; unset($SESSION->wantsurl); redirect($wantsurl); } else { redirect($CFG->wwwroot . '/'); } exit; } $strpolicyagree = get_string('policyagree'); $strpolicyagreement = get_string('policyagreement'); $strpolicyagreementclick = get_string('policyagreementclick'); print_header($strpolicyagreement, $SITE->fullname, build_navigation(array(array('name' => $strpolicyagreement, 'link' => null, 'type' => 'misc')))); print_heading($strpolicyagreement); $mimetype = mimeinfo('type', $CFG->sitepolicy); if ($mimetype == 'document/unknown') { //fallback for missing index.php, index.html $mimetype = 'text/html'; } echo '<div class="noticebox">'; echo '<object id="policyframe" data="' . $CFG->sitepolicy . '" type="' . $mimetype . '">'; // we can not use our popups here, because the url may be arbitrary, see MDL-9823 echo '<a href="' . $CFG->sitepolicy . '" onclick="this.target=\'_blank\'">' . $strpolicyagreementclick . '</a>'; echo '</object></div>'; $linkyes = 'policy.php'; $optionsyes = array('agree' => 1, 'sesskey' => sesskey()); $linkno = $CFG->wwwroot . '/login/logout.php'; $optionsno = array('sesskey' => sesskey()); notice_yesno($strpolicyagree, $linkyes, $linkno, $optionsyes, $optionsno); print_footer();
$forum = $discussion->get_forum(); $cm = $forum->get_course_module(); $course = $forum->get_course(); // Check permission for change $discussion->require_edit(); // Is this the actual delete? if ($_SERVER['REQUEST_METHOD'] == 'POST') { if ($delete) { $discussion->delete(); redirect($forum->get_url(forum::PARAM_PLAIN)); } else { $discussion->undelete(); redirect('../../discuss.php?' . $discussion->get_link_params(forum::PARAM_PLAIN)); } } // Confirm page. Work out navigation for header $pagename = get_string($delete ? 'deletediscussion' : 'undeletediscussion', 'forumng', $discussion->get_subject(false)); $navigation = array(); $navigation[] = array('name' => shorten_text(htmlspecialchars($discussion->get_subject())), 'link' => $discussion->get_url(), 'type' => 'forumng'); $navigation[] = array('name' => $pagename, 'type' => 'forumng'); $PAGEWILLCALLSKIPMAINDESTINATION = true; print_header_simple(format_string($forum->get_name()) . ': ' . $pagename, "", build_navigation($navigation, $cm), "", "", true, '', navmenu($course, $cm)); print skip_main_destination(); // Show confirm option $confirmstring = get_string($delete ? 'confirmdeletediscussion' : 'confirmundeletediscussion', 'forumng'); notice_yesno($confirmstring, 'delete.php', '../../discuss.php', array('d' => $discussion->get_id(), 'delete' => $delete, 'clone' => $cloneid), array('d' => $discussion->get_id(), 'clone' => $cloneid), 'post', 'get'); // Display footer print_footer($course); } catch (forum_exception $e) { forum_utils::handle_exception($e); }
} $strblogs = get_string('blogs', 'blog'); if ($action == 'delete') { if (!$existing) { error('Incorrect blog post id'); } if (data_submitted() and $confirm and confirm_sesskey()) { do_delete($existing); redirect($returnurl); } else { $optionsyes = array('id' => $id, 'action' => 'delete', 'confirm' => 1, 'sesskey' => sesskey(), 'courseid' => $courseid); $optionsno = array('userid' => $existing->userid, 'courseid' => $courseid); print_header("{$SITE->shortname}: {$strblogs}", $SITE->fullname); blog_print_entry($existing); echo '<br />'; notice_yesno(get_string('blogdeleteconfirm', 'blog'), 'edit.php', 'index.php', $optionsyes, $optionsno, 'post', 'get'); print_footer(); die; } } require_once 'edit_form.php'; $blogeditform = new blog_edit_form(null, compact('existing', 'sitecontext')); if ($blogeditform->is_cancelled()) { redirect($returnurl); } else { if ($blogeditform->no_submit_button_pressed()) { no_submit_button_actions($blogeditform, $sitecontext); } else { if ($fromform = $blogeditform->get_data()) { //save stuff in db switch ($action) {
/** * Shows the question bank editing interface. * * The function also processes a number of actions: * * Actions affecting the question pool: * move Moves a question to a different category * deleteselected Deletes the selected questions from the category * Other actions: * category Chooses the category * displayoptions Sets display options * * @author Martin Dougiamas and many others. This has recently been extensively * rewritten by Gustav Delius and other members of the Serving Mathematics project * {@link http://maths.york.ac.uk/serving_maths} * @param moodle_url $pageurl object representing this pages url. */ function question_showbank($tabname, $contexts, $pageurl, $cm, $page, $perpage, $sortorder, $sortorderdecoded, $cat, $recurse, $showhidden, $showquestiontext) { global $COURSE; if (optional_param('deleteselected', false, PARAM_BOOL)) { // teacher still has to confirm // make a list of all the questions that are selected $rawquestions = $_REQUEST; // This code is called by both POST forms and GET links, so cannot use data_submitted. $questionlist = ''; // comma separated list of ids of questions to be deleted $questionnames = ''; // string with names of questions separated by <br /> with // an asterix in front of those that are in use $inuse = false; // set to true if at least one of the questions is in use foreach ($rawquestions as $key => $value) { // Parse input for question ids if (preg_match('!^q([0-9]+)$!', $key, $matches)) { $key = $matches[1]; $questionlist .= $key . ','; question_require_capability_on($key, 'edit'); if (record_exists('quiz_question_instances', 'question', $key)) { $questionnames .= '* '; $inuse = true; } $questionnames .= get_field('question', 'name', 'id', $key) . '<br />'; } } if (!$questionlist) { // no questions were selected redirect($pageurl->out()); } $questionlist = rtrim($questionlist, ','); // Add an explanation about questions in use if ($inuse) { $questionnames .= '<br />' . get_string('questionsinuse', 'quiz'); } notice_yesno(get_string("deletequestionscheck", "quiz", $questionnames), $pageurl->out_action(), $pageurl->out(true), array('deleteselected' => $questionlist, 'confirm' => md5($questionlist)), $pageurl->params(), 'post', 'get'); echo '</td></tr>'; echo '</table>'; print_footer($COURSE); exit; } // starts with category selection form print_box_start('generalbox questionbank'); print_heading(get_string('questionbank', 'question'), '', 2); question_category_form($contexts->having_one_edit_tab_cap($tabname), $pageurl, $cat, $recurse, $showhidden, $showquestiontext); // continues with list of questions question_list($contexts->having_one_edit_tab_cap($tabname), $pageurl, $cat, isset($cm) ? $cm : null, $recurse, $page, $perpage, $showhidden, $sortorder, $sortorderdecoded, $showquestiontext, $contexts->having_cap('moodle/question:add')); print_box_end(); }
break; } } else { notify('Had an unspecified error with the component installer, sorry.'); } } } break; case DELETION_OF_SELECTED_LANG: //delete a directory(ies) containing a lang pack completely if ($uninstalllang == 'en_utf8') { $notice_error[] = 'en_utf8 can not be uninstalled!'; } else { if (!$confirm && confirm_sesskey()) { admin_externalpage_print_header(); notice_yesno(get_string('uninstallconfirm', 'admin', $uninstalllang), 'langimport.php?mode=' . DELETION_OF_SELECTED_LANG . '&uninstalllang=' . $uninstalllang . '&confirm=1&sesskey=' . sesskey(), 'langimport.php'); print_footer(); die; } else { if (confirm_sesskey()) { $dest1 = $CFG->dataroot . '/lang/' . $uninstalllang; $dest2 = $CFG->dirroot . '/lang/' . $uninstalllang; $rm1 = false; $rm2 = false; if (file_exists($dest1)) { $rm1 = remove_dir($dest1); } if (file_exists($dest2)) { $rm2 = remove_dir($dest2); } get_list_of_languages(true);
/** * Deleting existing comments */ function glossary_comment_delete() { global $USER; $cid = optional_param('cid', 0, PARAM_INT); // Comment ID $confirm = optional_param('confirm', 0, PARAM_BOOL); // delete confirmation if (!($comment = get_record('glossary_comments', 'id', $cid))) { error('Comment is incorrect'); } if (!($entry = get_record('glossary_entries', 'id', $comment->entryid))) { error('Entry is incorrect'); } if (!($glossary = get_record('glossary', 'id', $entry->glossaryid))) { error('Incorrect glossary'); } if (!($cm = get_coursemodule_from_instance('glossary', $glossary->id))) { error('Course Module ID was incorrect'); } if (!($course = get_record('course', 'id', $cm->course))) { error('Course is misconfigured'); } require_login($course->id, false, $cm); $context = get_context_instance(CONTEXT_MODULE, $cm->id); if ($comment->userid != $USER->id and !has_capability('mod/glossary:managecomments', $context)) { error('You can\'t delete other people\'s comments!'); } if (!$glossary->allowcomments and !has_capability('mod/glossary:managecomments', $context)) { error('You can\'t delete comments in this glossary!'); } if (data_submitted() and $confirm) { delete_records('glossary_comments', 'id', $cid); add_to_log($course->id, 'glossary', 'delete comment', "comments.php?id={$cm->id}&eid={$entry->id}", "{$comment->id}", $cm->id); redirect("comments.php?id={$cm->id}&eid={$entry->id}"); } else { $linkyes = 'comment.php'; $optionsyes = array('action' => 'delete', 'cid' => $cid, 'confirm' => 1); $linkno = 'comments.php'; $optionsno = array('id' => $cm->id, 'eid' => $entry->id); $strdeletewarning = get_string('areyousuredeletecomment', 'glossary'); glossary_comment_print_header($course, $cm, $glossary, $entry, 'delete'); glossary_print_comment($course, $cm, $glossary, $entry, $comment); notice_yesno($strdeletewarning, $linkyes, $linkno, $optionsyes, $optionsno, 'post', 'get'); print_footer($course); die; } }
error('Course is misconfigured'); } if (!($glossary = get_record('glossary', 'id', $cm->instance))) { error('Course module is incorrect'); } $strglossaries = get_string('modulenameplural', 'glossary'); $entryalreadyexist = get_string('entryalreadyexist', 'glossary'); $entryexported = get_string('entryexported', 'glossary'); $navigation = build_navigation('', $cm); print_header_simple(format_string($glossary->name), '', $navigation, '', '', true, '', navmenu($course, $cm)); if ($PermissionGranted) { $entry = get_record('glossary_entries', 'id', $entry); if (!$confirm) { echo '<div class="boxaligncenter">'; $areyousure = get_string('areyousureexport', 'glossary'); notice_yesno('<h2>' . format_string($entry->concept) . '</h2><p align="center">' . $areyousure . '<br /><b>' . format_string($mainglossary->name) . '</b>?', 'exportentry.php?id=' . $id . '&mode=' . $mode . '&hook=' . $hook . '&entry=' . $entry->id . '&confirm=1', 'view.php?id=' . $cm->id . '&mode=' . $mode . '&hook=' . $hook); echo '</div>'; } else { if (!$mainglossary->allowduplicatedentries) { $dupentry = get_record('glossary_entries', 'glossaryid', $mainglossary->id, 'lower(concept)', moodle_strtolower(addslashes($entry->concept))); if ($dupentry) { $PermissionGranted = 0; } } if ($PermissionGranted) { $dbentry = new stdClass(); $dbentry->id = $entry->id; $dbentry->glossaryid = $mainglossary->id; $dbentry->sourceglossaryid = $glossary->id; if (!update_record('glossary_entries', $dbentry)) { error('Could not export the entry to the main glossary');
<?php // $Id: index.php,v 1.28 2009/05/06 09:29:06 tjhunt Exp $ // this is the 'my moodle' page require_once dirname(__FILE__) . '/../config.php'; require_once $CFG->dirroot . '/course/lib.php'; require_login(); $strmymoodle = get_string('mymoodle', 'my'); if (isguest()) { print_header($strmymoodle); notice_yesno(get_string('noguest', 'my') . '<br /><br />' . get_string('liketologin'), get_login_url(), $CFG->wwwroot); print_footer(); die; } $edit = optional_param('edit', -1, PARAM_BOOL); $blockaction = optional_param('blockaction', '', PARAM_ALPHA); $PAGE->set_context(get_context_instance(CONTEXT_USER, $USER->id)); $PAGE->set_url('my/index.php'); $PAGE->set_blocks_editing_capability('moodle/my:manageblocks'); // Note: MDL-19010 there will be further changes to printing header and blocks. // The code will be much nicer than this eventually. $pageblocks = blocks_setup($PAGE, BLOCKS_PINNED_BOTH); if ($edit != -1 and $PAGE->user_allowed_editing()) { $USER->editing = $edit; } $button = update_mymoodle_icon($USER->id); $header = $SITE->shortname . ': ' . $strmymoodle; $navigation = build_navigation($strmymoodle); $loggedinas = user_login_string(); if (empty($CFG->langmenu)) { $langmenu = '';
} if ($userid > 0 and $userid == $USER->id || has_capability('mod/data:manageuserpresets', $context)) { //ok can delete } else { error("Invalid request"); } $path = data_preset_path($course, $userid, $shortname); $strwarning = get_string('deletewarning', 'data') . '<br />' . data_preset_name($shortname, $path); $options = new object(); $options->fullname = $userid . '/' . $shortname; $options->action = 'delete'; $options->d = $data->id; $options->sesskey = sesskey(); $optionsno = new object(); $optionsno->d = $data->id; notice_yesno($strwarning, 'preset.php', 'preset.php', $options, $optionsno, 'post', 'get'); print_footer($course); exit; break; case 'delete': if (!data_submitted() and !confirm_sesskey()) { error("Invalid request"); } if ($userid > 0 and $userid == $USER->id || has_capability('mod/data:manageuserpresets', $context)) { //ok can delete } else { error("Invalid request"); } $presetpath = data_preset_path($course, $userid, $shortname); if (!clean_preset($presetpath)) { error("Error deleting a preset!");
if ($urltogo == $CFG->wwwroot or $urltogo == $CFG->wwwroot . '/' or $urltogo == $CFG->wwwroot . '/index.php') { $urltogo = $CFG->wwwroot . '/my/'; } } /// check if user password has expired /// Currently supported only for ldap-authentication module if (!empty($userauth->config->expiration) and $userauth->config->expiration == 1) { $days2expire = $userauth->password_expire($USER->username); if (intval($days2expire) > 0 && intval($days2expire) < intval($userauth->config->expiration_warning)) { print_header("{$site->fullname}: {$loginsite}", "{$site->fullname}", $loginsite, $focus, "", true, "<div class=\"langmenu\">{$langmenu}</div>"); notice_yesno(get_string('auth_passwordwillexpire', 'auth', $days2expire), $passwordchangeurl, $urltogo); print_footer(); exit; } elseif (intval($days2expire) < 0) { print_header("{$site->fullname}: {$loginsite}", "{$site->fullname}", $loginsite, $focus, "", true, "<div class=\"langmenu\">{$langmenu}</div>"); notice_yesno(get_string('auth_passwordisexpired', 'auth'), $passwordchangeurl, $urltogo); print_footer(); exit; } } reset_login_count(); redirect($urltogo); exit; } else { if (empty($errormsg)) { $errormsg = get_string("invalidlogin"); } // TODO: if the user failed to authenticate, check if the username corresponds to a remote mnet user if (!empty($CFG->mnet_dispatcher_mode) && $CFG->mnet_dispatcher_mode === 'strict' && is_enabled_auth('mnet')) { $errormsg .= get_string('loginlinkmnetuser', 'mnet', "mnet_email.php?u={$frm->username}"); }
} $key->courseid = $course->id; require_login($course); $context = get_context_instance(CONTEXT_COURSE, $course->id); require_capability('moodle/grade:export', $context); // extra security check if (!empty($key->userid) and $USER->id != $key->userid) { error('You are not owner of this key'); } $returnurl = $CFG->wwwroot . '/grade/export/keymanager.php?id=' . $course->id; if ($id and $delete) { if (!$confirm) { print_header(get_string('deleteselectedkey'), get_string('deleteselectedkey')); $optionsyes = array('id' => $id, 'delete' => 1, 'courseid' => $courseid, 'sesskey' => sesskey(), 'confirm' => 1); $optionsno = array('id' => $courseid); notice_yesno(get_string('deletekeyconfirm', 'userkey', $key->value), 'key.php', 'keymanager.php', $optionsyes, $optionsno, 'get', 'get'); print_footer(); die; } else { if (confirm_sesskey()) { delete_records('user_private_key', 'id', $id); redirect('keymanager.php?id=' . $course->id); } } } /// First create the form $editform = new key_form(); $editform->set_data($key); if ($editform->is_cancelled()) { redirect($returnurl); } elseif ($data = $editform->get_data()) {
/** * Saves (creates or updates) a question. * * Given some question info and some data about the answers * this function parses, organises and saves the question * It is used by {@link question.php} when saving new data from * a form, and also by {@link import.php} when importing questions * This function in turn calls {@link save_question_options} * to save question-type specific data. * * Whether we are saving a new question or updating an existing one can be * determined by testing !empty($question->id). If it is not empty, we are updating. * * The question will be saved in category $form->category. * * @param object $question the question object which should be updated. For a new question will be mostly empty. * @param object $form the object containing the information to save, as if from the question editing form. * @param object $course not really used any more. * @return object On success, return the new question object. On failure, * return an object as follows. If the error object has an errors field, * display that as an error message. Otherwise, the editing form will be * redisplayed with validation errors, from validation_errors field, which * is itself an object, shown next to the form fields. (I don't think this is accurate any more.) */ function save_question($question, $form, $course) { global $USER; // This default implementation is suitable for most // question types. // First, save the basic question itself $question->name = trim($form->name); $question->questiontext = trim($form->questiontext); $question->questiontextformat = $form->questiontextformat; $question->parent = isset($form->parent) ? $form->parent : 0; $question->length = $this->actual_number_of_questions($question); $question->penalty = isset($form->penalty) ? $form->penalty : 0; if (empty($form->image)) { $question->image = ''; } else { $question->image = $form->image; } if (empty($form->generalfeedback)) { $question->generalfeedback = ''; } else { $question->generalfeedback = trim($form->generalfeedback); } if (empty($question->name)) { $question->name = shorten_text(strip_tags($question->questiontext), 15); if (empty($question->name)) { $question->name = '-'; } } if ($question->penalty > 1 or $question->penalty < 0) { $question->errors['penalty'] = get_string('invalidpenalty', 'quiz'); } if (isset($form->defaultgrade)) { $question->defaultgrade = $form->defaultgrade; } list($question->category) = explode(',', $form->category); if (!empty($question->id)) { /// Question already exists, update. $question->modifiedby = $USER->id; $question->timemodified = time(); if (!update_record('question', $question)) { error('Could not update question!'); } } else { /// New question. // Set the unique code $question->stamp = make_unique_id_code(); $question->createdby = $USER->id; $question->modifiedby = $USER->id; $question->timecreated = time(); $question->timemodified = time(); if (!($question->id = insert_record('question', $question))) { error('Could not insert new question!'); } } // Now to save all the answers and type-specific options $form->id = $question->id; $form->qtype = $question->qtype; $form->category = $question->category; $form->questiontext = $question->questiontext; $result = $this->save_question_options($form); if (!empty($result->error)) { error($result->error); } if (!empty($result->notice)) { notice($result->notice, "question.php?id={$question->id}"); } if (!empty($result->noticeyesno)) { notice_yesno($result->noticeyesno, "question.php?id={$question->id}&courseid={$course->id}", "edit.php?courseid={$course->id}"); print_footer($course); exit; } // Give the question a unique version stamp determined by question_hash() if (!set_field('question', 'version', question_hash($question), 'id', $question->id)) { error('Could not update question version field'); } return $question; }
print_error("bookmarknotfound", "block_exabis_eportfolio"); } if (data_submitted() && $confirm && confirm_sesskey()) { delete_records('block_exabeporviewblock', 'viewid', $view->id); $status = delete_records('block_exabeporview', 'id', $view->id); add_to_log(SITEID, 'blog', 'delete', 'views_mod.php?courseid=' . $courseid . '&id=' . $view->id . '&action=delete&confirm=1', $view->name); if (!$status) { print_error('deleteposterror', 'block_exabis_eportfolio', $returnurl); } redirect($returnurl); } else { $optionsyes = array('id' => $id, 'action' => 'delete', 'confirm' => 1, 'sesskey' => sesskey(), 'courseid' => $courseid); $optionsno = array('courseid' => $courseid); block_exabis_eportfolio_print_header('views'); echo '<br />'; notice_yesno(get_string("deleteconfirm", "block_exabis_eportfolio"), 'views_mod.php', 'views_list.php', $optionsyes, $optionsno, 'post', 'get'); print_footer(); die; } } $query = "select i.id, i.name, i.type, ic.name AS cname, ic2.name AS cname_parent, COUNT(com.id) As comments" . " from {$CFG->prefix}block_exabeporitem i" . " join {$CFG->prefix}block_exabeporcate ic on i.categoryid = ic.id" . " left join {$CFG->prefix}block_exabeporcate ic2 on ic.pid = ic2.id" . " left join {$CFG->prefix}block_exabeporitemcomm com on com.itemid = i.id" . " where i.userid= " . $USER->id . " GROUP BY i.id, i.name, i.type, ic.name, ic2.name" . " ORDER BY i.name"; $portfolioItems = get_records_sql($query); if (!$portfolioItems) { $portfolioItems = array(); } foreach ($portfolioItems as &$item) { if (null == $item->cname_parent) { $item->category = format_string($item->cname); } else { $item->category = format_string($item->cname_parent) . " ⇒ " . format_string($item->cname); }
if ($notice != null) { $title = $notice->name; } $navlinks[] = array('name' => format_string($title)); $navigation = build_navigation($navlinks); // Handle deletions if (!empty($d)) { if (!confirm_sesskey()) { print_error('confirmsesskeybad', 'error'); } if (!$confirm) { print_header_simple(format_string($title), '', $navigation, '', '', true); $info = new object(); $info->name = format_string($notice->name); $info->text = format_text($notice->text, FORMAT_HTML); notice_yesno(get_string('noticedeleteconfirm', 'webinar', $info), "sitenotice.php?id={$id}&d=1&confirm=1&sesskey={$USER->sesskey}", $returnurl); print_footer(); exit; } else { begin_sql(); if (!delete_records('webinar_notice', 'id', $id)) { rollback_sql(); print_error('error:couldnotdeletenotice', 'webinar', $returnurl); } if (!delete_records('webinar_notice_data', 'noticeid', $id)) { rollback_sql(); print_error('error:couldnotdeletenotice', 'webinar', $returnurl); } commit_sql(); redirect($returnurl); }
/** * Render the Edit mode of the Presenter (lists all the slides and allows re-ordering). * Called from with the {@link render()} function when necessary. */ function render_edit() { //display any feedback if (!empty($this->feedback)) { echo $this->feedback; } global $CFG; $streditpresenter = get_string('presenter:edit', 'sloodle'); $strviewanddelete = get_string('presenter:viewanddelete', 'sloodle'); $strnoentries = get_string('noentries', 'sloodle'); $strnoslides = get_string('presenter:empty', 'sloodle'); $strdelete = get_string('delete', 'sloodle'); $stradd = get_string('presenter:add', 'sloodle'); $straddatend = get_string('presenter:addatend', 'sloodle'); $straddbefore = get_string('presenter:addbefore', 'sloodle'); $strtype = get_string('type', 'sloodle'); $strurl = get_string('url', 'sloodle'); $strname = get_string('name', 'sloodle'); $stryes = get_string('yes'); $strno = get_string('no'); $strmove = get_string('move'); $stredit = get_string('edit', 'sloodle'); $strview = get_string('view', 'sloodle'); $strdelete = get_string('delete'); $strmoveslide = get_string('presenter:moveslide', 'sloodle'); $streditslide = get_string('presenter:editslide', 'sloodle'); $strviewslide = get_string('presenter:viewslide', 'sloodle'); $strdeleteslide = get_string('presenter:deleteslide', 'sloodle'); // Get a list of entry URLs $entries = $this->presenter->get_slides(); if (!is_array($entries)) { $entries = array(); } $numentries = count($entries); // Any images to display? if ($entries === false || count($entries) == 0) { echo '<h4>' . $strnoslides . '</h4>'; echo '<h4><a href="' . SLOODLE_WWWROOT . '/view.php?id=' . $this->cm->id . '&mode=addslide">' . $stradd . '</a></h4><br>'; } else { // Are we being asked to confirm the deletion of a slide? if ($this->presenter_mode == 'confirmdeleteslide') { // Make sure the session key is specified and valid if (required_param('sesskey') != sesskey()) { error('Invalid session key'); exit; } // Determine which slide is being deleted $entryid = (int) required_param('entry', PARAM_INT); // Make sure the specified entry is recognised if (isset($entries[$entryid])) { // Construct our links $linkYes = SLOODLE_WWWROOT . "/view.php?id={$this->cm->id}&mode=deleteslide&entry={$entryid}&sesskey=" . sesskey(); $linkNo = SLOODLE_WWWROOT . "/view.php?id={$this->cm->id}&mode=edit"; // Output our confirmation form notice_yesno(get_string('presenter:confirmdelete', 'sloodle', $entries[$entryid]->name), $linkYes, $linkNo); echo "<br/>"; } } // Are we being asked to confirm the deletion of multiple slides? $deletingentries = array(); if ($this->presenter_mode == 'confirmdeletemultiple') { // Make sure the session key is specified and valid if (required_param('sesskey') != sesskey()) { error('Invalid session key'); exit; } // Grab the array of entries to be deleted if (isset($_REQUEST['entries'])) { $deletingentries = $_REQUEST['entries']; } if (is_array($deletingentries) && count($deletingentries) > 0) { // Construct our links $entriesparam = ''; foreach ($deletingentries as $de) { $entriesparam .= "entries[]={$de}&"; } $linkYes = SLOODLE_WWWROOT . "/view.php?id={$this->cm->id}&mode=deletemultiple&{$entriesparam}sesskey=" . sesskey(); $linkNo = SLOODLE_WWWROOT . "/view.php?id={$this->cm->id}&mode=edit"; // Output our confirmation form notice_yesno(get_string('presenter:confirmdeletemultiple', 'sloodle', count($deletingentries)), $linkYes, $linkNo); echo "<br/>"; } else { // No slides selected. // Inform the user to select slides first, and then click the button again. notify(get_string('presenter:noslidesfordeletion', 'sloodle')); } } // Are we currently moving a slide? if ($this->presenter_mode == 'moveslide') { $linkCancel = SLOODLE_WWWROOT . "/view.php?id={$this->cm->id}&mode=edit"; $strcancel = get_string('cancel'); // Display a message and an optional 'cancel' link print_box_start('generalbox', 'notice'); echo "<p>", get_string('presenter:movingslide', 'sloodle', $entries[$this->movingentryid]->name), "</p>\n"; echo "<p>(<a href=\"{$linkCancel}\">{$strcancel}</a>)</p>\n"; print_box_end(); } // Setup a table object to display Presenter entries $entriesTable = new stdClass(); $entriesTable->head = array(get_string('position', 'sloodle'), '<div id="selectboxes"><a href="#"><div style=\'text-align:center;\' id="selectall">' . get_string('selectall', 'sloodle') . '</div></a></div>', get_string('name', 'sloodle'), get_string('type', 'sloodle'), get_string('actions', 'sloodle')); $entriesTable->align = array('center', 'center', 'left', 'left', 'center'); $entriesTable->size = array('5%', '5%', '30%', '20%', '30%'); // Go through each entry $numentries = count($entries); foreach ($entries as $entryid => $entry) { // Create a new row for the table $row = array(); // Extract the entry data $slideplugin = $this->_session->plugins->get_plugin('presenter-slide', $entry->type); if (is_object($slideplugin)) { $entrytypename = $slideplugin->get_plugin_name(); } else { $entrytypename = '(unknown type)'; } // Construct the link to the entry source $entrylink = "<a href=\"{$entry->source}\" title=\"{$entry->source}\">{$entry->name}</a>"; // If this is the slide being moved, then completely ignore it if ($this->movingentryid == $entryid) { continue; } // If we are in move mode, then add a 'move here' row before this slide if ($this->presenter_mode == 'moveslide') { $movelink = SLOODLE_WWWROOT . "/view.php?id={$this->cm->id}&mode=setslideposition&entry={$this->movingentryid}&position={$entry->slideposition}"; $movebutton = "<a href=\"{$movelink}\" title=\"{$strmove}\"><img src=\"{$CFG->pixpath}/movehere.gif\" class=\"\" alt=\"{$strmove}\" /></a>\n"; $entriesTable->data[] = array('', '', $movebutton, '', '', ''); // If the current row belongs to the slide being moved, then emphasise it, and append (moving) to the end if ($entryid == $this->movingentryid) { $entrylink = "<strong>{$entrylink}</strong> <em>(" . get_string('moving', 'sloodle') . ')</em>'; } } // Define our action links $actionBaseLink = SLOODLE_WWWROOT . "/view.php?id={$this->cm->id}"; $actionLinkMove = $actionBaseLink . "&mode=moveslide&entry={$entryid}"; $actionLinkEdit = $actionBaseLink . "&mode=editslide&entry={$entryid}"; $actionLinkView = $actionBaseLink . "&mode=view&sloodledisplayentry={$entry->slideposition}#slide"; $actionLinkDelete = $actionBaseLink . "&mode=confirmdeleteslide&entry={$entryid}&sesskey=" . sesskey(); // Prepare the add buttons separately $actionLinkAdd = $actionBaseLink . "&mode=addslide&sloodleentryposition={$entry->slideposition}"; $addButtons = "<a href=\"{$actionLinkAdd}\" title=\"{$straddbefore}\"><img src=\"" . SLOODLE_WWWROOT . "/lib/media/add.png\" alt=\"{$stradd}\" /></a>\n"; // Construct our list of action buttons $actionButtons = ''; $actionButtons .= "<a href=\"{$actionLinkMove}\" title=\"{$strmoveslide}\"><img src=\"{$CFG->pixpath}/t/move.gif\" class=\"iconsmall\" alt=\"{$strmove}\" /></a>\n"; $actionButtons .= "<a href=\"{$actionLinkEdit}\" title=\"{$streditslide}\"><img src=\"{$CFG->pixpath}/t/edit.gif\" class=\"iconsmall\" alt=\"{$stredit}\" /></a>\n"; $actionButtons .= "<a href=\"{$actionLinkView}\" title=\"{$strviewslide}\"><img src=\"{$CFG->pixpath}/t/preview.gif\" class=\"iconsmall\" alt=\"{$strview}\" /></a>\n"; $actionButtons .= "<a href=\"{$actionLinkDelete}\" title=\"{$strdeleteslide}\"><img src=\"{$CFG->pixpath}/t/delete.gif\" class=\"iconsmall\" alt=\"{$strdelete}\" /></a>\n"; $actionButtons .= $addButtons; //create checkbox for multiple edit functions $checked = ''; if (in_array($entryid, $deletingentries)) { $checked = "checked=\"checked\""; } $checkbox = "<div style='text-align:center;'><input type=\"checkbox\" name=\"entries[]\" {$checked} value=\"{$entryid}\" /></div>"; // Add each item of data to our table row. // The first item is a check box for multiple deletes // The second items are the position and the name of the entry, hyperlinked to the resource. // The next is the name of the entry type. // The last is a list of action buttons -- move, edit, view, and delete. $row[] = $entry->slideposition; $row[] = $checkbox; $row[] = $entrylink; $row[] = $entrytypename; $row[] = $actionButtons; // Add the row to our table $entriesTable->data[] = $row; } // If we are in move mode, then add a final 'move here' row at the bottom // We need to add a final row at the bottom // Prepare the action link for this row $endentrynum = $entry->slideposition + 1; $actionLinkAdd = $actionBaseLink . "&mode=addslide&sloodleentryposition={$endentrynum}"; $addButtons = "<a href=\"{$actionLinkAdd}\" title=\"{$straddatend}\"><img src=\"" . SLOODLE_WWWROOT . "/lib/media/add.png\" alt=\"{$stradd}\" /></a>\n"; $sloodleInsert = get_string("presenter:sloodleinsert", "sloodle"); // It will contain a last 'add' button, and possibly a 'move here' button too (if we are in move mode) $movebutton = ''; if ($this->presenter_mode == 'moveslide') { $movelink = SLOODLE_WWWROOT . "/view.php?id={$this->cm->id}&mode=setslideposition&entry={$this->movingentryid}&position={$endentrynum}"; $movebutton = "<a href=\"{$movelink}\" title=\"{$strmove}\"><img src=\"{$CFG->pixpath}/movehere.gif\" class=\"\" alt=\"{$strmove}\" /></a>\n"; } // Add a button to delete all selected slides $deleteButton = '<input type="submit" value="' . get_string('deleteselected', 'sloodle') . '" />'; $entriesTable->data[] = array('', ' <div id="selectboxes2"><a href="#"><div style=\'text-align:center;\' id="selectall2">' . get_string('selectall', 'sloodle') . '</div></a></div>', $movebutton, '', $deleteButton . ' ' . $addButtons); // Put our table inside a form to allow us to delete multiple slides based on the checkboxes echo '<form action="" method="get" id="editform" name="editform">'; echo "<input type=\"hidden\" name=\"id\" value=\"{$this->cm->id}\" />\n"; // Course module ID so that the request comes to the right places echo "<input type=\"hidden\" name=\"mode\" value=\"confirmdeletemultiple\" />\n"; // The operation being conducted print_table($entriesTable); echo "<input type=\"hidden\" name=\"sesskey\" value=\"" . sesskey() . "\" />\n"; // Session key to ensure unauthorised deletions are not possible (e.g. using XSS) echo '</form>'; } }
function process_selection($data) { global $CURMAN; $id = $this->required_param('id', PARAM_INT); if (empty($data->_selection)) { echo print_error('no_items_selected', 'block_curr_admin'); } else { notice_yesno(get_string('confirm_waitlist_' . $data->do, 'block_curr_admin', count($data->_selection)), 'index.php', 'index.php', array('s' => $this->pagename, 'id' => $id, 'action' => $data->do, 'selected' => implode(',', $data->_selection)), array('s' => $this->pagename, 'id' => $id), 'POST', 'GET'); } }