コード例 #1
0
 /**
  * Prints the page header.
  */
 function print_header()
 {
     global $CFG, $USER, $PAGE;
     require_once $CFG->libdir . '/blocklib.php';
     require_once $CFG->dirroot . '/course/lib.php';
     require_once $CFG->dirroot . '/my/pagelib.php';
     /// My Moodle arguments:
     $edit = optional_param('edit', -1, PARAM_BOOL);
     $blockaction = optional_param('blockaction', '', PARAM_ALPHA);
     $mymoodlestr = get_string('mymoodle', 'my');
     if (isguest()) {
         $wwwroot = $CFG->wwwroot . '/login/index.php';
         if (!empty($CFG->loginhttps)) {
             $wwwroot = str_replace('http:', 'https:', $wwwroot);
         }
         print_header($mymoodlestr);
         notice_yesno(get_string('noguest', 'my') . '<br /><br />' . get_string('liketologin'), $wwwroot, $CFG->wwwroot);
         print_footer();
         die;
     }
     /// Add curriculum stylesheets...
     if (file_exists($CFG->dirroot . '/curriculum/styles.css')) {
         $CFG->stylesheets[] = $CFG->wwwroot . '/curriculum/styles.css';
     }
     /// Fool the page library into thinking we're in My Moodle.
     $CFG->pagepath = $CFG->wwwroot . '/my/index.php';
     $PAGE = page_create_instance($USER->id);
     if ($section = optional_param('section', '', PARAM_ALPHAEXT)) {
         $PAGE->section = $section;
     }
     $this->pageblocks = blocks_setup($PAGE, BLOCKS_PINNED_BOTH);
     /// Make sure that the curriculum block is actually on this
     /// user's My Moodle page instance.
     if ($cablockid = get_field('block', 'id', 'name', 'curr_admin')) {
         if (!record_exists('block_pinned', 'blockid', $cablockid, 'pagetype', 'my-index')) {
             blocks_execute_action($PAGE, $this->pageblocks, 'add', (int) $cablockid, true, false);
         }
     }
     if ($edit != -1 and $PAGE->user_allowed_editing()) {
         $USER->editing = $edit;
     }
     //$PAGE->print_header($mymoodlestr);
     $title = $this->get_title();
     print_header($title, $title, build_navigation($this->get_navigation()));
     echo '<table border="0" cellpadding="3" cellspacing="0" width="100%" id="layout-table">';
     echo '<tr valign="top">';
     $blocks_preferred_width = bounded_number(180, blocks_preferred_width($this->pageblocks[BLOCK_POS_LEFT]), 210);
     if (blocks_have_content($this->pageblocks, BLOCK_POS_LEFT) || $PAGE->user_is_editing()) {
         echo '<td style="vertical-align: top; width: ' . $blocks_preferred_width . 'px;" id="left-column">';
         blocks_print_group($PAGE, $this->pageblocks, BLOCK_POS_LEFT);
         echo '</td>';
     }
     echo '<td valign="top" id="middle-column">';
     if (blocks_have_content($this->pageblocks, BLOCK_POS_CENTRE) || $PAGE->user_is_editing()) {
         blocks_print_group($PAGE, $this->pageblocks, BLOCK_POS_CENTRE);
     }
 }
コード例 #2
0
}
require_login();
$mymoodlestr = get_string('mymoodle', 'my');
if (isguest()) {
    $wwwroot = $CFG->wwwroot . '/login/index.php';
    if (!empty($CFG->loginhttps)) {
        $wwwroot = str_replace('http:', 'https:', $wwwroot);
    }
    print_header($mymoodlestr);
    notice_yesno(get_string('noguest', 'my') . '<br /><br />' . get_string('liketologin'), $wwwroot, $CFG->wwwroot);
    print_footer();
    die;
}
$edit = optional_param('edit', -1, PARAM_BOOL);
$blockaction = optional_param('blockaction', '', PARAM_ALPHA);
$PAGE = page_create_instance($USER->id);
$pageblocks = blocks_setup($PAGE, BLOCKS_PINNED_BOTH);
if ($edit != -1 and $PAGE->user_allowed_editing()) {
    $USER->editing = $edit;
}
$PAGE->print_header($mymoodlestr);
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':
            $blocks_preferred_width = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), 210);
            if (blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $PAGE->user_is_editing()) {
                echo '<td style="vertical-align: top; width: ' . $blocks_preferred_width . 'px;" id="left-column">';
                print_container_start();
コード例 #3
0
$SESSION->dataprefs[$data->id]['sort'] = $sort;
// Make it sticky
$order = optional_param('order', $SESSION->dataprefs[$data->id]['order'], PARAM_ALPHA) == 'ASC' ? 'ASC' : 'DESC';
$SESSION->dataprefs[$data->id]['order'] = $order;
// Make it sticky
$oldperpage = get_user_preferences('data_perpage_' . $data->id, 10);
$perpage = optional_param('perpage', $oldperpage, PARAM_INT);
if ($perpage < 2) {
    $perpage = 2;
}
if ($perpage != $oldperpage) {
    set_user_preference('data_perpage_' . $data->id, $perpage);
}
add_to_log($course->id, 'data', 'view', "view.php?id={$cm->id}", $data->id, $cm->id);
// Initialize $PAGE, compute blocks
$PAGE = page_create_instance($data->id);
$pageblocks = blocks_setup($PAGE);
$blocks_preferred_width = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), 210);
if ($edit != -1 and $PAGE->user_allowed_editing()) {
    $USER->editing = $edit;
}
/// RSS and CSS and JS meta
$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 . '" /> ';
}
コード例 #4
0
ファイル: view.php プロジェクト: r007/PMoodle
if (isguestuser()) {
    $navigation = build_navigation('', $cm);
    print_header_simple(format_string($chat->name), '', $navigation, '', '', true, '', navmenu($course, $cm));
    $wwwroot = $CFG->wwwroot . '/login/index.php';
    if (!empty($CFG->loginhttps)) {
        $wwwroot = str_replace('http:', 'https:', $wwwroot);
    }
    notice_yesno(get_string('noguests', 'chat') . '<br /><br />' . get_string('liketologin'), $wwwroot, $CFG->wwwroot . '/course/view.php?id=' . $course->id);
    print_footer($course);
    exit;
} else {
    require_capability('mod/chat:chat', $context);
}
add_to_log($course->id, 'chat', 'view', "view.php?id={$cm->id}", $chat->id, $cm->id);
// Initialize $PAGE, compute blocks
$PAGE = page_create_instance($chat->id);
$pageblocks = blocks_setup($PAGE);
$blocks_preferred_width = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), 210);
/// Print the page header
$strenterchat = get_string('enterchat', 'chat');
$stridle = get_string('idle', 'chat');
$strcurrentusers = get_string('currentusers', 'chat');
$strnextsession = get_string('nextsession', 'chat');
if ($edit != -1 and $PAGE->user_allowed_editing()) {
    $USER->editing = $edit;
}
$PAGE->print_header($course->shortname . ': %fullname%');
echo '<table id="layout-table"><tr>';
$lt = empty($THEME->layouttable) ? array('left', 'middle', 'right') : $THEME->layouttable;
foreach ($lt as $column) {
    switch ($column) {
コード例 #5
0
}
$game->showtimetaken = 1;
//check bdaloukas
$game->timelimit = 0;
//check bdaloukas
$game->timeclose = 0;
//check bdaloukas
// Check login and get context.
require_login($course->id, false, $cm);
if ($USER->username == 'guest') {
    redirect("{$CFG->wwwroot}/mod/game/attempt.php?id={$id}");
}
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
add_to_log($course->id, "game", "view", "view.php?id={$cm->id}", $game->id, $cm->id);
// Initialize $PAGE, compute blocks
$PAGE = page_create_instance($game->id);
$pageblocks = blocks_setup($PAGE);
$blocks_preferred_width = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), 210);
// Print the page header
if ($edit != -1 and $PAGE->user_allowed_editing()) {
    $USER->editing = $edit;
}
//only check pop ups if the user is not a teacher, and popup is set
if (function_exists('build_navigation')) {
    //for version 1.9
    $navigation = build_navigation('', $cm);
    $PAGE->print_header($course->shortname . ': %fullname%', '', $navigation);
} else {
    if ($course->category) {
        $navigation = "<a href=\"{$CFG->wwwroot}/course/view.php?id={$course->id}\">{$course->shortname}</a> ->";
    } else {
コード例 #6
0
        error("The course with id {$quiz->course} that the quiz with id {$q} belongs to is missing");
    }
    if (!($cm = get_coursemodule_from_instance("quiz", $quiz->id, $course->id))) {
        error("The course module for the quiz with id {$q} is missing");
    }
}
// Check login and get context.
require_login($course->id, false, $cm);
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
// if no questions have been set up yet redirect to edit.php
if (!$quiz->questions and has_capability('mod/quiz:manage', $context)) {
    redirect($CFG->wwwroot . '/mod/quiz/edit.php?cmid=' . $cm->id);
}
add_to_log($course->id, "quiz", "view", "view.php?id={$cm->id}", $quiz->id, $cm->id);
// Initialize $PAGE, compute blocks
$PAGE = page_create_instance($quiz->id);
$pageblocks = blocks_setup($PAGE);
$blocks_preferred_width = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), 210);
// Print the page header
if ($edit != -1 and $PAGE->user_allowed_editing()) {
    $USER->editing = $edit;
}
//only check pop ups if the user is not a teacher, and popup is set
$bodytags = has_capability('mod/quiz:attempt', $context) && $quiz->popup ? 'onload="popupchecker(\'' . get_string('popupblockerwarning', 'quiz') . '\');"' : '';
$PAGE->print_header($course->shortname . ': %fullname%', '', $bodytags);
echo '<table id="layout-table"><tr>';
if (!empty($CFG->showblocksonmodpages) && (blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $PAGE->user_is_editing())) {
    echo '<td style="width: ' . $blocks_preferred_width . 'px;" id="left-column">';
    print_container_start();
    blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
    print_container_end();
コード例 #7
0
    // bigbluebutton_update_bigbluebutton_times($c);
    if (!($bigbluebutton = get_record('bigbluebutton', 'id', $c))) {
        error('The course module ID is incorrect.');
    }
    if (!($course = get_record('course', 'id', $bigbluebutton->course))) {
        error('The course is misconfigured.');
    }
    if (!($cm = get_coursemodule_from_instance('bigbluebutton', $bigbluebutton->id, $course->id))) {
        error('The module ID is incorrect.');
    }
}
require_course_login($course, true, $cm);
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
add_to_log($course->id, 'bigbluebutton', 'view', "view.php?id={$cm->id}", $bigbluebutton->id, $cm->id);
/// Initialize $PAGE
$PAGE = page_create_instance($bigbluebutton->id);
$pageblocks = blocks_setup($PAGE);
$blocks_preferred_width = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), 210);
/// Print the page header
$strnextsession = get_string('nextsession', 'bigbluebutton');
if (!empty($edit) && $PAGE->user_allowed_editing()) {
    if ($edit == 'on') {
        $USER->editing = true;
    } else {
        if ($edit == 'off') {
            $USER->editing = false;
        }
    }
}
$PAGE->print_header($course->shortname . ': %fullname%');
echo '<table id="layout-table"><tr>';
コード例 #8
0
 // Get update button, if allowed for current user
 $strforum = get_string("modulename", "forum");
 $buttontext = $forum->display_search_form();
 // Atom header meta tag
 $feedtype = $forum->get_effective_feed_option();
 if ($feedtype == forum::FEEDTYPE_DISCUSSIONS || $feedtype == forum::FEEDTYPE_ALL_POSTS && $forum->can_view_discussions()) {
     $atomurl = $forum->get_feed_url(forum::FEEDFORMAT_ATOM, $groupid);
     $meta = '<link rel="alternate" type="application/atom+xml" ' . 'title="Atom feed" href="' . htmlspecialchars($atomurl) . '" />';
 } else {
     $meta = '';
 }
 // Initialize $PAGE, compute blocks
 require_once $CFG->dirroot . '/mod/forumng/pagelib.php';
 global $CURRENTFORUM;
 $CURRENTFORUM = $forum;
 $PAGE = page_create_instance($forum->get_id());
 $pageblocks = blocks_setup($PAGE);
 if (class_exists('ouflags') && ou_get_is_mobile()) {
     ou_mobile_configure_theme();
 }
 // Check for editing on/off button presses
 if ($PAGE->user_allowed_editing()) {
     $edit = optional_param('edit', -1, PARAM_BOOL);
     $goback = false;
     if (class_exists('ouflags')) {
         // OU only: support edit locking and per-course editing
         $resetlock = optional_param('resetlock', 0, PARAM_BOOL);
         if ($edit != -1 || $resetlock == 1) {
             // Update user editing status
             updateediting($edit, $resetlock, $course);
             $goback = true;
コード例 #9
0
ファイル: view.php プロジェクト: JackCanada/moodle-hacks
         if ($gradeinfo->attempts) {
             if ($gradeinfo->nquestions < $lesson->minquestions) {
                 $a = new stdClass();
                 $a->nquestions = $gradeinfo->nquestions;
                 $a->minquestions = $lesson->minquestions;
                 lesson_set_message(get_string('numberofpagesviewednotice', 'lesson', $a));
             }
             lesson_set_message(get_string("numberofcorrectanswers", "lesson", $gradeinfo->earned), 'notify');
             $a = new stdClass();
             $a->grade = number_format($gradeinfo->grade * $lesson->grade / 100, 1);
             $a->total = $lesson->grade;
             lesson_set_message(get_string('yourcurrentgradeisoutof', 'lesson', $a), 'notify');
         }
     }
 }
 $PAGE = page_create_instance($lesson->id);
 $PAGE->set_lessonpageid($page->id);
 $pageblocks = blocks_setup($PAGE);
 $leftcolumnwidth = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), 210);
 $rightcolumnwidth = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]), 210);
 if ($edit != -1 and $PAGE->user_allowed_editing()) {
     $USER->editing = $edit;
 }
 /// Print the page header, heading and tabs
 $PAGE->print_header();
 if ($attemptflag) {
     print_heading(get_string('attempt', 'lesson', $retries + 1));
 }
 /// This calculates and prints the ongoing score
 if ($lesson->ongoing and !empty($pageid)) {
     lesson_print_ongoing_score($lesson);
コード例 #10
0
    // to users who can post
    $hideunusedblog = !$posts && !$canpost && !$canaudit;
    if ($hideunusedblog) {
        print_header();
    } else {
        $navigation = oublog_build_navigation($cm, $oublog, $oubloginstance, $oubloguser, $extranav);
        print_header_simple(format_string($oublog->name), "", $navigation, "", oublog_get_meta_tags($oublog, $oubloginstance, $currentgroup, $cm), true, $buttontext, navmenu($course, $cm));
    }
} else {
    $navigation = oublog_build_navigation($cm, $oublog, $oubloginstance, null, $extranav);
    print_header_simple(format_string($oublog->name), "", $navigation, "", oublog_get_meta_tags($oublog, $oubloginstance, $currentgroup, $cm), true, $buttontext, navmenu($course, $cm));
}
print '<div class="oublog-topofpage"></div>';
require_once dirname(__FILE__) . '/pagelib.php';
// Initialize $PAGE, compute blocks
$PAGE = page_create_instance($oublog->id);
$pageblocks = blocks_setup($PAGE);
$editing = isediting($cm->course);
if (class_exists('ouflags') && ou_get_is_mobile() && $blogdets == 'show') {
    print '<div id="middle-column">';
    ou_print_mobile_navigation($id, $blogdets, null, $user);
} else {
    // The left column ...
    if ($hasleft = !empty($CFG->showblocksonmodpages) && (blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $editing)) {
        print '<div id="left-column">';
        blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
        print '</div>';
    }
    print '</div>';
    // fix mixed columns in rtl mode and editing mode (nadavkav patch)
    // The right column, BEFORE the middle-column.
コード例 #11
0
ファイル: view.php プロジェクト: kai707/ITSA-backup
    dimdim_update_dimdim_times($c);
    if (!($dimdim = get_record('dimdim', 'id', $c))) {
        error('Course module is incorrect');
    }
    if (!($course = get_record('course', 'id', $dimdim->course))) {
        error('Course is misconfigured');
    }
    if (!($cm = get_coursemodule_from_instance('dimdim', $dimdim->id, $course->id))) {
        error('Course Module ID was incorrect');
    }
}
require_course_login($course, true, $cm);
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
add_to_log($course->id, 'dimdim', 'view', "view.php?id={$cm->id}", $dimdim->id, $cm->id);
// Initialize $PAGE, compute blocks
$PAGE = page_create_instance($dimdim->id);
$pageblocks = blocks_setup($PAGE);
$blocks_preferred_width = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), 210);
/// Print the page header
$strnextsession = get_string('nextsession', 'dimdim');
if (!empty($edit) && $PAGE->user_allowed_editing()) {
    if ($edit == 'on') {
        $USER->editing = true;
    } else {
        if ($edit == 'off') {
            $USER->editing = false;
        }
    }
}
$PAGE->print_header($course->shortname . ': %fullname%');
echo '<table id="layout-table"><tr>';