/** * Constructor for the base resource class * * Constructor for the base resource class. * If cmid is set create the cm, course, resource objects. * and do some checks to make sure people can be here, and so on. * * @param cmid integer, the current course module id - not set for new resources */ function resource_base($cmid = 0) { global $CFG, $COURSE; $this->navlinks = array(); if ($cmid) { if (!($this->cm = get_coursemodule_from_id('resource', $cmid))) { error("Course Module ID was incorrect"); } if (!($this->course = get_record("course", "id", $this->cm->course))) { error("Course is misconfigured"); } if (!($this->resource = get_record("resource", "id", $this->cm->instance))) { error("Resource ID was incorrect"); } $this->strresource = get_string("modulename", "resource"); $this->strresources = get_string("modulenameplural", "resource"); if (!$this->cm->visible and !has_capability('moodle/course:viewhiddenactivities', get_context_instance(CONTEXT_MODULE, $this->cm->id))) { $pagetitle = strip_tags($this->course->shortname . ': ' . $this->strresource); $navigation = build_navigation($this->navlinks, $this->cm); print_header($pagetitle, $this->course->fullname, $navigation, "", "", true, '', user_login_string($course) . '<hr style="width:95%">' . navmenu($this->course, $this->cm)); notice(get_string("activityiscurrentlyhidden"), "{$CFG->wwwroot}/course/view.php?id={$this->course->id}"); } } else { $this->course = $COURSE; } }
function print_header($title) { global $USER; $replacements = array('%fullname%' => get_string('mymoodle', 'my')); foreach ($replacements as $search => $replace) { $title = str_replace($search, $replace, $title); } $site = get_site(); $button = update_mymoodle_icon($USER->id); $nav = get_string('mymoodle', 'my'); $header = $site->shortname . ': ' . $nav; $loggedinas = user_login_string($site); print_header($title, $header, $nav, '', '', true, $button, $loggedinas); }
function print_header_and_tabs($cm, $course, $quiz, $reportmode = "overview", $meta = "") { global $CFG; /// Define some strings $strquizzes = get_string("modulenameplural", "quiz"); $strquiz = get_string("modulename", "quiz"); /// Print the page header $navigation = build_navigation('', $cm); print_header_simple(format_string($quiz->name), "", $navigation, '', $meta, true, update_module_button($cm->id, $course->id, $strquiz), user_login_string($course) . '<hr style="width:95%">' . navmenu($course, $cm)); /// Print the tabs $currenttab = 'reports'; $mode = $reportmode; require $CFG->dirroot . '/mod/quiz/tabs.php'; }
function print_header($title) { global $USER, $CFG; $replacements = array('%fullname%' => get_string('mymoodle', 'my')); foreach ($replacements as $search => $replace) { $title = str_replace($search, $replace, $title); } $site = get_site(); $button = update_mymoodle_icon($USER->id); $nav = get_string('mymoodle', 'my'); $header = $site->shortname . ': ' . $nav; $navlinks = array(array('name' => $nav, 'link' => '', 'type' => 'misc')); $navigation = build_navigation($navlinks); $loggedinas = user_login_string($site); if (empty($CFG->langmenu)) { $langmenu = ''; } else { $currlang = current_language(); $langs = get_list_of_languages(); $langlabel = get_accesshide(get_string('language')); $langmenu = popup_form($CFG->wwwroot . '/my/index.php?lang=', $langs, 'chooselang', $currlang, '', '', '', true, 'self', $langlabel); } print_header($title, $header, $navigation, '', '', true, $button, $loggedinas . $langmenu); }
$cm->visible = 1; $cm->course = $course->id; $buttontext = ""; } } else { error('Must specify a course module or a forum ID'); } } if (!$buttontext) { $buttontext = forum_search_form($course, $search); } require_course_login($course, true, $cm); $context = get_context_instance(CONTEXT_MODULE, $cm->id); /// Print header. $navigation = build_navigation('', $cm); print_header_simple(format_string($forum->name), "", $navigation, "", "", true, $buttontext, user_login_string($course) . '<hr style="width:95%">' . navmenu($course, $cm)); /// Some capability checks. if (empty($cm->visible) and !has_capability('moodle/course:viewhiddenactivities', $context)) { notice(get_string("activityiscurrentlyhidden")); } if (!has_capability('mod/forum:viewdiscussion', $context)) { notice(get_string('noviewdiscussionspermission', 'forum')); } /// find out current groups mode groups_print_activity_menu($cm, 'view.php?id=' . $cm->id); $currentgroup = groups_get_activity_group($cm); $groupmode = groups_get_activity_groupmode($cm); /// Okay, we can show the discussions. Log the forum view. if ($cm->id) { add_to_log($course->id, "forum", "view forum", "view.php?id={$cm->id}", "{$forum->id}", $cm->id); } else {
require_course_login($course, true); if ($course->id != SITEID) { require_login($course->id); } add_to_log($course->id, "resource", "view all", "index.php?id={$course->id}", ""); $strresource = get_string("modulename", "resource"); $strresources = get_string("modulenameplural", "resource"); $strweek = get_string("week"); $strtopic = get_string("topic"); $strname = get_string("name"); $strsummary = get_string("summary"); $strlastmodified = get_string("lastmodified"); $navlinks = array(); $navlinks[] = array('name' => $strresources, 'link' => '', 'type' => 'activityinstance'); $navigation = build_navigation($navlinks); print_header("{$course->shortname}: {$strresources}", $course->fullname, $navigation, "", "", true, "", user_login_string($course) . '<hr style="width:95%">' . navmenu($course)); if (!($resources = get_all_instances_in_course("resource", $course))) { notice(get_string('thereareno', 'moodle', $strresources), "../../course/view.php?id={$course->id}"); exit; } if ($course->format == "weeks") { $table->head = array($strweek, $strname, $strsummary); $table->align = array("center", "left", "left"); } else { if ($course->format == "topics") { $table->head = array($strtopic, $strname, $strsummary); $table->align = array("center", "left", "left"); } else { $table->head = array($strlastmodified, $strname, $strsummary); $table->align = array("left", "left", "left"); }
set_user_preference('calendar_lookahead', $value); } break; case 'persistflt': set_user_preference('calendar_persistflt', intval($value)); break; } } redirect('view.php?course=' . $course->id, get_string('changessaved'), 1); exit; } $site = get_site(); $strcalendar = get_string('calendar', 'calendar'); $strpreferences = get_string('preferences', 'calendar'); $navlinks = array(); if ($course->id != SITEID) { $navlinks[] = array('name' => $course->shortname, 'link' => "{$CFG->wwwroot}/course/view.php?id={$course->id}", 'type' => 'misc'); } $navlinks[] = array('name' => $strpreferences, 'link' => 'view.php', 'type' => 'misc'); $navigation = build_navigation($navlinks); print_header("{$site->shortname}: {$strcalendar}: {$strpreferences}", $strcalendar, $navigation, '', '', true, '', user_login_string($site)); print_heading($strpreferences); print_simple_box_start("center"); $prefs->timeformat = get_user_preferences('calendar_timeformat', ''); $prefs->startwday = get_user_preferences('calendar_startwday', CALENDAR_STARTING_WEEKDAY); $prefs->maxevents = get_user_preferences('calendar_maxevents', CALENDAR_UPCOMING_MAXEVENTS); $prefs->lookahead = get_user_preferences('calendar_lookahead', CALENDAR_UPCOMING_DAYS); $prefs->persistflt = get_user_preferences('calendar_persistflt', 0); include './preferences.html'; print_simple_box_end(); print_footer($course);
} require_login($course->id, false, $cm); $context = get_context_instance(CONTEXT_MODULE, $cm->id); require_capability('mod/glossary:export', $context); $strglossaries = get_string("modulenameplural", "glossary"); $strglossary = get_string("modulename", "glossary"); $strallcategories = get_string("allcategories", "glossary"); $straddentry = get_string("addentry", "glossary"); $strnoentries = get_string("noentries", "glossary"); $strsearchconcept = get_string("searchconcept", "glossary"); $strsearchindefinition = get_string("searchindefinition", "glossary"); $strsearch = get_string("search"); $strexportfile = get_string("exportfile", "glossary"); $strexportentries = get_string('exportentries', 'glossary'); $navigation = build_navigation('', $cm); print_header_simple(format_string($glossary->name), "", $navigation, "", "", true, update_module_button($cm->id, $course->id, $strglossary), user_login_string($course) . '<hr style="width:95%">' . navmenu($course, $cm)); print_heading($strexportentries); print_box_start('glossarydisplay generalbox'); ?> <form action="exportfile.php" method="post"> <table border="0" cellpadding="6" cellspacing="6" width="100%"> <tr><td align="center"> <input type="submit" value="<?php p($strexportfile); ?> " /> </td></tr></table> <div> <input type="hidden" name="id" value="<?php p($id); ?>
/** * Display the file resource * * Displays a file resource embedded, in a frame, or in a popup. * Output depends on type of file resource. * * @param CFG global object */ function display() { global $CFG, $THEME, $USER; /// 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; $this->set_parameters(); // set the parameters array /////////////////////////////////////////////// /// Possible display modes are: /// File displayed in a frame in a normal window /// File displayed embedded in a normal page /// File displayed in a popup window /// File displayed emebedded in a popup window /// First, find out what sort of file we are dealing with. require_once $CFG->libdir . '/filelib.php'; $querystring = ''; $resourcetype = ''; $embedded = false; $mimetype = mimeinfo("type", $resource->reference); $pagetitle = strip_tags($course->shortname . ': ' . format_string($resource->name)); $formatoptions = new object(); $formatoptions->noclean = true; if ($resource->options != "bogusoption_usedtobe_frame") { // TODO nicolasconnault 14-03-07: This option should be renamed "embed" if (in_array($mimetype, array('image/gif', 'image/jpeg', 'image/png'))) { // It's an image $resourcetype = "image"; $embedded = true; } else { if ($mimetype == "audio/mp3") { // It's an MP3 audio file $resourcetype = "mp3"; $embedded = true; } else { if ($mimetype == "video/x-flv") { // It's a Flash video file $resourcetype = "flv"; $embedded = true; } else { if (substr($mimetype, 0, 10) == "video/x-ms") { // It's a Media Player file $resourcetype = "mediaplayer"; $embedded = true; } else { if ($mimetype == "video/quicktime") { // It's a Quicktime file $resourcetype = "quicktime"; $embedded = true; } else { if ($mimetype == "application/x-shockwave-flash") { // It's a Flash file $resourcetype = "flash"; $embedded = true; } else { if ($mimetype == "video/mpeg") { // It's a Mpeg file $resourcetype = "mpeg"; $embedded = true; } else { if ($mimetype == "text/html") { // It's a web page $resourcetype = "html"; } else { if ($mimetype == "application/zip") { // It's a zip archive $resourcetype = "zip"; $embedded = true; } else { if ($mimetype == 'application/pdf' || $mimetype == 'application/x-pdf') { $resourcetype = "pdf"; $embedded = true; } } } } } } } } } } } $isteamspeak = stripos($resource->reference, 'teamspeak://') === 0; /// Form the parse string if (!empty($resource->alltext)) { $querys = array(); $parray = explode(',', $resource->alltext); foreach ($parray as $fieldstring) { $field = explode('=', $fieldstring); $querys[] = urlencode($field[1]) . '=' . urlencode($this->parameters[$field[0]]['value']); } if ($isteamspeak) { $querystring = implode('?', $querys); } else { $querystring = implode('&', $querys); } } /// Set up some variables $inpopup = optional_param('inpopup', 0, PARAM_BOOL); if (resource_is_url($resource->reference)) { $fullurl = $resource->reference; if (!empty($querystring)) { $urlpieces = parse_url($resource->reference); if (empty($urlpieces['query']) or $isteamspeak) { $fullurl .= '?' . $querystring; } else { $fullurl .= '&' . $querystring; } } } else { if ($CFG->resource_allowlocalfiles and strpos($resource->reference, RESOURCE_LOCALPATH) === 0) { // Localpath $localpath = get_user_preferences('resource_localpath', 'D:'); $relativeurl = str_replace(RESOURCE_LOCALPATH, $localpath, $resource->reference); if ($querystring) { $relativeurl .= '?' . $querystring; } $relativeurl = str_replace('\\', '/', $relativeurl); $relativeurl = str_replace(' ', '%20', $relativeurl); $fullurl = 'file:///' . htmlentities($relativeurl); $localpath = true; } else { // Normal uploaded file if ($CFG->slasharguments) { $relativeurl = "/file.php/{$course->id}/{$resource->reference}"; if ($querystring) { $relativeurl .= '?' . $querystring; } } else { $relativeurl = "/file.php?file=/{$course->id}/{$resource->reference}"; if ($querystring) { $relativeurl .= '&' . $querystring; } } $fullurl = "{$CFG->wwwroot}{$relativeurl}"; } } /// Print a notice and redirect if we are trying to access a file on a local file system /// and the config setting has been disabled if (!$CFG->resource_allowlocalfiles and strpos($resource->reference, RESOURCE_LOCALPATH) === 0) { if ($inpopup) { print_header($pagetitle, $course->fullname); } else { $navigation = build_navigation($this->navlinks, $cm); print_header($pagetitle, $course->fullname, $navigation, "", "", true, update_module_button($cm->id, $course->id, $this->strresource), user_login_string($course) . '<hr style="width:95%">' . navmenu($course, $cm)); } notify(get_string('notallowedlocalfileaccess', 'resource', '')); if ($inpopup) { close_window_button(); } print_footer('none'); die; } /// Check whether this is supposed to be a popup, but was called directly if ($resource->popup and !$inpopup) { /// Make a page and a pop-up window $navigation = build_navigation($this->navlinks, $cm); print_header($pagetitle, $course->fullname, $navigation, "", "", true, update_module_button($cm->id, $course->id, $this->strresource), user_login_string($course) . '<hr style="width:95%">' . navmenu($course, $cm)); echo "\n<script type=\"text/javascript\">"; echo "\n<!--\n"; echo "openpopup('/mod/resource/view.php?inpopup=true&id={$cm->id}','resource{$resource->id}','{$resource->popup}');\n"; echo "\n-->\n"; echo '</script>'; if (trim(strip_tags($resource->summary))) { print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions), "center"); } $link = "<a href=\"{$CFG->wwwroot}/mod/resource/view.php?inpopup=true&id={$cm->id}\" " . "onclick=\"this.target='resource{$resource->id}'; return openpopup('/mod/resource/view.php?inpopup=true&id={$cm->id}', " . "'resource{$resource->id}','{$resource->popup}');\">" . format_string($resource->name, true) . "</a>"; echo '<div class="popupnotice">'; print_string('popupresource', 'resource'); echo '<br />'; print_string('popupresourcelink', 'resource', $link); echo '</div>'; print_footer($course); exit; } /// Now check whether we need to display a frameset $frameset = optional_param('frameset', '', PARAM_ALPHA); if (empty($frameset) and !$embedded and !$inpopup and $resource->options == "frame" and empty($USER->screenreader)) { @header('Content-Type: text/html; charset=utf-8'); echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">\n"; echo "<html dir=\"ltr\">\n"; echo '<head>'; echo '<meta http-equiv="content-type" content="text/html; charset=utf-8" />'; echo "<title>" . format_string($course->shortname) . ": " . strip_tags(format_string($resource->name, true)) . "</title></head>\n"; echo "<frameset rows=\"{$CFG->resource_framesize},*\">"; echo "<frame src=\"view.php?id={$cm->id}&type={$resource->type}&frameset=top\" title=\"" . get_string('modulename', 'resource') . "\"/>"; if (!empty($localpath)) { // Show it like this so we interpose some HTML echo "<frame src=\"view.php?id={$cm->id}&type={$resource->type}&inpopup=true\" title=\"" . get_string('modulename', 'resource') . "\"/>"; } else { echo "<frame src=\"{$fullurl}\" title=\"" . get_string('modulename', 'resource') . "\"/>"; } echo "</frameset>"; echo "</html>"; exit; } /// We can only get here once per resource, so add an entry to the log add_to_log($course->id, "resource", "view", "view.php?id={$cm->id}", $resource->id, $cm->id); /// If we are in a frameset, just print the top of it if (!empty($frameset) and $frameset == "top") { $navigation = build_navigation($this->navlinks, $cm); print_header($pagetitle, $course->fullname, $navigation, "", "", true, update_module_button($cm->id, $course->id, $this->strresource), user_login_string($course) . '<hr style="width:95%">' . navmenu($course, $cm, "parent")); $options = new object(); $options->para = false; echo '<div class="summary">' . format_text($resource->summary, FORMAT_HTML, $options) . '</div>'; if (!empty($localpath)) { // Show some help echo '<div align="right" class="helplink">'; link_to_popup_window('/mod/resource/type/file/localpath.php', get_string('localfile', 'resource'), get_string('localfilehelp', 'resource'), 400, 500, get_string('localfilehelp', 'resource')); echo '</div>'; } print_footer('empty'); exit; } /// Display the actual resource if ($embedded) { // Display resource embedded in page $strdirectlink = get_string("directlink", "resource"); if ($inpopup) { print_header($pagetitle); } else { $navigation = build_navigation($this->navlinks, $cm); print_header_simple($pagetitle, '', $navigation, "", "", true, update_module_button($cm->id, $course->id, $this->strresource), user_login_string($course) . '<hr style="width:95%">' . navmenu($course, $cm, "self")); } if ($resourcetype == "image") { echo '<div class="resourcecontent resourceimg">'; echo "<img title=\"" . strip_tags(format_string($resource->name, true)) . "\" class=\"resourceimage\" src=\"{$fullurl}\" alt=\"\" />"; echo '</div>'; } else { if ($resourcetype == "mp3") { if (!empty($THEME->resource_mp3player_colors)) { $c = $THEME->resource_mp3player_colors; // You can set this up in your theme/xxx/config.php } else { $c = 'bgColour=000000&btnColour=ffffff&btnBorderColour=cccccc&iconColour=000000&' . 'iconOverColour=00cc00&trackColour=cccccc&handleColour=ffffff&loaderColour=ffffff&' . 'font=Arial&fontColour=FF33FF&buffer=10&waitForPlay=no&autoPlay=yes'; } $c .= '&volText=' . get_string('vol', 'resource') . '&panText=' . get_string('pan', 'resource'); $c = htmlentities($c); $id = 'filter_mp3_' . time(); //we need something unique because it might be stored in text cache $cleanurl = addslashes_js($fullurl); // If we have Javascript, use UFO to embed the MP3 player, otherwise depend on plugins echo '<div class="resourcecontent resourcemp3">'; echo '<span class="mediaplugin mediaplugin_mp3" id="' . $id . '"></span>' . '<script type="text/javascript">' . "\n" . '//<![CDATA[' . "\n" . 'var FO = { movie:"' . $CFG->wwwroot . '/lib/mp3player/mp3player.swf?src=' . $cleanurl . '",' . "\n" . 'width:"600", height:"70", majorversion:"6", build:"40", flashvars:"' . $c . '", quality: "high" };' . "\n" . 'UFO.create(FO, "' . $id . '");' . "\n" . '//]]>' . "\n" . '</script>' . "\n"; echo '<noscript>'; echo "<object type=\"audio/mpeg\" data=\"{$fullurl}\" width=\"600\" height=\"70\">"; echo "<param name=\"src\" value=\"{$fullurl}\" />"; echo '<param name="quality" value="high" />'; echo '<param name="autoplay" value="true" />'; echo '<param name="autostart" value="true" />'; echo '</object>'; echo '<p><a href="' . $fullurl . '">' . $fullurl . '</a></p>'; echo '</noscript>'; echo '</div>'; } else { if ($resourcetype == "flv") { $id = 'filter_flv_' . time(); //we need something unique because it might be stored in text cache $cleanurl = addslashes_js($fullurl); // If we have Javascript, use UFO to embed the FLV player, otherwise depend on plugins echo '<div class="resourcecontent resourceflv">'; echo '<span class="mediaplugin mediaplugin_flv" id="' . $id . '"></span>' . '<script type="text/javascript">' . "\n" . '//<![CDATA[' . "\n" . 'var FO = { movie:"' . $CFG->wwwroot . '/filter/mediaplugin/flvplayer.swf?file=' . $cleanurl . '",' . "\n" . 'width:"600", height:"400", majorversion:"6", build:"40", allowscriptaccess:"never", quality: "high" };' . "\n" . 'UFO.create(FO, "' . $id . '");' . "\n" . '//]]>' . "\n" . '</script>' . "\n"; echo '<noscript>'; echo "<object type=\"video/x-flv\" data=\"{$fullurl}\" width=\"600\" height=\"400\">"; echo "<param name=\"src\" value=\"{$fullurl}\" />"; echo '<param name="quality" value="high" />'; echo '<param name="autoplay" value="true" />'; echo '<param name="autostart" value="true" />'; echo '</object>'; echo '<p><a href="' . $fullurl . '">' . $fullurl . '</a></p>'; echo '</noscript>'; echo '</div>'; } else { if ($resourcetype == "mediaplayer") { echo '<div class="resourcecontent resourcewmv">'; echo '<object type="video/x-ms-wmv" data="' . $fullurl . '">'; echo '<param name="controller" value="true" />'; echo '<param name="autostart" value="true" />'; echo "<param name=\"src\" value=\"{$fullurl}\" />"; echo '<param name="scale" value="noScale" />'; echo "<a href=\"{$fullurl}\">{$fullurl}</a>"; echo '</object>'; echo '</div>'; } else { if ($resourcetype == "mpeg") { echo '<div class="resourcecontent resourcempeg">'; echo '<object classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsm p2inf.cab#Version=5,1,52,701" type="application/x-oleobject">'; echo "<param name=\"fileName\" value=\"{$fullurl}\" />"; echo '<param name="autoStart" value="true" />'; echo '<param name="animationatStart" value="true" />'; echo '<param name="transparentatStart" value="true" />'; echo '<param name="showControls" value="true" />'; echo '<param name="Volume" value="-450" />'; echo '<!--[if !IE]>-->'; echo '<object type="video/mpeg" data="' . $fullurl . '">'; echo '<param name="controller" value="true" />'; echo '<param name="autostart" value="true" />'; echo "<param name=\"src\" value=\"{$fullurl}\" />"; echo "<a href=\"{$fullurl}\">{$fullurl}</a>"; echo '<!--<![endif]-->'; echo '<a href="' . $fullurl . '">' . $fullurl . '</a>'; echo '<!--[if !IE]>-->'; echo '</object>'; echo '<!--<![endif]-->'; echo '</object>'; echo '</div>'; } else { if ($resourcetype == "quicktime") { echo '<div class="resourcecontent resourceqt">'; echo '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"'; echo ' codebase="http://www.apple.com/qtactivex/qtplugin.cab">'; echo "<param name=\"src\" value=\"{$fullurl}\" />"; echo '<param name="autoplay" value="true" />'; echo '<param name="loop" value="true" />'; echo '<param name="controller" value="true" />'; echo '<param name="scale" value="aspect" />'; echo '<!--[if !IE]>-->'; echo "<object type=\"video/quicktime\" data=\"{$fullurl}\">"; echo '<param name="controller" value="true" />'; echo '<param name="autoplay" value="true" />'; echo '<param name="loop" value="true" />'; echo '<param name="scale" value="aspect" />'; echo '<!--<![endif]-->'; echo '<a href="' . $fullurl . '">' . $fullurl . '</a>'; echo '<!--[if !IE]>-->'; echo '</object>'; echo '<!--<![endif]-->'; echo '</object>'; echo '</div>'; } else { if ($resourcetype == "flash") { echo '<div class="resourcecontent resourceswf">'; echo '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">'; echo "<param name=\"movie\" value=\"{$fullurl}\" />"; echo '<param name="autoplay" value="true" />'; echo '<param name="loop" value="true" />'; echo '<param name="controller" value="true" />'; echo '<param name="scale" value="aspect" />'; echo '<!--[if !IE]>-->'; echo "<object type=\"application/x-shockwave-flash\" data=\"{$fullurl}\">"; echo '<param name="controller" value="true" />'; echo '<param name="autoplay" value="true" />'; echo '<param name="loop" value="true" />'; echo '<param name="scale" value="aspect" />'; echo '<!--<![endif]-->'; echo '<a href="' . $fullurl . '">' . $fullurl . '</a>'; echo '<!--[if !IE]>-->'; echo '</object>'; echo '<!--<![endif]-->'; echo '</object>'; echo '</div>'; } elseif ($resourcetype == 'zip') { echo '<div class="resourcepdf">'; echo get_string('clicktoopen', 'resource') . '<a href="' . $fullurl . '">' . format_string($resource->name) . '</a>'; echo '</div>'; } elseif ($resourcetype == 'pdf') { echo '<div class="resourcepdf">'; echo '<object data="' . $fullurl . '" type="application/pdf">'; echo get_string('clicktoopen', 'resource') . '<a href="' . $fullurl . '">' . format_string($resource->name) . '</a>'; echo '</object>'; echo '</div>'; } } } } } } } if (trim($resource->summary)) { print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions, $course->id), "center"); } if ($inpopup) { echo "<div class=\"popupnotice\">(<a href=\"{$fullurl}\">{$strdirectlink}</a>)</div>"; echo "</div>"; // MDL-12098 print_footer($course); // MDL-12098 } else { print_spacer(20, 20); print_footer($course); } } else { // Display the resource on it's own if (!empty($localpath)) { // Show a link to help work around browser security echo '<div align="right" class="helplink">'; link_to_popup_window('/mod/resource/type/file/localpath.php', get_string('localfile', 'resource'), get_string('localfilehelp', 'resource'), 400, 500, get_string('localfilehelp', 'resource')); echo '</div>'; echo "<div class=\"popupnotice\">(<a href=\"{$fullurl}\">{$fullurl}</a>)</div>"; } redirect($fullurl); } }
// error(get_string("noreviewuntil", "quiz", userdate($hotpot->timeclose))); //} if ($attempt->userid != $USER->id) { error("This is not your attempt!"); } } add_to_log($course->id, "hotpot", "review", "review.php?id={$cm->id}&attempt={$attempt->id}", "{$hotpot->id}", "{$cm->id}"); // Print the page header $strmodulenameplural = get_string("modulenameplural", "hotpot"); $strmodulename = get_string("modulename", "hotpot"); // print header $title = format_string($course->shortname) . ": {$hotpot->name}"; $heading = $course->fullname; $navigation = build_navigation('', $cm); $button = update_module_button($cm->id, $course->id, $strmodulename); print_header($title, $heading, $navigation, "", "", true, $button, user_login_string($course) . '<hr style="width:95%">' . navmenu($course, $cm)); print '<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>'; // for overlib print_heading($hotpot->name); hotpot_print_attempt_summary($hotpot, $attempt); hotpot_print_review_buttons($course, $hotpot, $attempt, $context); $action = has_capability('mod/hotpot:viewreport', $context) ? optional_param('action', '', PARAM_ALPHA) : ''; if ($action) { $xml = get_field('hotpot_details', 'details', 'attempt', $attempt->id); print '<hr>'; switch ($action) { case 'showxmltree': print '<pre id="contents">'; $xml_tree = new hotpot_xml_tree($xml, "['hpjsresult']['#']"); print_r($xml_tree->xml_value('fields')); print '</pre>';
if (!count_records('data_fields', 'dataid', $data->id)) { // Brand new database! redirect($CFG->wwwroot . '/mod/data/field.php?d=' . $data->id); // Redirect to field entry } } if ($rid) { //editting a record, do you have access to edit this? if (!has_capability('mod/data:manageentries', $context) or !data_isowner($rid) or !confirm_sesskey()) { error(get_string('noaccess', 'data')); } } /// Print the page header $strdata = get_string('modulenameplural', 'data'); $navigation = build_navigation('', $cm); print_header_simple($data->name, "", $navigation, "", "", true, "", user_login_string($course) . '<hr style="width:95%">' . navmenu($course)); print_heading(format_string($data->name)); /// Groups needed for Add entry tab $currentgroup = groups_get_activity_group($cm); $groupmode = groups_get_activity_groupmode($cm); /// Print the tabs $currenttab = 'add'; include 'tabs.php'; $um = new upload_manager('recordsfile', false, false, null, false, 0); if ($um->preprocess_files() && confirm_sesskey()) { $filename = $um->files['recordsfile']['tmp_name']; // Large files are likely to take their time and memory. Let PHP know // that we'll take longer, and that the process should be recycled soon // to free up memory. @set_time_limit(0); @raise_memory_limit("96M");
if (!$ineditperiod || $USER->id != $fromdb->userid and !has_capability('mod/glossary:manageentries', $context)) { if ($USER->id != $fromdb->userid) { error(get_string('errcannoteditothers', 'glossary')); } elseif (!$ineditperiod) { error(get_string('erredittimeexpired', 'glossary')); } die; } if ($aliases = get_records_menu("glossary_alias", "entryid", $e, '', 'id, alias')) { $toform->aliases = implode("\n", $aliases) . "\n"; } $mform->set_data($toform); } } $stredit = empty($e) ? get_string('addentry', 'glossary') : get_string("edit"); $navigation = build_navigation($stredit, $cm); print_header_simple(format_string($glossary->name), "", $navigation, "", "", true, "", user_login_string($course) . '<hr style="width:95%">' . navmenu($course, $cm)); print_heading(format_string($glossary->name)); /// Info box ///if ( $glossary->intro ) { /// print_simple_box(format_text($glossary->intro), 'center', '70%', '', 5, 'generalbox', 'intro'); ///} /// Tabbed browsing sections ///$tab = GLOSSARY_ADDENTRY_VIEW; ///include("tabs.php"); if (!$e) { require_capability('mod/glossary:write', $context); } $mform->display(); ///glossary_print_tabbed_table_end(); print_footer($course);
$meta = ''; if (!empty($CFG->enablerssfeeds) && !empty($CFG->data_enablerssfeeds) && $data->rssarticles > 0) { $rsspath = rss_get_url($course->id, $USER->id, 'data', $data->id); $meta .= '<link rel="alternate" type="application/rss+xml" '; $meta .= 'title ="' . format_string($course->shortname) . ': %fullname%" href="' . $rsspath . '" />'; } if ($data->csstemplate) { $meta .= '<link rel="stylesheet" type="text/css" href="' . $CFG->wwwroot . '/mod/data/css.php?d=' . $data->id . '" /> '; } if ($data->jstemplate) { $meta .= '<script type="text/javascript" src="' . $CFG->wwwroot . '/mod/data/js.php?d=' . $data->id . '"></script>'; } /// Print the page header $strdata = get_string('modulenameplural', 'data'); $navigation = build_navigation('', $cm); print_header_simple($data->name, '', $navigation, '', $meta, true, update_module_button($cm->id, $course->id, get_string('modulename', 'data')), user_login_string($course) . '<hr style="width:95%">' . navmenu($course, $cm), '', ''); /// Check to see if groups are being used here groups_print_activity_menu($cm, 'edit.php?d=' . $data->id); $currentgroup = groups_get_activity_group($cm); $groupmode = groups_get_activity_groupmode($cm); print_heading(format_string($data->name)); if ($currentgroup) { $groupselect = " AND groupid = '{$currentgroup}'"; $groupparam = "&groupid={$currentgroup}"; } else { $groupselect = ""; $groupparam = ""; $currentgroup = 0; } /// Print the tabs $currenttab = 'add';
// the breadcrumbs. $strdiscussionname = ''; } else { // Show the discussion name in the breadcrumbs. $strdiscussionname = format_string($discussion->name) . ':'; } $forcefocus = empty($reply) ? NULL : 'message'; $navlinks = array(); if ($post->parent) { $navlinks[] = array('name' => format_string($toppost->subject, true), 'link' => "discuss.php?d={$discussion->id}", 'type' => 'title'); $navlinks[] = array('name' => get_string('editing', 'forum'), 'link' => '', 'type' => 'title'); } else { $navlinks[] = array('name' => format_string($toppost->subject), 'link' => '', 'type' => 'title'); } $navigation = build_navigation($navlinks, $cm); print_header("{$course->shortname}: {$strdiscussionname} " . format_string($toppost->subject), $course->fullname, $navigation, $mform_post->focus($forcefocus), "", true, "", user_login_string($course) . '<hr style="width:95%">' . navmenu($course, $cm)); // checkup if (!empty($parent) && !forum_user_can_see_post($forum, $discussion, $post)) { error("You cannot reply to this post"); } if (empty($parent) && empty($edit) && !forum_user_can_post_discussion($forum)) { error("You cannot start a new discussion in this forum"); } if ($forum->type == 'qanda' && !has_capability('mod/forum:viewqandawithoutposting', $modcontext) && !empty($discussion->id) && !forum_user_has_posted($forum->id, $discussion->id, $USER->id)) { notify(get_string('qandanotify', 'forum')); } forum_check_throttling($forum); if (!empty($parent)) { forum_print_post($parent, $course->id, $ownpost = false, $reply = false, $link = false); if (empty($post->edit)) { if (forum_tp_can_track_forums($forum) && forum_tp_is_tracked($forum)) {
/** * Print a standard lesson heading. * * This will also print up to three * buttons in the breadcrumb, lesson heading * lesson tabs, lesson notifications and perhaps * a popup with a media file. * * @return void **/ function print_header($title = '', $morenavlinks = array()) { global $CFG; $this->init_full(); /// Variable setup/check $context = get_context_instance(CONTEXT_MODULE, $this->modulerecord->id); $activityname = format_string($this->activityrecord->name); if ($this->lessonpageid === NULL) { error('Programmer error: must set the lesson page ID'); } if (empty($title)) { $title = "{$this->courserecord->shortname}: {$activityname}"; } /// Build the buttons if (has_capability('mod/lesson:edit', $context)) { $buttons = '<span class="edit_buttons">' . update_module_button($this->modulerecord->id, $this->courserecord->id, get_string('modulename', 'lesson')); if (!empty($this->lessonpageid) and $this->lessonpageid != LESSON_EOL) { $buttons .= '<form ' . $CFG->frametarget . ' method="get" action="' . $CFG->wwwroot . '/mod/lesson/lesson.php">' . '<input type="hidden" name="id" value="' . $this->modulerecord->id . '" />' . '<input type="hidden" name="action" value="editpage" />' . '<input type="hidden" name="redirect" value="navigation" />' . '<input type="hidden" name="pageid" value="' . $this->lessonpageid . '" />' . '<input type="submit" value="' . get_string('editpagecontent', 'lesson') . '" />' . '</form>'; if (!empty($CFG->showblocksonmodpages) and $this->user_allowed_editing()) { if ($this->user_is_editing()) { $onoff = 'off'; } else { $onoff = 'on'; } $buttons .= '<form ' . $CFG->frametarget . ' method="get" action="' . $CFG->wwwroot . '/mod/lesson/view.php">' . '<input type="hidden" name="id" value="' . $this->modulerecord->id . '" />' . '<input type="hidden" name="pageid" value="' . $this->lessonpageid . '" />' . '<input type="hidden" name="edit" value="' . $onoff . '" />' . '<input type="submit" value="' . get_string("blocksedit{$onoff}") . '" /> </form>'; } } $buttons .= '</span>'; } else { $buttons = ' '; } /// Build the meta /// Currently broken because the $meta is printed before the JavaScript is printed // if (!optional_param('pageid', 0, PARAM_INT) and !empty($this->activityrecord->mediafile)) { // // open our pop-up // $url = '/mod/lesson/mediafile.php?id='.$this->modulerecord->id; // $name = 'lessonmediafile'; // $options = 'menubar=0,location=0,left=5,top=5,scrollbars,resizable,width='. $this->activityrecord->mediawidth .',height='. $this->activityrecord->mediaheight; // $meta = "\n<script type=\"text/javascript\">"; // $meta .= "\n<!--\n"; // $meta .= " openpopup('$url', '$name', '$options', 0);"; // $meta .= "\n// -->\n"; // $meta .= '</script>'; // } else { $meta = ''; // } $navigation = build_navigation($morenavlinks, $this->modulerecord); print_header($title, $this->courserecord->fullname, $navigation, '', $meta, true, $buttons, user_login_string($this->courserecord) . '<hr style="width:95%">' . navmenu($this->courserecord, $this->modulerecord)); if (has_capability('mod/lesson:manage', $context)) { print_heading_with_help($activityname, 'overview', 'lesson'); // Rename our objects for the sake of the tab code list($cm, $course, $lesson, $currenttab) = array(&$this->modulerecord, &$this->courserecord, &$this->activityrecord, 'view'); include $CFG->dirroot . '/mod/lesson/tabs.php'; } else { print_heading($activityname); } lesson_print_messages(); }
$nonmembers[$userid] = groups_get_user_displayname($userid, $courseid); $potentialmemberscount++; } natcasesort($nonmembers); // Print out the HTML foreach ($nonmembers as $id => $name) { $potentialmembersoptions .= "<option value=\"{$id}\">{$name}</option>\n"; } } else { $potentialmembersoptions .= '<option> </option>'; } // Print the page and form $strgroups = get_string('groups'); $strparticipants = get_string('participants'); $groupname = groups_get_group_displayname($groupid); print_header("{$course->shortname}: {$strgroups}", $course->fullname, "<a href=\"{$CFG->wwwroot}/course/view.php?id={$courseid}\">{$course->shortname}</a> " . "-> <a href=\"{$CFG->wwwroot}/user/index.php?id={$courseid}\">{$strparticipants}</a> " . '-> <a href="' . format_string(groups_home_url($courseid, $groupid, $groupingid, false)) . "\">{$strgroups}</a>" . '-> ' . get_string('adduserstogroup', 'group'), '', '', true, '', user_login_string($course, $USER)); ?> <div id="addmembersform"> <h3 class="main"><?php print_string('adduserstogroup', 'group'); echo " {$groupname}"; ?> </h3> <form id="assignform" method="post" action=""> <div> <input type="hidden" name="sesskey" value="<?php p(sesskey()); ?> " /> <input type="hidden" name="courseid" value="<?php
function glossary_comment_print_header($course, $cm, $glossary, $entry, $action) { switch ($action) { case 'add': $straction = get_string('addingcomment', 'glossary'); break; case 'edit': $straction = get_string('editingcomment', 'glossary'); break; case 'delete': $straction = get_string('deletingcomment', 'glossary'); break; } $strglossary = get_string('modulename', 'glossary'); $strcomments = get_string('comments', 'glossary'); $navlinks = array(); $navlinks[] = array('name' => $strcomments, 'link' => "comments.php?id={$cm->id}&eid={$entry->id}", 'type' => 'title'); $navlinks[] = array('name' => $straction, 'link' => '', 'type' => 'action'); $navigation = build_navigation($navlinks, $cm); print_header_simple(format_string($glossary->name), '', $navigation, '', '', true, update_module_button($cm->id, $course->id, $strglossary), user_login_string($course) . '<hr style="width:95%">' . navmenu($course, $cm)); /// print original glossary entry for any comment action (add, update, delete) glossary_print_entry($course, $cm, $glossary, $entry, 'approval', '', false); }
calendar_set_filters($courses, $groups, $users); } // Let's see if we are supposed to provide a referring course link // but NOT for the "main page" course if ($SESSION->cal_course_referer != SITEID && ($shortname = get_field('course', 'shortname', 'id', $SESSION->cal_course_referer)) !== false) { require_login(); if (empty($course)) { $course = get_record('course', 'id', $SESSION->cal_course_referer); // Useful to have around } } $strcalendar = get_string('calendar', 'calendar'); $prefsbutton = calendar_preferences_button(); // Print title and header $navigation = build_navigation($navlinks); print_header("{$site->shortname}: {$strcalendar}: {$pagetitle}", $strcalendar, $navigation, '', '', true, $prefsbutton, user_login_string($site)); echo calendar_overlib_html(); // Layout the whole page as three big columns. echo '<table id="calendar" style="height:100%;">'; echo '<tr>'; // START: Main column echo '<td class="maincalendar">'; echo '<div class="heightcontainer">'; switch ($view) { case 'day': calendar_show_day($day, $mon, $yr, $courses, $groups, $users, $courseid); break; case 'month': calendar_show_month_detailed($mon, $yr, $courses, $groups, $users, $courseid); break; case 'upcoming':
} $edit = optional_param('edit', -1, PARAM_BOOL); $blockaction = optional_param('blockaction', '', PARAM_ALPHA); $PAGE->set_context(get_context_instance(CONTEXT_USER, $USER->id)); $PAGE->set_url('my/index.php'); $PAGE->set_blocks_editing_capability('moodle/my:manageblocks'); // Note: MDL-19010 there will be further changes to printing header and blocks. // The code will be much nicer than this eventually. $pageblocks = blocks_setup($PAGE, BLOCKS_PINNED_BOTH); if ($edit != -1 and $PAGE->user_allowed_editing()) { $USER->editing = $edit; } $button = update_mymoodle_icon($USER->id); $header = $SITE->shortname . ': ' . $strmymoodle; $navigation = build_navigation($strmymoodle); $loggedinas = user_login_string(); if (empty($CFG->langmenu)) { $langmenu = ''; } else { $currlang = current_language(); $langs = get_list_of_languages(); $langlabel = get_accesshide(get_string('language')); $langmenu = popup_form($CFG->wwwroot . '/my/index.php?lang=', $langs, 'chooselang', $currlang, '', '', '', true, 'self', $langlabel); } print_header($strmymoodle, $header, $navigation, '', '', true, $button, $loggedinas . $langmenu); echo '<table id="layout-table">'; echo '<tr valign="top">'; $lt = empty($THEME->layouttable) ? array('left', 'middle', 'right') : $THEME->layouttable; foreach ($lt as $column) { switch ($column) { case 'left':
function setVisibility(id, visibility) { document.getElemenotById(id).style.display = visibility; } </script> </head> <body> <?php require_once '../../config.php'; $navlinks[] = array('name' => 'Sell Books', 'link' => null, 'type' => 'activityinstance'); $navigation = build_navigation($navlinks); require_login(); // echo $OUTPUT->heading(); if (!$export) { print_header('Sell Books Form', 'Sell Books Form', $navigation, '', '', true, '', user_login_string($SITE) . $langmenu); } require_once 'breadcrumb.php'; global $USER; $action = optional_param('action', "", PARAM_ALPHANUM); //get action $book_id = optional_param('bookid', "", PARAM_ALPHANUM); //get book id require_once "tabs.php"; ?> <html> <head> <div style="width: 600px; align: center; margin-left: 300px; margin-right: 100px;"> <?php
if (!($context = get_context_instance_by_id($contextid))) { error('Incorrect context id'); } if (!($course = $DB->get_record('course', array('id' => $courseid_1)))) { echo "No course found for id=" . $courseid_1 . "."; print_error('nocourseid'); } require_login($courseid_1); $pagename = get_string('letters', 'grades'); // $navigation = grade_build_nav(__FILE__, $pagename, $courseid_1); $navlinks[] = array('name' => "Graph", 'link' => null, 'type' => 'activityinstance'); $navigation = build_navigation($navlinks); //print_header('Grader Report', 'Grader Report', $navigation, '', '', true, '', user_login_string($SITE).$langmenu); //print_grade_plugin_selector($courseid_1, 'edit', 'graph'); print_header('Grade: Graph', 'Grade: Graph', $navigation, '', '', true, '', user_login_string($SITE) . $langmenu); //print_grade_plugin_selector($courseid_1, 'edit', 'graph'); /*if ($context->contextlevel == CONTEXT_SYSTEM or $context->contextlevel == CONTEXT_COURSECAT) { require_once $CFG->libdir.'/adminlib.php'; require_login(); admin_externalpage_setup('letters'); $admin = true; } else if ($context->contextlevel == CONTEXT_COURSE) { require_login($context->instanceid); $admin = false; } else { error('Incorrect context level'); }
$modname = optional_param('modname', '', PARAM_ALPHA); // not used?? $modid = optional_param('modid', 'activity/All', PARAM_FILE); // not a file, but looks like it anyway $modaction = optional_param('modaction', '', PARAM_ALPHA); // not used?? $chooserecent = optional_param('chooserecent', 0, PARAM_INT); if (!($course = get_record("course", "id", $id))) { error("That's an invalid course id"); } require_login($course->id); add_to_log($course->id, "course", "recent", "recent.php?id={$course->id}", "{$course->id}"); $strrecentactivity = get_string("recentactivity"); $meta = '<meta name="robots" content="none" />'; // prevent duplicate content in search engines MDL-7299 $loggedinas = user_login_string($course, $USER); if (!empty($chooserecent)) { $userinfo = get_string("allparticipants"); $dateinfo = get_string("alldays"); if ($user) { if (!($u = get_record("user", "id", $user))) { error("That's an invalid user!"); } $userinfo = fullname($u); } if ($date) { $dateinfo = userdate($date, get_string("strftimedaydate")); } if ($course->id != SITEID) { print_header("{$course->shortname}: {$strrecentactivity}", $course->fullname, "<a href=\"view.php?id={$course->id}\">{$course->shortname}</a> ->\n <a href=\"recent.php?id={$course->id}\">{$strrecentactivity}</a> -> {$userinfo}, {$dateinfo}", "", $meta); } else {
add_to_log(SITEID, 'course', 'view', 'view.php?id=' . SITEID, SITEID); } if (empty($CFG->langmenu)) { $langmenu = ''; } else { $currlang = current_language(); $langs = get_list_of_languages(); $langlabel = get_accesshide(get_string('language')); $langmenu = popup_form($CFG->wwwroot . '/index.php?lang=', $langs, 'chooselang', $currlang, '', '', '', true, 'self', $langlabel); } $PAGE = page_create_object(PAGE_COURSE_VIEW, SITEID); $pageblocks = blocks_setup($PAGE); $editing = $PAGE->user_is_editing(); $preferred_width_left = bounded_number(BLOCK_L_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), BLOCK_L_MAX_WIDTH); $preferred_width_right = bounded_number(BLOCK_R_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]), BLOCK_R_MAX_WIDTH); print_header($SITE->fullname, $SITE->fullname, 'home', '', '<meta name="description" content="' . s(strip_tags($SITE->summary)) . '" />', true, '', user_login_string($SITE) . $langmenu); ?> <table id="layout-table" summary="layout"> <tr> <?php $lt = empty($THEME->layouttable) ? array('left', 'middle', 'right') : $THEME->layouttable; foreach ($lt as $column) { switch ($column) { case 'left': if (blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $editing) { echo '<td style="width: ' . $preferred_width_left . 'px;" id="left-column">'; print_container_start(); blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT); print_container_end();
/** * Can provide a course object to make the footer contain a link to * to the course home page, otherwise the link will go to the site home * @uses $USER * @param mixed $course course object, used for course link button or * 'none' means no user link, only docs link * 'empty' means nothing printed in footer * 'home' special frontpage footer * @param object $usercourse course used in user link * @param boolean $return output as string * @return mixed string or void */ function print_footer($course = NULL, $usercourse = NULL, $return = false) { global $USER, $CFG, $THEME, $COURSE, $SITE, $PAGE; if (defined('ADMIN_EXT_HEADER_PRINTED') and !defined('ADMIN_EXT_FOOTER_PRINTED')) { admin_externalpage_print_footer(); return; } $PAGE->set_state(moodle_page::STATE_PRINTING_FOOTER); /// Course links or special footer if ($course) { if ($course === 'empty') { // special hack - sometimes we do not want even the docs link in footer $output = ''; if (!empty($THEME->open_header_containers)) { for ($i = 0; $i < $THEME->open_header_containers; $i++) { $output .= print_container_end_all(); // containers opened from header } } else { //1.8 theme compatibility $output .= "\n</div>"; // content div } $output .= "\n</div>\n</body>\n</html>"; // close page div started in header if ($return) { return $output; } else { echo $output; return; } } else { if ($course === 'none') { // Don't print any links etc $homelink = ''; $loggedinas = ''; $home = false; } else { if ($course === 'home') { // special case for site home page - please do not remove $course = $SITE; $homelink = '<div class="sitelink">' . '<a title="Moodle ' . $CFG->release . '" href="http://moodle.org/">' . '<img style="width:100px;height:30px" src="' . $CFG->wwwroot . '/pix/moodlelogo.gif" alt="moodlelogo" /></a></div>'; $home = true; } else { if ($course === 'upgrade') { $home = false; $loggedinas = ''; $homelink = '<div class="sitelink">' . '<a title="Moodle ' . $CFG->target_release . '" href="http://docs.moodle.org/en/Administrator_documentation" onclick="this.target=\'_blank\'">' . '<img style="width:100px;height:30px" src="' . $CFG->wwwroot . '/pix/moodlelogo.gif" alt="moodlelogo" /></a></div>'; } else { $homelink = '<div class="homelink"><a ' . $CFG->frametarget . ' href="' . $CFG->wwwroot . '/course/view.php?id=' . $course->id . '">' . format_string($course->shortname) . '</a></div>'; $home = false; } } } } } else { $course = $SITE; // Set course as site course by default $homelink = '<div class="homelink"><a ' . $CFG->frametarget . ' href="' . $CFG->wwwroot . '/">' . get_string('home') . '</a></div>'; $home = false; } /// Set up some other navigation links (passed from print_header by ugly hack) $menu = isset($THEME->menu) ? str_replace('navmenu', 'navmenufooter', $THEME->menu) : ''; $title = isset($THEME->title) ? $THEME->title : ''; $button = isset($THEME->button) ? $THEME->button : ''; $heading = isset($THEME->heading) ? $THEME->heading : ''; $navigation = isset($THEME->navigation) ? $THEME->navigation : ''; $navmenulist = isset($THEME->navmenulist) ? $THEME->navmenulist : ''; /// Set the user link if necessary if (!$usercourse and is_object($course)) { $usercourse = $course; } if (!isset($loggedinas)) { $loggedinas = user_login_string($usercourse, $USER); } if ($loggedinas == $menu) { $menu = ''; } /// there should be exactly the same number of open containers as after the header if ($THEME->open_header_containers != open_containers()) { debugging('Unexpected number of open containers: ' . open_containers() . ', expecting ' . $THEME->open_header_containers, DEBUG_DEVELOPER); } /// Provide some performance info if required $performanceinfo = ''; if (defined('MDL_PERF') || (!empty($CFG->perfdebug) and $CFG->perfdebug > 7)) { $perf = get_performance_info(); if (defined('MDL_PERFTOLOG') && !function_exists('register_shutdown_function')) { error_log("PERF: " . $perf['txt']); } if (defined('MDL_PERFTOFOOT') || debugging() || $CFG->perfdebug > 7) { $performanceinfo = $perf['html']; } } /// Include the actual footer file ob_start(); include $CFG->footer; $output = ob_get_contents(); ob_end_clean(); $PAGE->set_state(moodle_page::STATE_DONE); if ($return) { return $output; } else { echo $output; } }
/** * 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); $navigation = build_navigation($this->strsubmissions, $this->cm); print_header_simple(format_string($this->assignment->name, true), "", $navigation, '', '', true, update_module_button($cm->id, $course->id, $this->strassignment), user_login_string($course) . '<hr style="width:95%">' . 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 if ($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); }
} } // Print the page and form $strgroups = get_string('groups'); $strparticipants = get_string('participants'); $stradduserstogroup = get_string('adduserstogroup', 'group'); $strusergroupmembership = get_string('usergroupmembership', 'group'); $groupname = format_string($group->name); $navlinks = array(); $navlinks[] = array('name' => $strparticipants, 'link' => "{$CFG->wwwroot}/user/index.php?id={$courseid}", 'type' => 'misc'); $navlinks[] = array('name' => $strgroups, 'link' => "{$CFG->wwwroot}/group/index.php?id={$courseid}", 'type' => 'misc'); $navlinks[] = array('name' => $stradduserstogroup, 'link' => null, 'type' => 'misc'); $navigation = build_navigation($navlinks); $PAGE->requires->js('group/clientlib.js'); $PAGE->requires->js_function_call('init_add_remove_members_page'); print_header("{$course->shortname}: {$strgroups}", $course->fullname, $navigation, '', '', true, '', user_login_string($course, $USER)); check_theme_arrows(); ?> <div id="addmembersform"> <h3 class="main"><?php print_string('adduserstogroup', 'group'); echo ": {$groupname}"; ?> </h3> <form id="assignform" method="post" action="<?php echo $CFG->wwwroot; ?> /group/members.php?group=<?php echo $groupid;
} elseif ($data = $editform->get_data()) { if ($data->id) { if (!groups_update_group($data, $editform->_upload_manager)) { error('Error updating group'); } } else { if (!($id = groups_create_group($data, $editform->_upload_manager))) { error('Error creating group'); } $returnurl = $CFG->wwwroot . '/group/index.php?id=' . $course->id . '&group=' . $id; } redirect($returnurl); } $strgroups = get_string('groups'); $strparticipants = get_string('participants'); if ($id) { $strheading = get_string('editgroupsettings', 'group'); } else { $strheading = get_string('creategroup', 'group'); } $navlinks = array(array('name' => $strparticipants, 'link' => $CFG->wwwroot . '/user/index.php?id=' . $courseid, 'type' => 'misc'), array('name' => $strgroups, 'link' => $CFG->wwwroot . '/group/index.php?id=' . $courseid, 'type' => 'misc'), array('name' => $strheading, 'link' => '', 'type' => 'misc')); $navigation = build_navigation($navlinks); /// Print header print_header_simple($strgroups, ': ' . $strgroups, $navigation, '', '', true, '', user_login_string($course) . '<hr style="width:95%">' . navmenu($course)); echo '<div id="grouppicture">'; if ($id) { print_group_picture($group, $course->id); } echo '</div>'; $editform->display(); print_footer($course);
if ($page_number < 1) { $page_number = 1; } //run the query against the index $sq = new SearchQuery($query_string, $page_number, 10, false); } if (!($site = get_site())) { redirect("index.php"); } $strsearch = get_string('search', 'search'); $strquery = get_string('enteryoursearchquery', 'search'); $navlinks[] = array('name' => $strsearch, 'link' => "index.php", 'type' => 'misc'); $navlinks[] = array('name' => $strquery, 'link' => null, 'type' => 'misc'); $navigation = build_navigation($navlinks); $site = get_site(); print_header("{$strsearch}", "{$site->fullname}", $navigation, "", "", true, " ", user_login_string($course) . '<hr style="width:95%">' . navmenu($site)); //keep things pretty, even if php5 isn't available if (!$check) { print_heading(search_check_php5(true)); print_footer(); exit(0); } print_box_start(); print_heading($strquery); print_box_start(); $vars = get_object_vars($adv); if (isset($vars)) { foreach ($vars as $key => $value) { // htmlentities breaks non-ascii chars $adv->key = stripslashes($value); //$adv->$key = stripslashes(htmlentities($value));
add_to_log(SITEID, 'course', 'view', 'view.php?id=' . SITEID, SITEID); } if (empty($CFG->langmenu)) { $langmenu = ''; } else { $currlang = current_language(); $langs = get_list_of_languages(); $langlabel = get_accesshide(get_string('language')); $langmenu = popup_form($CFG->wwwroot . '/index.php?lang=', $langs, 'chooselang', $currlang, '', '', '', true, 'self', $langlabel); } $PAGE = page_create_object(PAGE_COURSE_VIEW, SITEID); $pageblocks = blocks_setup($PAGE); $editing = $PAGE->user_is_editing(); $preferred_width_left = bounded_number(BLOCK_L_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), BLOCK_L_MAX_WIDTH); $preferred_width_right = bounded_number(BLOCK_R_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]), BLOCK_R_MAX_WIDTH); print_header($SITE->fullname, $SITE->fullname, 'home', '', '<meta name="description" content="' . strip_tags(format_text($SITE->summary, FORMAT_HTML)) . '" />', true, '', user_login_string($SITE) . $langmenu); ?> <table id="layout-table" summary="layout"> <tr> <?php $lt = empty($THEME->layouttable) ? array('left', 'middle', 'right') : $THEME->layouttable; foreach ($lt as $column) { switch ($column) { case 'left': if (blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $editing) { echo '<td style="width: ' . $preferred_width_left . 'px;" id="left-column">'; print_container_start(); blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT); print_container_end();
// no action $title = ''; break; } $form = stripslashes_recursive($form); if (!empty($SESSION->cal_course_referer)) { // TODO: This is part of the Great $course Hack in Moodle. Replace it at some point. $course = get_record('course', 'id', $SESSION->cal_course_referer); } else { $course = $site; } require_login($course, false); $navlinks[] = $calendar_navlink; $navlinks[] = array('name' => $title, 'link' => null, 'type' => 'misc'); $navigation = build_navigation($navlinks); print_header($site->shortname . ': ' . $strcalendar . ': ' . $title, $strcalendar, $navigation, 'eventform.name', '', true, '', user_login_string($site)); echo calendar_overlib_html(); echo '<table id="calendar">'; echo '<tr><td class="maincalendar">'; switch ($action) { case 'delete': $confirm = optional_param('confirm', 0, PARAM_INT); $repeats = optional_param('repeats', 0, PARAM_INT); if ($confirm and confirm_sesskey()) { // Kill it and redirect to day view if (($event = get_record('event', 'id', $eventid)) !== false) { if ($event->repeatid && $repeats) { delete_records('event', 'repeatid', $event->repeatid); add_to_log($event->courseid, 'calendar', 'delete all', '', $event->name); } else { delete_records('event', 'id', $eventid);