本文整理汇总了PHP中close_window函数的典型用法代码示例。如果您正苦于以下问题:PHP close_window函数的具体用法?PHP close_window怎么用?PHP close_window使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了close_window函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update_groups
/**
* Update the groups for this user
* @param none
*/
function update_groups($memberid, $to_add)
{
$util = new Utility();
$user = new User($memberid);
$orig = array_keys($user->groups);
$groups_to_add = $util->getAddedItems($orig, $to_add);
$groups_to_remove = $util->getRemovedItems($orig, $to_add);
$user->add_groups($groups_to_add);
$user->remove_groups($groups_to_remove);
close_window();
}
示例2: submissions
/**
* Top-level function for handling of submissions called by submissions.php
*
* This is for handling the teacher interaction with the grading interface
* This should be suitable for most assignment types.
*
* @param $mode string Specifies the kind of teacher interaction taking place
*/
function submissions($mode)
{
///The main switch is changed to facilitate
///1) Batch fast grading
///2) Skip to the next one on the popup
///3) Save and Skip to the next one on the popup
//make user global so we can use the id
global $USER;
switch ($mode) {
case 'grade':
// We are in a popup window grading
if ($submission = $this->process_feedback()) {
//IE needs proper header with encoding
print_header(get_string('feedback', 'assignment') . ':' . format_string($this->assignment->name));
print_heading(get_string('changessaved'));
print $this->update_main_listing($submission);
}
close_window();
break;
case 'single':
// We are in a popup window displaying submission
$this->display_submission();
break;
case 'all':
// Main window, display everything
$this->display_submissions();
break;
case 'fastgrade':
///do the fast grading stuff - this process should work for all 3 subclasses
$grading = false;
$commenting = false;
$col = false;
if (isset($_POST['submissioncomment'])) {
$col = 'submissioncomment';
$commenting = true;
}
if (isset($_POST['menu'])) {
$col = 'menu';
$grading = true;
}
if (!$col) {
//both submissioncomment and grade columns collapsed..
$this->display_submissions();
break;
}
foreach ($_POST[$col] as $id => $unusedvalue) {
$id = (int) $id;
//clean parameter name
$this->process_outcomes($id);
if (!($submission = $this->get_submission($id))) {
$submission = $this->prepare_new_submission($id);
$newsubmission = true;
} else {
$newsubmission = false;
}
unset($submission->data1);
// Don't need to update this.
unset($submission->data2);
// Don't need to update this.
//for fast grade, we need to check if any changes take place
$updatedb = false;
if ($grading) {
$grade = $_POST['menu'][$id];
$updatedb = $updatedb || $submission->grade != $grade;
$submission->grade = $grade;
} else {
if (!$newsubmission) {
unset($submission->grade);
// Don't need to update this.
}
}
if ($commenting) {
$commentvalue = trim($_POST['submissioncomment'][$id]);
$updatedb = $updatedb || $submission->submissioncomment != stripslashes($commentvalue);
$submission->submissioncomment = $commentvalue;
} else {
unset($submission->submissioncomment);
// Don't need to update this.
}
$submission->teacher = $USER->id;
$submission->mailed = $updatedb ? 0 : $submission->mailed;
//only change if it's an update
$submission->timemarked = time();
//if it is not an update, we don't change the last modified time etc.
//this will also not write into database if no submissioncomment and grade is entered.
if ($updatedb) {
if ($newsubmission) {
if (!($sid = insert_record('assignment_submissions', $submission))) {
return false;
}
$submission->id = $sid;
} else {
//.........这里部分代码省略.........
示例3: tag_set
}
}
$question = $qtypeobj->save_question($question, $fromform);
if (!empty($CFG->usetags) && isset($fromform->tags)) {
// A wizardpage from multipe pages questiontype like calculated may not
// allow editing the question tags, hence the isset($fromform->tags) test.
require_once $CFG->dirroot . '/tag/lib.php';
tag_set('question', $question->id, $fromform->tags);
}
}
// Purge this question from the cache.
question_bank::notify_question_edited($question->id);
if ($qtypeobj->finished_edit_wizard($fromform) || $movecontext) {
if ($inpopup) {
echo $OUTPUT->notification(get_string('changessaved'), '');
close_window(3);
} else {
$returnurl->param('lastchanged', $question->id);
if ($appendqnumstring) {
$returnurl->param($appendqnumstring, $question->id);
$returnurl->param('sesskey', sesskey());
$returnurl->param('cmid', $cmid);
}
redirect($returnurl);
}
} else {
$nexturlparams = array('returnurl' => $originalreturnurl, 'appendqnumstring' => $appendqnumstring, 'scrollpos' => $scrollpos);
if (isset($fromform->nextpageparam) && is_array($fromform->nextpageparam)) {
//useful for passing data to the next page which is not saved in the database.
$nexturlparams += $fromform->nextpageparam;
}
示例4: error
if ($id) {
if (!($cm = get_coursemodule_from_id('assignment', $id))) {
error("Course Module ID was incorrect");
}
} else {
error("Course module is incorrect");
}
if ($a) {
if (!($assignment = get_record("assignment", "id", $a))) {
error("assignment ID was incorrect");
}
if (!($course = get_record("course", "id", $assignment->course))) {
error("Course is misconfigured");
}
} else {
error("Assignment not specified");
}
// Check user is logged in and capable of submitting
require_login($course->id, false, $cm);
require_capability('mod/assignment:grade', get_context_instance(CONTEXT_MODULE, $cm->id));
if (set_field('assignment_peerreview', 'savedcomments', $comments, 'assignment', $assignment->id)) {
print_heading(get_string('commentssaved', 'assignment_peerreview'), 'center', 1);
} else {
notify(get_string('unabletosavecomments', 'assignment_peerreview'));
}
require 'assignment.class.php';
$assignmentclass = 'assignment_peerreview';
$assignmentinstance = new $assignmentclass($cm->id, $assignment, $cm, $course);
echo '<p align="center"><a href="#null" onclick="window.close();">' . get_string('close', 'assignment_peerreview') . '</a></p>';
close_window(1);
$assignmentinstance->view_footer();
示例5: time
$transaction = $DB->start_delegated_transaction();
$quba->process_all_actions(time());
question_engine::save_questions_usage_by_activity($quba);
$transaction->allow_commit();
// Set the result's total mark (sumgrades).
$result->sumgrades = $quba->get_total_mark();
$result->timemodified = time();
$DB->update_record('offlinequiz_results', $result);
// Log this action.
$params = array('objectid' => $slotquestion->id, 'courseid' => $course->id, 'context' => context_module::instance($cm->id), 'other' => array('offlinequizid' => $offlinequiz->id, 'resultid' => $result->id, 'slot' => $slot));
$event = \mod_offlinequiz\event\question_manually_graded::create($params);
$event->trigger();
// Update the gradebook.
offlinequiz_update_grades($offlinequiz);
echo $OUTPUT->notification(get_string('changessaved'), 'notifysuccess');
close_window(2, true);
die;
}
}
// Print the comment form.
echo '<form method="post" class="mform" id="manualgradingform" action="' . $CFG->wwwroot . '/mod/offlinequiz/comment.php">';
$options = new mod_offlinequiz_display_options();
$options->hide_all_feedback();
$options->manualcomment = question_display_options::EDITABLE;
if (property_exists($slotquestion, '_number')) {
echo $quba->render_question($slot, $options, $slotquestion->_number);
} else {
echo $quba->render_question($slot, $options);
}
?>
<div>
示例6: submissions
function submissions($mode)
{
global $CFG, $USER;
switch ($mode) {
case 'grade':
// We are in a popup window grading
if ($submission = $this->process_feedback()) {
//IE needs proper header with encoding
print_header(get_string('feedback', 'assignment') . ':' . format_string($this->assignment->name));
print_heading(get_string('changessaved'));
print $this->update_main_listing($submission);
}
close_window();
break;
case 'single':
// We are in a popup window displaying submission
$this->display_submission();
break;
case 'all':
// Main window, display everything
$this->display_submissions();
break;
case 'next':
/// We are currently in pop up, but we want to skip to next one without saving.
/// This turns out to be similar to a single case
/// The URL used is for the next submission.
$this->display_submission();
break;
case 'saveandnext':
///We are in pop up. save the current one and go to the next one.
//first we save the current changes
if ($submission = $this->process_feedback()) {
$extra_javascript = $this->update_main_listing($submission);
}
//then we display the next submission
$this->display_submission($extra_javascript);
break;
default:
echo "something seriously is wrong!!";
break;
}
}
示例7: stdClass
// Save data in bd
$update = new stdClass();
$update->id = $data->gradeid;
$update->grade = round($data->grade, 2);
$update->comments = $data->comment_editor['text'];
$update->timemodified = time();
// Retrieve data of that registry from db to know if status must be update or not
if ($rdatastatus = $DB->get_field('rcontent_grades', 'status', array('id' => $update->id))) {
if ($rdatastatus == "POR_CORREGIR") {
$update->status = "CORREGIDO";
}
}
$DB->update_record('rcontent_grades', $update);
// Update gradebook
$rcontent = $DB->get_record('rcontent', array('id' => $rcontent->id));
rcontent_update_grades($rcontent, $data->user);
add_to_log($course->id, 'rcontent', 'update grades', 'grade.php?id=' . $data->id . '&user=' . $data->user, $data->user, $data->id);
close_window();
}
$struserfullname = fullname($user, true);
$PAGE->set_pagelayout('popup');
$PAGE->navbar->add(get_string('comments', 'rcontent') . ':' . $struserfullname . ':' . format_string($rcontent->name), null, null, navigation_node::TYPE_CUSTOM, null);
echo $OUTPUT->header();
echo $OUTPUT->heading($heading);
// Print user information
$picture = $OUTPUT->user_picture($user, array('courseid' => $course->id));
$userlink = '<a href="' . $CFG->wwwroot . '/user/view.php?id=' . $user->id . '&course=' . $rcontent->course . '">' . fullname($user, has_capability('moodle/site:viewfullnames', $contextmodule)) . '</a>';
echo $picture . ' ' . $userlink . ' (' . $user->email . ')';
// Print form
$mform->display();
echo $OUTPUT->footer($course);
示例8: strtotime
if ($userObject->has_role('External Examiner')) {
$review_type = 'External';
$review_deadline = strtotime($propertyObj->get_external_review_deadline());
} else {
$review_type = 'Internal';
$review_deadline = strtotime($propertyObj->get_internal_review_deadline());
}
$userid = $userObject->get_user_ID();
$review = new Review($paperID, $userid, $review_type, $mysqli);
if (isset($_POST['close'])) {
$review->record_general_comments($_POST['paper_comments'], false);
echo close_window();
exit;
} elseif (isset($_POST['finish'])) {
$review->record_general_comments($_POST['paper_comments'], true);
echo close_window();
exit;
}
function close_window()
{
$html = "<html>\n<head>\n<title>Rogō</title>\n</head>\n<body onload=\"window.close();\"></body>\n</html>";
return $html;
}
?>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="content-type" content="text/html;charset=<?php
echo $configObject->get('cfg_page_charset');
?>
" />
示例9: change_time
function change_time() {
echo "<div id='action_box'><div class='box_title'>Position time and day change</div>";
$_ESCAPED_POSITION_ID = mysql_real_escape_string($_POST['position_id']);
$_ESCAPED_SDAY = mysql_real_escape_string($_POST['sday']);
$_ESCAPED_EDAY = mysql_real_escape_string($_POST['eday']);
$_ESCAPED_STIME = mysql_real_escape_string($_POST['stime']);
$_ESCAPED_ETIME = mysql_real_escape_string($_POST['etime']);
if ($_ESCAPED_SDAY > $_ESCAPED_EDAY || $_ESCAPED_STIME >= $_ESCAPED_ETIME) {
echo "The start day must be the same or earlier than the end day.";
echo "<BR>   AND<BR>";
echo "The start time must be earlier than the end time";
}
else
{
include 'includes/db_info.php';
$query = "update ".$dbname.".positions set sday=".$_ESCAPED_SDAY.",eday=".$_ESCAPED_EDAY.",starttime=".$_ESCAPED_STIME.",endtime=".$_ESCAPED_ETIME." where position_id = ".$_ESCAPED_POSITION_ID;
mysql_query($query);
/* Delete days from the regular schedule that are before
new start day or after the new end day. */
$query = "delete from ".$dbname.".sched where position_id = ".$_ESCAPED_POSITION_ID." AND (
day < ".$_ESCAPED_SDAY." OR day > ".$_ESCAPED_EDAY.")";
mysql_query($query);
/* Find shifts on the dynamic schedule for the position we are changing
if that that shift's date is on a day less than the new start
day or greater than the new end day, delete it. */
$query = "select shift_id,date from ".$dbname.".dyn_sched where position_id = ".$_ESCAPED_POSITION_ID;
$result = mysql_query($query);
while ($row = mysql_fetch_array($result))
{
$day_of_week = date("w",strtotime($row['date']));
if (($day_of_week < $_ESCAPED_SDAY) || ($day_of_week > $_ESCAPED_EDAY))
{
$query = "delete from ".$dbname.".dyn_sched where shift_id = ".$row['shift_id'];
mysql_query($query);
}
}
/* Delete all shifts on the regular schedule that end before the new start time
or start before the new end time. */
$query = "delete from ".$dbname.".sched where (stime >= ".$_ESCAPED_ETIME." OR etime <= ".$_ESCAPED_STIME.") AND position_id = ".$_ESCAPED_POSITION_ID;
mysql_query($query);
/* Delete all shifts on the dynamic schedule that end before the new start time
or start before the new end time. */
$query = "delete from ".$dbname.".dyn_sched where (stime >= ".$_ESCAPED_ETIME." OR etime <= ".$_ESCAPED_STIME.") AND position_id = ".$_ESCAPED_POSITION_ID;
mysql_query($query);
/* Set start of the shift to the new start time if the shift straddles the new
start time - Regular schedule */
$query = "update ".$dbname.".sched set stime = ".$_ESCAPED_STIME." where position_id = ".$_ESCAPED_POSITION_ID." AND
stime < ".$_ESCAPED_STIME;
mysql_query($query);
/* Same for the end time*/
$query = "update ".$dbname.".sched set etime = ".$_ESCAPED_ETIME." where position_id = ".$_ESCAPED_POSITION_ID." AND
etime > ".$_ESCAPED_ETIME;
mysql_query($query);
/* Set start of the shift to the new start time if the shift straddles the new
start time - Dynamic Schedule */
$query = "update ".$dbname.".dyn_sched set stime = ".$_ESCAPED_STIME." where position_id = ".$_ESCAPED_POSITION_ID." AND
stime < ".$_ESCAPED_STIME;
mysql_query($query);
/* Same for the end time */
$query = "update ".$dbname.".dyn_sched set etime = ".$_ESCAPED_ETIME." where position_id = ".$_ESCAPED_POSITION_ID." AND
etime > ".$_ESCAPED_ETIME;
mysql_query($query);
/* refresh the parent page */
$url = "./positionmod.php?action=edit_position&position_id=";
$url .= $_ESCAPED_POSITION_ID;
parent_goto($url);
close_window();
}
echo "</div>";
}
示例10: edit_comment_page
function edit_comment_page($userid, $pageno, $enableedit = true)
{
global $CFG, $USER;
if (!($user = get_record('user', 'id', $userid))) {
error('No such user!');
}
if (!($submission = $this->get_submission($user->id))) {
error('User has no submission to comment on!');
}
if (!has_capability('mod/assignment:grade', $this->context)) {
if (has_capability('mod/assignment:submit', $this->context) && $USER->id == $userid) {
$enableedit = false;
} else {
error('No permission to view or edit this assignment');
}
}
$showprevious = optional_param('showprevious', -1, PARAM_INT);
if ($enableedit && optional_param('topframe', false, PARAM_INT)) {
if ($showprevious != -1) {
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">';
echo '<html><head><title>' . get_string('feedback', 'assignment') . ':' . fullname($user, true) . ':' . format_string($this->assignment->name) . '</title></head>';
echo '<frameset cols="60%, 40%">';
echo '<frame src="editcomment.php?';
echo 'id=' . $this->cm->id . '&userid=' . $userid . '&pageno=' . $pageno . '&showprevious=' . $showprevious;
echo '">';
echo '<frame src="editcomment.php?';
echo 'a=' . $showprevious . '&userid=' . $userid . '&action=showprevious';
echo '">';
echo '</frameset></html>';
die;
}
}
$savedraft = optional_param('savedraft', null, PARAM_TEXT);
$generateresponse = optional_param('generateresponse', null, PARAM_TEXT);
if ($enableedit && $savedraft) {
print_header(get_string('feedback', 'assignment') . ':' . format_string($this->assignment->name));
print_heading(get_string('draftsaved', 'assignment_uploadpdf'));
close_window();
die;
}
if ($enableedit && $generateresponse) {
if ($this->create_response_pdf($userid, $submission->id)) {
$submission->data2 = ASSIGNMENT_UPLOADPDF_STATUS_RESPONDED;
$updated = new Object();
$updated->id = $submission->id;
$updated->data2 = $submission->data2;
update_record('assignment_submissions', $updated);
print_header(get_string('feedback', 'assignment') . ':' . format_string($this->assignment->name));
print_heading(get_string('responseok', 'assignment_uploadpdf'));
require_once $CFG->dirroot . '/version.php';
if ($version >= 2007101500) {
require_once $CFG->libdir . '/gradelib.php';
}
print $this->update_main_listing($submission);
close_window();
die;
} else {
print_header(get_string('feedback', 'assignment') . ':' . format_string($this->assignment->name));
error(get_string('responseproblem', 'assignment_uploadpdf'));
//close_window();
die;
}
}
list($imageurl, $imgwidth, $imgheight, $pagecount) = $this->get_page_image($userid, $pageno, $submission);
// FIXME - check I don't need all of these
require_js(array('yui_yahoo', 'yui_event', 'yui_dom', 'yui_dom-event', 'yui_container', 'yui_element', 'yui_button', 'yui_menu', 'yui_utilities'));
require_js($CFG->wwwroot . '/mod/assignment/type/uploadpdf/scripts/mootools-core-1.4.1.js');
require_js($CFG->wwwroot . '/mod/assignment/type/uploadpdf/scripts/mootools-more-1.4.0.1.js');
require_js($CFG->wwwroot . '/mod/assignment/type/uploadpdf/scripts/raphael-min.js');
require_js($CFG->wwwroot . '/mod/assignment/type/uploadpdf/scripts/contextmenu.js');
require_js($CFG->wwwroot . '/mod/assignment/type/uploadpdf/scripts/annotate.js');
print_header(get_string('feedback', 'assignment') . ':' . fullname($user, true) . ':' . format_string($this->assignment->name));
echo '<div id="saveoptions">';
if ($enableedit) {
echo '<form action="' . $CFG->wwwroot . '/mod/assignment/type/uploadpdf/editcomment.php" method="post" target="_top" >';
echo '<input type="hidden" name="id" value="' . $this->cm->id . '" />';
echo '<input type="hidden" name="userid" value="' . $userid . '" />';
echo '<input type="hidden" name="pageno" value="' . $pageno . '" />';
// 'Save draft' button
echo '<button type="submit" id="savedraft" name="savedraft" value="savedraft" title="' . get_string('savedraft', 'assignment_uploadpdf') . '"><img src="' . $CFG->wwwroot . '/mod/assignment/type/uploadpdf/style/savequit.png"/></button>';
// 'Generate response' button
echo '<button type="submit" id="generateresponse" name="generateresponse" value="generateresponse" title="' . get_string('generateresponse', 'assignment_uploadpdf') . '"><img src="' . $CFG->wwwroot . '/mod/assignment/type/uploadpdf/style/tostudent.png"/></button>';
}
// 'Download original' button
$pdfurl = $CFG->wwwroot . '/file.php?file=/' . $this->file_area_name($userid);
if ($enableedit) {
$pdfurl .= '/submission/submission.pdf';
} else {
$pdfurl .= '/responses/response.pdf';
}
$downloadorig = get_string('downloadoriginal', 'assignment_uploadpdf');
echo '<a href="' . $pdfurl . '" target="_blank" id="downloadpdf" title="' . $downloadorig . '" alt="' . $downloadorig . '" ><img src="' . $CFG->wwwroot . '/mod/assignment/type/uploadpdf/style/download.png" alt="' . $downloadorig . '" title="' . $downloadorig . '" /></a>';
if ($enableedit) {
echo '</form>';
}
// Show previous assignment
if ($enableedit) {
$ps_sql = 'SELECT asn.id, asn.name FROM `' . $CFG->prefix . 'assignment` asn ';
$ps_sql .= 'INNER JOIN `' . $CFG->prefix . 'assignment_submissions` sub ON sub.assignment = asn.id ';
$ps_sql .= 'WHERE course = ' . $this->course->id;
//.........这里部分代码省略.........