Exemplo n.º 1
0
                    case FRONTPAGETOPICONLY:
                        // Do nothing!!  :-)
                        break;
                }
                echo '<br />';
            }
            print_container_end();
            echo '</td>';
            break;
        case 'right':
            // The right column
            if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $editing || $PAGE->user_allowed_editing()) {
                echo '<td style="width: ' . $preferred_width_right . 'px;" id="right-column">';
                print_container_start();
                if ($PAGE->user_allowed_editing()) {
                    echo '<div style="text-align:center">' . update_course_icon($SITE->id) . '</div>';
                    echo '<br />';
                }
                blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
                print_container_end();
                echo '</td>';
            }
            break;
    }
}
?>

  </tr>
</table>

<?php 
Exemplo n.º 2
0
 function print_header($title, $morenavlinks = NULL, $meta = '', $bodytags = '', $extrabuttons = '')
 {
     global $USER, $CFG;
     $this->init_full();
     $replacements = array('%fullname%' => $this->courserecord->fullname);
     foreach ($replacements as $search => $replace) {
         $title = str_replace($search, $replace, $title);
     }
     $navlinks = array();
     if (!empty($morenavlinks)) {
         $navlinks = array_merge($navlinks, $morenavlinks);
     }
     $navigation = build_navigation($navlinks);
     // The "Editing On" button will be appearing only in the "main" course screen
     // (i.e., no breadcrumbs other than the default one added inside this function)
     $buttons = switchroles_form($this->courserecord->id);
     if ($this->user_allowed_editing()) {
         $buttons .= update_course_icon($this->courserecord->id);
     }
     $buttons = empty($morenavlinks) ? $buttons : '&nbsp;';
     // Add any extra buttons requested (by the resource module, for example)
     if ($extrabuttons != '') {
         $buttons = $buttons == '&nbsp;' ? $extrabuttons : $buttons . $extrabuttons;
     }
     print_header($title, $this->courserecord->fullname, $navigation, '', $meta, true, $buttons, user_login_string($this->courserecord, $USER), false, $bodytags);
 }
Exemplo n.º 3
0
/**
 * This function is called when printing the format
 * in /index.php
 *
 * @return void
 **/
function page_frontpage()
{
    // Get all of the standard globals - the format script is usually included
    // into a file that has called config.php
    global $CFG, $PAGE, $USER, $SESSION, $COURSE, $SITE;
    $course = get_site();
    if (has_capability('moodle/course:update', get_context_instance(CONTEXT_COURSE, SITEID))) {
        echo '<div style="text-align:right">' . update_course_icon($course->id) . '</div>';
    }
    require_once $CFG->dirroot . '/mod/forum/lib.php';
    require_once $CFG->dirroot . '/course/format/page/format.php';
    print_footer('home');
    die;
}
Exemplo n.º 4
0
 function print_header($title, $morebreadcrumbs = NULL, $meta = '', $bodytags = '', $extrabuttons = '')
 {
     global $USER, $CFG;
     $this->init_full();
     $replacements = array('%fullname%' => $this->courserecord->fullname);
     foreach ($replacements as $search => $replace) {
         $title = str_replace($search, $replace, $title);
     }
     if ($this->courserecord->id == SITEID) {
         $breadcrumbs = array();
     } else {
         $breadcrumbs = array($this->courserecord->shortname => $CFG->wwwroot . '/course/view.php?id=' . $this->courserecord->id);
     }
     if (!empty($morebreadcrumbs)) {
         $breadcrumbs = array_merge($breadcrumbs, $morebreadcrumbs);
     }
     $total = count($breadcrumbs);
     $current = 1;
     $crumbtext = '';
     foreach ($breadcrumbs as $text => $href) {
         if ($current++ == $total) {
             $crumbtext .= ' ' . $text;
         } else {
             $crumbtext .= ' <a href="' . $href . '">' . $text . '</a> ->';
         }
     }
     // The "Editing On" button will be appearing only in the "main" course screen
     // (i.e., no breadcrumbs other than the default one added inside this function)
     $buttons = switchroles_form($this->courserecord->id) . update_course_icon($this->courserecord->id);
     $buttons = empty($morebreadcrumbs) ? $buttons : '&nbsp;';
     // Add any extra buttons requested (by the resource module, for example)
     if ($extrabuttons != '') {
         $buttons = $buttons == '&nbsp;' ? $extrabuttons : $buttons . $extrabuttons;
     }
     print_header($title, $this->courserecord->fullname, $crumbtext, '', $meta, true, $buttons, user_login_string($this->courserecord, $USER), false, $bodytags);
     echo '<div class="accesshide"><a href="#startofcontent">' . get_string('skiptomaincontent') . '</a></div>';
 }
Exemplo n.º 5
0
 function print_header($title, $morenavlinks = NULL, $meta = '', $bodytags = '')
 {
     global $USER, $CFG;
     $this->init_full();
     $replacements = array('%fullname%' => $this->courserecord->fullname);
     foreach ($replacements as $search => $replace) {
         $title = str_replace($search, $replace, $title);
     }
     $navlinks = array();
     if (!empty($morenavlinks)) {
         $navlinks = array_merge($navlinks, $morenavlinks);
     }
     $navigation = build_navigation($navlinks);
     // The "Editing On" button will be appearing only in the "main" course screen
     // (i.e., no breadcrumbs other than the default one added inside this function)
     $buttons = switchroles_form($this->courserecord->id);
     if ($this->user_allowed_editing()) {
         $buttons .= update_course_icon($this->courserecord->id);
     }
     $buttons = empty($morenavlinks) ? $buttons : '&nbsp;';
     print_header($title, $this->courserecord->fullname, $navigation, '', $meta, true, $buttons, user_login_string($this->courserecord, $USER), false, $bodytags);
     echo '<div class="accesshide"><a href="#startofcontent">' . get_string('skiptomaincontent') . '</a></div>';
 }
Exemplo n.º 6
0
            // Okay, global variable alert. VERY UGLY. We need to create
            // this object here before the <blockname>_print_block()
            // function is called, since that function needs to set some
            // stuff in the javascriptportal object.
            $COURSE->javascriptportal = new jsportal();
            $useajax = true;
        }
    }
}
$CFG->blocksdrag = $useajax;
// this will add a new class to the header so we can style differently
// The "Editing On" button will be appearing only in the "main" course screen
// (i.e., no breadcrumbs other than the default one added inside this function)
$buttons = switchroles_form($course->id);
if ($PAGE->user_allowed_editing()) {
    $buttons .= update_course_icon($course->id);
}
$title = get_string('course') . ': ' . $course->fullname;
$navigation = build_navigation(array());
print_header($title, $course->fullname, $navigation, '', '', true, $buttons, user_login_string($course, $USER), false, $bodytags);
$completion = new completion_info($course);
if ($completion->is_enabled() && ajaxenabled()) {
    require_js(array('yui_yahoo', 'yui_event', 'yui_connection', 'yui_dom'));
    // Need to do this after the header because it requires the YUI stuff
    // to be loaded already
    require_js('course/completion.js');
    print_js_config(array('completion_strsaved' => get_string('saved', 'completion'), 'completion_strtitley' => get_string('completion-title-manual-y', 'completion'), 'completion_strtitlen' => get_string('completion-title-manual-n', 'completion'), 'completion_stralty' => get_string('completion-alt-manual-y', 'completion'), 'completion_straltn' => get_string('completion-alt-manual-n', 'completion')));
    // This value tracks whether there has been a dynamic change to the page.
    // It is used so that if a user does this - (a) set some tickmarks, (b)
    // go to another page, (c) clicks Back button - the page will
    // automatically reload. Otherwise it would start with the wrong tick
 /**
  * Print out the header and any pre-page content information.
  *
  */
 function print_header()
 {
     global $CFG, $PAGE, $USER, $COURSE, $course;
     // AJAX-capable course format?
     $CFG->useajax = false;
     $ajaxformatfile = $CFG->dirroot . '/course/format/' . $course->format . '/ajax.php';
     $bodytags = '';
     if (file_exists($ajaxformatfile)) {
         // Needs to exist otherwise no AJAX by default
         $CFG->ajaxcapable = false;
         // May be overridden later by ajaxformatfile
         $CFG->ajaxtestedbrowsers = array();
         // May be overridden later by ajaxformatfile
         require_once $ajaxformatfile;
         if (!empty($USER->editing) && $CFG->ajaxcapable) {
             // Course-based switches
             if (ajaxenabled($CFG->ajaxtestedbrowsers)) {
                 // rowser, user and site-based switches
                 require_js(array('yui_yahoo', 'yui_dom', 'yui_event', 'yui_dragdrop', 'yui_connection', 'ajaxcourse_blocks', 'ajaxcourse_sections'));
                 if (debugging('', DEBUG_DEVELOPER)) {
                     require_js(array('yui_logger'));
                     $bodytags = 'onload = "javascript:
                     show_logger = function() {
                         var logreader = new YAHOO.widget.LogReader();
                         logreader.newestOnTop = false;
                         logreader.setTitle(\'Moodle Debug: YUI Log Console\');
                     };
                     show_logger();
                     "';
                 }
                 // Okay, global variable alert. VERY UGLY. We need to create
                 // this object here before the <blockname>_print_block()
                 // function is called, since that function needs to set some
                 // stuff in the javascriptportal object.
                 $COURSE->javascriptportal = new jsportal();
                 $CFG->useajax = true;
             }
         }
     }
     $CFG->blocksdrag = $CFG->useajax;
     // this will add a new class to the header so we can style differently
     /// *** The only part we are really changing is here....
     $breadcrumbs = array($this->course->shortname => $CFG->wwwroot . '/course/view.php?id=' . $this->course->id);
     $total = count($breadcrumbs);
     $current = 1;
     $crumbtext = '';
     foreach ($breadcrumbs as $text => $href) {
         if ($current++ == $total) {
             $crumbtext .= ' ' . $text;
         } else {
             $crumbtext .= ' <a href="' . $href . '">' . $text . '</a> ->';
         }
     }
     // The "Editing On" button will be appearing only in the "main" course screen
     // (i.e., no breadcrumbs other than the default one added inside this function)
     $buttons = switchroles_form($this->course->id) . update_course_icon($this->course->id);
     $title = get_string('course') . ': ' . $this->course->fullname;
     if (empty($this->course->logo)) {
         $heading = $this->course->fullname;
     } else {
         $heading = '<img src="' . $CFG->wwwroot . '/file.php/' . $this->course->id . '/' . $this->course->logo . '" ' . 'alt="' . $this->course->fullname . '" />';
     }
     print_header($title, $heading, $crumbtext, '', '', true, $buttons, user_login_string($this->course, $USER), false, $bodytags);
     echo '<div class="accesshide"><a href="#startofcontent">' . get_string('skiptomaincontent') . '</a></div>';
 }
Exemplo n.º 8
0
        $stradmin = get_string('admin');
        print "<p style=\"font-size: x-small;\"><a href=\"{$CFG->wwwroot}/cms";
        print "/index.php?course={$courseid}&amp;sesskey={$USER->sesskey}\">{$stradmin}</a></p>\n";
    }
}
print_simple_box_end();
echo '</td>' . "\n";
// The right column
$showblocks = $pagedata->showblocks && (blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $editing) ? 1 : 0;
if (has_capability('moodle/legacy:editingteacher', $context, $USER->id)) {
    $showblocks = true;
}
if ($showblocks) {
    echo '<td style="width: ' . $preferred_width_right . 'px;" id="right-column">';
    if (has_capability('moodle/legacy:admin', $context, $USER->id, false)) {
        echo '<div align="center">' . update_course_icon($course->id) . '</div>';
        if (!$pagedata->showblocks && blocks_have_content($pageblocks, BLOCK_POS_RIGHT)) {
            echo '<br />' . "\n" . '<div class="cms-warning" align="center">' . get_string('nonvisibleblocks', 'cms') . '</div>' . "\n";
        }
        echo '<br />';
    }
    blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
    echo '</td>' . "\n";
}
echo '</tr>' . "\n";
echo '</table>' . "\n";
if (defined('SITEID') && SITEID == $course->id) {
    // Close the page when we're on site level.
    echo '</div>';
    // content wrapper end
    print_footer(NULL, $course);