/** * Finish displaying the resource with the course blocks */ function display_course_blocks_end() { global $CFG; $PAGE = $this->PAGE; $pageblocks = blocks_setup($PAGE); $blocks_preferred_width = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]), 210); echo '</div>'; if (!empty($THEME->customcorners)) { print_custom_corners_end(); } echo '</td>'; if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $PAGE->user_is_editing()) { echo '<td style="width: ' . $blocks_preferred_width . 'px;" id="right-column">'; if (!empty($THEME->customcorners)) { print_custom_corners_start(); } blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT); if (!empty($THEME->customcorners)) { print_custom_corners_end(); } echo '</td>'; } echo '</tr></table>'; print_footer($this->course); }
} 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">'; if (!empty($THEME->customcorners)) { print_custom_corners_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); if (!empty($THEME->customcorners)) { print_custom_corners_end(); } echo '</td>'; } break; } } ?> </tr> </table> <?php print_footer('home'); // Please do not modify this line
/** * Print table ending tags for a side block box. */ function print_side_block_end($attributes = array()) { global $CFG, $THEME; echo '</div>'; if (!empty($THEME->customcorners)) { require_once $CFG->dirroot . '/lib/custom_corners_lib.php'; print_custom_corners_end(); } echo '</div>'; // IE workaround: if I do it THIS way, it works! WTF? if (!empty($CFG->allowuserblockhiding) && isset($attributes['id'])) { echo '<script type="text/javascript">' . "\n//<![CDATA[\n" . 'elementCookieHide("' . $attributes['id'] . '"); ' . "\n//]]>\n" . '</script>'; } }
function admin_externalpage_print_footer($adminroot) { global $CFG, $PAGE, $SITE, $THEME; if (!empty($SITE->fullname)) { $pageblocks = blocks_setup($PAGE); $preferred_width_right = bounded_number(BLOCK_R_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]), BLOCK_R_MAX_WIDTH); $lt = empty($THEME->layouttable) ? array('left', 'middle', 'right') : $THEME->layouttable; foreach ($lt as $column) { if ($column != 'middle') { array_shift($lt); } else { if ($column == 'middle') { break; } } } foreach ($lt as $column) { switch ($column) { case 'left': echo '<td style="width: ' . $preferred_width_left . 'px;" id="left-column">'; if (!empty($THEME->customcorners)) { print_custom_corners_start(); } blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT); if (!empty($THEME->customcorners)) { print_custom_corners_end(); } echo '</td>'; break; case 'middle': if (!empty($THEME->customcorners)) { print_custom_corners_end(); } echo '</td>'; break; case 'right': if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT)) { echo '<td style="width: ' . $preferred_width_right . 'px;" id="right-column">'; if (!empty($THEME->customcorners)) { print_custom_corners_start(); } blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT); if (!empty($THEME->customcorners)) { print_custom_corners_end(); } echo '</td>'; } break; } } echo '</tr></table>'; } print_footer(); }
//if ($user->lastaccess) { // if (time() - $user->lastaccess > $CFG->message_offline_time) { // echo get_string('offline', 'message').': '.format_time(time() - $user->lastaccess); // } else { // echo get_string('lastaccess').': '.get_string('ago', 'message', format_time(time() - $user->lastaccess)); // } //} else { // echo get_string("lastaccess").":". get_string("never"); //} //echo '</font>'; echo '<div class="commands">'; if ($contact = get_record('message_contacts', 'userid', $USER->id, 'contactid', $user->id)) { if ($contact->blocked) { message_contact_link($user->id, 'add', false, 'user.php?id=' . $user->id, true); message_contact_link($user->id, 'unblock', false, 'user.php?id=' . $user->id, true); } else { message_contact_link($user->id, 'remove', false, 'user.php?id=' . $user->id, true); message_contact_link($user->id, 'block', false, 'user.php?id=' . $user->id, true); } } else { message_contact_link($user->id, 'add', false, 'user.php?id=' . $user->id, true); message_contact_link($user->id, 'block', false, 'user.php?id=' . $user->id, true); } message_history_link($user->id, 0, false, '', '', 'both'); echo '</div>'; echo '</td></tr></table>'; if (!empty($THEME->customcorners)) { print_custom_corners_end(false, 'content'); } echo '</div></div></body></html>'; // Close possible theme tables off
function finish_page($course) { if (!empty($THEME->customcorners)) { print_custom_corners_end(); } echo '</td></tr></table>'; print_footer($course); exit; }
/** * 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; require_once $CFG->libdir . '/filelib.php'; /// 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; /// Fetch parameters $inpopup = optional_param('inpopup', 0, PARAM_BOOL); $page = optional_param('page', 0, PARAM_INT); $frameset = optional_param('frameset', '', PARAM_ALPHA); /// Init some variables $errorcode = 0; $buttontext = 0; $querystring = ''; $resourcetype = ''; $mimetype = mimeinfo("type", $resource->reference); $pagetitle = strip_tags($course->shortname . ': ' . format_string($resource->name)); $formatoptions = new object(); $formatoptions->noclean = true; /// Cache this per request static $items; /// Check for errors $errorcode = $this->check4errors($resource->reference, $course, $resource); /// If there are any error, show it instead of the resource page if ($errorcode) { if (!has_capability('moodle/course:activityvisibility', get_context_instance(CONTEXT_COURSE, $course->id))) { /// Resource not available page $errortext = get_string('resourcenotavailable', 'resource'); } else { /// Depending of the error, show different messages and pages if ($errorcode == 1) { $errortext = get_string('invalidfiletype', 'error', $resource->reference); } else { if ($errorcode == 2) { $errortext = get_string('filenotfound', 'error', $resource->reference); } else { if ($errorcode == 3) { $errortext = get_string('packagenotdeplyed', 'resource'); } else { if ($errorcode == 4) { $errortext = get_string('packagechanged', 'resource'); } else { if ($errorcode == 5) { $errortext = get_string('packagenotdeplyed', 'resource'); // no button though since from repository. } } } } } } /// Display the error and exit if ($inpopup) { print_header($pagetitle, $course->fullname . ' : ' . $resource->name); } else { $this->navlinks[] = array('name' => format_string($resource->name), 'link' => '', 'type' => 'activityinstance'); $this->navigation = build_navigation($this->navlinks); print_header($pagetitle, $course->fullname, $this->navigation, "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm)); } print_simple_box_start('center', '60%'); echo '<p align="center">' . $errortext . '</p>'; /// If errors were 3 or 4 and isteacheredit(), show the deploy button if (has_capability('moodle/course:manageactivities', get_context_instance(CONTEXT_COURSE, $course->id)) && ($errorcode == 3 || $errorcode == 4)) { $link = 'type/ims/deploy.php'; $options['courseid'] = $course->id; $options['cmid'] = $cm->id; $options['file'] = $resource->reference; $options['sesskey'] = $USER->sesskey; $options['inpopup'] = $inpopup; if ($errorcode == 3) { $label = get_string('deploy', 'resource'); } else { if ($errorcode == 4) { $label = get_string('redeploy', 'resource'); } } $method = 'post'; /// Let's go with the button echo '<center>'; print_single_button($link, $options, $label, $method); echo '</center>'; } print_simple_box_end(); /// Close button if inpopup if ($inpopup) { close_window_button(); } print_footer(); exit; } /// Load serialized IMS CP index to memory only once. if (empty($items)) { if (!$this->isrepository) { $resourcedir = $CFG->dataroot . '/' . $course->id . '/' . $CFG->moddata . '/resource/' . $resource->id; } else { $resourcedir = $CFG->repository . $resource->reference; } if (!($items = ims_load_serialized_file($resourcedir . '/moodle_inx.ser'))) { error(get_string('errorreadingfile', 'error', 'moodle_inx.ser')); } } /// Check whether this is supposed to be a popup, but was called directly if (empty($frameset) && $resource->popup && !$inpopup) { /// Make a page and a pop-up window $this->navlinks[] = array('name' => format_string($resource->name), 'link' => null, 'type' => 'misc'); $this->navigation = build_navigation($this->navlinks); print_header($pagetitle, $course->fullname, $this->navigation, "", "", true, update_module_button($cm->id, $course->id, $this->strresource), 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}\" target=\"resource{$resource->id}\" onclick=\"return openpopup('/mod/resource/view.php?inpopup=true&id={$cm->id}', 'resource{$resource->id}','{$resource->popup}');\">" . format_string($resource->name, true) . "</a>"; echo "<p> </p>"; echo '<p align="center">'; print_string('popupresource', 'resource'); echo '<br />'; print_string('popupresourcelink', 'resource', $link); echo "</p>"; print_footer($course); exit; } /// No frames or framesets anymore, except iframe. in print_ims, iframe filled. /// needs callback to this file to display table of contents in the iframe so /// $frameset = 'toc' leads to output of toc and blank or 'ims' produces the /// iframe. if (empty($frameset) || $frameset == 'ims') { /// Conditional argument to pass to IMS JavaScript. Need to be global to retrieve it from our custom javascript! :-( global $jsarg; $jsarg = 'false'; if (!empty($this->parameters->navigationmenu)) { $jsarg = 'true'; } /// Define $CFG->javascript to use our custom javascript. Save the original one to add it from ours. Global too! :-( global $standard_javascript; $standard_javascript = $CFG->javascript; // Save original javascript file $CFG->javascript = $CFG->dirroot . '/mod/resource/type/ims/javascript.php'; //Use our custom IMS javascript code /// moodle header if ($resource->popup) { //print_header($pagetitle, $course->fullname.' : '.$resource->name); print_header(); } else { $this->navlinks[] = array('name' => format_string($resource->name), 'link' => '', 'type' => 'activityinstance'); $this->navigation = build_navigation($this->navlinks); print_header($pagetitle, $course->fullname, $this->navigation, "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm, "parent")); } /// content - this produces everything else $this->print_ims($cm, $course, $items, $resource, $page); /// Now, let's print the footer. It's harcoded here to save some space /// because it's impossible to use print_footer() to print NOTHING /// Added programatic support to customcorners themes. if (!empty($THEME->customcorners)) { print_custom_corners_end(false, 'content'); } echo '</div></div></body></html>'; /// Close everything. /// log it. add_to_log($course->id, "resource", "view", "view.php?id={$cm->id}", $resource->id, $cm->id); exit; } if ($frameset == 'toc') { print_header(); $this->print_toc($items, $resource, $page); echo '</div></div></body></html>'; exit; } }