コード例 #1
0
ファイル: outputrenderers.php プロジェクト: afgal/moodle-1
    /**
     * Start output by sending the HTTP headers, and printing the HTML <head>
     * and the start of the <body>.
     *
     * To control what is printed, you should set properties on $PAGE. If you
     * are familiar with the old {@link print_header()} function from Moodle 1.9
     * you will find that there are properties on $PAGE that correspond to most
     * of the old parameters to could be passed to print_header.
     *
     * Not that, in due course, the remaining $navigation, $menu parameters here
     * will be replaced by more properties of $PAGE, but that is still to do.
     *
     * @return string HTML that you must output this, preferably immediately.
     */
    public function header() {
        global $USER, $CFG;

        if (\core\session\manager::is_loggedinas()) {
            $this->page->add_body_class('userloggedinas');
        }

        // If the user is logged in, and we're not in initial install,
        // check to see if the user is role-switched and add the appropriate
        // CSS class to the body element.
        if (!during_initial_install() && isloggedin() && is_role_switched($this->page->course->id)) {
            $this->page->add_body_class('userswitchedrole');
        }

        // Give themes a chance to init/alter the page object.
        $this->page->theme->init_page($this->page);

        $this->page->set_state(moodle_page::STATE_PRINTING_HEADER);

        // Find the appropriate page layout file, based on $this->page->pagelayout.
        $layoutfile = $this->page->theme->layout_file($this->page->pagelayout);
        // Render the layout using the layout file.
        $rendered = $this->render_page_layout($layoutfile);

        // Slice the rendered output into header and footer.
        $cutpos = strpos($rendered, $this->unique_main_content_token);
        if ($cutpos === false) {
            $cutpos = strpos($rendered, self::MAIN_CONTENT_TOKEN);
            $token = self::MAIN_CONTENT_TOKEN;
        } else {
            $token = $this->unique_main_content_token;
        }

        if ($cutpos === false) {
            throw new coding_exception('page layout file ' . $layoutfile . ' does not contain the main content placeholder, please include "<?php echo $OUTPUT->main_content() ?>" in theme layout file.');
        }
        $header = substr($rendered, 0, $cutpos);
        $footer = substr($rendered, $cutpos + strlen($token));

        if (empty($this->contenttype)) {
            debugging('The page layout file did not call $OUTPUT->doctype()');
            $header = $this->doctype() . $header;
        }

        // If this theme version is below 2.4 release and this is a course view page
        if ((!isset($this->page->theme->settings->version) || $this->page->theme->settings->version < 2012101500) &&
                $this->page->pagelayout === 'course' && $this->page->url->compare(new moodle_url('/course/view.php'), URL_MATCH_BASE)) {
            // check if course content header/footer have not been output during render of theme layout
            $coursecontentheader = $this->course_content_header(true);
            $coursecontentfooter = $this->course_content_footer(true);
            if (!empty($coursecontentheader)) {
                // display debug message and add header and footer right above and below main content
                // Please note that course header and footer (to be displayed above and below the whole page)
                // are not displayed in this case at all.
                // Besides the content header and footer are not displayed on any other course page
                debugging('The current theme is not optimised for 2.4, the course-specific header and footer defined in course format will not be output', DEBUG_DEVELOPER);
                $header .= $coursecontentheader;
                $footer = $coursecontentfooter. $footer;
            }
        }

        send_headers($this->contenttype, $this->page->cacheable);

        $this->opencontainers->push('header/footer', $footer);
        $this->page->set_state(moodle_page::STATE_IN_BODY);

        return $header . $this->skip_link_target('maincontent');
    }
コード例 #2
0
ファイル: renderers.php プロジェクト: nigeli/moodle
    /**
     * Renders the header for the page
     *
     * @return string
     */
    public function header() {
        global $USER, $CFG;

        if (session_is_loggedinas()) {
            $this->page->add_body_class('userloggedinas');
        }

        $this->page->set_state(moodle_page::STATE_PRINTING_HEADER);

        // Find the appropriate page layout file, based on $this->page->pagelayout.
        $layoutfile = $this->page->theme->layout_file($this->page->pagelayout);
        // Render the layout using the layout file.
        $rendered = $this->render_page_layout($layoutfile);

        // Slice the rendered output into header and footer.
        $cutpos = strpos($rendered, $this->unique_main_content_token);
        if ($cutpos === false) {
            $cutpos = strpos($rendered, self::MAIN_CONTENT_TOKEN);
            $token = self::MAIN_CONTENT_TOKEN;
        } else {
            $token = $this->unique_main_content_token;
        }

        if ($cutpos === false) {
            // TODO: Search for a better solution to this... check this is even needed?
            //       The following code will lead to header containing nothing, and
            //       footer containing all of the content for the template.
            // turned off error by john for ajax load of blocks without main content.
            // throw new coding_exception('page layout file ' . $layoutfile .
            //        ' does not contain the string "' . self::MAIN_CONTENT_TOKEN . '".');
        }
        $header = substr($rendered, 0, $cutpos);
        $footer = substr($rendered, $cutpos + strlen($token));

        if (empty($this->contenttype)) {
            debugging('The page layout file did not call $OUTPUT->doctype()');
            $header = $this->doctype() . $header;
        }

        send_headers($this->contenttype, $this->page->cacheable);

        $this->opencontainers->push('header/footer', $footer);
        $this->page->set_state(moodle_page::STATE_IN_BODY);

        return $header . $this->skip_link_target('maincontent');
    }
コード例 #3
0
 /**
  * Start output by sending the HTTP headers, and printing the HTML <head>
  * and the start of the <body>.
  *
  * To control what is printed, you should set properties on $PAGE. If you
  * are familiar with the old {@link print_header()} function from Moodle 1.9
  * you will find that there are properties on $PAGE that correspond to most
  * of the old parameters to could be passed to print_header.
  *
  * Not that, in due course, the remaining $navigation, $menu parameters here
  * will be replaced by more properties of $PAGE, but that is still to do.
  *
  * @return string HTML that you must output this, preferably immediately.
  */
 public function header()
 {
     global $USER, $CFG;
     if (session_is_loggedinas()) {
         $this->page->add_body_class('userloggedinas');
     }
     $this->page->set_state(moodle_page::STATE_PRINTING_HEADER);
     // Find the appropriate page layout file, based on $this->page->pagelayout.
     $layoutfile = $this->page->theme->layout_file($this->page->pagelayout);
     // Render the layout using the layout file.
     $rendered = $this->render_page_layout($layoutfile);
     // Slice the rendered output into header and footer.
     $cutpos = strpos($rendered, $this->unique_main_content_token);
     if ($cutpos === false) {
         $cutpos = strpos($rendered, self::MAIN_CONTENT_TOKEN);
         $token = self::MAIN_CONTENT_TOKEN;
     } else {
         $token = $this->unique_main_content_token;
     }
     if ($cutpos === false) {
         throw new coding_exception('page layout file ' . $layoutfile . ' does not contain the main content placeholder, please include "<?php echo $OUTPUT->main_content() ?>" in theme layout file.');
     }
     $header = substr($rendered, 0, $cutpos);
     $footer = substr($rendered, $cutpos + strlen($token));
     if (empty($this->contenttype)) {
         debugging('The page layout file did not call $OUTPUT->doctype()');
         $header = $this->doctype() . $header;
     }
     send_headers($this->contenttype, $this->page->cacheable);
     $this->opencontainers->push('header/footer', $footer);
     $this->page->set_state(moodle_page::STATE_IN_BODY);
     return $header . $this->skip_link_target('maincontent');
 }
コード例 #4
0
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML dir="<?php 
echo $Align == "right" ? "RTL" : "LTR";
?>
">
<HEAD>
<SCRIPT TYPE="text/javascript" LANGUAGE="javascript">
<!--
window.name="login";
//-->
</SCRIPT>
<?php 
// You can put html head statements right after the "<HEAD>" tag.
// Both values are boolean. See explanations in 'remotelogin.lib.php' file.
send_headers(1, 1);
?>
</HEAD>
<BODY<?php 
echo C_FILLED_LOGIN ? " CLASS=\"ChatBody\"" : "";
echo C_BACKGR_IMG && C_BACKGR_IMG_PATH != "" ? " style=\"background-image: url(" . C_BACKGR_IMG_PATH . "); background-attachment: fixed;\"" : "";
?>
>
<CENTER>
<?php 
// You can put html statements right after the "<BODY>" tag or add php code here.
$Is_Error = isset($Error);
if (isset($_COOKIE)) {
    if (isset($_COOKIE["CookieUsername"])) {
        $CookieUsername = urldecode($_COOKIE["CookieUsername"]);
    }
コード例 #5
0
ファイル: api.php プロジェクト: joran98/laclef-webapp
function forbidden()
{
    header(':', true, 403);
    send_headers();
    $response = array("version" => $version, "response" => "Forbidden");
    echo json_encode($response);
}
コード例 #6
0
ファイル: page-header.php プロジェクト: Br3nda/wrms
    }
    $theme->HTMLHeader();
    if ($theme->panel_top) {
        $theme->PageHeader();
    }
    $theme->BeginPanels();
    if ($theme->panel_left) {
        $theme->LeftPanel();
    }
    $theme->BeginContentArea();
    if (isset($client_messages) && is_array($client_messages) && count($client_messages) > 0 || count($c->messages) > 0) {
        echo "<div id=\"messages\"><ul class=\"messages\">\n";
        foreach ($client_messages as $i => $msg) {
            // ##HelpTextKey## gets converted to a "/help.php?h=HelpTextKey" link
            $msg = preg_replace_callback("/##([^#]+)##/", "make_help_link", $msg);
            echo "<li class=\"messages\">{$msg}</li>\n";
        }
        foreach ($c->messages as $i => $msg) {
            // ##HelpTextKey## gets converted to a "/help.php?h=HelpTextKey" link
            $msg = preg_replace_callback("/##([^#]+)##/", "make_help_link", $msg);
            echo "<li class=\"messages\">{$msg}</li>\n";
        }
        echo "</ul></div>\n";
    }
    if (isset($tmnu) && is_object($tmnu)) {
        $tmnu->LinkActiveSubMenus();
        $theme->TopMenuBar($tmnu);
    }
}
send_headers();
コード例 #7
0
 /**
  * Start output by sending the HTTP headers, and printing the HTML <head>
  * and the start of the <body>.
  *
  * To control what is printed, you should set properties on $PAGE. If you
  * are familiar with the old {@link print_header()} function from Moodle 1.9
  * you will find that there are properties on $PAGE that correspond to most
  * of the old parameters to could be passed to print_header.
  *
  * Not that, in due course, the remaining $navigation, $menu parameters here
  * will be replaced by more properties of $PAGE, but that is still to do.
  *
  * @param string $navigation legacy, like the old parameter to print_header. Will be
  *      removed when there is a $PAGE->... replacement.
  * @param string $menu legacy, like the old parameter to print_header. Will be
  *      removed when there is a $PAGE->... replacement.
  * @return string HTML that you must output this, preferably immediately.
  */
 public function header($navigation = '', $menu = '')
 {
     // TODO remove $navigation and $menu arguments - replace with $PAGE->navigation
     global $USER, $CFG;
     if (isloggedin()) {
         include $CFG->libdir . '/offline/lib.php';
         $menu = offline_output_menu($menu);
     }
     $this->page->set_state(moodle_page::STATE_PRINTING_HEADER);
     // Find the appropriate page template, based on $this->page->generaltype.
     $templatefile = $this->page->theme->template_for_page($this->page->generaltype);
     if ($templatefile) {
         // Render the template.
         $template = $this->render_page_template($templatefile, $menu, $navigation);
     } else {
         // New style template not found, fall back to using header.html and footer.html.
         $template = $this->handle_legacy_theme($navigation, $menu);
     }
     // Slice the template output into header and footer.
     $cutpos = strpos($template, self::MAIN_CONTENT_TOKEN);
     if ($cutpos === false) {
         throw new coding_exception('Layout template ' . $templatefile . ' does not contain the string "' . self::MAIN_CONTENT_TOKEN . '".');
     }
     $header = substr($template, 0, $cutpos);
     $footer = substr($template, $cutpos + strlen(self::MAIN_CONTENT_TOKEN));
     if (empty($this->contenttype)) {
         debugging('The layout template did not call $OUTPUT->doctype()');
         $this->doctype();
     }
     send_headers($this->contenttype, $this->page->cacheable);
     $this->opencontainers->push('header/footer', $footer);
     $this->page->set_state(moodle_page::STATE_IN_BODY);
     return $header . $this->skip_link_target();
 }
コード例 #8
0
ファイル: registrationreturn.php プロジェクト: evltuma/moodle
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript">
//<![CDATA[
top.location.href = '{$redirect}';
//]]
</script>
</head>
<body>
<noscript>
{$clickhere}
</noscript>
</body>
</html>
EOD;
    // We always send the headers because they set the encoding.
    send_headers('text/html; charset=utf-8', false);
    echo $html;
} else {
    if (!empty($msg) && !empty($err)) {
        $params = array();
        $params['sesskey'] = sesskey();
        $params['top'] = '1';
        if (!empty($err)) {
            $params['lti_errormsg'] = $err;
        }
        if (!empty($id)) {
            $params['id'] = $id;
        }
        $redirect = new moodle_url('/mod/lti/registrationreturn.php', $params);
        $redirect = $redirect->out(false);
        redirect($redirect, $err);