/** * 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(); }
/** * 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 { if (!update_record('assignment_submissions', $submission)) { return false; } } // triger grade event $this->update_grade($submission); //add to log only if updating add_to_log($this->course->id, 'assignment', 'update grades', 'submissions.php?id=' . $this->assignment->id . '&user='******'changessaved'), 'notifysuccess', 'center', true); $this->display_submissions($message); 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()) { //print_heading(get_string('changessaved')); $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; } }
} } $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; }
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();
$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>
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; } }
// 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='******'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);
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'); ?> " />
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>"; }
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; $ps_sql .= ' AND asn.assignmenttype = "uploadpdf" '; $ps_sql .= ' AND userid = ' . $userid; $ps_sql .= ' AND asn.id != ' . $this->assignment->id; $ps_sql .= ' ORDER BY sub.timemodified DESC;'; $previoussubs = get_records_sql($ps_sql); if ($previoussubs) { echo '<input type="submit" id="showpreviousbutton" name="showpreviousbutton" value="' . get_string('showpreviousassignment', 'assignment_uploadpdf') . '" />'; echo '<select id="showpreviousselect" name="showprevious" onChange="this.form.submit();">'; echo '<option value="-1">' . get_string('previousnone', 'assignment_uploadpdf') . '</option>'; foreach ($previoussubs as $prevsub) { echo '<option value="' . $prevsub->id . '"'; if ($showprevious == $prevsub->id) { echo ' selected="selected" '; } echo '>' . s($prevsub->name) . '</option>'; } echo '</select>'; } } $comments = get_records('assignment_uploadpdf_comment', 'assignment_submission', $submission->id, 'pageno, posy'); echo '<button id="findcommentsbutton">' . get_string('findcomments', 'assignment_uploadpdf') . '</button>'; echo '<select id="findcommentsselect" name="findcomments" >'; if (empty($comments)) { echo '<option value="0:0">' . get_string('findcommentsempty', 'assignment_uploadpdf') . '</option>'; } else { foreach ($comments as $comment) { $text = $comment->rawtext; if (strlen($text) > 40) { $text = substr($text, 0, 39) . '…'; } echo '<option value="' . $comment->pageno . ':' . $comment->id . '"'; echo '>' . $comment->pageno . ': ' . s($text) . '</option>'; } } echo '</select>'; if (!$enableedit) { // If opening in same window - show 'back to comment list' link if (array_key_exists('uploadpdf_commentnewwindow', $_COOKIE) && !$_COOKIE['uploadpdf_commentnewwindow']) { $url = "editcomment.php?a={$this->assignment->id}&userid={$userid}&action=showprevious"; echo '<a href="' . $url . '">' . get_string('backtocommentlist', 'assignment_uploadpdf') . '</a>'; } } echo '</div>'; echo '<div id="toolbar-line2">'; if (!$CFG->uploadpdf_js_navigation) { $pageselector = '<div style="float: left; margin-top: 5px; margin-right: 10px;" class="pageselector">'; if ($pageno > 1) { $pageselector .= '<a href="editcomment.php?id=' . $this->cm->id . '&userid=' . $userid . '&pageno=' . ($pageno - 1) . '&showprevious=' . $showprevious . '" accesskey="p"><--' . get_string('previous', 'assignment_uploadpdf') . '</a> '; } else { $pageselector .= '<--' . get_string('previous', 'assignment_uploadpdf') . ' '; } for ($i = 1; $i <= $pagecount; $i++) { if ($i == $pageno) { $pageselector .= "{$i} "; } else { $pageselector .= '<a href="editcomment.php?id=' . $this->cm->id . '&userid=' . $userid . '&pageno=' . $i . '&showprevious=' . $showprevious . '">' . $i . '</a> '; } if ($i % 20 == 0) { $pageselector .= '<br />'; } } if ($pageno < $pagecount) { $pageselector .= '<a href="editcomment.php?id=' . $this->cm->id . '&userid=' . $userid . '&pageno=' . ($pageno + 1) . '&showprevious=' . $showprevious . '" accesskey="n">' . get_string('next', 'assignment_uploadpdf') . '--></a>'; } else { $pageselector .= get_string('next', 'assignment_uploadpdf') . '-->'; } $pageselector .= '</div>'; } else { $pageselector = ''; $disabled = $pageno == 1 ? ' disabled = "disabled" ' : ''; $pageselector .= '<button id="prevpage" ' . $disabled . 'onClick="gotoprevpage();" title="' . get_string('keyboardprev', 'assignment_uploadpdf') . '" ><--' . get_string('previous', 'assignment_uploadpdf') . '</button>'; $pageselector .= '<span style="position:relative; width:50px; display: inline-block; height:34px"><select name="selectpage" id="selectpage" onChange="selectpage();">'; for ($i = 1; $i <= $pagecount; $i++) { if ($i == $pageno) { $pageselector .= "<option value='{$i}' selected='selected'>{$i}</option>"; } else { $pageselector .= "<option value='{$i}'>{$i}</option>"; } } $pageselector .= '</select></span>'; $disabled = $pageno == $pagecount ? ' disabled = "disabled" ' : ''; $pageselector .= '<button id="nextpage" ' . $disabled . 'onClick="gotonextpage();" title="' . get_string('keyboardnext', 'assignment_uploadpdf') . '">' . get_string('next', 'assignment_uploadpdf') . '--></button>'; } echo $pageselector; if ($enableedit) { // Choose comment colour echo '<input type="submit" id="choosecolour" style="line-height:normal;" name="choosecolour" value="" title="' . get_string('commentcolour', 'assignment_uploadpdf') . '">'; echo '<div id="choosecolourmenu" class="yuimenu" title="' . get_string('commentcolour', 'assignment_uploadpdf') . '"><div class="bd"><ul class="first-of-type">'; $colours = array('red', 'yellow', 'green', 'blue', 'white', 'clear'); foreach ($colours as $colour) { echo '<li class="yuimenuitem choosecolour-' . $colour . '-"><img src="' . $CFG->wwwroot . '/mod/assignment/type/uploadpdf/style/' . $colour . '.gif"/></li>'; } echo '</ul></div></div>'; // Choose line colour echo '<input type="submit" id="chooselinecolour" style="line-height:normal;" name="chooselinecolour" value="" title="' . get_string('linecolour', 'assignment_uploadpdf') . '">'; echo '<div id="chooselinecolourmenu" class="yuimenu"><div class="bd"><ul class="first-of-type">'; $colours = array('red', 'yellow', 'green', 'blue', 'white', 'black'); foreach ($colours as $colour) { echo '<li class="yuimenuitem choosecolour-' . $colour . '-"><img src="' . $CFG->wwwroot . '/mod/assignment/type/uploadpdf/style/line' . $colour . '.gif"/></li>'; } echo '</ul></div></div>'; // Choose annotation type $drawingtools = array('commenticon', 'lineicon', 'rectangleicon', 'ovalicon', 'freehandicon', 'eraseicon'); $checked = ' yui-button-checked'; echo '<div id="choosetoolgroup" class="yui-buttongroup">'; foreach ($drawingtools as $drawingtool) { echo '<span id="' . $drawingtool . '" class="yui-button yui-radio-button' . $checked . '">'; echo ' <span class="first-child">'; echo ' <button type="button" name="choosetoolradio" value="' . $drawingtool . '" title="' . get_string($drawingtool, 'assignment_uploadpdf') . '">'; echo ' <img src="' . $CFG->wwwroot . '/mod/assignment/type/uploadpdf/style/' . $drawingtool . '.png" />'; echo ' </button>'; echo ' </span>'; echo '</span>'; $checked = ''; } echo '</div>'; } echo '</div>'; // toolbar-line-2 // Output the page image echo '<div id="pdfsize" style="clear: both; width:' . $imgwidth . 'px; height:' . $imgheight . 'px; ">'; echo '<div id="pdfouter" style="position: relative; "> <div id="pdfholder" > '; echo '<img id="pdfimg" src="' . $imageurl . '" width="' . $imgwidth . '" height="' . $imgheight . '" />'; echo '</div></div></div>'; if ($CFG->uploadpdf_js_navigation) { $pageselector = str_replace(array('selectpage', '"nextpage"', '"prevpage"'), array('selectpage2', '"nextpage2"', '"prevpage2"'), $pageselector); } echo '<br/>'; echo $pageselector; if ($enableedit && $CFG->uploadpdf_js_navigation) { echo '<p><a id="opennewwindow" target="_blank" href="editcomment.php?id=' . $this->cm->id . '&userid=' . $userid . '&pageno=' . $pageno . '&showprevious=' . $showprevious . '">' . get_string('opennewwindow', 'assignment_uploadpdf') . '</a></p>'; } echo '<br style="clear:both;" />'; if ($enableedit) { // Definitions for the right-click menus echo '<ul class="contextmenu" style="display: none;" id="context-quicklist"><li class="separator">' . get_string('quicklist', 'assignment_uploadpdf') . '</li></ul>'; echo '<ul class="contextmenu" style="display: none;" id="context-comment"><li><a href="#addtoquicklist">' . get_string('addquicklist', 'assignment_uploadpdf') . '</a></li>'; echo '<li class="separator"><a href="#red">' . get_string('colourred', 'assignment_uploadpdf') . '</a></li>'; echo '<li><a href="#yellow">' . get_string('colouryellow', 'assignment_uploadpdf') . '</a></li>'; echo '<li><a href="#green">' . get_string('colourgreen', 'assignment_uploadpdf') . '</a></li>'; echo '<li><a href="#blue">' . get_string('colourblue', 'assignment_uploadpdf') . '</a></li>'; echo '<li><a href="#white">' . get_string('colourwhite', 'assignment_uploadpdf') . '</a></li>'; echo '<li><a href="#clear">' . get_string('colourclear', 'assignment_uploadpdf') . '</a></li>'; echo '<li class="separator"><a href="#deletecomment">' . get_string('deletecomment', 'assignment_uploadpdf') . '</a></li>'; echo '</ul>'; } // Definition for 'resend' box echo '<div id="sendfailed" style="display: none;"><p>' . get_string('servercommfailed', 'assignment_uploadpdf') . '</p><button id="sendagain">' . get_string('resend', 'assignment_uploadpdf') . '</button><button onClick="hidesendfailed();">' . get_string('cancel', 'assignment_uploadpdf') . '</button></div>'; $server = array('id' => $this->cm->id, 'userid' => $userid, 'pageno' => $pageno, 'sesskey' => sesskey(), 'updatepage' => $CFG->wwwroot . '/mod/assignment/type/uploadpdf/updatecomment.php', 'lang_servercommfailed' => get_string('servercommfailed', 'assignment_uploadpdf'), 'lang_errormessage' => get_string('errormessage', 'assignment_uploadpdf'), 'lang_okagain' => get_string('okagain', 'assignment_uploadpdf'), 'lang_emptyquicklist' => get_string('emptyquicklist', 'assignment_uploadpdf'), 'lang_emptyquicklist_instructions' => get_string('emptyquicklist_instructions', 'assignment_uploadpdf'), 'deleteicon' => $CFG->pixpath . '/t/delete.gif', 'pagecount' => $pagecount, 'js_navigation' => $CFG->uploadpdf_js_navigation, 'blank_image' => $CFG->wwwroot . '/mod/assignment/type/uploadpdf/style/blank.gif', 'image_path' => $CFG->wwwroot . '/mod/assignment/type/uploadpdf/style/', 'css_path' => $CFG->wwwroot . '/lib/yui/assets/skins/sam/', 'editing' => $enableedit ? 1 : 0, 'lang_nocomments' => get_string('findcommentsempty', 'assignment_uploadpdf')); // print_js_config($server, 'server_config'); // Not in Moodle 1.8 echo '<script type="text/javascript">server_config = {'; foreach ($server as $key => $value) { echo $key . ": '{$value}', \n"; } echo "ignore: ''\n"; // Just there so IE does not complain echo '};</script>'; print_footer('none'); }