本文整理汇总了PHP中notice_yesno函数的典型用法代码示例。如果您正苦于以下问题:PHP notice_yesno函数的具体用法?PHP notice_yesno怎么用?PHP notice_yesno使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了notice_yesno函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: print_header
/**
* 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);
}
}
示例2: print_entry
/**
* 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();
}
示例3: user_message_form
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();
示例4: confirm_sesskey
<?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}");
示例5: clearfilelist
}
}
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>";
示例6: repository_exception
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);
示例7: error
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))) {
示例8: print_error
}
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=' . $note->userid;
if (note_delete($noteid)) {
add_to_log($note->courseid, 'notes', 'delete', 'index.php?course=' . $note->courseid . '&user=' . $note->userid . '#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=' . $user->id, '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();
}
示例9: object
// 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();
示例10: redirect
}
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) {
示例11: delete_file
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;
}
示例12: displaydir
} 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)
示例13: unset
$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();
示例14: redirect
$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);
}
示例15: get_string
}
$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) {