function print_message($msg) { print_header(); echo "\n<center>\n<table height=300>\n<tr><td align=center><font color=NAVY><b>\n {$msg}\n </b></font>\n </td>\n</tr>\n</table>\n\t"; print_footer(); exit; }
/** * Show a simple confirmation form */ public static function confirm($label) { if (is_post()) { if (isset($_POST['confirm_yes'])) { return true; } else { if (isset($_POST['confirm_no'])) { return false; } } } ?> <?php print_header(); ?> <div id="confirm_form"> <?php \Meta\Core\Form::open(); ?> <h2><?php echo $label; ?> </h2> <input type="submit" name="confirm_yes" value="Sim" /> <input type="submit" name="confirm_no" value="Nao" /> <?php \Meta\Core\Form::close(); ?> </div> <?php print_footer(); ?> <?php exit; }
function print_entry($course) { global $CFG, $USER; $strloginto = get_string("loginto", "", $course->shortname); $strcourses = get_string("courses"); $teacher = get_teacher($course->id); if ((double) $course->cost < 0) { $cost = (double) $CFG->enrol_cost; } else { $cost = (double) $course->cost; } if (abs($cost) < 0.01) { // no cost, default to base class entry to course $manual = enrolment_factory::factory('manual'); $manual->print_entry($course); } else { $navlinks = array(); $navlinks[] = array('name' => $strcourses, 'link' => "{$CFG->wwwroot}/course", 'type' => 'misc'); $navlinks[] = array('name' => $strloginto, 'link' => null, 'type' => 'misc'); $navigation = build_navigation($navlinks); print_header($strloginto, $course->fullname, $navigation); print_course($course, "80%"); if ($course->password) { // Presenting two options print_heading(get_string('costorkey', 'enrol_paypal'), 'center'); } print_simple_box_start("center"); if ($USER->username == 'guest') { // force login only for guest user, not real users with guest role if (empty($CFG->loginhttps)) { $wwwroot = $CFG->wwwroot; } else { // This actually is not so secure ;-), 'cause we're // in unencrypted connection... $wwwroot = str_replace("http://", "https://", $CFG->wwwroot); } echo '<div align="center"><p>' . get_string('paymentrequired') . '</p>'; echo '<p><b>' . get_string('cost') . ": {$CFG->enrol_currency} {$cost}" . '</b></p>'; echo '<p><a href="' . $wwwroot . '/login/">' . get_string('loginsite') . '</a></p>'; echo '</div>'; } else { //Sanitise some fields before building the PayPal form $coursefullname = $course->fullname; $courseshortname = $course->shortname; $userfullname = fullname($USER); $userfirstname = $USER->firstname; $userlastname = $USER->lastname; $useraddress = $USER->address; $usercity = $USER->city; include $CFG->dirroot . '/enrol/paypal/enrol.html'; } print_simple_box_end(); if ($course->password) { // Second option $password = ''; include $CFG->dirroot . '/enrol/manual/enrol.html'; } print_footer(); } }
function invalid_booking($message) { global $day, $month, $year, $area, $room; print_header($day, $month, $year, $area, isset($room) ? $room : ""); echo "<h1>" . get_vocab('invalid_booking') . "</h1>\n"; echo "<p>{$message}</p>\n"; // Print footer and exit print_footer(TRUE); }
function output_html($result = array(), $arguments = array()) { print_header(); print_table_head(); foreach ($result as $no => $line) { print_table_line($no, $line['day'], $line['counter']); } print_footer(); }
function html_footer() { global $course, $choose; if ($choose) { echo "</td></tr></table>"; } else { echo "</td></tr></table>"; print_footer($course); } }
function html_footer() { global $course, $choose; if ($choose) { wiki_table_end(); } else { wiki_table_end(); print_footer($course); } }
function html_footer() { global $course, $choose, $adminroot; echo '</td></tr></table>'; if ($course->id == SITEID) { admin_externalpage_print_footer($adminroot); } else { print_footer($course); } }
function display() { global $CFG; $formatoptions = new object(); $formatoptions->noclean = true; /// Are we displaying the course blocks? if ($this->resource->options == 'showblocks') { parent::display_course_blocks_start(); $entry = get_record('kaltura_entries', 'context', "R_" . "{$this->resource}->id"); if (trim(strip_tags($this->resource->alltext))) { echo $entry->title; $player_url = $CFG->wwwroot . '/mod/kaltura/kswfdoc.php?context=' . $this->course->id . '&entry_id=' . $resource->alltext; $formatoptions = new object(); $formatoptions->noclean = true; print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions, $this->course->id), "center"); if ($resource->alltext) { echo '<input style="margin-top:20px;" type="button" value="View video presentation" onclick="kalturaInitModalBox(\'' . $player_url . '\', {width:780, height:400});">'; } // echo embed_kaltura($resource->alltext,get_width($entry),get_height($entry),$entry->entry_type); } parent::display_course_blocks_end(); } else { /// Set up generic stuff first, including checking for access parent::display(); /// Set up some shorthand variables $cm = $this->cm; $course = $this->course; $resource = $this->resource; $entry = get_record('kaltura_entries', 'context', "R_" . "{$resource->id}"); $pagetitle = strip_tags($course->shortname . ': ' . format_string($resource->name)); $inpopup = optional_param('inpopup', '', PARAM_BOOL); add_to_log($course->id, "resource", "view", "view.php?id={$cm->id}", $resource->id, $cm->id); $navigation = build_navigation($this->navlinks, $cm); print_header($pagetitle, $course->fullname, $navigation, "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm)); if (trim(strip_tags($this->resource->alltext))) { echo $entry->title; } $formatoptions = new object(); $formatoptions->noclean = true; print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions, $this->course->id), "center"); if (trim(strip_tags($this->resource->alltext))) { $player_url = $CFG->wwwroot . '/mod/kaltura/kswfdoc.php?context=' . $this->course->id . '&entry_id=' . $resource->alltext; if ($resource->alltext) { echo '<input type="button" style="margin-top:20px;" value="View video presentation" onclick="kalturaInitModalBox(\'' . $player_url . '\', {width:780, height:400});">'; } // echo embed_kaltura($resource->alltext,get_width($entry),get_height($entry),$entry->entry_type); } /* print_simple_box(format_text($resource->alltext, $resource->reference, $formatoptions, $course->id), "center", "", "", "20"); */ $strlastmodified = get_string("lastmodified"); echo "<div class=\"modified\">{$strlastmodified}: " . userdate($resource->timemodified) . "</div>"; print_footer($course); } }
function display() { global $CFG; $formatoptions = new object(); $formatoptions->noclean = true; /// Are we displaying the course blocks? if ($this->resource->options == 'showblocks') { parent::display_course_blocks_start(); $entry = get_record('kaltura_entries', 'context', "R_" . "{$this->resource}->id"); if (trim(strip_tags($this->resource->alltext))) { echo $entry->title; $context = get_context_instance(CONTEXT_COURSE, $this->course->id); $formatoptions = new object(); $formatoptions->noclean = true; print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions, $this->course->id), "center"); if (has_capability('moodle/course:manageactivities', $context)) { echo embed_kaltura($resource->alltext, get_width($entry), get_height($entry), $entry->entry_type, $entry->design, true); } else { echo embed_kaltura($resource->alltext, get_width($entry), get_height($entry), KalturaEntryType::MEDIA_CLIP, $entry->design, true); } } parent::display_course_blocks_end(); } else { /// Set up generic stuff first, including checking for access parent::display(); /// Set up some shorthand variables $cm = $this->cm; $course = $this->course; $resource = $this->resource; $entry = get_record('kaltura_entries', 'context', "R_" . "{$resource->id}"); $pagetitle = strip_tags($course->shortname . ': ' . format_string($resource->name)); $inpopup = optional_param('inpopup', '', PARAM_BOOL); add_to_log($course->id, "resource", "view", "view.php?id={$cm->id}", $resource->id, $cm->id); $navigation = build_navigation($this->navlinks, $cm); print_header($pagetitle, $course->fullname, $navigation, "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm)); if (trim(strip_tags($this->resource->alltext))) { echo $entry->title; $context = get_context_instance(CONTEXT_COURSE, $this->course->id); $formatoptions = new object(); $formatoptions->noclean = true; print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions, $this->course->id), "center"); if (has_capability('moodle/course:manageactivities', $context)) { echo embed_kaltura($resource->alltext, get_width($entry), get_height($entry), $entry->entry_type, $entry->design, true); } else { echo embed_kaltura($resource->alltext, get_width($entry), get_height($entry), KalturaEntryType::MEDIA_CLIP, $entry->design, true); } } /* print_simple_box(format_text($resource->alltext, $resource->reference, $formatoptions, $course->id), "center", "", "", "20"); */ $strlastmodified = get_string("lastmodified"); echo "<div class=\"modified\">{$strlastmodified}: " . userdate($resource->timemodified) . "</div>"; print_footer($course); } }
public static function printFooter($return_to = null, $return_text = null) { if (!empty($return_to)) { if (empty($return_text)) { $return_text = get_string('back'); } $return_text = htmlspecialchars($return_text); echo '<div style="text-align:center; margin:auto;">', '<a href="', $return_to, '" title="', $return_text, '">', $return_text, '</a>', '</div>'; } print_footer(); }
function rejudge_showresult($success = true) { print_header(get_string('notice')); if ($success) { $message = get_string('rejudgesuccess', 'assignment_onlinejudge'); } else { $message = get_string('rejudgefailed', 'assignment_onlinejudge'); } print_box($message, 'generalbox', 'notice'); close_window_button(); print_footer('none'); }
function apply($discussion, $all, $selected, $formdata) { global $COURSE, $USER, $CFG; // Begin with standard text $a = (object) array('name' => fullname($USER, true)); $allhtml = "<head>"; foreach ($CFG->stylesheets as $stylesheet) { $allhtml .= '<link rel="stylesheet" type="text/css" href="' . $stylesheet . '" />' . "\n"; } $allhtml .= "</head>\n<body id='forumng-email'>\n"; $preface = get_string('forward_preface', 'forumng', $a); $allhtml .= $preface; $alltext = format_text_email($preface, FORMAT_HTML); // Include intro if specified if (!preg_match('~^(<br[^>]*>|<p>|</p>|\\s)*$~', $formdata->message)) { $alltext .= "\n" . forum_cron::EMAIL_DIVIDER . "\n"; $allhtml .= '<hr size="1" noshade="noshade" />'; // Add intro $message = trusttext_strip(stripslashes($formdata->message)); $allhtml .= format_text($message, $formdata->format); $alltext .= format_text_email($message, $formdata->format); } // Get list of all post ids in discussion order $alltext .= "\n" . forum_cron::EMAIL_DIVIDER . "\n"; $allhtml .= '<hr size="1" noshade="noshade" />'; $poststext = ''; $postshtml = ''; $discussion->build_selected_posts_email($selected, $poststext, $postshtml); $alltext .= $poststext; $allhtml .= $postshtml . '</body>'; $emails = preg_split('~[; ]+~', $formdata->email); $subject = stripslashes($formdata->subject); foreach ($emails as $email) { $fakeuser = (object) array('email' => $email, 'mailformat' => 1, 'id' => 0); $from = $USER; $from->maildisplay = 999; // Nasty hack required for OU moodle if (!email_to_user($fakeuser, $from, $subject, $alltext, $allhtml)) { print_error('error_forwardemail', 'forumng', $formdata->email); } } // Log that it was sent $discussion->log('forward discussion', $formdata->email); if (!empty($formdata->ccme)) { if (!email_to_user($USER, $from, $subject, $alltext, $allhtml)) { print_error('error_forwardemail', 'forumng', $USER->email); } } $discussion->print_subpage_header($this->get_page_name()); print_box(get_string('forward_done', 'forumng')); print_continue('../../discuss.php?' . $discussion->get_link_params(forum::PARAM_PLAIN)); print_footer($COURSE); }
function iplookup_display($ip, $user = 0) { print_header(); if ($user) { if ($user = get_record('user', 'id', $user)) { print_heading(fullname($user) . ", {$user->city}, {$user->country}", 'center', '4'); } } echo 'Search results: <iframe src="http://www.hostip.info/api/get.html?ip=' . $ip . '" height="60" width="300"></iframe>'; echo '<object data="http://www.hostip.info/map/frame.html?ip=' . $ip . '" ' . 'type="text/html" border="0" width="610" height="330"></object>'; close_window_button(); print_footer('none'); }
/** * initialize the controller */ function init() { global $pgv_lang, $CONTACT_EMAIL, $GEDCOM, $pgv_changes; $this->nid = safe_GET_xref('nid'); $noterec = find_other_record($this->nid); if (isset($pgv_changes[$this->nid . "_" . $GEDCOM])) { $noterec = "0 @" . $this->nid . "@ NOTE\n"; } else { if (!$noterec) { return false; } } $this->note = new Note($noterec); $this->note->ged_id = PGV_GED_ID; // This record is from a file if (!$this->note->canDisplayDetails()) { print_header($pgv_lang["private"] . " " . $pgv_lang["shared_note_info"]); print_privacy_error($CONTACT_EMAIL); print_footer(); exit; } $this->uname = PGV_USER_NAME; //-- perform the desired action switch ($this->action) { case "addfav": $this->addFavorite(); break; case "accept": $this->acceptChanges(); break; case "undo": $this->note->undoChange(); break; } //-- check for the user //-- if the user can edit and there are changes then get the new changes if ($this->show_changes && PGV_USER_CAN_EDIT && isset($pgv_changes[$this->nid . "_" . $GEDCOM])) { $newrec = find_updated_record($this->nid); $this->diffnote = new Note($newrec); $this->diffnote->setChanged(true); $noterec = $newrec; } if ($this->note->canDisplayDetails()) { $this->canedit = PGV_USER_CAN_EDIT; } if ($this->show_changes && $this->canedit) { $this->note->diffMerge($this->diffnote); } }
/** * 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'); $context = context_system::get_context(); $navlinks = array(); $navlinks[] = array('name' => $strcourses, 'link' => ".", 'type' => 'misc'); $navlinks[] = array('name' => $strloginto, 'link' => null, 'type' => 'misc'); $navigation = build_navigation($navlinks); // if we get here we are going to display the BUY COURSE message print_header($strloginto, $course->fullname, $navigation, "form.password"); include "{$CFG->dirroot}/enrol/joomdle/enrol.html"; print_footer(); }
function print_page($title, $text, $header = '') { global $p_user; /*if ($p_user['bp_user_id']) { $bpApi = new TheGame(); preg_match('`/([^/]*)$`Uis', $_SERVER['PHP_SELF'], $res); $pageTag = $bpApi->getPageTags($p_user['bp_user_id'], $p_user['login_id'], $res[1]); var_dump($pageTag); }*/ print_header($title, $header); print_leftbar(); print_topbar(); echo $text; print_footer(); }
function csverror($message, $link = '') { global $CFG, $SESSION; print_header(get_string('error')); echo '<br />'; $message = clean_text($message); print_simple_box('<span style="font-family:monospace;color:#000000;">' . $message . '</span>', 'center', '', '#FFBBBB', 5, 'errorbox'); if (!$link) { if (!empty($SESSION->fromurl)) { $link = $SESSION->fromurl; unset($SESSION->fromurl); } else { $link = $CFG->wwwroot . '/'; } } print_continue($link); print_footer(); die; }
function view_result($idx) { global $URL; $dbh = dbconnect(); /* 설문 내용 뽑기 */ $query = "select * from poll_data where poll_idx={$idx}"; $sth = dbquery($dbh, $query); list($poll_idx, $question, $sdate, $edate, $status, $answer_no, $answer[1], $answer[2], $answer[3], $answer[4], $answer[5], $answer[6], $answer[7], $answer[8], $answer[9], $answer[10]) = dbselect($sth); if (!$poll_idx) { print_alert("잘못된 설문번호입니다. ", 'back'); exit; } /* 결과 뽑기 */ $query = "select answer,count(answer) from poll_result where poll_idx={$idx} group by answer"; $sth = dbquery($dbh, $query); while (list($answer_num, $count) = dbselect($sth)) { $RESULT[$answer_num] = $count; $sum += $count; } /* 결과 화면 출력 */ print_header(); echo "\n<table border=1 bordercolor=white bordercolorlight=silver cellpadding=3 cellspacing=0 width=350>\n<tr><td colspan=2 bgcolor=f6f6f6 align=center><font size=2><b>설문 결과</b><br><br>{$question}</b></font></td></tr>\n"; for ($i = 1; $i <= $answer_no; $i++) { $result_count = $RESULT[$i]; if (!$result_count) { $result_count = 0; } if ($sum) { $ratio = round($result_count / $sum * 100, 0); $width = $ratio * 2; } else { $sum = 0; $ratio = 0; $width = 0; } echo "\n<tr><td width=300><font size=2>{$i}. {$answer[$i]}<br>\n <img src=\"{$URL['home']}/icon/bar{$i}.gif\" width='{$width}' height=10> ({$result_count})</font></td>\n <td width=50 align=right><font size=2 color=NAVY>{$ratio}%</font></td>\n</tr>\n"; } echo "\n<tr><td colspan=2 bgcolor=f6f6f6 align=right><font size=2>총 투표 수 : {$sum}</font>\n</td></tr>\n</table>\n<center>\n<input type=button value=\" 닫 기 \" onClick=\"window.close();\">\n<!--a href=\"javascript:this.close();\">[닫기]</a-->\n"; print_footer(); }
function access_denied($p_url = null) { if (null === $p_url) { global $g_logout; $p_url = $g_logout; } print_html_top(); print_head_top(); print_title(config_get('window_title')); print_css(config_get('css_inc_file')); print_head_bottom(); print_body_top(); print_header(config_get('page_title')); print_top_page(config_get('top_page_inc')); echo '<div class="warning">'; echo '<div align="center">Access Denied<br /><br />'; print_bracket_link($p_url, lang_get('proceed')); print '</div></div>'; print_bottom_page(config_get('bottom_page_inc')); print_footer(__FILE__); print_body_bottom(); print_html_bottom(); exit; }
} elseif (!in_array($mode, $reportlist)) { print_error('erroraccessingreport', 'quiz'); } // if no questions have been set up yet redirect to edit.php if (!$quiz->questions and has_capability('mod/quiz:manage', $context)) { redirect('edit.php?cmid=' . $cm->id); } // Upgrade any attempts that have not yet been upgraded to the // Moodle 1.5 model (they will not yet have the timestamp set) if ($attempts = $DB->get_records_sql("SELECT a.*" . " FROM {quiz_attempts} a, {question_states} s" . " WHERE a.quiz = ? AND s.attempt = a.uniqueid AND s.timestamp = 0", array($quiz->id))) { foreach ($attempts as $attempt) { quiz_upgrade_states($attempt); } } add_to_log($course->id, "quiz", "report", "report.php?id={$cm->id}", "{$quiz->id}", "{$cm->id}"); /// Open the selected quiz report and display it if (!is_readable("report/{$mode}/report.php")) { print_error('reportnotfound', 'quiz', '', $mode); } include "report/default.php"; // Parent class include "report/{$mode}/report.php"; $reportclassname = "quiz_{$mode}_report"; $report = new $reportclassname(); if (!$report->display($quiz, $cm, $course)) { // Run the report! print_error("preprocesserror", 'quiz'); } /// Print footer print_footer($course);
break; } echo '<br />'; } print_container_end(); echo '</td>'; break; case 'right': // The right column if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $editing || $PAGE->user_allowed_editing()) { echo '<td style="width: ' . $preferred_width_right . 'px;" id="right-column">'; print_container_start(); if ($PAGE->user_allowed_editing()) { echo '<div style="text-align:center">' . update_course_icon($SITE->id) . '</div>'; echo '<br />'; } blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT); print_container_end(); echo '</td>'; } break; } } ?> </tr> </table> <?php print_footer('home'); // Please do not modify this line
print_box_end(); } print_box_start('generalbox info'); echo filter_text(text_to_html($course->summary), $course->id); if ($managerroles = get_config('', 'coursemanager')) { $coursemanagerroles = split(',', $managerroles); foreach ($coursemanagerroles as $roleid) { $role = get_record('role', 'id', $roleid); $canseehidden = has_capability('moodle/role:viewhiddenassigns', $context); $roleid = (int) $roleid; if ($users = get_role_users($roleid, $context, true, '', 'u.lastname ASC', $canseehidden)) { foreach ($users as $teacher) { $fullname = fullname($teacher, has_capability('moodle/site:viewfullnames', $context)); $namesarray[] = format_string($role->name) . ': <a href="' . $CFG->wwwroot . '/user/view.php?id=' . $teacher->id . '&course=' . SITEID . '">' . $fullname . '</a>'; } } } if (!empty($namesarray)) { echo "<ul class=\"teachers\">\n<li>"; echo implode('</li><li>', $namesarray); echo "</li></ul>"; } } require_once "{$CFG->dirroot}/enrol/enrol.class.php"; $enrol = enrolment_factory::factory($course->enrol); echo $enrol->get_access_icons($course); print_box_end(); echo "<br />"; close_window_button(); print_footer();
/** * 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); $navlinks = array(); $navlinks[] = array('name' => $strcourses, 'link' => ".", 'type' => 'misc'); $navlinks[] = array('name' => $strloginto, 'link' => null, 'type' => 'misc'); $navigation = build_navigation($navlinks); 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, $navigation); 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'); } // force a refresh of mycourses unset($USER->mycourses); 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, $navigation, "form.password"); print_course($course, "80%"); include "{$CFG->dirroot}/enrol/manual/enrol.html"; print_footer(); }
exit; } $r = sql_command("delete from {$tbl_users} where id={$Id};"); if ($r == -1) { print_header(0, 0, 0, "", ""); // This is unlikely to happen in normal operation. Do not translate. print "<form class=\"edit_users_error\" method=\"post\" action=\"" . htmlspecialchars(basename($PHP_SELF)) . "\">\n"; print " <fieldset>\n"; print " <legend></legend>\n"; print " <p class=\"error\">Error deleting entry {$Id} from the {$tbl_users} table.</p>\n"; print " <p class=\"error\">" . sql_error() . "</p>\n"; print " <input type=\"submit\" value=\" " . get_vocab("ok") . " \">\n"; print " </fieldset>\n"; print "</form>\n"; // Print footer and exit print_footer(TRUE); } /* Success. Do not display a message. Simply fall through into the list display. */ } /*---------------------------------------------------------------------------*\ | Display the list of users | \*---------------------------------------------------------------------------*/ /* Print the standard MRBS header */ print_header(0, 0, 0, "", ""); print "<h2>" . get_vocab("user_list") . "</h2>\n"; if ($level >= $min_user_editing_level) { print "<form method=\"post\" action=\"" . htmlspecialchars(basename($PHP_SELF)) . "\">\n"; print " <div>\n"; print " <input type=\"hidden\" name=\"Action\" value=\"Add\">\n"; print " <input type=\"hidden\" name=\"Id\" value=\"-1\">\n"; print " <input type=\"submit\" value=\"" . get_vocab("add_new_user") . "\">\n";
echo "<input type=\"hidden\" name=\"id\" value=\"{$certrequest->userid}\" />"; echo "<input type=\"submit\" value=\"" . get_string("sendmessage", "message") . "\" onclick=\"return openpopup('/message/discussion.php?id={$certrequest->userid}', 'message_{$certrequest->userid}', 'menubar=0,location=0,scrollbars,status,resizable,width=400,height=500', 0);\" />"; echo "</form>"; echo "</div></div>"; //print previous Certification requests $sql = "userid='{$certrequest->userid}' AND courseid='{$certrequest->courseid}' AND status='declined'"; $prevrequests = get_records_select('tao_user_certification_status', $sql); if (!empty($prevrequests)) { print_heading(get_string('previousrequests', 'block_tao_certification_path')); $table = new stdclass(); $table->head = array(get_string('time'), get_string('changedby', 'block_tao_certification_path'), get_string('status'), get_string('description')); foreach ($prevrequests as $prev) { if ($USER->id == $prev->changeuserid) { $changeuser = $USER; } else { $changeuser = get_record('user', 'id', $prev->changeuserid); } $table->data[] = array(userdate($prev->timechanged), fullname($changeuser), $prev->status, $prev->description); } print_table($table); } print_heading($strtitle); require_once 'approve_form.php'; $userform = new approve_form(); $userform->display(); } print_footer(NULL, $course); function print_row($left, $right) { echo "\n<tr><td class=\"label c0\">{$left}</td><td class=\"info c1\">{$right}</td></tr>\n"; }
/** * This function checks to see whether local database customisations are up-to-date * by comparing $CFG->local_version to the variable $local_version defined in * local/version.php. If not, it looks for a function called 'xmldb_local_upgrade' * in a file called 'local/db/upgrade.php', and if it's there calls it with the * appropiate $oldversion parameter. Then it updates $CFG->local_version. * On success it prints a continue link. On failure it prints an error. * * @uses $CFG * @uses $db to do something really evil with the debug setting that should probably be eliminated. TODO! * @param string $continueto a URL passed to print_continue() if the local upgrades succeed. */ function upgrade_local_dbs($continueto) { global $CFG, $db; $path = '/local'; $pat = 'local'; $status = true; $changed = false; $firstloop = true; while (is_dir($CFG->dirroot . $path)) { // if we don't have code version or a db upgrade file, check lower if (!file_exists($CFG->dirroot . "{$path}/version.php") || !file_exists($CFG->dirroot . "{$path}/db/upgrade.php")) { $path .= '/local'; $pat .= 'local'; continue; } require_once $CFG->dirroot . "{$path}/version.php"; // Get code versions $cfgvarname = "{$pat}_version"; if (empty($CFG->{$cfgvarname})) { // normally we'd install, but just replay all the upgrades. $CFG->{$cfgvarname} = 0; } $localversionvar = "{$pat}_version"; // echo "($localversionvar) ".$$localversionvar." > ($cfgvarname) ".$CFG->{$cfgvarname}."<br/>"; if (${$localversionvar} > $CFG->{$cfgvarname}) { // something upgrades! upgrade_log_start(); /// Capabilities /// do this first *instead of* last , so that the installer has the chance to locally assign caps if (!update_capabilities($pat)) { error('Could not set up the capabilities for ' . $pat . '!'); } if ($firstloop) { $strdatabaseupgrades = get_string('databaseupgrades'); print_header($strdatabaseupgrades, $strdatabaseupgrades, build_navigation(array(array('name' => $strdatabaseupgrades, 'link' => null, 'type' => 'misc'))), '', upgrade_get_javascript()); $firstloop = false; } $changed = true; require_once $CFG->dirroot . "{$path}/db/upgrade.php"; $db->debug = true; $upgradefunc = "xmldb_{$pat}_upgrade"; if ($upgradefunc($CFG->{$cfgvarname})) { $db->debug = false; if (set_config($localversionvar, ${$localversionvar})) { notify(get_string('databasesuccess'), 'notifysuccess'); notify(get_string('databaseupgradelocal', '', $path . ' >> ' . ${$localversionvar}), 'notifysuccess'); } else { $status = false; error('Upgrade of local database customisations failed in $path! (Could not update version in config table)'); } } else { $db->debug = false; error("Upgrade failed! See {$path}/version.php"); } if (!events_update_definition($pat)) { error('Could not set up the events definitions for ' . $pat . '!'); } upgrade_log_finish(); } else { if (${$localversionvar} < $CFG->{$cfgvarname}) { notify("WARNING!!! The local version you are using in {$path} is OLDER than the version that made these databases!"); } } $path .= '/local'; $pat .= 'local'; } if ($changed) { print_continue($continueto); print_footer('none'); exit; } }
//Check to see if we are deleting a comment delete_records('ilpconcern_comments', 'id', $commentid); } if ($action == 'updatecomment') { print_heading(get_string('addcomment', 'ilpconcern')); $mform->display(); } else { print_heading(get_string('concerncomments', 'ilpconcern')); $comments = get_records('ilpconcern_comments', 'concernspost', $concernspost); $stryes = get_string('complete', 'ilpconcern'); $strdelete = get_string('delete'); $stredit = get_string('edit'); $strenter = get_string('update'); echo '<div class="ilpcenter">'; if ($comments !== false) { foreach ($comments as $comment) { $commentuser = get_record('user', 'id', $comment->userid); echo '<div class="forumpost ilpcomment boxaligncenter">' . format_text($comment->comment, $comment->format) . '<div class="commands">' . fullname($commentuser) . ', ' . userdate($comment->created, get_string('strftimedate')) . '<br />' . ilpconcern_update_comment_menu($comment->id, $context) . '</div></div>'; } } echo '</div>'; if (has_capability('mod/ilpconcern:addcomment', $context) || $USER->id == $user->id && has_capability('mod/ilpconcern:addowncomment', $context)) { echo '<div class="addbox">'; echo '<a href="' . $link_values . '&action=updatecomment">' . get_string('addcomment', 'ilpconcern') . '</a></div>'; } } //add_to_log($course->id, 'comment', 'view', // 'view.php?id='.$cm->id.'&concernspost='.$concernspost.'&mode=student', fullname($USER), $cm->id); /// Finish the page print_footer($footer);
/** * Display all the submissions ready for grading */ function display_submissions($message = '') { global $CFG, $db, $USER; require_once $CFG->libdir . '/gradelib.php'; /* first we check to see if the form has just been submitted * to request user_preference updates */ if (isset($_POST['updatepref'])) { $perpage = optional_param('perpage', 10, PARAM_INT); $perpage = $perpage <= 0 ? 10 : $perpage; set_user_preference('assignment_perpage', $perpage); set_user_preference('assignment_quickgrade', optional_param('quickgrade', 0, PARAM_BOOL)); } /* next we get perpage and quickgrade (allow quick grade) params * from database */ $perpage = get_user_preferences('assignment_perpage', 10); $quickgrade = get_user_preferences('assignment_quickgrade', 0); $grading_info = grade_get_grades($this->course->id, 'mod', 'assignment', $this->assignment->id); if (!empty($CFG->enableoutcomes) and !empty($grading_info->outcomes)) { $uses_outcomes = true; } else { $uses_outcomes = false; } $teacherattempts = true; /// Temporary measure $page = optional_param('page', 0, PARAM_INT); $strsaveallfeedback = get_string('saveallfeedback', 'assignment'); /// Some shortcuts to make the code read better $course = $this->course; $assignment = $this->assignment; $cm = $this->cm; $tabindex = 1; //tabindex for quick grading tabbing; Not working for dropdowns yet add_to_log($course->id, 'assignment', 'view submission', 'submissions.php?id=' . $this->assignment->id, $this->assignment->id, $this->cm->id); $navlinks = array(); $navlinks[] = array('name' => $this->strassignments, 'link' => "index.php?id={$course->id}", 'type' => 'activity'); $navlinks[] = array('name' => format_string($this->assignment->name, true), 'link' => "view.php?a={$this->assignment->id}", 'type' => 'activityinstance'); $navlinks[] = array('name' => $this->strsubmissions, 'link' => '', 'type' => 'title'); $navigation = build_navigation($navlinks); print_header_simple(format_string($this->assignment->name, true), "", $navigation, '', '', true, update_module_button($cm->id, $course->id, $this->strassignment), navmenu($course, $cm)); if (!empty($message)) { echo $message; // display messages here if any } $context = get_context_instance(CONTEXT_MODULE, $cm->id); /// find out current groups mode $groupmode = groups_get_activity_groupmode($cm); $currentgroup = groups_get_activity_group($cm, true); groups_print_activity_menu($cm, 'submissions.php?id=' . $this->cm->id); /// Get all ppl that are allowed to submit assignments $users = get_users_by_capability($context, 'mod/assignment:submit', '', '', '', '', $currentgroup, '', false); $users = array_keys($users); if (!empty($CFG->enablegroupings) && !empty($cm->groupingid)) { $groupingusers = groups_get_grouping_members($cm->groupingid, 'u.id', 'u.id'); $users = array_intersect($users, array_keys($groupingusers)); } $tablecolumns = array('picture', 'fullname', 'grade', 'submissioncomment', 'timemodified', 'timemarked', 'status', 'finalgrade'); if ($uses_outcomes) { $tablecolumns[] = 'outcome'; // no sorting based on outcomes column } $tableheaders = array('', get_string('fullname'), get_string('grade'), get_string('comment', 'assignment'), get_string('lastmodified') . ' (' . $course->student . ')', get_string('lastmodified') . ' (' . $course->teacher . ')', get_string('status'), get_string('finalgrade', 'grades')); if ($uses_outcomes) { $tableheaders[] = get_string('outcome', 'grades'); } require_once $CFG->libdir . '/tablelib.php'; $table = new flexible_table('mod-assignment-submissions'); $table->define_columns($tablecolumns); $table->define_headers($tableheaders); $table->define_baseurl($CFG->wwwroot . '/mod/assignment/submissions.php?id=' . $this->cm->id . '&currentgroup=' . $currentgroup); $table->sortable(true, 'lastname'); //sorted by lastname by default $table->collapsible(true); $table->initialbars(true); $table->column_suppress('picture'); $table->column_suppress('fullname'); $table->column_class('picture', 'picture'); $table->column_class('fullname', 'fullname'); $table->column_class('grade', 'grade'); $table->column_class('submissioncomment', 'comment'); $table->column_class('timemodified', 'timemodified'); $table->column_class('timemarked', 'timemarked'); $table->column_class('status', 'status'); $table->column_class('finalgrade', 'finalgrade'); if ($uses_outcomes) { $table->column_class('outcome', 'outcome'); } $table->set_attribute('cellspacing', '0'); $table->set_attribute('id', 'attempts'); $table->set_attribute('class', 'submissions'); $table->set_attribute('width', '90%'); //$table->set_attribute('align', 'center'); $table->no_sorting('finalgrade'); $table->no_sorting('outcome'); // Start working -- this is necessary as soon as the niceties are over $table->setup(); /// Check to see if groups are being used in this assignment if (!$teacherattempts) { $teachers = get_course_teachers($course->id); if (!empty($teachers)) { $keys = array_keys($teachers); } foreach ($keys as $key) { unset($users[$key]); } } if (empty($users)) { print_heading(get_string('noattempts', 'assignment')); return true; } /// Construct the SQL if ($where = $table->get_sql_where()) { $where .= ' AND '; } if ($sort = $table->get_sql_sort()) { $sort = ' ORDER BY ' . $sort; } $select = 'SELECT u.id, u.firstname, u.lastname, u.picture, s.id AS submissionid, s.grade, s.submissioncomment, s.timemodified, s.timemarked, COALESCE(SIGN(SIGN(s.timemarked) + SIGN(s.timemarked - s.timemodified)), 0) AS status '; $sql = 'FROM ' . $CFG->prefix . 'user u ' . 'LEFT JOIN ' . $CFG->prefix . 'assignment_submissions s ON u.id = s.userid AND s.assignment = ' . $this->assignment->id . ' ' . 'WHERE ' . $where . 'u.id IN (' . implode(',', $users) . ') '; $table->pagesize($perpage, count($users)); ///offset used to calculate index of student in that particular query, needed for the pop up to know who's next $offset = $page * $perpage; $strupdate = get_string('update'); $strgrade = get_string('grade'); $grademenu = make_grades_menu($this->assignment->grade); if (($ausers = get_records_sql($select . $sql . $sort, $table->get_page_start(), $table->get_page_size())) !== false) { $grading_info = grade_get_grades($this->course->id, 'mod', 'assignment', $this->assignment->id, array_keys($ausers)); foreach ($ausers as $auser) { $final_grade = $grading_info->items[0]->grades[$auser->id]; /// Calculate user status $auser->status = $auser->timemarked > 0 && $auser->timemarked >= $auser->timemodified; $picture = print_user_picture($auser->id, $course->id, $auser->picture, false, true); if (empty($auser->submissionid)) { $auser->grade = -1; //no submission yet } if (!empty($auser->submissionid)) { ///Prints student answer and student modified date ///attach file or print link to student answer, depending on the type of the assignment. ///Refer to print_student_answer in inherited classes. if ($auser->timemodified > 0) { $studentmodified = '<div id="ts' . $auser->id . '">' . $this->print_student_answer($auser->id) . userdate($auser->timemodified) . '</div>'; } else { $studentmodified = '<div id="ts' . $auser->id . '"> </div>'; } ///Print grade, dropdown or text if ($auser->timemarked > 0) { $teachermodified = '<div id="tt' . $auser->id . '">' . userdate($auser->timemarked) . '</div>'; if ($final_grade->locked or $final_grade->overridden) { $grade = '<div id="g' . $auser->id . '">' . $final_grade->str_grade . '</div>'; } else { if ($quickgrade) { $menu = choose_from_menu(make_grades_menu($this->assignment->grade), 'menu[' . $auser->id . ']', $auser->grade, get_string('nograde'), '', -1, true, false, $tabindex++); $grade = '<div id="g' . $auser->id . '">' . $menu . '</div>'; } else { $grade = '<div id="g' . $auser->id . '">' . $this->display_grade($auser->grade) . '</div>'; } } } else { $teachermodified = '<div id="tt' . $auser->id . '"> </div>'; if ($final_grade->locked or $final_grade->overridden) { $grade = '<div id="g' . $auser->id . '">' . $final_grade->str_grade . '</div>'; } else { if ($quickgrade) { $menu = choose_from_menu(make_grades_menu($this->assignment->grade), 'menu[' . $auser->id . ']', $auser->grade, get_string('nograde'), '', -1, true, false, $tabindex++); $grade = '<div id="g' . $auser->id . '">' . $menu . '</div>'; } else { $grade = '<div id="g' . $auser->id . '">' . $this->display_grade($auser->grade) . '</div>'; } } } ///Print Comment if ($final_grade->locked or $final_grade->overridden) { $comment = '<div id="com' . $auser->id . '">' . shorten_text(strip_tags($final_grade->str_feedback), 15) . '</div>'; } else { if ($quickgrade) { $comment = '<div id="com' . $auser->id . '">' . '<textarea tabindex="' . $tabindex++ . '" name="submissioncomment[' . $auser->id . ']" id="submissioncomment' . $auser->id . '" rows="2" cols="20">' . $auser->submissioncomment . '</textarea></div>'; } else { $comment = '<div id="com' . $auser->id . '">' . shorten_text(strip_tags($auser->submissioncomment), 15) . '</div>'; } } } else { $studentmodified = '<div id="ts' . $auser->id . '"> </div>'; $teachermodified = '<div id="tt' . $auser->id . '"> </div>'; $status = '<div id="st' . $auser->id . '"> </div>'; if ($final_grade->locked or $final_grade->overridden) { $grade = '<div id="g' . $auser->id . '">' . $final_grade->str_grade . '</div>'; } else { if ($quickgrade) { // allow editing $menu = choose_from_menu(make_grades_menu($this->assignment->grade), 'menu[' . $auser->id . ']', $auser->grade, get_string('nograde'), '', -1, true, false, $tabindex++); $grade = '<div id="g' . $auser->id . '">' . $menu . '</div>'; } else { $grade = '<div id="g' . $auser->id . '">-</div>'; } } if ($final_grade->locked or $final_grade->overridden) { $comment = '<div id="com' . $auser->id . '">' . $final_grade->str_feedback . '</div>'; } else { if ($quickgrade) { $comment = '<div id="com' . $auser->id . '">' . '<textarea tabindex="' . $tabindex++ . '" name="submissioncomment[' . $auser->id . ']" id="submissioncomment' . $auser->id . '" rows="2" cols="20">' . $auser->submissioncomment . '</textarea></div>'; } else { $comment = '<div id="com' . $auser->id . '"> </div>'; } } } if (empty($auser->status)) { /// Confirm we have exclusively 0 or 1 $auser->status = 0; } else { $auser->status = 1; } $buttontext = $auser->status == 1 ? $strupdate : $strgrade; ///No more buttons, we use popups ;-). $popup_url = '/mod/assignment/submissions.php?id=' . $this->cm->id . '&userid=' . $auser->id . '&mode=single' . '&offset=' . $offset++; $button = link_to_popup_window($popup_url, 'grade' . $auser->id, $buttontext, 600, 780, $buttontext, 'none', true, 'button' . $auser->id); $status = '<div id="up' . $auser->id . '" class="s' . $auser->status . '">' . $button . '</div>'; $finalgrade = '<span id="finalgrade_' . $auser->id . '">' . $final_grade->str_grade . '</span>'; $outcomes = ''; if ($uses_outcomes) { foreach ($grading_info->outcomes as $n => $outcome) { $outcomes .= '<div class="outcome"><label>' . $outcome->name . '</label>'; $options = make_grades_menu(-$outcome->scaleid); if ($outcome->grades[$auser->id]->locked or !$quickgrade) { $options[0] = get_string('nooutcome', 'grades'); $outcomes .= ': <span id="outcome_' . $n . '_' . $auser->id . '">' . $options[$outcome->grades[$auser->id]->grade] . '</span>'; } else { $outcomes .= ' '; $outcomes .= choose_from_menu($options, 'outcome_' . $n . '[' . $auser->id . ']', $outcome->grades[$auser->id]->grade, get_string('nooutcome', 'grades'), '', 0, true, false, 0, 'outcome_' . $n . '_' . $auser->id); } $outcomes .= '</div>'; } } $row = array($picture, fullname($auser), $grade, $comment, $studentmodified, $teachermodified, $status, $finalgrade); if ($uses_outcomes) { $row[] = $outcomes; } $table->add_data($row); } } /// Print quickgrade form around the table if ($quickgrade) { echo '<form action="submissions.php" id="fastg" method="post">'; echo '<div>'; echo '<input type="hidden" name="id" value="' . $this->cm->id . '" />'; echo '<input type="hidden" name="mode" value="fastgrade" />'; echo '<input type="hidden" name="page" value="' . $page . '" />'; echo '</div>'; //echo '<div style="text-align:center"><input type="submit" name="fastg" value="'.get_string('saveallfeedback', 'assignment').'" /></div>'; } $table->print_html(); /// Print the whole table if ($quickgrade) { echo '<div style="text-align:center"><input type="submit" name="fastg" value="' . get_string('saveallfeedback', 'assignment') . '" /></div>'; echo '</form>'; } /// End of fast grading form /// Mini form for setting user preference echo '<br />'; echo '<form id="options" action="submissions.php?id=' . $this->cm->id . '" method="post">'; echo '<div>'; echo '<input type="hidden" id="updatepref" name="updatepref" value="1" />'; echo '<table id="optiontable" align="right">'; echo '<tr align="right"><td>'; echo '<label for="perpage">' . get_string('pagesize', 'assignment') . '</label>'; echo ':</td>'; echo '<td>'; echo '<input type="text" id="perpage" name="perpage" size="1" value="' . $perpage . '" />'; helpbutton('pagesize', get_string('pagesize', 'assignment'), 'assignment'); echo '</td></tr>'; echo '<tr align="right">'; echo '<td>'; print_string('quickgrade', 'assignment'); echo ':</td>'; echo '<td>'; if ($quickgrade) { echo '<input type="checkbox" name="quickgrade" value="1" checked="checked" />'; } else { echo '<input type="checkbox" name="quickgrade" value="1" />'; } helpbutton('quickgrade', get_string('quickgrade', 'assignment'), 'assignment') . '</p></div>'; echo '</td></tr>'; echo '<tr>'; echo '<td colspan="2" align="right">'; echo '<input type="submit" value="' . get_string('savepreferences') . '" />'; echo '</td></tr></table>'; echo '</div>'; echo '</form>'; ///End of mini form print_footer($this->course); }
\t\t\t\t\t<td width="75%" align="right">[ <a href="signup_page.php"><strong>Sign Up</strong></a> ]</td> \t\t\t\t</tr> \t\t\t\t<tr class="row-1"> \t\t\t\t\t<th>{$s_username}:</th> \t\t\t\t\t<td><input type="text" name="f_username" size="32" maxlength="32" /></td> \t\t\t\t</tr> \t\t\t\t<tr class="row-2"> \t\t\t\t\t<th>{$s_password}:</th> \t\t\t\t\t<td><input type="password" name="f_password" size="32" maxlength="32" /></td> \t\t\t\t</tr> \t\t\t\t<tr class="row-1"> \t\t\t\t\t<th>{$s_save_login}:</th> \t\t\t\t\t<td><input type="checkbox" name="f_perm_login" /></td> \t\t\t\t</tr> \t\t\t\t<tr class="buttons"> \t\t\t\t\t<td colspan="2"><input type="submit" value="{$s_login_button}" /></td> \t\t\t\t</tr> \t\t\t</table> \t\t</form> \t</div> \t</div> \t <script type="text/javascript" language="JavaScript"> window.document.f_login_form.f_username.focus(); </script> EOT; print_bottom_page($g_bottom_page_inc); print_footer(__FILE__); print_body_bottom(); print_html_bottom();