MDL-20204 first batch of major theme changes, some regressions are still there, expect more changes and improvements soon; see tracker for details and list of subtasks

This commit is contained in:
Petr Skoda 2009-12-16 18:00:58 +00:00
parent e09ef36a4c
commit 78946b9bdb
268 changed files with 5923 additions and 7986 deletions

View File

@ -8,7 +8,7 @@ require_once($CFG->dirroot.'/mod/forum/lib.php');
require_once($CFG->libdir.'/adminlib.php');
admin_externalpage_setup('bloglevelupgrade');
$PAGE->set_generaltype('maintenance');
$PAGE->set_pagelayout('maintenance');
$go = optional_param('go', 0, PARAM_BOOL);

View File

@ -110,7 +110,6 @@ $CFG->dirroot = str_replace('\\', '/', dirname(dirname(dirname(__FI
$CFG->libdir = "$CFG->dirroot/lib";
$CFG->wwwroot = "http://localhost";
$CFG->httpswwwroot = $CFG->wwwroot;
$CFG->httpsthemewww = $CFG->wwwroot;
$CFG->dataroot = str_replace('\\', '/', dirname(dirname(dirname(__FILE__))).'/moodledata');
$CFG->docroot = 'http://docs.moodle.org';
$CFG->directorypermissions = 00777;
@ -262,7 +261,6 @@ if ($interactive) {
}
$CFG->wwwroot = $wwwroot;
$CFG->httpswwwroot = $CFG->wwwroot;
$CFG->httpsthemewww = $CFG->wwwroot;
//We need dataroot before lang download

View File

@ -1334,7 +1334,7 @@ if (isset($argv) && isset($argc)) {
require_capability('moodle/site:config', $systemcontext);
$PAGE->set_url($CFG->wwwroot.'/admin/generator.php');
$PAGE->set_generaltype('form');
$PAGE->set_pagelayout('form');
$generator = new generator_web();
$generator->setup();
$generator->display();

View File

@ -107,7 +107,7 @@ $origxmlstrictheaders = !empty($CFG->xmlstrictheaders);
$CFG->xmlstrictheaders = false;
if (!core_tables_exist()) {
$PAGE->set_generaltype('maintenance');
$PAGE->set_pagelayout('maintenance');
// fake some settings
$CFG->docroot = 'http://docs.moodle.org';
@ -188,7 +188,7 @@ if (empty($CFG->version)) {
}
if ($version > $CFG->version) { // upgrade
$PAGE->set_generaltype('maintenance');
$PAGE->set_pagelayout('maintenance');
$a->oldversion = "$CFG->release ($CFG->version)";
$a->newversion = "$release ($version)";

View File

@ -310,7 +310,6 @@
}
/// Print the form.
check_theme_arrows();
?>
<form id="assignform" method="post" action="<?php echo $baseurl . '&amp;roleid=' . $roleid ?>"><div>
<input type="hidden" name="sesskey" value="<?php echo sesskey() ?>" />

View File

@ -8,6 +8,9 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
// "themesettings" settingpage
$temp = new admin_settingpage('themesettings', get_string('themesettings', 'admin'));
$temp->add(new admin_setting_configtext('themelist', get_string('themelist', 'admin'), get_string('configthemelist','admin'), '', PARAM_NOTAGS));
$setting = new admin_setting_configcheckbox('themedesignermode', get_string('themedesignermode', 'admin'), get_string('configthemedesignermode', 'admin'), 0);
$setting->set_updatedcallback('theme_reset_all_caches');
$temp->add($setting);
$temp->add(new admin_setting_configcheckbox('allowuserthemes', get_string('allowuserthemes', 'admin'), get_string('configallowuserthemes', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('allowcoursethemes', get_string('allowcoursethemes', 'admin'), get_string('configallowcoursethemes', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('allowcategorythemes', get_string('allowcategorythemes', 'admin'), get_string('configallowcategorythemes', 'admin'), 0));
@ -23,6 +26,14 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
$ADMIN->add('themes', $temp);
$ADMIN->add('themes', new admin_externalpage('themeselector', get_string('themeselector','admin'), $CFG->wwwroot . '/theme/index.php'));
// settings for each theme
foreach (get_plugin_list('theme') as $theme => $themedir) {
$settings_path = "$themedir/settings.php";
if (file_exists($settings_path)) {
include($settings_path);
}
}
// calendar
$temp = new admin_settingpage('calendar', get_string('calendarsettings','admin'));
$temp->add(new admin_setting_special_adminseesall());
@ -132,3 +143,4 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
$ADMIN->add('appearance', new admin_externalpage('managetags', get_string('managetags', 'tag'), "$CFG->wwwroot/tag/manage.php"));
} // end of speedup

View File

@ -9,7 +9,6 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
$temp = new admin_settingpage('experimentalsettings', get_string('experimentalsettings', 'admin'));
$temp->add(new admin_setting_configcheckbox('enableglobalsearch', get_string('enableglobalsearch', 'admin'), get_string('configenableglobalsearch', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('smartpix', get_string('smartpix', 'admin'), get_string('configsmartpix', 'admin'), 0));
$item = new admin_setting_configcheckbox('enablehtmlpurifier', get_string('enablehtmlpurifier', 'admin'), get_string('configenablehtmlpurifier', 'admin'), 0);
$item->set_updatedcallback('reset_text_filters_cache');
$temp->add($item);

View File

@ -4,10 +4,7 @@
* Please note that is file is always loaded last - it means that you can inject entries into other categories too.
*/
if ($hassiteconfig || has_capability('moodle/question:config', $systemcontext)) {
require_once($CFG->libdir. '/portfoliolib.php');
if ($hassiteconfig) {
$ADMIN->add('modules', new admin_category('modsettings', get_string('activitymodules')));
$ADMIN->add('modsettings', new admin_page_managemods());
if ($modules = $DB->get_records('modules')) {
@ -136,6 +133,9 @@ if ($hassiteconfig || has_capability('moodle/question:config', $systemcontext))
}
}
//== Portfolio settings ==
require_once($CFG->libdir. '/portfoliolib.php');
$catname = get_string('portfolios', 'portfolio');
$manage = get_string('manageportfolios', 'portfolio');
$url = "$CFG->wwwroot/$CFG->admin/portfolio.php";
@ -222,9 +222,7 @@ if ($hassiteconfig || has_capability('moodle/question:config', $systemcontext))
$ADMIN->add('repositorysettings', new admin_externalpage('repositoryinstanceedit',
get_string('editrepositoryinstance', 'repository'), $url, 'moodle/site:config', true),
'', $url);
foreach (repository::get_types()
as $repositorytype)
{
foreach (repository::get_types() as $repositorytype) {
//display setup page for plugins with: general options or multiple instances (e.g. has instance config)
$typeoptionnames = repository::static_function($repositorytype->get_typename(), 'get_type_option_names');
$instanceoptionnames = repository::static_function($repositorytype->get_typename(), 'get_instance_option_names');
@ -236,6 +234,7 @@ if ($hassiteconfig || has_capability('moodle/question:config', $systemcontext))
'moodle/site:config');
}
}
}
// Web services
$ADMIN->add('modules', new admin_category('webservicesettings', get_string('webservices', 'webservice')));
@ -264,6 +263,7 @@ if ($hassiteconfig || has_capability('moodle/question:config', $systemcontext))
}
}
if ($hassiteconfig || has_capability('moodle/question:config', $systemcontext)) {
// Question type settings.
$ADMIN->add('modules', new admin_category('qtypesettings', get_string('questiontypes', 'admin')));
$ADMIN->add('qtypesettings', new admin_page_manageqtypes());

View File

@ -13,7 +13,7 @@ require_login(0, false);
$adminroot = admin_get_root(); // need all settings
admin_externalpage_setup('upgradesettings'); // now hidden page
$PAGE->set_generaltype('maintenance');
$PAGE->set_pagelayout('maintenance');
// now we'll deal with the case that the admin has submitted the form with new settings
if ($data = data_submitted() and confirm_sesskey()) {

View File

@ -73,8 +73,6 @@ $alloweduserselector = new service_user_selector('removeselect', array('servicei
}
}
/// Print the form.
check_theme_arrows();
/// display the UI
?>
<form id="assignform" method="post" action="service_users.php?id=<?php echo $id ?>"><div>

View File

@ -29,7 +29,7 @@ httpsrequired();
$select = html_select::make_popup_form("$CFG->httpswwwroot/login/index.php", 'lang', $langs, 'chooselang', $currlang);
$select->nothinglabel = false;
$select->set_label(get_accesshide(get_string('language')));
$langmenu = $OUTPUT->select($select);
$langmenu = '<div class="langmenu">'.$OUTPUT->select($select).'</div>';
}
$loginsite = get_string("loginsite");
@ -82,7 +82,7 @@ httpsrequired();
$PAGE->set_title("$site->fullname: $loginsite");
$PAGE->set_heading($site->fullname);
$PAGE->set_focuscontrol('idp');
$PAGE->set_headingmenu('<div class="langmenu">'.$langmenu.'</div>');
$PAGE->set_headingmenu($langmenu);
echo $OUTPUT->header();
include("index_form.html");

View File

@ -9288,9 +9288,10 @@ WHERE
$restorelog_file = fopen("$dest_dir/restorelog.html","a");
//Add the stylesheet
$stylesheetshtml = '';
foreach ($CFG->stylesheets as $stylesheet) {
/* foreach ($CFG->stylesheets as $stylesheet) {
//TODO: MDL-21120
$stylesheetshtml .= '<link rel="stylesheet" type="text/css" href="'.$stylesheet.'" />'."\n";
}
}*/
///Accessibility: added the 'lang' attribute to $direction, used in theme <html> tag.
$languagehtml = get_html_lang($dir=true);
@ -9299,7 +9300,7 @@ WHERE
fwrite ($restorelog_file," \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"> ");
fwrite ($restorelog_file,"<html dir=\"ltr\".$languagehtml.");
fwrite ($restorelog_file,"<head>");
fwrite ($restorelog_file,$stylesheetshtml);
// fwrite ($restorelog_file,$stylesheetshtml);
fwrite ($restorelog_file,"<title>".$course_header->course_shortname." Restored </title>");
fwrite ($restorelog_file,"</head><body><br/><h1>The following changes were made during the Restoration of this Course.</h1><br/><br/>");
fwrite ($restorelog_file,"The Course ShortName is now - ".$course_header->course_shortname." The FullName is now - ".$course_header->course_fullname."<br/><br/>");

View File

@ -88,6 +88,7 @@ class block_global_navigation_tree extends block_tree {
if ($this->contentgenerated === true) {
return true;
}
$this->page->requires->yui_lib('dom');
$this->page->requires->js('lib/javascript-navigation.js');
// Navcount is used to allow us to have multiple trees although I dont' know why
// you would want to trees the same

View File

@ -815,7 +815,7 @@ class block_tree extends block_list {
*
* Also adds the required javascript call to the page output.
*
* @param moodle_core_renderer $output
* @param core_renderer $output
* @return string HTML
*/
protected function formatted_contents($output) {

View File

@ -175,7 +175,7 @@ if ($returnurl) {
$managefeeds = new moodle_url($CFG->wwwroot . '/blocks/rss_client/managefeeds.php', $urlparams);
$PAGE->set_url('blocks/rss_client/editfeed.php', $urlparams);
$PAGE->set_generaltype('form');
$PAGE->set_pagelayout('form');
if ($rssid) {
$isadding = false;

View File

@ -78,7 +78,7 @@ $feeds = $DB->get_records_select('block_rss_client', $select, null, $DB->sql_ord
$strmanage = get_string('managefeeds', 'block_rss_client');
$PAGE->set_generaltype('form');
$PAGE->set_pagelayout('form');
$PAGE->set_title($strmanage);
$PAGE->set_heading($strmanage);

View File

@ -55,7 +55,7 @@ if ($returnurl) {
$urlparams['returnurl'] = $returnurl;
}
$PAGE->set_url('blocks/rss_client/viewfeed.php', $urlparams);
$PAGE->set_generaltype('popup');
$PAGE->set_pagelayout('popup');
$rssrecord = $DB->get_record('block_rss_client', array('id' => $rssid), '*', MUST_EXIST);

View File

@ -87,6 +87,7 @@ class block_settings_navigation_tree extends block_tree {
if ($this->contentgenerated === true) {
return true;
}
$this->page->requires->yui_lib('dom');
$this->page->requires->js('lib/javascript-navigation.js');
block_settings_navigation_tree::$navcount++;

View File

@ -11,6 +11,9 @@ required changes in code:
* move post instalation code from install() method into db/install.php
* completely rewrite file handling
* rewrite backup/restore
* theme changes: move plugin styles into blocks/xxx/styles.css and use new css markers for images,
move all images into new blocks/xxx/pix/ directory and use new outputlib api
optional - no changes needed in older code:
*

View File

@ -719,7 +719,7 @@ function calendar_get_events($tstart, $tend, $users, $groups, $courses, $withdur
}
function calendar_top_controls($type, $data) {
global $CFG, $CALENDARDAYS, $THEME;
global $CFG, $CALENDARDAYS;
$content = '';
if(!isset($data['d'])) {
$data['d'] = 1;

View File

@ -9,7 +9,7 @@
$id = optional_param('id', 0, PARAM_INT); // course id
$categoryid = optional_param('category', 0, PARAM_INT); // course category - can be changed in edit form
$PAGE->set_generaltype('form');
$PAGE->set_pagelayout('form');
/// basic access control checks
if ($id) { // editing course

View File

@ -19,7 +19,6 @@
?>
</select></td>
<td valign="top">
<?php check_theme_arrows(); ?>
<p class="arrow_button">
<input name="add" id="add" type="submit" value="<?php echo '&nbsp;'.$THEME->larrow.' &nbsp; &nbsp; '.get_string('add'); ?>" title="<?php print_string('add'); ?>" />
<br />

View File

@ -1383,12 +1383,12 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
if (!empty($customicon)) {
if (substr($customicon, 0, 4) === 'mod/') {
list($modname, $iconname) = explode('/', substr($customicon, 4), 2);
$icon = $OUTPUT->mod_icon_url(str_replace(array('.gif', '.png'), '', $customicon), $modname);
$icon = $OUTPUT->old_icon_url(str_replace(array('.gif', '.png'), '', $customicon), $modname);
} else {
$icon = $OUTPUT->old_icon_url(str_replace(array('.gif', '.png'), '', $customicon));
}
} else {
$icon = $OUTPUT->mod_icon_url('icon', $mod->modname);
$icon = $OUTPUT->old_icon_url('icon', $mod->modname);
}
//Accessibility: for files get description via icon, this is very ugly hack!
@ -2924,12 +2924,12 @@ function make_editing_buttons($mod, $absolute=false, $moveselect=true, $indent=-
$leftright = '';
if (has_capability('moodle/course:update', get_context_instance(CONTEXT_COURSE, $mod->course))) {
if (right_to_left()) { // Exchange arrows on RTL
$rightarrow = 't/left';
$leftarrow = 't/right';
} else {
$rightarrow = 't/right';
$leftarrow = 't/left';
if (right_to_left()) { // Exchange arrows on RTL
$rightarrow = 't/left';
$leftarrow = 't/right';
} else {
$rightarrow = 't/right';
$leftarrow = 't/left';
}
if ($indent > 0) {

View File

@ -35,7 +35,7 @@
$return = optional_param('return', 0, PARAM_BOOL); //return to course/view.php if false or mod/modname/view.php if true
$type = optional_param('type', '', PARAM_ALPHANUM); //TODO: hopefully will be removed in 2.0
$PAGE->set_generaltype('form');
$PAGE->set_pagelayout('form');
$url = new moodle_url($CFG->wwwroot.'/course/modedit.php');
if (!empty($add)) {

View File

@ -30,7 +30,7 @@
$strupdatesevery = get_string("updatesevery", "moodle", COURSE_LIVELOG_REFRESH);
$PAGE->set_url('/course/report/log/live.php', Array('id'=>$course->id));
$PAGE->set_generaltype('popup');
$PAGE->set_pagelayout('popup');
$PAGE->set_title("$strlivelogs ($strupdatesevery)");
$PAGE->set_periodic_refresh_delay(COURSE_LIVELOG_REFRESH);
$PAGE->set_heading($strlivelogs);

View File

@ -127,7 +127,7 @@ foreach ($cms as $cm) {
if (!empty($cm->icon)) {
$icon = '<img src="'.$OUTPUT->old_icon_url($cm->icon).'" class="activityicon" alt="" /> ';
} else {
$icon = '<img src="'.$OUTPUT->mod_icon_url('icon', $cm->modname).'" class="activityicon" alt="" /> ';
$icon = '<img src="'.$OUTPUT->old_icon_url('icon', $cm->modname).'" class="activityicon" alt="" /> ';
}
$class = $cm->visible ? '' : 'class="dimmed"'; // hidden modules are dimmed

View File

@ -90,6 +90,7 @@
}
$PAGE->set_url('course/view.php', array('id' => $course->id));
$PAGE->set_pagelayout('course');
$PAGE->set_pagetype('course-view-' . $course->format);
$PAGE->set_other_editing_capability('moodle/course:manageactivities');
@ -197,7 +198,8 @@
$PAGE->set_title(get_string('course') . ': ' . $course->fullname);
$PAGE->set_heading($course->fullname);
$PAGE->set_button($buttons);
$PAGE->set_headingmenu(user_login_string($course, $USER));
//TODO: MDL-21123 this should be done in course page layout, not here with this ugly hack!
//$PAGE->set_headingmenu(user_login_string($course, $USER));
echo $OUTPUT->header();
if ($completion->is_enabled() && ajaxenabled()) {

View File

@ -48,7 +48,7 @@ var $errormsg;
* @param course current course object
*/
function print_entry($course) {
global $CFG, $USER, $SESSION, $THEME, $OUTPUT, $PAGE;
global $CFG, $USER, $SESSION, $OUTPUT, $PAGE;
$strloginto = get_string('loginto', '', $course->shortname);
$strcourses = get_string('courses');
@ -134,7 +134,7 @@ function print_entry($course) {
* @param course the current course, as an object
*/
function check_entry($form, $course) {
global $CFG, $USER, $SESSION, $THEME;
global $CFG, $USER, $SESSION;
if (empty($form->password)) {
$form->password = '';

View File

@ -129,7 +129,6 @@ if ($data = data_submitted() and confirm_sesskey()) {
/// Print header
print_grade_page_head($COURSE->id, 'outcome', 'course');
check_theme_arrows();
require('course_form.html');
echo $OUTPUT->footer();

View File

@ -36,7 +36,6 @@ $PAGE->requires->yui_lib('element');
$PAGE->requires->yui_lib('container');
$PAGE->requires->yui_lib('animation');
$PAGE->requires->js('grade/edit/tree/functions.js');
$PAGE->requires->css('/grade/edit/tree/tree.css');
$courseid = required_param('id', PARAM_INT);
$action = optional_param('action', 0, PARAM_ALPHA);

View File

@ -803,13 +803,12 @@ class grade_plugin_info {
* @param boolean $return Whether to return (true) or echo (false) the HTML generated by this function
* @param string $bodytags Additional attributes that will be added to the <body> tag
* @param string $buttons Additional buttons to display on the page
* @param array $extracss An array of additional stylesheets to load (relative paths)
*
* @return string HTML code or nothing if $return == false
*/
function print_grade_page_head($courseid, $active_type, $active_plugin=null,
$heading = false, $return=false,
$buttons=false, $extracss=array()) {
$buttons=false) {
global $CFG, $COURSE, $OUTPUT, $PAGE;
$strgrades = get_string('grades');
$plugin_info = grade_get_plugin_info($courseid, $active_type, $active_plugin);
@ -826,13 +825,6 @@ function print_grade_page_head($courseid, $active_type, $active_plugin=null,
$first_link = $CFG->wwwroot.'/grade/index.php?id='.$COURSE->id;
}
if ($active_type == 'preferences') {
$CFG->stylesheets[] = $CFG->wwwroot . '/grade/report/styles.css';
}
foreach ($extracss as $css_url) {
$CFG->stylesheets[] = $css_url;
}
$PAGE->navbar->add($strgrades, $first_link);

View File

@ -35,7 +35,6 @@ $toggle = optional_param('toggle', NULL, PARAM_INT);
$toggle_type = optional_param('toggle_type', 0, PARAM_ALPHANUM);
$PAGE->set_url('grade/report/grader/index.php', compact('courseid', 'page', 'perpageurl', 'edit', 'sortitemid'));
$PAGE->requires->css('lib/yui/container/assets/skins/sam/container.css');
/// basic access checks
if (!$course = $DB->get_record('course', array('id' => $courseid))) {

View File

@ -217,8 +217,8 @@ class grade_report_grader extends grade_report {
if ($bounded > $finalgrade) {
$errorstr = 'lessthanmin';
} else if ($bounded < $finalgrade) {
$errorstr = 'morethanmax';
}
$errorstr = 'morethanmax';
}
}
if ($errorstr) {
$user = $DB->get_record('user', array('id' => $userid), 'id, firstname, lastname');

View File

@ -1,4 +0,0 @@
#content #siteconfiglink {
text-align: right;
}

View File

@ -147,7 +147,6 @@ echo $OUTPUT->header();
</select></td>
<td valign="top">
<?php check_theme_arrows(); ?>
<p class="arrow_button">
<input name="add" id="add" type="submit" value="<?php echo '&nbsp;'.$THEME->larrow.' &nbsp; &nbsp; '.get_string('add'); ?>" title="<?php print_string('add'); ?>" />
<br />

View File

@ -87,7 +87,6 @@ $PAGE->set_title("$course->shortname: $strgroups");
$PAGE->set_heading($course->fullname);
$PAGE->set_headingmenu(user_login_string($course, $USER));
echo $OUTPUT->header();
check_theme_arrows();
?>
<div id="addmembersform">

View File

@ -113,7 +113,7 @@ if(preg_match('~(##emoticons_html##)~', $output, $matches)) {
}
// Do the main output.
$PAGE->set_generaltype('popup');
$PAGE->set_pagelayout('popup');
$PAGE->set_title($title);
echo $OUTPUT->header();
echo $OUTPUT->box_start();

View File

@ -78,17 +78,18 @@
$select = html_select::make_popup_form($CFG->wwwroot .'/index.php', 'lang', $langs, 'chooselang', $currlang);
$select->nothinglabel = false;
$select->set_label(get_accesshide(get_string('language')));
$langmenu = $OUTPUT->select($select);
//TODO: MDL-21123
$langmenu = '<div class="langmenu">'.$OUTPUT->select($select).'</div>';
}
$PAGE->set_other_editing_capability('moodle/course:manageactivities');
$PAGE->set_url('');
$PAGE->set_docs_path('');
$PAGE->set_generaltype('home');
$PAGE->set_pagelayout('home');
$editing = $PAGE->user_is_editing();
$PAGE->set_title($SITE->fullname);
$PAGE->set_heading($SITE->fullname);
$PAGE->set_headingmenu(user_login_string($SITE) . $langmenu);
echo $OUTPUT->header();
$PAGE->set_headingmenu($langmenu);
echo $OUTPUT->header($langmenu);
/// Print Section
if ($SITE->numsections > 0) {

View File

@ -139,10 +139,7 @@ $CFG->lang = $config->lang;
$CFG->dirroot = str_replace('\\', '/', dirname(__FILE__)); // Fix for win32
$CFG->libdir = "$CFG->dirroot/lib";
$CFG->wwwroot = install_guess_wwwroot(); // can not be changed - ppl must use the real address when installing
$CFG->themedir = $CFG->dirroot.'/theme';
$CFG->themewww = $CFG->wwwroot.'/theme';
$CFG->httpswwwroot = $CFG->wwwroot;
$CFG->httpsthemewww = $CFG->wwwroot;
$CFG->dataroot = $config->dataroot;
$CFG->admin = $config->admin;
$CFG->docroot = 'http://docs.moodle.org';

View File

@ -39,7 +39,7 @@ if (isset($CFG->iplookup)) {
}
$PAGE->set_url('iplookup/index.php', array('id'=>$ip, 'user'=>$user));
$PAGE->set_generaltype('popup');
$PAGE->set_pagelayout('popup');
$info = array($ip);
$note = array();

View File

@ -304,6 +304,8 @@ $string['configsupportemail'] = 'This email address will be published to users o
$string['configsupportname'] = 'This is the name of a person or other entity offering general help via the support email or web address.';
$string['configsupportpage'] = 'This web address will be published to users of this site as the one to go to when they need general help (for example, when new users create their own accounts). If this address is left blank then no link will be supplied.';
$string['configteacherassignteachers'] = 'Should ordinary teachers be allowed to assign other teachers within courses they teach? If \'No\', then only course creators and admins can assign teachers.';
$string['configthemedesignermode'] = 'All theme images and CSS are cached in browsers and in server for a very long time. Turn on this setting if you are developing or tweaking themes. This setting is also suitable for developers.
You can invalidate all theme caches manually from the theme selection page too. WARNING: enabling of theme designer mode affects the server performance severly!';
$string['configthemelist'] = 'Leave this blank to allow any valid theme to be used. If you want to shorten the theme menu, you can specify a comma-separated list of names here (Don\'t use spaces!).
For example: standard,orangewhite.';
$string['configtimezone'] = 'You can set the default timezone here. This is the only the DEFAULT timezone for displaying dates - each user can override this by setting their own in their profile. \"Server time\" here will make Moodle default to the server\'s operating system setting, but \"Server time\" in the user profile will make the user default to this timezone setting. Cronjobs that depend on a time of day to run will use this timezone.';
@ -851,7 +853,9 @@ $string['tablenosave'] = 'Changes in table above are saved automatically.';
$string['tablesnosave'] = 'Changes in tables above are saved automatically.';
$string['tabselectedtofront'] = 'On tables with tabs, should the row with the currently selected tab be placed at the front';
$string['tabselectedtofronttext'] = 'Bring selected tab row to front';
$string['themedesignermode'] = 'Theme designer mode';
$string['themelist'] = 'Theme list';
$string['themeresetcaches'] = 'Invalidate theme caches';
$string['themeselector'] = 'Theme Selector';
$string['themesettings'] = 'Theme settings';
$string['therewereerrors'] = 'There were errors in your data';

View File

@ -1,5 +1,5 @@
<?php // $Id$
// theme_standard.php - created with Moodle 2.0 dev
<?php
$string['pluginname'] = "Standard";
$string['region-side-pre'] = 'Left';
$string['region-side-post'] = 'Right';

View File

@ -5185,6 +5185,12 @@ function admin_externalpage_setup($section, $extrabutton = '',
$adminroot = admin_get_root(false, false); // settings not required for external pages
$extpage = $adminroot->locate($section);
if ($section === 'upgradesettings') {
$PAGE->set_pagelayout('maintenance');
} else {
$PAGE->set_pagelayout('admin');
}
$PAGE->set_context(get_context_instance(CONTEXT_SYSTEM));
// $PAGE->set_extra_button($extrabutton); TODO
@ -5222,7 +5228,7 @@ function admin_externalpage_setup($section, $extrabutton = '',
* @param string $focus focus element
*/
function admin_externalpage_print_header($focus='') {
global $CFG, $PAGE, $SITE, $THEME, $OUTPUT;
global $CFG, $PAGE, $SITE, $OUTPUT;
if (!is_string($focus)) {
$focus = ''; // BC compatibility, there used to be adminroot parameter

View File

@ -32,7 +32,7 @@
* @param page_requirements_manager $requires The page_requirements_manager to initialise.
*/
function setup_core_javascript(page_requirements_manager $requires) {
global $CFG, $OUTPUT;
global $CFG, $OUTPUT, $PAGE;
// JavaScript should always work with $CFG->httpswwwroot rather than $CFG->wwwroot.
// Otherwise, in some situations, users will get warnings about insecure content
@ -41,7 +41,9 @@ function setup_core_javascript(page_requirements_manager $requires) {
$config = array(
'wwwroot' => $CFG->httpswwwroot, // Yes, really. See above.
'sesskey' => sesskey(),
'loadingicon' => $OUTPUT->old_icon_url('i/loading_small')
'loadingicon' => $OUTPUT->old_icon_url('i/loading_small', 'moodle', false),
'themerev' => theme_get_revision(),
'theme' => $PAGE->theme->name,
);
if (debugging('', DEBUG_DEVELOPER)) {
$config['developerdebug'] = true;
@ -74,7 +76,7 @@ function setup_core_javascript(page_requirements_manager $requires) {
*
* Typical useage would be
* <pre>
* $PAGE->requires->css('mod/mymod/styles.css');
* $PAGE->requires->css('mod/mymod/userstyles.php?id='.$id); // not overriddable via themes!
* $PAGE->requires->js('mod/mymod/script.js');
* $PAGE->requires->js('mod/mymod/small_but_urgent.js')->in_head();
* $PAGE->requires->js_function_call('init_mymod', array($data))->on_dom_ready();
@ -148,11 +150,6 @@ class page_requirements_manager {
* performance. Optional dependencies are not loaded automatically - if you want
* them you will need to load them first with other calls to this method.
*
* If the YUI library you ask for requires one or more CSS files, and if
* <head> has already been printed, then an exception will be thrown.
* Therefore, you are strongly advised to request all the YUI libraries you
* will need before output is started.
*
* Even if a particular library is requested more than once (perhaps as a dependancy
* of other libraries) it will only be linked to once.
*
@ -696,10 +693,7 @@ class required_js extends linked_requirement {
*
* This class (with the help of {@link ajax_resolve_yui_lib()}) knows about the
* dependancies between the different YUI libraries, and will include all the
* other libraries required by the one you ask for. It also knows which YUI
* libraries require css files. If the library you ask for requires CSS files,
* then you should ask for it before <head> is output, or an exception will
* be thrown.
* other libraries required by the one you ask for.
*
* By default JavaScript files are included at the end of the HTML.
* This is recommended practice because it means that the web browser will only
@ -726,15 +720,10 @@ class required_yui_lib extends linked_requirement {
parent::__construct($manager, '');
$this->when = page_requirements_manager::WHEN_AT_END;
list($jsurls, $cssurls) = ajax_resolve_yui_lib($libname);
$jsurls = ajax_resolve_yui_lib($libname);
foreach ($jsurls as $jsurl) {
$this->jss[] = $manager->js($jsurl, true);
}
foreach ($cssurls as $cssurl) {
// this might be a bit problematic because it requires yui to be
// requested before print_header() - this was not required in 1.9.x
$manager->css($cssurl, true);
}
}
public function get_html() {
@ -1150,8 +1139,7 @@ function ajax_generate_script_tag($js) {
/**
* Given the name of a YUI library, return a list of the .js and .css files that
* it requries.
* Given the name of a YUI library, return a list of the .js that it requries.
*
* This method takes note of the $CFG->useexternalyui setting.
*
@ -1159,10 +1147,8 @@ function ajax_generate_script_tag($js) {
* the -debug version of the YUI files, otherwise it will return links to the -min versions.
*
* @param string $libname the name of a YUI library, for example 'autocomplete'.
* @return array with two elementes. The first is an array of the JavaScript URLs
* that must be loaded to make this library work, in the order they should be
* loaded. The second element is a (possibly empty) list of CSS files that
* need to be loaded.
* @return an array of the JavaScript URLs that must be loaded to make this library work,
* in the order they should be loaded.
*/
function ajax_resolve_yui_lib($libname) {
global $CFG;
@ -1171,99 +1157,53 @@ function ajax_resolve_yui_lib($libname) {
// because another part of the code may later ask for other bits. It is easier, and
// not very inefficient, just to always use (and get browsers to cache) the combined file.
static $translatelist = array(
'yahoo' => 'yahoo-dom-event',
'animation' => array('yahoo-dom-event', 'animation'),
'autocomplete' => array(
'js' => array('yahoo-dom-event', 'datasource', 'autocomplete'),
'css' => array('autocomplete/assets/skins/sam/autocomplete.css')),
'button' => array(
'js' => array('yahoo-dom-event', 'element', 'button'),
'css' => array('button/assets/skins/sam/button.css')),
'calendar' => array(
'js' => array('yahoo-dom-event', 'calendar'),
'css' => array('calendar/assets/skins/sam/calendar.css')),
'carousel' => array(
'js' => array('yahoo-dom-event', 'element', 'carousel'),
'css' => array('carousel/assets/skins/sam/carousel.css')),
'charts' => array('yahoo-dom-event', 'element', 'datasource', 'json', 'charts'),
'colorpicker' => array(
'js' => array('utilities', 'slider', 'colorpicker'),
'css' => array('colorpicker/assets/skins/sam/colorpicker.css')),
'connection' => array('yahoo-dom-event', 'connection'),
'container' => array(
'js' => array('yahoo-dom-event', 'container'),
'css' => array('container/assets/skins/sam/container.css')),
'cookie' => array('yahoo-dom-event', 'cookie'),
'datasource' => array('yahoo-dom-event', 'datasource'),
'datatable' => array(
'js' => array('yahoo-dom-event', 'element', 'datasource', 'datatable'),
'css' => array('datatable/assets/skins/sam/datatable.css')),
'dom' => 'yahoo-dom-event',
'dom-event' => 'yahoo-dom-event',
'dragdrop' => array('yahoo-dom-event', 'dragdrop'),
'editor' => array(
'js' => array('yahoo-dom-event', 'element', 'container', 'menu', 'button', 'editor'),
'css' => array('assets/skins/sam/skin.css')),
'element' => array('yahoo-dom-event', 'element'),
'event' => 'yahoo-dom-event',
'get' => array('yahoo-dom-event', 'get'),
'history' => array('yahoo-dom-event', 'history'),
'imagecropper' => array(
'js' => array('yahoo-dom-event', 'dragdrop', 'element', 'resize', 'imagecropper'),
'css' => array('assets/skins/sam/resize.css', 'assets/skins/sam/imagecropper.css')),
'imageloader' => array('yahoo-dom-event', 'imageloader'),
'json' => array('yahoo-dom-event', 'json'),
'layout' => array(
'js' => array('yahoo-dom-event', 'dragdrop', 'element', 'layout'),
'css' => array('reset-fonts-grids/reset-fonts-grids.css', 'assets/skins/sam/layout.css')),
'logger' => array(
'js' => array('yahoo-dom-event', 'logger'),
'css' => array('logger/assets/skins/sam/logger.css')),
'menu' => array(
'js' => array('yahoo-dom-event', 'container', 'menu'),
'css' => array('menu/assets/skins/sam/menu.css')),
'paginator' => array(
'js' => array('yahoo-dom-event', 'element', 'paginator'),
'css' => array('paginator/assets/skins/sam/paginator.css')),
'profiler' => array('yahoo-dom-event', 'profiler'),
'yahoo' => array('yahoo-dom-event'),
'animation' => array('yahoo-dom-event', 'animation'),
'autocomplete' => array('yahoo-dom-event', 'datasource', 'autocomplete'),
'button' => array('yahoo-dom-event', 'element', 'button'),
'calendar' => array('yahoo-dom-event', 'calendar'),
'carousel' => array('yahoo-dom-event', 'element', 'carousel'),
'charts' => array('yahoo-dom-event', 'element', 'datasource', 'json', 'charts'),
'colorpicker' => array('utilities', 'slider', 'colorpicker'),
'connection' => array('yahoo-dom-event', 'connection'),
'container' => array('yahoo-dom-event', 'container'),
'cookie' => array('yahoo-dom-event', 'cookie'),
'datasource' => array('yahoo-dom-event', 'datasource'),
'datatable' => array('yahoo-dom-event', 'element', 'datasource', 'datatable'),
'dom' => array('yahoo-dom-event'),
'dom-event' => array('yahoo-dom-event'),
'dragdrop' => array('yahoo-dom-event', 'dragdrop'),
'editor' => array('yahoo-dom-event', 'element', 'container', 'menu', 'button', 'editor'),
'element' => array('yahoo-dom-event', 'element'),
'event' => array('yahoo-dom-event'),
'get' => array('yahoo-dom-event', 'get'),
'history' => array('yahoo-dom-event', 'history'),
'imagecropper' => array('yahoo-dom-event', 'dragdrop', 'element', 'resize', 'imagecropper'),
'imageloader' => array('yahoo-dom-event', 'imageloader'),
'json' => array('yahoo-dom-event', 'json'),
'layout' => array('yahoo-dom-event', 'dragdrop', 'element', 'layout'),
'logger' => array('yahoo-dom-event', 'logger'),
'menu' => array('yahoo-dom-event', 'container', 'menu'),
'paginator' => array('yahoo-dom-event', 'element', 'paginator'),
'profiler' => array('yahoo-dom-event', 'profiler'),
'profilerviewer' => array('yuiloader-dom-event', 'element', 'profiler', 'profilerviewer'),
'resize' => array(
'js' => array('yahoo-dom-event', 'dragdrop', 'element', 'resize'),
'css' => array('assets/skins/sam/resize.css')),
'selector' => array('yahoo-dom-event', 'selector'),
'simpleeditor' => array(
'js' => array('yahoo-dom-event', 'element', 'container', 'simpleeditor'),
'css' => array('assets/skins/sam/skin.css')),
'slider' => array('yahoo-dom-event', 'gragdrop', 'slider'),
'stylesheet' => array('yahoo-dom-event', 'stylesheet'),
'tabview' => array(
'js' => array('yahoo-dom-event', 'element', 'tabview'),
'css' => array('assets/skins/sam/skin.css')),
'treeview' => array(
'js' => array('yahoo-dom-event', 'treeview'),
'css' => array('treeview/assets/skins/sam/treeview.css')),
'uploader' => array('yahoo-dom-event', 'element', 'uploader'),
'utilities' => array('yahoo-dom-event', 'connection', 'animation', 'dragdrop', 'element', 'get'),
'yuiloader' => 'yuiloader',
'yuitest' => array(
'js' => array('yahoo-dom-event', 'logger', 'yuitest'),
'css' => array('logger/assets/logger.css', 'yuitest/assets/testlogger.css')),
'resize' => array('yahoo-dom-event', 'dragdrop', 'element', 'resize'),
'selector' => array('yahoo-dom-event', 'selector'),
'simpleeditor' => array('yahoo-dom-event', 'element', 'container', 'simpleeditor'),
'slider' => array('yahoo-dom-event', 'gragdrop', 'slider'),
'stylesheet' => array('yahoo-dom-event', 'stylesheet'),
'tabview' => array('yahoo-dom-event', 'element', 'tabview'),
'treeview' => array('yahoo-dom-event', 'treeview'),
'uploader' => array('yahoo-dom-event', 'element', 'uploader'),
'utilities' => array('yahoo-dom-event', 'connection', 'animation', 'dragdrop', 'element', 'get'),
'yuiloader' => array('yuiloader'),
'yuitest' => array('yahoo-dom-event', 'logger', 'yuitest'),
);
if (!isset($translatelist[$libname])) {
throw new coding_exception('Unknown YUI library ' . $libname);
}
$data = $translatelist[$libname];
if (!is_array($data)) {
$jsnames = array($data);
$cssfiles = array();
} else if (isset($data['js']) && isset($data['css'])) {
$jsnames = $data['js'];
$cssfiles = $data['css'];
} else {
$jsnames = $data;
$cssfiles = array();
}
$jsnames = $translatelist[$libname];
$debugging = debugging('', DEBUG_DEVELOPER);
if ($debugging) {
@ -1294,12 +1234,7 @@ function ajax_resolve_yui_lib($libname) {
}
}
$cssurls = array();
foreach ($cssfiles as $css) {
$cssurls[] = $libpath . $css;
}
return array($jsurls, $cssurls);
return $jsurls;
}
/**

View File

@ -296,22 +296,6 @@ class page_requirements_manager_test extends ajaxlib_unit_test_base {
$this->assertTrue($this->requires->is_top_of_body_done());
}
public function test_requiring_css() {
global $CFG;
$cssfile = 'theme/standard/styles_layout.css'; // Just needs to be a CSS file that exists.
$this->requires->css($cssfile);
$html = $this->requires->get_head_code();
$this->assertContains($html, $CFG->httpswwwroot . '/' . $cssfile);
}
public function test_nonexistant_css_throws_exception() {
$cssfile = 'css/file/that/does/not/exist.css';
$this->expectException();
$this->requires->css($cssfile);
}
public function test_requiring_js() {
global $CFG;
$jsfile = 'lib/javascript-static.js'; // Just needs to be a JS file that exists.
@ -331,10 +315,10 @@ class page_requirements_manager_test extends ajaxlib_unit_test_base {
}
public function test_nonexistant_js_throws_exception() {
$cssfile = 'js/file/that/does/not/exist.js';
$jsfile = 'js/file/that/does/not/exist.js';
$this->expectException();
$this->requires->js($cssfile);
$this->requires->js($jsfile);
}
public function test_requiring_skip_link() {

View File

@ -167,9 +167,9 @@ class block_manager {
* @return array the internal names of the regions on this page where block may appear.
*/
public function get_regions() {
if (is_null($this->defaultregion)) {
if (is_null($this->defaultregion)) {
$this->page->initialise_theme_and_output();
}
}
return array_keys($this->regions);
}
@ -303,7 +303,7 @@ class block_manager {
* output the blocks anyway, so we are not doing wasted effort.)
*
* @param string $region a block region that exists on this page.
* @param object $output a moodle_core_renderer. normally the global $OUTPUT.
* @param object $output a core_renderer. normally the global $OUTPUT.
* @return boolean Whether there is anything in this region.
*/
public function region_has_content($region, $output) {
@ -781,7 +781,7 @@ class block_manager {
* Return an array of content objects from a set of block instances
*
* @param array $instances An array of block instances
* @param moodle_renderer_base The renderer to use.
* @param renderer_base The renderer to use.
* @param string $region the region name.
* @return array An array of block_content (and possibly block_move_target) objects.
*/
@ -1056,7 +1056,7 @@ class block_manager {
}
$editpage = new moodle_page();
$editpage->set_generaltype('form');
$editpage->set_pagelayout('form');
$editpage->set_course($this->page->course);
$editpage->set_context($block->context);
$editurlbase = str_replace($CFG->wwwroot . '/', '', $this->page->url->out(true));
@ -1455,11 +1455,11 @@ function blocks_remove_inappropriate($course) {
return;
$blockmanager = blocks_get_by_page($page);
if(empty($blockmanager)) {
if (empty($blockmanager)) {
return;
}
if(($pageformat = $page->pagetype) == NULL) {
if (($pageformat = $page->pagetype) == NULL) {
return;
}

55
lib/configonlylib.php Normal file
View File

@ -0,0 +1,55 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Minimalistic library, usable even when no other moodle libs are loaded.
*
* The only library that gets loaded if you define ABORT_AFTER_CONFIG
* before including main config.php. You can resume normal script operation
* if you define ABORT_AFTER_CONFIG_CANCEL and require the setup.php
*
* @package moodlecore
* @copyright 2009 petr Skoda (skodak)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* Minimalistic parameter validation function.
* Can not use optional param because moodlelib.php is not loaded yet
* @param string $name
* @param mixed $default
* @param string $type
* @return mixed
*/
function min_optional_param($name, $default, $type) {
$value = $default;
if (isset($_GET[$name])) {
$value = $_GET[$name];
} else if (isset($_GET['amp;'.$name])) {
// very, very, very ugly hack, unforunately $OUTPUT->old_icon_url() is not used properly in javascript code :-(
$value = $_GET['amp;'.$name];
}
switch($type) {
case 'INT': $value = (int)$value; break;
case 'SAFEDIR': $value = preg_replace('/[^a-zA-Z0-9_-]/', '', $value); break;
case 'SAFEPATH': $value = preg_replace('/[^a-zA-Z0-9\/_-]/', '', $value); break;
default: die("Coding error: incorrent parameter type specified ($type).");
}
return $value;
}

View File

@ -49,7 +49,7 @@ function xmldb_main_install() {
'enrol_plugins_enabled' => 'manual',
'style' => 'default',
'template' => 'default',
'theme' => 'standardwhite',
'theme' => 'standard', //TODO: MDL-20204 replace with some new default theme when implemented
'filter_multilang_converted' => 1,
'siteidentifier' => random_string(32).get_host_from_url($CFG->wwwroot),
'backup_version' => 2008111700,
@ -216,4 +216,6 @@ function xmldb_main_install() {
set_role_contextlevels($guestrole, get_default_contextlevels('guest'));
set_role_contextlevels($userrole, get_default_contextlevels('user'));
// init themes
set_config('themerev', 1);
}

View File

@ -20,7 +20,7 @@
// before any action that may take longer time to finish.
function xmldb_main_upgrade($oldversion) {
global $CFG, $THEME, $USER, $DB, $OUTPUT;
global $CFG, $USER, $DB, $OUTPUT;
require_once($CFG->libdir.'/db/upgradelib.php'); // Core Upgrade-related functions

View File

@ -585,7 +585,7 @@ function get_current_group($courseid, $full = false) {
* @return void, always throws moodle_exception
*/
function error($message, $link='') {
throw new moodle_exception('notlocalisederrormessage', 'error', $link, $message, 'error() is a deprecated function, please call print_error() instead of error()');
throw new moodle_exception('notlocalisederrormessage', 'error', $link, $message, 'error() is a deprecated function, please call print_error() instead of error()');
}
@ -1720,33 +1720,6 @@ function make_mod_upload_directory($courseid) {
return make_upload_directory($courseid .'/'. $CFG->moddata);
}
/**
* This is a slight variatoin on the standard_renderer_factory that uses
* custom_corners_core_renderer instead of moodle_core_renderer.
*
* This generates the slightly different HTML that the custom_corners theme expects.
*
* @copyright 2009 Tim Hunt
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @deprecated Required to make the old $THEME->customcorners setting work.
*/
class custom_corners_renderer_factory extends standard_renderer_factory {
public function __construct($theme) {
parent::__construct($theme);
global $CFG;
require_once($CFG->themedir . '/custom_corners/renderers.php');
}
/* Implement the subclass method. */
public function get_renderer($module, $page, $subtype=null) {
if ($module == 'core') {
return new custom_corners_core_renderer($page);
}
return parent::get_renderer($module, $page, $subtype);
}
}
/**
* Used to be used for setting up the theme. No longer used by core code, and
* should not have been used elsewhere.
@ -1777,25 +1750,6 @@ function current_theme() {
return $PAGE->theme->name;
}
/**
* This used to be the thing that theme styles.php files used to do all the work.
* This is now handled differently. You should copy theme/standard/styes.php
* into your theme.
*
* @deprecated
* @param int $lastmodified Always gets set to now
* @param int $lifetime The max-age header setting (seconds) defaults to 300
* @param string $themename The name of the theme to use (optional) defaults to current theme
* @param string $forceconfig Force a particular theme config (optional)
* @param string $lang Load styles for the specified language (optional)
*/
function style_sheet_setup($lastmodified=0, $lifetime=300, $themename='', $forceconfig='', $lang='') {
global $CFG, $PAGE, $THEME, $showdeprecatedstylesheetsetupwarning;
$showdeprecatedstylesheetsetupwarning = true;
include($CFG->dirroot . '/theme/styles.php');
exit;
}
/**
* @todo Remove this deprecated function when no longer used
* @deprecated since Moodle 2.0 - use $PAGE->pagetype instead of the .
@ -1895,7 +1849,7 @@ function print_heading($text, $deprecated = '', $size = 2, $class = 'main', $ret
function print_heading_block($heading, $class='', $return=false) {
global $OUTPUT;
debugging('print_heading_with_block() has been deprecated. Please change your code to use $OUTPUT->heading().');
$output = $OUTPUT->heading($heading, 2, 'headingblock header ' . moodle_renderer_base::prepare_classes($class));
$output = $OUTPUT->heading($heading, 2, 'headingblock header ' . renderer_base::prepare_classes($class));
if ($return) {
return $output;
} else {
@ -2012,6 +1966,13 @@ function print_container_start($clearfix=false, $classes='', $idbase='', $return
}
}
/**
* Deprecated, now handled automatically in themes
*/
function check_theme_arrows() {
debugging('check_theme_arrows() has been deprecated, do not use it anymore, it is now automatic.');
}
/**
* Simple function to end a container (see above)
*
@ -2193,7 +2154,7 @@ function print_footer($course = NULL, $usercourse = NULL, $return = false) {
// TODO check arguments.
if (is_string($course)) {
debugging("Magic values like 'home', 'empty' passed to print_footer no longer have any effect. " .
'To achieve a similar effect, call $PAGE->set_generaltype before you call print_header.', DEBUG_DEVELOPER);
'To achieve a similar effect, call $PAGE->set_pagelayout before you call print_header.', DEBUG_DEVELOPER);
} else if (!empty($course->id) && $course->id != $PAGE->course->id) {
throw new coding_exception('The $course object you passed to print_footer does not match $PAGE->course.');
}
@ -3702,8 +3663,6 @@ function build_navigation($extranavlinks, $cm = null) {
* @return string
*/
function navmenu($course, $cm=NULL, $targetwindow='self') {
global $CFG, $THEME, $USER, $DB, $OUTPUT;
// This function has been deprecated with the creation of the global nav in
// moodle 2.0
@ -3776,7 +3735,7 @@ function delete_event($id) {
/**
* Call this function to hide an event in the calendar table
* the event will be identified by the id field of the $event object.
*
*
* @param object $event An object representing an event from the calendar table. The event will be identified by the id field.
* @return true
*/

View File

View File

@ -74,8 +74,8 @@ class tinymce_texteditor extends texteditor {
$directionality = get_string('thisdirection');
$strtime = get_string('strftimetime');
$strdate = get_string('strftimedaydate');
$lang = str_replace('_utf8', '', current_language()); // use more standard language codes
$contentcss = $CFG->themewww.'/'.current_theme().'/styles.php'; // should be customizable
$lang = str_replace('_utf8', '', current_language()); // use more standard language codes
$contentcss = $PAGE->theme->editor_css_url()->out(false, array(), false);
$context = empty($options['context']) ? get_context_instance(CONTEXT_SYSTEM) : $options['context'];
if (!empty($options['legacy'])) {

View File

@ -2068,9 +2068,10 @@ function file_modify_html_header($text) {
global $CFG;
$stylesheetshtml = '';
foreach ($CFG->stylesheets as $stylesheet) {
/* foreach ($CFG->stylesheets as $stylesheet) {
//TODO: MDL-21120
$stylesheetshtml .= '<link rel="stylesheet" type="text/css" href="'.$stylesheet.'" />'."\n";
}
}*/
$ufo = '';
if (filter_is_enabled('filter/mediaplugin')) {

View File

@ -233,7 +233,7 @@ function install_print_help_page($help) {
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
echo '<html dir="'.(right_to_left() ? 'rtl' : 'ltr').'">
<head>
<link rel="shortcut icon" href="theme/standard/favicon.ico" />
<link rel="shortcut icon" href="theme/standard/pix/favicon.ico" />
<link rel="stylesheet" type="text/css" href="'.$CFG->wwwroot.'/install.php?css=1" />
<title>'.get_string('installation','install').'</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
@ -279,7 +279,7 @@ function install_print_header($config, $stagename, $heading, $stagetext) {
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
echo '<html dir="'.(right_to_left() ? 'rtl' : 'ltr').'">
<head>
<link rel="shortcut icon" href="theme/standard/favicon.ico" />';
<link rel="shortcut icon" href="theme/standard/pix/favicon.ico" />';
$sheets = array('styles_layout', 'styles_fonts', 'styles_color', 'styles_moz');
$csss = array();

View File

@ -321,7 +321,7 @@ navigation_tree.prototype.move_to_sidebar_popout = function(e) {
var moveicon = moveto[i].getElementsByTagName('img');
if (moveicon.length>0) {
for (var j=0;j<moveicon.length;j++) {
moveicon[j].src = moveicon[j].src.replace(/movetosidetab/, 'movetoblock');
moveicon[j].src = get_image_url('t/movetoblock', 'moodle');
moveicon[j].setAttribute('alt', this.toggleblockdisplay);
moveicon[j].setAttribute('title', this.toggleblockdisplay);
}
@ -406,7 +406,7 @@ navigation_tree.prototype.move_to_block_position = function(e) {
var moveicon = moveto[i].getElementsByTagName('img');
if (moveicon.length>0) {
for (var j=0;j<moveicon.length;j++) {
moveicon[j].src = moveicon[j].src.replace(/movetoblock/, 'movetosidetab');
moveicon[j].src = get_image_url('t/movetosidetab', 'moodle');
moveicon[j].setAttribute('alt', this.togglesidetabdisplay);
moveicon[j].setAttribute('title', this.togglesidetabdisplay);
}
@ -471,7 +471,7 @@ navigation_tab_panel.prototype.create_tab_panel = function () {
var navbarcontrol = document.createElement('div');
YAHOO.util.Dom.addClass(navbarcontrol, 'controls');
var removeall = document.createElement('img');
removeall.setAttribute('src', moodle_cfg.wwwroot+'/pix/t/movetoblock.png');
removeall.setAttribute('src', get_image_url('t/movetoblock', 'moodle'));
removeall.setAttribute('title', mstr.moodle.moveallsidetabstoblock);
removeall.setAttribute('alt', mstr.moodle.moveallsidetabstoblock);
navbarcontrol.appendChild(removeall);

View File

@ -1385,3 +1385,17 @@ function update_progress_bar (id, width, pt, msg, es){
function frame_breakout(e, properties) {
this.setAttribute('target', properties.framename);
}
function get_image_url(imagename, component) {
var url = moodle_cfg.wwwroot + '/theme/image.php?theme=' + moodle_cfg.theme + '&image=' + imagename;
if (moodle_cfg.themerev > 0) {
url = url + '&rev=' + moodle_cfg.themerev;
}
if (component != '' && component != 'moodle' && component != 'core') {
url = url + '&component=' + component;
}
return url;
}

View File

@ -6439,16 +6439,9 @@ function get_list_of_themes() {
$themelist = array_keys(get_plugin_list("theme"));
}
foreach ($themelist as $key => $theme) {
if (!file_exists("$CFG->themedir/$theme/config.php")) { // bad folder
continue;
}
$THEME = new object(); // Note this is not the global one!! :-)
include("$CFG->themedir/$theme/config.php");
if (!isset($THEME->sheets)) { // Not a valid 1.5 theme
continue;
}
$themes[$theme] = $theme;
foreach ($themelist as $key => $themename) {
$theme = theme_config::load($themename);
$themes[$themename] = $theme;
}
asort($themes);
@ -6709,7 +6702,12 @@ function get_component_directory($component, $fullpaths=true) {
if ($component == 'moodle') {
$path = ($fullpaths ? $CFG->libdir : 'lib');
} else {
list($type, $plugin) = explode('_', $component, 2);
if (strpos($component, '_') === false) {
$type = 'mod';
$plugin = $component;
} else {
list($type, $plugin) = explode('_', $component, 2);
}
$path = get_plugin_directory($type, $plugin, $fullpaths);
}
@ -6747,7 +6745,8 @@ function get_plugin_types($fullpaths=true) {
'repository' => 'repository',
'portfolio' => 'portfolio',
'qtype' => 'question/type',
'qformat' => 'question/format');
'qformat' => 'question/format',
'theme' => 'theme'); // this is a bit hacky, themes may be in dataroot too
$mods = get_plugin_list('mod');
foreach ($mods as $mod => $moddir) {
@ -6759,19 +6758,13 @@ function get_plugin_types($fullpaths=true) {
}
}
// do not include themes if in non-standard location
if (empty($CFG->themedir) or $CFG->themedir === $CFG->dirroot.'/theme') {
$info['theme'] = 'theme';
}
// local is always last
// local is always last!
$info['local'] = 'local';
$fullinfo = array();
foreach ($info as $type => $dir) {
$fullinfo[$type] = $CFG->dirroot.'/'.$dir;
}
$fullinfo['theme'] = $CFG->themedir;
}
return ($fullpaths ? $fullinfo : $info);
@ -6780,10 +6773,9 @@ function get_plugin_types($fullpaths=true) {
/**
* Simplified version of get_list_of_plugins()
* @param string $plugintype type of plugin
* @param bool $fullpaths false means relative paths from dirroot
* @return array name=>fulllocation pairs of plugins of given type
*/
function get_plugin_list($plugintype, $fullpaths=true) {
function get_plugin_list($plugintype) {
global $CFG;
$ignored = array('CVS', '_vti_cnf', 'simpletest', 'db');
@ -6799,40 +6791,53 @@ function get_plugin_list($plugintype, $fullpaths=true) {
$plugintype = 'mod';
}
$fulldirs = array();
if ($plugintype === 'mod') {
// mod is an exception because we have to call this function from get_plugin_types()
$fulldir = $CFG->dirroot.'/mod';
$dir = $fullpaths ? $fulldir : 'mod';
$fulldirs[] = $CFG->dirroot.'/mod';
} else if ($plugintype === 'theme') {
// themes are an exception because they may be stored also in dataroot
$fulldirs[] = $CFG->dirroot.'/theme';
} else {
$fulltypes = get_plugin_types(true);
$types = get_plugin_types($fullpaths);
$types = get_plugin_types(true);
if (!array_key_exists($plugintype, $types)) {
return array();
}
$fulldir = $fulltypes[$plugintype];
$dir = $types[$plugintype];
$fulldir = $types[$plugintype];
if (!file_exists($fulldir)) {
return array();
}
$fulldirs[] = $fulldir;
}
$result = array();
$items = new DirectoryIterator($fulldir);
foreach ($items as $item) {
if ($item->isDot() or !$item->isDir()) {
//TODO: MDL-20799 add themedir support
foreach ($fulldirs as $fulldir) {
if (!is_dir($fulldir)) {
continue;
}
$pluginname = $item->getFilename();
if (in_array($pluginname, $ignored)) {
continue;
$items = new DirectoryIterator($fulldir);
foreach ($items as $item) {
if ($item->isDot() or !$item->isDir()) {
continue;
}
$pluginname = $item->getFilename();
if (in_array($pluginname, $ignored)) {
continue;
}
if ($pluginname !== clean_param($pluginname, PARAM_SAFEDIR)) {
// better ignore plugins with problematic names here
continue;
}
$result[$pluginname] = $fulldir.'/'.$pluginname;
unset($item);
}
if ($pluginname !== clean_param($pluginname, PARAM_SAFEDIR)) {
// better ignore plugins with problematic names here
continue;
}
$result[$pluginname] = $dir.'/'.$pluginname;
unset($items);
}
ksort($result);
@ -6858,14 +6863,8 @@ function get_list_of_plugins($directory='mod', $exclude='', $basedir='') {
$plugins = array();
if (empty($basedir)) {
// This switch allows us to use the appropiate theme directory - and potentialy alternatives for other plugins
switch ($directory) {
case "theme":
$basedir = $CFG->themedir;
break;
default:
$basedir = $CFG->dirroot .'/'. $directory;
}
// TODO: MDL-20799 megre theme with themedir if defined
$basedir = $CFG->dirroot .'/'. $directory;
} else {
$basedir = $basedir .'/'. $directory;
@ -6966,37 +6965,37 @@ function plugin_supports($type, $name, $feature, $default=null) {
$name = clean_param($name, PARAM_SAFEDIR); //bit of extra security
if ($type === 'mod') {
// we need this special case because we support subplugins in modules,
// otherwise it would end up in infinite loop
if ($name === 'NEWMODULE') {
//somebody forgot to rename the module template
return false;
}
include_once("$CFG->dirroot/mod/$name/lib.php");
// we need this special case because we support subplugins in modules,
// otherwise it would end up in infinite loop
if ($name === 'NEWMODULE') {
//somebody forgot to rename the module template
return false;
}
include_once("$CFG->dirroot/mod/$name/lib.php");
$function = $name.'_supports';
} else {
if ($feature == FEATURE_MOD_SUBPLUGINS) {
//sorry only modules
return false;
}
if (!$dir = get_plugin_directory($type, $name)) {
throw new coding_exception("Unsupported plugin type or name ($type/$name)");
}
$libfile = $dir.'/lib.php';
if (file_exists($libfile)) {
include_once($libfile);
}
$function = $type.'_'.$name.'_supports';
if ($feature == FEATURE_MOD_SUBPLUGINS) {
//sorry only modules
return false;
}
if (!$dir = get_plugin_directory($type, $name)) {
throw new coding_exception("Unsupported plugin type or name ($type/$name)");
}
$libfile = $dir.'/lib.php';
if (file_exists($libfile)) {
include_once($libfile);
}
$function = $type.'_'.$name.'_supports';
}
if (function_exists($function)) {
$supports = $function($feature);
if (is_null($supports)) {
// plugin does not know - use default
// plugin does not know - use default
return $default;
} else {
return $supports;

View File

@ -433,7 +433,7 @@ class navigation_node {
$link->add_class('dimmed');
}
if (!empty($CFG->framename) && ($PAGE->generaltype=='topframe' || $CFG->framename!='_top')) {
if (!empty($CFG->framename) && ($PAGE->pagelayout=='topframe' || $CFG->framename!='_top')) {
$breakoutaction = new breakout_of_frame_action();
$link->add_action($breakoutaction);
}

View File

@ -283,7 +283,7 @@ class html_label extends moodle_html_component {
/**
* This class hold all the information required to describe a <select> menu that
* will be printed by {@link moodle_core_renderer::select()}. (Or by an overridden
* will be printed by {@link core_renderer::select()}. (Or by an overridden
* version of that method in a subclass.)
*
* This component can also hold enough metadata to be used as a popup form. It just
@ -915,7 +915,7 @@ class html_field extends labelled_html_component {
/**
* Holds all the information required to render a <table> by
* {@see moodle_core_renderer::table()} or by an overridden version of that
* {@see core_renderer::table()} or by an overridden version of that
* method in a subclass.
*
* Example of usage:

View File

@ -45,26 +45,21 @@ interface renderer_factory {
/**
* Return the renderer for a particular part of Moodle.
*
* The renderer interfaces are defined by classes called moodle_{plugin}_renderer
* The renderer interfaces are defined by classes called {plugin}_renderer
* where {plugin} is the name of the component. The renderers for core Moodle are
* defined in lib/renderer.php. For plugins, they will be defined in a file
* called renderer.php inside the plugin.
*
* Renderers will normally want to subclass the moodle_renderer_base class.
* Renderers will normally want to subclass the renderer_base class.
* (However, if you really know what you are doing, you don't have to do that.)
*
* There is no separate interface definition for renderers. The default
* moodle_{plugin}_renderer implementation also serves to define the API for
* {plugin}_renderer implementation also serves to define the API for
* other implementations of the interface, whether or not they subclass it.
* For example, {@link custom_corners_core_renderer} does subclass
* {@link moodle_core_renderer}. On the other hand, if you are using
* {@link template_renderer_factory} then you always get back an instance
* of the {@link template_renderer} class, whatever type of renderer you ask
* for. This uses the fact that PHP is a dynamic language.
*
* A particular plugin can define multiple renderers if it wishes, using the
* $subtype parameter. For example moodle_mod_workshop_renderer,
* moodle_mod_workshop_allocation_manual_renderer etc.
* $subtype parameter. For example workshop_renderer,
* workshop_allocation_manual_renderer etc.
*
* @param string $component name such as 'core', 'mod_forum' or 'qtype_multichoice'.
* @param moodle_page $page the page the renderer is outputting content for.
@ -74,6 +69,7 @@ interface renderer_factory {
public function get_renderer($component, $page, $subtype=null);
}
/**
* This is a base class to help you implement the renderer_factory interface.
*
@ -95,9 +91,10 @@ abstract class renderer_factory_base implements renderer_factory {
* Constructor.
* @param theme_config $theme the theme we belong to.
*/
public function __construct($theme) {
public function __construct(theme_config $theme) {
$this->theme = $theme;
}
/**
* For a given module name, return the name of the standard renderer class
* that defines the renderer interface for that module.
@ -109,17 +106,24 @@ abstract class renderer_factory_base implements renderer_factory {
* @param string $subtype optional subtype such as 'news' resulting to 'mod_forum_news'
* @return string the name of the standard renderer class for that module.
*/
protected function standard_renderer_class_for_module($component, $subtype=null) {
if ($component != 'core') {
$pluginrenderer = get_component_directory($component) . '/renderer.php';
if (file_exists($pluginrenderer)) {
include_once($pluginrenderer);
protected function standard_renderer_class_for_plugin($component, $subtype=null) {
global $CFG; // needed in incldued files
if ($component !== 'core') {
// renderers are stored in lib.php files like the rest of standard functions and classes
$libfile = get_component_directory($component) . '/renderer.php';
if (file_exists($libfile)) {
include_once($libfile);
}
}
if (strpos($component, 'mod_') === 0) {
$component = substr($component, 4);
}
if (is_null($subtype)) {
$class = 'moodle_' . $component . '_renderer';
$class = $component . '_renderer';
} else {
$class = 'moodle_' . $component . '_' . $subtype . '_renderer';
$class = $component . '_' . $subtype . '_renderer';
}
if (!class_exists($class)) {
throw new coding_exception('Request for an unknown renderer class ' . $class);
@ -140,16 +144,16 @@ abstract class renderer_factory_base implements renderer_factory {
class standard_renderer_factory extends renderer_factory_base {
/**
* Implement the subclass method
* @param string $module name such as 'core', 'mod_forum' or 'qtype_multichoice'.
* @param string $component name such as 'core', 'mod_forum' or 'qtype_multichoice'.
* @param moodle_page $page the page the renderer is outputting content for.
* @param string $subtype optional subtype such as 'news' resulting to 'mod_forum_news'
* @return object an object implementing the requested renderer interface.
*/
public function get_renderer($module, $page, $subtype=null) {
if ($module == 'core') {
return new moodle_core_renderer($page);
public function get_renderer($component, $page, $subtype=null) {
if ($component === 'core') {
return new core_renderer($page);
} else {
$class = $this->standard_renderer_class_for_module($module, $subtype);
$class = $this->standard_renderer_class_for_plugin($component, $subtype);
return new $class($page, $this->get_renderer('core', $page));
}
}
@ -166,16 +170,16 @@ class standard_renderer_factory extends renderer_factory_base {
class cli_renderer_factory extends standard_renderer_factory {
/**
* Implement the subclass method
* @param string $module name such as 'core', 'mod_forum' or 'qtype_multichoice'.
* @param string $component name such as 'core', 'mod_forum' or 'qtype_multichoice'.
* @param moodle_page $page the page the renderer is outputting content for.
* @param string $subtype optional subtype such as 'news' resulting to 'mod_forum_news'
* @return object an object implementing the requested renderer interface.
*/
public function get_renderer($module, $page, $subtype=null) {
if ($module == 'core') {
public function get_renderer($component, $page, $subtype=null) {
if ($component === 'core') {
return new cli_core_renderer($page);
} else {
parent::get_renderer($module, $page, $subtype);
parent::get_renderer($component, $page, $subtype);
}
}
}
@ -188,11 +192,9 @@ class cli_renderer_factory extends standard_renderer_factory {
* It will load any code from theme/mytheme/renderers.php and
* theme/parenttheme/renderers.php, if then exist. Then whenever you ask for
* a renderer for 'component', it will create a mytheme_component_renderer or a
* parenttheme_component_renderer, instead of a moodle_component_renderer,
* parenttheme_component_renderer, instead of a component_renderer,
* if either of those classes exist.
*
* This generates the slightly different HTML that the custom_corners theme expects.
*
* @copyright 2009 Tim Hunt
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @since Moodle 2.0
@ -204,129 +206,40 @@ class theme_overridden_renderer_factory extends standard_renderer_factory {
* Constructor.
* @param object $theme the theme we are rendering for.
*/
public function __construct($theme) {
global $CFG;
public function __construct(theme_config $theme) {
parent::__construct($theme);
// Initialise $this->prefixes.
$renderersfile = $theme->dir . '/renderers.php';
if (is_readable($renderersfile)) {
include_once($renderersfile);
$this->prefixes[] = $theme->name . '_';
}
if (!empty($theme->parent)) {
$renderersfile = $CFG->themedir .'/'. $theme->parent . '/renderers.php';
if (is_readable($renderersfile)) {
include_once($renderersfile);
$this->prefixes[] = $theme->parent . '_';
}
}
$this->prefixes = $theme->renderer_prefixes();
}
/**
* Implement the subclass method
* @param string $module name such as 'core', 'mod_forum' or 'qtype_multichoice'.
* @param string $component name such as 'core', 'mod_forum' or 'qtype_multichoice'.
* @param moodle_page $page the page the renderer is outputting content for.
* @param string $subtype optional subtype such as 'news' resulting to 'mod_forum_news'
* @return object an object implementing the requested renderer interface.
*/
public function get_renderer($module, $page, $subtype=null) {
public function get_renderer($component, $page, $subtype=null) {
if (strpos($component, 'mod_') === 0) {
$component = substr($component, 4);
}
foreach ($this->prefixes as $prefix) {
// theme lib.php files are loaded automatically
if (is_null($subtype)) {
$classname = $prefix . $module . '_renderer';
$classname = $prefix . '_' . $component . '_renderer';
} else {
$classname = $prefix . $module . '_' . $subtype . '_renderer';
$classname = $prefix . '_' . $component . '_' . $subtype . '_renderer';
}
if (class_exists($classname)) {
if ($module == 'core') {
if ($component === 'core') {
return new $classname($page);
} else {
return new $classname($page, $this->get_renderer('core', $page));
}
}
}
return parent::get_renderer($module, $page, $subtype);
}
}
/**
* This is renderer factory that allows you to create templated themes.
*
* This should be considered an experimental proof of concept. In particular,
* the performance is probably not very good. Do not try to use in on a busy site
* without doing careful load testing first!
*
* This renderer factory returns instances of {@link template_renderer} class
* which which implement the corresponding renderer interface in terms of
* templates. To use this your theme must have a templates folder inside it.
* Then suppose the method moodle_core_renderer::greeting($name = 'world');
* exists. Then, a call to $OUTPUT->greeting() will cause the template
* /theme/yourtheme/templates/core/greeting.php to be rendered, with the variable
* $name available. The greeting.php template might contain
*
* <pre>
* <h1>Hello <?php echo $name ?>!</h1>
* </pre>
*
* @copyright 2009 Tim Hunt
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @since Moodle 2.0
*/
class template_renderer_factory extends renderer_factory_base {
/**
* An array of paths of where to search for templates. Normally this theme,
* the parent theme then the standardtemplate theme. (If some of these do
* not exist, or are the same as each other, then the list will be shorter.
*/
protected $searchpaths = array();
/**
* Constructor.
* @param object $theme the theme we are rendering for.
*/
public function __construct($theme) {
global $CFG;
parent::__construct($theme);
// Initialise $this->searchpaths.
if ($theme->name != 'standardtemplate') {
$templatesdir = $theme->dir . '/templates';
if (is_dir($templatesdir)) {
$this->searchpaths[] = $templatesdir;
}
}
if (!empty($theme->parent)) {
$templatesdir = $CFG->themedir .'/'. $theme->parent . '/templates';
if (is_dir($templatesdir)) {
$this->searchpaths[] = $templatesdir;
}
}
$this->searchpaths[] = $CFG->themedir .'/standardtemplate/templates';
}
/**
* Implement the subclass method
* @param string $module name such as 'core', 'mod_forum' or 'qtype_multichoice'.
* @param moodle_page $page the page the renderer is outputting content for.
* @param string $subtype optional subtype such as 'news' resulting to 'mod_forum_news'
* @return object an object implementing the requested renderer interface.
*/
public function get_renderer($module, $page, $subtype=null) {
// Refine the list of search paths for this module.
$searchpaths = array();
foreach ($this->searchpaths as $rootpath) {
$path = $rootpath . '/' . $module;
if (!is_null($subtype)) {
$path .= '/' . $subtype;
}
if (is_dir($path)) {
$searchpaths[] = $path;
}
}
// Create a template_renderer that copies the API of the standard renderer.
$copiedclass = $this->standard_renderer_class_for_module($module, $subtype);
return new template_renderer($copiedclass, $searchpaths, $page);
// use standard renderes if themes do not contain overridden renderer
return parent::get_renderer($component, $page, $subtype);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -37,7 +37,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @since Moodle 2.0
*/
class moodle_renderer_base {
class renderer_base {
/** @var xhtml_container_stack the xhtml_container_stack to use. */
protected $opencontainers;
/** @var moodle_page the page we are rendering for. */
@ -149,31 +149,27 @@ class moodle_renderer_base {
return $classes;
}
/**
* Return the URL for an icon identified as in pre-Moodle 2.0 code.
*
* Suppose you have old code like $url = "$CFG->pixpath/i/course.gif";
* then old_icon_url('i/course'); will return the equivalent URL that is correct now.
*
* @param string $iconname the name of the icon.
* @return string the URL for that icon.
*/
public function old_icon_url($iconname) {
return $this->page->theme->old_icon_url($iconname);
/** OBSOLETED: to be removed soon */
public function old_icon_url($iconname, $component='moodle', $escaped=true) {
$url = $this->page->theme->image_url($iconname, $component);
return $url->out(false, array(), $escaped);
}
/** OBSOLETED: to be removed soon */
public function mod_icon_url($iconname, $component, $escaped=true) {
$url = $this->page->theme->image_url($iconname, $component);
return $url->out(false, array(), $escaped);
}
/**
* Return the URL for an icon identified as in pre-Moodle 2.0 code.
* Return the moodle_url for an image
*
* Suppose you have old code like $url = "$CFG->modpixpath/$mod/icon.gif";
* then mod_icon_url('icon', $mod); will return the equivalent URL that is correct now.
*
* @param string $iconname the name of the icon.
* @param string $module the module the icon belongs to.
* @return string the URL for that icon.
* @param string $imagename the name of the image
* @param string $component full plugin name
* @return moodle_url
*/
public function mod_icon_url($iconname, $module) {
return $this->page->theme->mod_icon_url($iconname, $module);
public function image_url($imagename, $component='moodle') {
return $this->page->theme->image_url($imagename, $component);
}
/**
@ -220,198 +216,13 @@ class moodle_renderer_base {
/**
* This is the templated renderer which copies the API of another class, replacing
* all methods calls with instantiation of a template.
*
* When the method method_name is called, this class will search for a template
* called method_name.php in the folders in $searchpaths, taking the first one
* that it finds. Then it will set up variables for each of the arguments of that
* method, and render the template. This is implemented in the {@link __call()}
* PHP magic method.
*
* Methods like print_box_start and print_box_end are handles specially, and
* implemented in terms of the print_box.php method.
* The standard implementation of the core_renderer interface.
*
* @copyright 2009 Tim Hunt
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @since Moodle 2.0
*/
class template_renderer extends moodle_renderer_base {
/** @var ReflectionClass information about the class whose API we are copying. */
protected $copiedclass;
/** @var array of places to search for templates. */
protected $searchpaths;
protected $rendererfactory;
/**
* Magic word used when breaking apart container templates to implement
* _start and _end methods.
*/
const CONTENTSTOKEN = '-@#-Contents-go-here-#@-';
/**
* Constructor
* @param string $copiedclass the name of a class whose API we should be copying.
* @param array $searchpaths a list of folders to search for templates in.
* @param moodle_page $page the page we are doing output for.
*/
public function __construct($copiedclass, $searchpaths, $page) {
parent::__construct($page);
$this->copiedclass = new ReflectionClass($copiedclass);
$this->searchpaths = $searchpaths;
}
/**
* PHP magic method implementation. Do not use this method directly.
* @param string $method The method to call
* @param array $arguments The arguments to pass to the method
* @return mixed The return value of the called method
*/
public function __call($method, $arguments) {
if (substr($method, -6) == '_start') {
return $this->process_start(substr($method, 0, -6), $arguments);
} else if (substr($method, -4) == '_end') {
return $this->process_end(substr($method, 0, -4), $arguments);
} else {
return $this->process_template($method, $arguments);
}
}
/**
* Render the template for a given method of the renderer class we are copying,
* using the arguments passed.
* @param string $method the method that was called.
* @param array $arguments the arguments that were passed to it.
* @return string the HTML to be output.
*/
protected function process_template($method, $arguments) {
if (!$this->copiedclass->hasMethod($method) ||
!$this->copiedclass->getMethod($method)->isPublic()) {
throw new coding_exception('Unknown method ' . $method);
}
// Find the template file for this method.
$template = $this->find_template($method);
// Use the reflection API to find out what variable names the arguments
// should be stored in, and fill in any missing ones with the defaults.
$namedarguments = array();
$expectedparams = $this->copiedclass->getMethod($method)->getParameters();
foreach ($expectedparams as $param) {
$paramname = $param->getName();
if (!empty($arguments)) {
$namedarguments[$paramname] = array_shift($arguments);
} else if ($param->isDefaultValueAvailable()) {
$namedarguments[$paramname] = $param->getDefaultValue();
} else {
throw new coding_exception('Missing required argument ' . $paramname);
}
}
// Actually render the template.
return $this->render_template($template, $namedarguments);
}
/**
* Actually do the work of rendering the template.
* @param string $_template the full path to the template file.
* @param array $_namedarguments an array variable name => value, the variables
* that should be available to the template.
* @return string the HTML to be output.
*/
protected function render_template($_template, $_namedarguments) {
// Note, we intentionally break the coding guidelines with regards to
// local variable names used in this function, so that they do not clash
// with the names of any variables being passed to the template.
global $CFG, $SITE, $THEME, $USER;
// The next lines are a bit tricky. The point is, here we are in a method
// of a renderer class, and this object may, or may not, be the same as
// the global $OUTPUT object. When rendering the template, we want to use
// this object. However, people writing Moodle code expect the current
// renderer to be called $OUTPUT, not $this, so define a variable called
// $OUTPUT pointing at $this. The same comment applies to $PAGE and $COURSE.
$OUTPUT = $this;
$PAGE = $this->page;
$COURSE = $this->page->course;
// And the parameters from the function call.
extract($_namedarguments);
// Include the template, capturing the output.
ob_start();
include($_template);
$_result = ob_get_contents();
ob_end_clean();
return $_result;
}
/**
* Searches the folders in {@link $searchpaths} to try to find a template for
* this method name. Throws an exception if one cannot be found.
* @param string $method the method name.
* @return string the full path of the template to use.
*/
protected function find_template($method) {
foreach ($this->searchpaths as $path) {
$filename = $path . '/' . $method . '.php';
if (file_exists($filename)) {
return $filename;
}
}
throw new coding_exception('Cannot find template for ' . $this->copiedclass->getName() . '::' . $method);
}
/**
* Handle methods like print_box_start by using the print_box template,
* splitting the result, pushing the end onto the stack, then returning the start.
* @param string $method the method that was called, with _start stripped off.
* @param array $arguments the arguments that were passed to it.
* @return string the HTML to be output.
*/
protected function process_start($method, $arguments) {
array_unshift($arguments, self::CONTENTSTOKEN);
$html = $this->process_template($method, $arguments);
list($start, $end) = explode(self::CONTENTSTOKEN, $html, 2);
$this->opencontainers->push($method, $end);
return $start;
}
/**
* Handle methods like print_box_end, we just need to pop the end HTML from
* the stack.
* @param string $method the method that was called, with _end stripped off.
* @param array $arguments not used. Assumed to be irrelevant.
* @return string the HTML to be output.
*/
protected function process_end($method, $arguments) {
return $this->opencontainers->pop($method);
}
/**
* @return array the list of paths where this class searches for templates.
*/
public function get_search_paths() {
return $this->searchpaths;
}
/**
* @return string the name of the class whose API we are copying.
*/
public function get_copied_class() {
return $this->copiedclass->getName();
}
}
/**
* The standard implementation of the moodle_core_renderer interface.
*
* @copyright 2009 Tim Hunt
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @since Moodle 2.0
*/
class moodle_core_renderer extends moodle_renderer_base {
class core_renderer extends renderer_base {
/** @var string used in {@link header()}. */
const PERFORMANCE_INFO_TOKEN = '%%PERFORMANCEINFO%%';
/** @var string used in {@link header()}. */
@ -510,7 +321,14 @@ class moodle_core_renderer extends moodle_renderer_base {
}
}
/// Perform a browser environment check for the flash version. Should only run once per login session.
// Get the theme stylesheet - this has to be always first CSS, this loads also styles.css from all plugins;
// any other custom CSS can not be overridden via themes and is highly discouraged
$urls = $this->page->theme->css_urls();
foreach ($urls as $url) {
$output .= '<link rel="stylesheet" type="text/css" href="' . $url->out() . '" />' . "\n";
}
// Perform a browser environment check for the flash version. Should only run once per login session.
if (isloggedin() && !empty($CFG->excludeoldflashclients) && empty($SESSION->flashversion)) {
$this->page->requires->yui_lib('event')->in_head();
$this->page->requires->yui_lib('connection')->in_head();
@ -519,9 +337,6 @@ class moodle_core_renderer extends moodle_renderer_base {
$this->page->requires->js_function_call('setflashversiontosession', array($CFG->wwwroot, sesskey()));
}
// Add the meta tags from the themes if any were requested.
$output .= $this->page->theme->get_meta_tags($this->page);
// Get any HTML from the page_requirements_manager.
$output .= $this->page->requires->get_head_code();
@ -698,28 +513,22 @@ class moodle_core_renderer extends moodle_renderer_base {
$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);
// 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);
if ($templatefile) {
// Render the template.
$template = $this->render_page_template($templatefile);
} else {
// New style template not found, fall back to using header.html and footer.html.
$template = $this->handle_legacy_theme();
}
// Slice the template output into header and footer.
$cutpos = strpos($template, self::MAIN_CONTENT_TOKEN);
// Slice the rendered output into header and footer.
$cutpos = strpos($rendered, self::MAIN_CONTENT_TOKEN);
if ($cutpos === false) {
throw new coding_exception('Layout template ' . $templatefile .
throw new coding_exception('page layout file ' . $layoutfile .
' does not contain the string "' . self::MAIN_CONTENT_TOKEN . '".');
}
$header = substr($template, 0, $cutpos);
$footer = substr($template, $cutpos + strlen(self::MAIN_CONTENT_TOKEN));
$header = substr($rendered, 0, $cutpos);
$footer = substr($rendered, $cutpos + strlen(self::MAIN_CONTENT_TOKEN));
if (empty($this->contenttype)) {
debugging('The layout template did not call $OUTPUT->doctype()');
debugging('The page layout file did not call $OUTPUT->doctype()');
$header = $this->doctype() . $header;
}
@ -732,17 +541,15 @@ class moodle_core_renderer extends moodle_renderer_base {
}
/**
* Renders and outputs the page template.
* @param string $templatefile The name of the template's file
* @param array $menu The menu that will be used in the included file
* @param array $navigation The navigation that will be used in the included file
* Renders and outputs the page layout file.
* @param string $layoutfile The name of the layout file
* @return string HTML code
*/
protected function render_page_template($templatefile) {
protected function render_page_layout($layoutfile) {
global $CFG, $SITE, $THEME, $USER;
// The next lines are a bit tricky. The point is, here we are in a method
// of a renderer class, and this object may, or may not, be the same as
// the global $OUTPUT object. When rendering the template, we want to use
// the global $OUTPUT object. When rendering the page layout file, we want to use
// this object. However, people writing Moodle code expect the current
// renderer to be called $OUTPUT, not $this, so define a variable called
// $OUTPUT pointing at $this. The same comment applies to $PAGE and $COURSE.
@ -750,131 +557,11 @@ class moodle_core_renderer extends moodle_renderer_base {
$PAGE = $this->page;
$COURSE = $this->page->course;
// Required for legacy template uses
$navigation = $this->page->has_navbar();
ob_start();
include($templatefile);
$template = ob_get_contents();
include($layoutfile);
$rendered = ob_get_contents();
ob_end_clean();
return $template;
}
/**
* Renders and outputs a legacy template.
* @param array $navigation The navigation that will be used in the included file
* @param array $menu The menu that will be used in the included file
* @return string HTML code
*/
protected function handle_legacy_theme() {
global $CFG, $SITE, $USER;
// Set a pretend global from the properties of this class.
// See the comment in render_page_template for a fuller explanation.
$COURSE = $this->page->course;
$THEME = $this->page->theme;
$OUTPUT = $this;
// Set up local variables that header.html expects.
$direction = $this->htmlattributes();
$title = $this->page->title;
$heading = $this->page->heading;
$focus = $this->page->focuscontrol;
$button = $this->page->button;
$pageid = $this->page->pagetype;
$pageclass = $this->page->bodyclasses;
$bodytags = ' class="' . $pageclass . '" id="' . $pageid . '"';
$home = $this->page->generaltype == 'home';
$menu = $this->page->headingmenu;
$meta = $this->standard_head_html();
// The next line is a nasty hack. having set $meta to standard_head_html, we have already
// got the contents of include($CFG->javascript). However, legacy themes are going to
// include($CFG->javascript) again. We want to make sure that when they do, nothing is output.
$CFG->javascript = $CFG->libdir . '/emptyfile.php';
// Set up local variables that footer.html expects.
$homelink = $this->home_link();
$loggedinas = $this->login_info();
$course = $this->page->course;
$performanceinfo = self::PERFORMANCE_INFO_TOKEN;
$navigation = $this->page->has_navbar();
if (!$menu && $navigation) {
$menu = $loggedinas;
}
if (!empty($this->page->theme->layouttable)) {
$lt = $this->page->theme->layouttable;
} else {
$lt = array('left', 'middle', 'right');
}
if (!empty($this->page->theme->block_l_max_width)) {
$preferredwidthleft = $this->page->theme->block_l_max_width;
} else {
$preferredwidthleft = 210;
}
if (!empty($this->page->theme->block_r_max_width)) {
$preferredwidthright = $this->page->theme->block_r_max_width;
} else {
$preferredwidthright = 210;
}
ob_start();
include($this->page->theme->dir . '/header.html');
echo '<table id="layout-table"><tr>';
foreach ($lt as $column) {
if ($column == 'left' && $this->page->blocks->region_has_content(BLOCK_POS_LEFT, $this)) {
echo '<td id="left-column" class="block-region" style="width: ' . $preferredwidthright . 'px; vertical-align: top;">';
echo $this->container_start();
echo $this->blocks_for_region(BLOCK_POS_LEFT);
echo $this->container_end();
echo '</td>';
} else if ($column == 'middle') {
echo '<td id="middle-column" style="vertical-align: top;">';
echo $this->container_start();
echo $this->skip_link_target();
echo self::MAIN_CONTENT_TOKEN;
echo $this->container_end();
echo '</td>';
} else if ($column == 'right' && $this->page->blocks->region_has_content(BLOCK_POS_RIGHT, $this)) {
echo '<td id="right-column" class="block-region" style="width: ' . $preferredwidthright . 'px; vertical-align: top;">';
echo $this->container_start();
echo $this->blocks_for_region(BLOCK_POS_RIGHT);
echo $this->container_end();
echo '</td>';
}
}
echo '</tr></table>';
$menu = str_replace('navmenu', 'navmenufooter', $menu);
include($THEME->dir . '/footer.html');
$output = ob_get_contents();
ob_end_clean();
// Put in the start of body code. Bit of a hack, put it in before the first
// <div or <table.
$divpos = strpos($output, '<div');
$tablepos = strpos($output, '<table');
if ($divpos === false || ($tablepos !== false && $tablepos < $divpos)) {
$pos = $tablepos;
} else {
$pos = $divpos;
}
$output = substr($output, 0, $divpos) . $this->standard_top_of_body_html() .
substr($output, $divpos);
// Put in the end token before the end of body.
$output = str_replace('</body>', self::END_HTML_TOKEN . '</body>', $output);
// Make sure we use the correct doctype.
$output = preg_replace('/(<!DOCTYPE.+?>)/s', $this->doctype(), $output);
return $output;
return $rendered;
}
/**
@ -926,7 +613,7 @@ class moodle_core_renderer extends moodle_renderer_base {
foreach ($controls as $control) {
$controlshtml[] = $this->output_tag('a', array('class' => 'icon',
'title' => $control['caption'], 'href' => $control['url']),
$this->output_empty_tag('img', array('src' => $this->old_icon_url($control['icon']),
$this->output_empty_tag('img', array('src' => $this->image_url($control['icon'])->out(false, array(), false),
'alt' => $control['caption'])));
}
return $this->output_tag('div', array('class' => 'commands'), implode('', $controlshtml));
@ -1006,7 +693,7 @@ class moodle_core_renderer extends moodle_renderer_base {
$plaintitle = strip_tags($bc->title);
$this->page->requires->js_function_call('new block_hider', array($bc->id, $userpref,
get_string('hideblocka', 'access', $plaintitle), get_string('showblocka', 'access', $plaintitle),
$this->old_icon_url('t/switch_minus'), $this->old_icon_url('t/switch_plus')));
$this->image_url('t/switch_minus')->out(false, array(), false), $this->image_url('t/switch_plus')->out(false, array(), false)));
}
}
@ -1264,7 +951,7 @@ class moodle_core_renderer extends moodle_renderer_base {
if (!empty($iconpath)) {
$icon->image->src = $iconpath;
} else {
$icon->image->src = $this->old_icon_url('docs');
$icon->image->src = $this->image_url('docs')->out(false, array(), false);
}
if (!empty($CFG->doctonewwindow)) {
@ -1391,7 +1078,7 @@ class moodle_core_renderer extends moodle_renderer_base {
$image = clone($image);
if (empty($image->src)) {
$image->src = $this->old_icon_url('spacer');
$image->src = $this->image_url('spacer')->out(false, array(), false);
}
$image->prepare();
@ -1947,12 +1634,12 @@ class moodle_core_renderer extends moodle_renderer_base {
// Header not yet printed
if (isset($_SERVER['SERVER_PROTOCOL'])) {
// server protocol should be always present, because this render
// can not be used from command line or when outputting custom XML
// server protocol should be always present, because this render
// can not be used from command line or when outputting custom XML
@header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found');
}
$this->page->set_url(''); // no url
//$this->page->set_generaltype('form'); //TODO: MDL-20676 blocks on error pages are weird, unfortunately it somehow detect the geenralpagetype from URL :-(
//$this->page->set_pagelayout('form'); //TODO: MDL-20676 blocks on error pages are weird, unfortunately it somehow detect the geenralpagetype from URL :-(
$this->page->set_title(get_string('error'));
$output .= $this->header();
}
@ -1996,7 +1683,7 @@ class moodle_core_renderer extends moodle_renderer_base {
*/
public function notification($message, $classes = 'notifyproblem') {
return $this->output_tag('div', array('class' =>
moodle_renderer_base::prepare_classes($classes)), clean_text($message));
renderer_base::prepare_classes($classes)), clean_text($message));
}
/**
@ -2139,7 +1826,7 @@ class moodle_core_renderer extends moodle_renderer_base {
$oddeven = 1;
$keys = array_keys($table->data);
$lastrowkey = end($keys);
$output .= $this->output_start_tag('tbody', array('class' => moodle_renderer_base::prepare_classes($table->bodyclasses))) . "\n";
$output .= $this->output_start_tag('tbody', array('class' => renderer_base::prepare_classes($table->bodyclasses))) . "\n";
foreach ($table->data as $key => $row) {
if (($row === 'hr') && ($countcols)) {
@ -2248,7 +1935,7 @@ class moodle_core_renderer extends moodle_renderer_base {
throw new coding_exception('Heading level must be an integer between 1 and 6.');
}
return $this->output_tag('h' . $level,
array('id' => $id, 'class' => moodle_renderer_base::prepare_classes($classes)), $text);
array('id' => $id, 'class' => renderer_base::prepare_classes($classes)), $text);
}
/**
@ -2271,7 +1958,7 @@ class moodle_core_renderer extends moodle_renderer_base {
public function box_start($classes = 'generalbox', $id = '') {
$this->opencontainers->push('box', $this->output_end_tag('div'));
return $this->output_start_tag('div', array('id' => $id,
'class' => 'box ' . moodle_renderer_base::prepare_classes($classes)));
'class' => 'box ' . renderer_base::prepare_classes($classes)));
}
/**
@ -2302,7 +1989,7 @@ class moodle_core_renderer extends moodle_renderer_base {
public function container_start($classes = '', $id = '') {
$this->opencontainers->push('container', $this->output_end_tag('div'));
return $this->output_start_tag('div', array('id' => $id,
'class' => moodle_renderer_base::prepare_classes($classes)));
'class' => renderer_base::prepare_classes($classes)));
}
/**
@ -2382,7 +2069,7 @@ class moodle_core_renderer extends moodle_renderer_base {
public function navbar() {
return $this->page->navbar->content();
}
}
}
/// RENDERERS
@ -2396,7 +2083,7 @@ class moodle_core_renderer extends moodle_renderer_base {
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @since Moodle 2.0
*/
class cli_core_renderer extends moodle_core_renderer {
class cli_core_renderer extends core_renderer {
/**
* Returns the page header.
* @return string HTML fragment

View File

@ -39,7 +39,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @since Moodle 2.0
*
* @property-read string $generaltype the general type of page this is. For example 'normal', 'popup', 'home'.
* @property-read string $pagelayout the general type of page this is. For example 'normal', 'popup', 'home'.
* Allows the theme to display things differently, if it wishes to.
* @property-read string $title the title that should go in the <head> section of the HTML of this page.
* @property-read string $heading the main heading that should be displayed at the top of the <body>.
@ -99,7 +99,14 @@ class moodle_page {
protected $_pagetype = null;
protected $_generaltype = 'normal';
protected $_pagelayout = 'normal';
/**
* List of theme layeout options, these are ignored by core.
* To be used in individual theme layout files only.
* @var array
*/
protected $_layout_options = array();
protected $_subpage = '';
@ -156,7 +163,7 @@ class moodle_page {
* This is simply to improve backwards compatability. If old code relies on
* a page class that implements print_header, or complex logic in
* user_allowed_editing then we stash an instance of that other class here,
* and delegate to it in certani situations.
* and delegate to it in certain situations.
*/
protected $_legacypageobject = null;
@ -284,12 +291,20 @@ class moodle_page {
}
/**
* Please do not call this method directly, use the ->generaltype syntax. {@link __get()}.
* Please do not call this method directly, use the ->pagelayout syntax. {@link __get()}.
* @return string the general type of page this is. For example 'normal', 'popup', 'home'.
* Allows the theme to display things differently, if it wishes to.
*/
public function get_generaltype() {
return $this->_generaltype;
public function get_pagelayout() {
return $this->_pagelayout;
}
/**
* Please do not call this method directly, use the ->layout_tions syntax. {@link __get()}.
* @return returns arrys with options for layout file
*/
public function get_layout_options() {
return $this->_layout_options;
}
/**
@ -373,7 +388,7 @@ class moodle_page {
* @return blocks_manager the blocks manager object for this page.
*/
public function get_blocks() {
global $CFG, $THEME;
global $CFG;
if (is_null($this->_blocks)) {
if (!empty($CFG->blockmanagerclass)) {
$classname = $CFG->blockmanagerclass;
@ -549,7 +564,7 @@ class moodle_page {
*/
public function debug_summary() {
$summary = '';
$summary .= 'General type: ' . $this->generaltype . '. ';
$summary .= 'General type: ' . $this->pagelayout . '. ';
if (!during_initial_install()) {
$summary .= 'Context ' . print_context_name($this->context) . ' (context id ' . $this->context->id . '). ';
}
@ -682,14 +697,13 @@ class moodle_page {
}
/**
* @param string $generaltype the general type of page this is. For example 'popup', 'home'.
* @param string $pagelayout the page layout this is. For example 'popup', 'home'.
* This properly defaults to 'normal', so you only need to call this function if
* you want something different. The exact range of supported page types is not
* strictly defined, this value is just passed to the theme. However, at the moment
* only 'normal', 'popup' amd 'home' are used.
* you want something different. The exact range of supported layouts is specified
* in the standard theme.
*/
public function set_generaltype($generaltype) {
$this->_generaltype = $generaltype;
public function set_pagelayout($pagelayout) {
$this->_pagelayout = $pagelayout;
}
/**
@ -951,10 +965,8 @@ class moodle_page {
if (!empty($CFG->loginhttps)) {
$HTTPSPAGEREQUIRED = true;
$CFG->httpswwwroot = str_replace('http:', 'https:', $CFG->wwwroot);
$CFG->httpsthemewww = str_replace('http:', 'https:', $CFG->themewww);
} else {
$CFG->httpswwwroot = $CFG->wwwroot;
$CFG->httpsthemewww = $CFG->themewww;
}
}
@ -995,21 +1007,6 @@ class moodle_page {
// Show the messaging popup, if there are messages.
message_popup_window();
// Add any stylesheets required using the horrible legacy mechanism.
if (!empty($CFG->stylesheets)) {
debugging('Some code on this page is using the horrible legacy mechanism $CFG->stylesheets to include links to ' .
'extra stylesheets. This is deprecated. Please use $PAGE->requires->css(...) instead.', DEBUG_DEVELOPER);
foreach ($CFG->stylesheets as $stylesheet) {
$this->requires->css($stylesheet, true);
}
}
// Require theme stylesheets.
$stylesheets = $this->theme->get_stylesheet_urls();
foreach ($stylesheets as $stylesheet) {
$this->requires->css($stylesheet, true);
}
$this->initialise_standard_body_classes();
}
@ -1035,15 +1032,14 @@ class moodle_page {
if (is_null($this->_theme)) {
$themename = $this->resolve_theme();
$this->_theme = theme_config::load($themename);
$this->_layout_options = $this->_theme->pagelayout_options($this->pagelayout);
}
$this->_theme->setup_blocks($this->generaltype, $this->blocks);
$this->_theme->setup_blocks($this->pagelayout, $this->blocks);
if ($this === $PAGE) {
$THEME = $this->_theme;
$OUTPUT = $this->_theme->get_renderer('core', $this);
// Support legacy code.
$this->_theme->setup_legacy_pix_paths();
}
$this->_wherethemewasinitialised = debug_backtrace();

View File

@ -33,7 +33,7 @@
require '../config.php';
$PAGE->set_url(new moodle_url($CFG->wwwroot.'/lib/session-test.php'));
$PAGE->set_generaltype('form');
$PAGE->set_pagelayout('form');
error('session test not reimplemented yet'); //DO NOT localize or use print_error()!
//

View File

@ -26,6 +26,14 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
// special support for highly optimised scripts that do not need libraries and DB connection
if (defined('ABORT_AFTER_CONFIG')) {
if (!defined('ABORT_AFTER_CONFIG_CANCEL')) {
require_once("$CFG->dirroot/lib/configonlylib.php");
return;
}
}
/**
* Holds the core settings that affect how Moodle works. Some of its fields
* are set in config.php, and the rest are loaded from the config table.
@ -94,7 +102,7 @@ global $PAGE;
global $COURSE;
/**
* $OUTPUT is an instance of moodle_core_renderer or one of its subclasses. Use
* $OUTPUT is an instance of core_renderer or one of its subclasses. Use
* it to generate HTML for output.
*
* $OUTPUT is initialised the first time it is used. See {@link bootstrap_renderer}
@ -202,15 +210,9 @@ $CFG->config_php_settings = (array)$CFG;
// Set up some paths.
$CFG->libdir = $CFG->dirroot .'/lib';
if (!isset($CFG->themedir)) {
$CFG->themedir = $CFG->dirroot.'/theme';
$CFG->themewww = $CFG->wwwroot.'/theme';
}
// Set httpswwwroot default value (this variable will replace $CFG->wwwroot
// inside some URLs used in HTTPSPAGEREQUIRED pages.
$CFG->httpswwwroot = $CFG->wwwroot;
$CFG->httpsthemewww = $CFG->themewww;
require_once($CFG->libdir .'/setuplib.php'); // Functions that MUST be loaded first

View File

@ -665,8 +665,6 @@ get_string('experimental', 'admin', NULL);
get_string('experimentalsettings', 'admin', NULL);
get_string('enableglobalsearch', 'admin', NULL);
get_string('configenableglobalsearch', 'admin', NULL);
get_string('smartpix', 'admin', NULL);
get_string('configsmartpix', 'admin', NULL);
get_string('enablehtmlpurifier', 'admin', NULL);
get_string('configenablehtmlpurifier', 'admin', NULL);
get_string('experimentalsplitrestore', 'admin', NULL);

View File

@ -665,8 +665,6 @@ old_get_string('experimental', 'admin', NULL);
old_get_string('experimentalsettings', 'admin', NULL);
old_get_string('enableglobalsearch', 'admin', NULL);
old_get_string('configenableglobalsearch', 'admin', NULL);
old_get_string('smartpix', 'admin', NULL);
old_get_string('configsmartpix', 'admin', NULL);
old_get_string('enablehtmlpurifier', 'admin', NULL);
old_get_string('configenablehtmlpurifier', 'admin', NULL);
old_get_string('experimentalsplitrestore', 'admin', NULL);

View File

@ -29,55 +29,6 @@ if (!defined('MOODLE_INTERNAL')) {
}
require_once($CFG->libdir . '/outputlib.php');
/**
* Unit tests for the pix_icon_finder class.
*
* @copyright 2009 Tim Hunt
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class pix_icon_finder_test extends UnitTestCase {
public function test_old_icon_url() {
global $CFG;
$if = new pix_icon_finder(new theme_config());
$this->assertEqual($CFG->httpswwwroot . '/pix/i/course.gif', $if->old_icon_url('i/course'));
}
/* Implement interface method. */
public function test_mod_icon_url() {
global $CFG;
$if = new pix_icon_finder(new theme_config());
$this->assertEqual($CFG->httpswwwroot . '/mod/quiz/icon.gif', $if->mod_icon_url('icon', 'quiz'));
}
}
/**
* Unit tests for the standard_renderer_factory class.
*
* @copyright 2009 Tim Hunt
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class theme_icon_finder_test extends UnitTestCase {
public function test_old_icon_url_test() {
global $CFG;
$theme = new theme_config();
$theme->name = 'test';
$if = new theme_icon_finder($theme);
$this->assertEqual($CFG->httpsthemewww . '/test/pix/i/course.gif', $if->old_icon_url('i/course'));
}
/* Implement interface method. */
public function test_mod_icon_url() {
global $CFG;
$theme = new theme_config();
$theme->name = 'test';
$if = new theme_icon_finder($theme);
$this->assertEqual($CFG->httpsthemewww . '/test/pix/mod/quiz/icon.gif', $if->mod_icon_url('icon', 'quiz'));
}
}
/**
* Subclass of renderer_factory_base for testing. Implement abstract method and
* count calls, so we can test caching behaviour.
@ -96,11 +47,11 @@ class testable_renderer_factory extends renderer_factory_base {
if (!in_array(array($module, $subtype), $this->createcalls)) {
$this->createcalls[] = array($module, $subtype);
}
return new moodle_core_renderer($page);
return new core_renderer($page);
}
public function standard_renderer_class_for_module($module, $subtype=null) {
return parent::standard_renderer_class_for_module($module, $subtype);
public function standard_renderer_class_for_plugin($module, $subtype=null) {
return parent::standard_renderer_class_for_plugin($module, $subtype);
}
}
@ -111,7 +62,7 @@ class testable_renderer_factory extends renderer_factory_base {
* @copyright 2009 Tim Hunt
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class moodle_mod_test_renderer extends moodle_core_renderer {
class mod_test_renderer extends core_renderer {
public function __construct($containerstack, $page) {
parent::__construct($containerstack, $page, null);
}
@ -144,7 +95,7 @@ class moodle_mod_test_renderer extends moodle_core_renderer {
* @copyright 2009 David Mudrak
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class moodle_mod_test_subtype_renderer extends moodle_core_renderer {
class mod_test_subtype_renderer extends core_renderer {
public function __construct($containerstack, $page) {
parent::__construct($containerstack, $page, null);
}
@ -177,39 +128,39 @@ class renderer_factory_base_test extends UnitTestCase {
}
public function test_standard_renderer_class_for_module_core() {
public function test_standard_renderer_class_for_plugin_core() {
// Set up.
$factory = new testable_renderer_factory();
// Exercise SUT.
$classname = $factory->standard_renderer_class_for_module('core');
$classname = $factory->standard_renderer_class_for_plugin('core');
// Verify outcome
$this->assertEqual('moodle_core_renderer', $classname);
$this->assertEqual('core_renderer', $classname);
}
public function test_standard_renderer_class_for_module_test() {
public function test_standard_renderer_class_for_plugin_test() {
// Set up.
$factory = new testable_renderer_factory();
// Exercise SUT.
$classname = $factory->standard_renderer_class_for_module('mod_test');
$classname = $factory->standard_renderer_class_for_plugin('mod_test');
// Verify outcome
$this->assertEqual('moodle_mod_test_renderer', $classname);
$this->assertEqual('mod_test_renderer', $classname);
}
public function test_standard_renderer_class_for_module_test_with_subtype() {
public function test_standard_renderer_class_for_plugin_test_with_subtype() {
// Set up.
$factory = new testable_renderer_factory();
// Exercise SUT.
$classname = $factory->standard_renderer_class_for_module('mod_test', 'subtype');
$classname = $factory->standard_renderer_class_for_plugin('mod_test', 'subtype');
// Verify outcome
$this->assertEqual('moodle_mod_test_subtype_renderer', $classname);
$this->assertEqual('mod_test_subtype_renderer', $classname);
}
public function test_standard_renderer_class_for_module_unknown() {
public function test_standard_renderer_class_for_plugin_unknown() {
// Set up.
$factory = new testable_renderer_factory();
$this->expectException();
// Exercise SUT.
$classname = $factory->standard_renderer_class_for_module('something_that_does_not_exist');
$classname = $factory->standard_renderer_class_for_plugin('something_that_does_not_exist');
}
}
@ -237,55 +188,17 @@ class standard_renderer_factory_test extends UnitTestCase {
public function test_get_core_renderer() {
$renderer = $this->factory->get_renderer('core', new moodle_page);
$this->assertIsA($renderer, 'moodle_core_renderer');
$this->assertIsA($renderer, 'core_renderer');
}
public function test_get_test_renderer() {
$renderer = $this->factory->get_renderer('mod_test', new moodle_page);
$this->assertIsA($renderer, 'moodle_mod_test_renderer');
$this->assertIsA($renderer, 'mod_test_renderer');
}
public function test_get_test_subtype_renderer() {
$renderer = $this->factory->get_renderer('mod_test', new moodle_page, 'subtype');
$this->assertIsA($renderer, 'moodle_mod_test_subtype_renderer');
}
}
/**
* Unit tests for the custom_corners_renderer_factory class.
*
* @copyright 2009 Tim Hunt
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class custom_corners_renderer_factory_test extends UnitTestCase {
public static $includecoverage = array('lib/outputrenderers.php', 'lib/outputcomponents.php');
protected $factory;
public function setUp() {
parent::setUp();
$this->factory = new custom_corners_renderer_factory(null, null);
}
public function tearDown() {
$this->factory = null;
parent::tearDown();
}
public function test_get_core_renderer() {
$renderer = $this->factory->get_renderer('core', new moodle_page);
$this->assertIsA($renderer, 'custom_corners_core_renderer');
}
public function test_get_test_renderer() {
$renderer = $this->factory->get_renderer('mod_test', new moodle_page);
$this->assertIsA($renderer, 'moodle_mod_test_renderer');
}
public function test_get_test_subtype_renderer() {
$renderer = $this->factory->get_renderer('mod_test', new moodle_page, 'subtype');
$this->assertIsA($renderer, 'moodle_mod_test_subtype_renderer');
$this->assertIsA($renderer, 'mod_test_subtype_renderer');
}
}
@ -311,7 +224,7 @@ class testable_theme_overridden_renderer_factory extends theme_overridden_render
* @copyright 2009 Tim Hunt
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class theme_overridden_renderer_factory_test extends UnitTestCase {
/*class theme_overridden_renderer_factory_test extends UnitTestCase { // TODO: MDL-21138 rewrite theme unit tests
public static $includecoverage = array('lib/outputlib.php');
protected $originalcfgthemedir;
@ -322,6 +235,7 @@ class theme_overridden_renderer_factory_test extends UnitTestCase {
public function setUp() {
global $CFG;
parent::setUp();
$this->originalcfgthemedir = $CFG->themedir;
$this->workspace = 'temp/theme_overridden_renderer_factory_fixtures';
@ -352,7 +266,7 @@ class theme_overridden_renderer_factory_test extends UnitTestCase {
}
protected function write_renderers_file($theme, $code) {
$filename = $theme->dir . '/renderers.php';
$filename = $theme->dir . '/lib.php';
file_put_contents($filename, "<?php\n" . $code);
}
@ -404,15 +318,15 @@ class theme_overridden_renderer_factory_test extends UnitTestCase {
$subrenderer = $factory->get_renderer('mod_test', new moodle_page, 'subtype');
// Verify outcome
$this->assertIsA($renderer, 'moodle_mod_test_renderer');
$this->assertIsA($subrenderer, 'moodle_mod_test_subtype_renderer');
$this->assertIsA($renderer, 'mod_test_renderer');
$this->assertIsA($subrenderer, 'mod_test_subtype_renderer');
}
public function test_get_renderer_overridden() {
// Set up - be very careful because the class under test uses require-once. Pick a unique theme name.
$theme = $this->make_theme('testrenderertheme');
$this->write_renderers_file($theme, '
class testrenderertheme_mod_test_renderer extends moodle_mod_test_renderer {
class testrenderertheme_mod_test_renderer extends mod_test_renderer {
}');
$factory = new testable_theme_overridden_renderer_factory($theme, $this->page);
@ -422,7 +336,7 @@ class theme_overridden_renderer_factory_test extends UnitTestCase {
// Verify outcome
$this->assertIsA($renderer, 'testrenderertheme_mod_test_renderer');
$this->assertIsA($subrenderer, 'moodle_mod_test_subtype_renderer');
$this->assertIsA($subrenderer, 'mod_test_subtype_renderer');
}
public function test_get_renderer_overridden_in_parent() {
@ -432,7 +346,7 @@ class theme_overridden_renderer_factory_test extends UnitTestCase {
$parenttheme = $this->make_theme('parentrenderertheme');
$this->write_renderers_file($theme, '');
$this->write_renderers_file($parenttheme, '
class parentrenderertheme_core_renderer extends moodle_core_renderer {
class parentrenderertheme_core_renderer extends core_renderer {
}');
$factory = new testable_theme_overridden_renderer_factory($theme, $this->page);
@ -449,10 +363,10 @@ class theme_overridden_renderer_factory_test extends UnitTestCase {
$theme->parent = 'ptheme';
$parenttheme = $this->make_theme('ptheme');
$this->write_renderers_file($theme, '
class ctheme_core_renderer extends moodle_core_renderer {
class ctheme_core_renderer extends core_renderer {
}');
$this->write_renderers_file($parenttheme, '
class ptheme_core_renderer extends moodle_core_renderer {
class ptheme_core_renderer extends core_renderer {
}');
$factory = new testable_theme_overridden_renderer_factory($theme, $this->page);
@ -462,199 +376,7 @@ class theme_overridden_renderer_factory_test extends UnitTestCase {
// Verify outcome
$this->assertIsA($renderer, 'ctheme_core_renderer');
}
}
/**
* Test-specific subclass that implements a getter for $searchpaths.
*
* @copyright 2009 Tim Hunt
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class testable_template_renderer_factory extends template_renderer_factory {
public static $includecoverage = array('lib/outputrenderers.php', 'lib/outputcomponents.php');
public function get_search_paths() {
return $this->searchpaths;
}
}
/**
* Unit tests for the template_renderer_factory class.
*
* @copyright 2009 Tim Hunt
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class template_renderer_factory_test extends UnitTestCase {
public static $includecoverage = array('lib/outputrenderers.php', 'lib/outputcomponents.php');
protected $originalcfgthemedir;
protected $workspace;
protected $page;
protected $foldertocleanup = null;
public function setUp() {
global $CFG;
parent::setUp();
$this->originalcfgthemedir = $CFG->themedir;
$this->workspace = 'temp/template_renderer_factory_fixtures';
make_upload_directory($this->workspace);
$CFG->themedir = $CFG->dataroot . '/' . $this->workspace;
$this->foldertocleanup = $CFG->themedir;
$this->page = new moodle_page;
}
public function tearDown() {
global $CFG;
if (!empty($this->foldertocleanup)) {
fulldelete($this->foldertocleanup);
$this->foldertocleanup = null;
}
$CFG->themedir = $this->originalcfgthemedir;
parent::tearDown();
}
protected function make_theme($name) {
global $CFG;
$theme = new stdClass;
$theme->name = $name;
$theme->dir = $CFG->themedir . '/' . $name;
make_upload_directory($this->workspace . '/' . $name);
return $theme;
}
protected function make_theme_template_dir($name, $module = '', $submodule = '') {
$path = $this->workspace . '/' . $name . '/templates';
if ($module) {
$path .= '/' . $module;
}
if ($submodule) {
$path .= '/' . $submodule;
}
make_upload_directory($path);
}
public function test_constructor_standardtemplate() {
global $CFG;
// Set up.
$theme = $this->make_theme('standardtemplate');
$this->make_theme_template_dir('standardtemplate');
// Exercise SUT.
$factory = new testable_template_renderer_factory($theme, $this->page);
// Verify outcome
$this->assertEqual(array($CFG->themedir . '/standardtemplate/templates'),
$factory->get_search_paths());
}
public function test_constructor_mytheme() {
global $CFG;
// Set up.
$theme = $this->make_theme('mytheme');
$this->make_theme_template_dir('mytheme');
$this->make_theme_template_dir('standardtemplate');
// Exercise SUT.
$factory = new testable_template_renderer_factory($theme, $this->page);
// Verify outcome
$this->assertEqual(array(
$CFG->themedir . '/mytheme/templates',
$CFG->themedir . '/standardtemplate/templates'),
$factory->get_search_paths());
}
public function test_constructor_mytheme_no_templates() {
global $CFG;
// Set up.
$theme = $this->make_theme('mytheme');
$this->make_theme_template_dir('standardtemplate');
// Exercise SUT.
$factory = new testable_template_renderer_factory($theme, $this->page);
// Verify outcome
$this->assertEqual(array($CFG->themedir . '/standardtemplate/templates'),
$factory->get_search_paths());
}
public function test_constructor_mytheme_with_parent() {
global $CFG;
// Set up.
$theme = $this->make_theme('mytheme');
$theme->parent = 'parenttheme';
$this->make_theme_template_dir('mytheme');
$this->make_theme_template_dir('parenttheme');
$this->make_theme_template_dir('standardtemplate');
// Exercise SUT.
$factory = new testable_template_renderer_factory($theme, $this->page);
// Verify outcome
$this->assertEqual(array(
$CFG->themedir . '/mytheme/templates',
$CFG->themedir . '/parenttheme/templates',
$CFG->themedir . '/standardtemplate/templates'),
$factory->get_search_paths());
}
public function test_constructor_mytheme_with_parent_no_templates() {
global $CFG;
// Set up.
$theme = $this->make_theme('mytheme');
$theme->parent = 'parenttheme';
$this->make_theme_template_dir('mytheme');
$this->make_theme_template_dir('standardtemplate');
// Exercise SUT.
$factory = new testable_template_renderer_factory($theme, $this->page);
$subfactory = new testable_template_renderer_factory($theme, $this->page, 'subtype');
// Verify outcome
$this->assertEqual(array(
$CFG->themedir . '/mytheme/templates',
$CFG->themedir . '/standardtemplate/templates'),
$factory->get_search_paths());
$this->assertEqual(array(
$CFG->themedir . '/mytheme/templates',
$CFG->themedir . '/standardtemplate/templates'),
$subfactory->get_search_paths());
}
public function test_get_renderer() {
global $CFG;
// Set up.
$theme = $this->make_theme('mytheme');
$theme->parent = 'parenttheme';
$this->make_theme_template_dir('mytheme', 'core');
$this->make_theme_template_dir('parenttheme', 'mod_test');
$this->make_theme_template_dir('standardtemplate', 'mod_test');
$this->make_theme_template_dir('parenttheme', 'mod_test', 'subtype');
$this->make_theme_template_dir('standardtemplate', 'mod_test', 'subtype');
$factory = new testable_template_renderer_factory($theme);
// Exercise SUT.
$renderer = $factory->get_renderer('mod_test', $this->page);
$subrenderer = $factory->get_renderer('mod_test', $this->page, 'subtype');
// Verify outcome
$this->assertEqual('moodle_mod_test_renderer', $renderer->get_copied_class());
$this->assertEqual(array(
$CFG->themedir . '/parenttheme/templates/mod_test',
$CFG->themedir . '/standardtemplate/templates/mod_test'),
$renderer->get_search_paths());
$this->assertEqual('moodle_mod_test_subtype_renderer', $subrenderer->get_copied_class());
$this->assertEqual(array(
$CFG->themedir . '/parenttheme/templates/mod_test/subtype',
$CFG->themedir . '/standardtemplate/templates/mod_test/subtype'),
$subrenderer->get_search_paths());
}
}
}*/
/**
* Unit tests for the xhtml_container_stack class.
@ -813,92 +535,20 @@ class xhtml_container_stack_test extends UnitTestCase {
}
}
/**
* Unit tests for the template_renderer class.
* Unit tests for the core_renderer class.
*
* @copyright 2009 Tim Hunt
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class template_renderer_test extends UnitTestCase {
public static $includecoverage = array('lib/outputrenderers.php', 'lib/outputcomponents.php');
protected $renderer;
protected $templatefolder;
protected $savedtemplates;
public function setUp() {
global $CFG;
parent::setUp();
$this->templatefolder = $CFG->dataroot . '/temp/template_renderer_fixtures/test';
make_upload_directory('temp/template_renderer_fixtures/test');
$page = new moodle_page;
$this->renderer = new template_renderer('moodle_mod_test_renderer',
array($this->templatefolder), $page);
}
public function tearDown() {
$this->renderer = null;
foreach ($this->savedtemplates as $template) {
unlink($template);
}
$this->savedtemplates = array();
parent::tearDown();
}
protected function save_template($name, $contents) {
$filename = $this->templatefolder . '/' . $name . '.php';
$this->savedtemplates[] = $filename;
file_put_contents($filename, $contents);
}
public function test_simple_template() {
$this->save_template('greeting', '<p>Hello <?php echo $name ?>!</p>');
$html = $this->renderer->greeting('Moodle');
$this->assertEqual('<p>Hello Moodle!</p>', $html);
}
public function test_simple_template_default_argument_value() {
$this->save_template('greeting', '<p>Hello <?php echo $name ?>!</p>');
$html = $this->renderer->greeting();
$this->assertEqual('<p>Hello world!</p>', $html);
}
public function test_box_template() {
$this->save_template('box', '<div class="box"<?php echo $id ?>><?php echo $content ?></div>');
$html = $this->renderer->box('This is a message in a box', 'messagediv');
$this->assertEqual('<div class="box"messagediv>This is a message in a box</div>', $html);
}
public function test_box_start_end_templates() {
$this->save_template('box', '<div class="box"<?php echo $id ?>><?php echo $content ?></div>');
$html = $this->renderer->box_start('messagediv');
$this->assertEqual('<div class="box"messagediv>', $html);
$html = $this->renderer->box_end();
$this->assertEqual('</div>', $html);
}
}
/**
* Unit tests for the moodle_core_renderer class.
*
* @copyright 2009 Tim Hunt
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class moodle_core_renderer_test extends UnitTestCase {
class core_renderer_test extends UnitTestCase {
public static $includecoverage = array('lib/outputrenderers.php', 'lib/outputcomponents.php');
protected $renderer;
public function setUp() {
parent::setUp();
$this->renderer = new moodle_core_renderer(new moodle_page);
$this->renderer = new core_renderer(new moodle_page);
}
public function test_select_simple() {
@ -1139,7 +789,7 @@ class moodle_core_renderer_test extends UnitTestCase {
'alt' => ''
)), $html);
$spacer = new html_image();
$spacer->src = $this->renderer->old_icon_url('myspacer');
$spacer->src = $this->renderer->image_url('myspacer');
$spacer->alt = 'sometext';
$spacer->add_class('my');
@ -1147,7 +797,7 @@ class moodle_core_renderer_test extends UnitTestCase {
$this->assert(new ContainsTagWithAttributes('img', array(
'class' => 'my image spacer',
'src' => $this->renderer->old_icon_url('myspacer'),
'src' => $this->renderer->image_url('myspacer'),
'alt' => 'sometext')), $html);
}
@ -1249,7 +899,7 @@ class moodle_core_renderer_test extends UnitTestCase {
$this->assert(new ContainsTagWithAttribute('div', 'class', 'heading-with-help'), $html);
$this->assert(new ContainsTagWithAttribute('span', 'class', 'helplink'), $html);
$this->assert(new ContainsTagWithAttribute('h2', 'class', 'main help'), $html);
$this->assert(new ContainsTagWithAttributes('img', array('class' => 'iconhelp image', 'src' => $this->renderer->old_icon_url('help'))), $html);
$this->assert(new ContainsTagWithAttributes('img', array('class' => 'iconhelp image', 'src' => $this->renderer->image_url('help'))), $html);
$this->assert(new ContainsTagWithContents('h2', 'Cool help text'), $html);
$helpicon = clone($originalicon);
@ -1259,7 +909,7 @@ class moodle_core_renderer_test extends UnitTestCase {
$this->assert(new ContainsTagWithAttribute('div', 'class', 'heading-with-help'), $html);
$this->assert(new ContainsTagWithAttribute('span', 'class', 'helplink'), $html);
$this->assert(new ContainsTagWithAttribute('h2', 'class', 'main help'), $html);
$this->assert(new ContainsTagWithAttributes('img', array('class' => 'iconhelp image', 'src' => $this->renderer->old_icon_url('help'))), $html);
$this->assert(new ContainsTagWithAttributes('img', array('class' => 'iconhelp image', 'src' => $this->renderer->image_url('help'))), $html);
$this->assert(new ContainsTagWithContents('h2', 'Cool help text'), $html);
}
}

View File

@ -177,9 +177,9 @@ class moodle_page_test extends UnitTestCase {
public function test_set_state_normal_path() {
$this->testpage->set_context(get_context_instance(CONTEXT_SYSTEM));
$this->testpage->set_course($this->create_a_course());
$this->testpage->set_course($this->create_a_course());
$this->assertEqual(moodle_page::STATE_BEFORE_HEADER, $this->testpage->state);
$this->assertEqual(moodle_page::STATE_BEFORE_HEADER, $this->testpage->state);
$this->testpage->set_state(moodle_page::STATE_PRINTING_HEADER);
$this->assertEqual(moodle_page::STATE_PRINTING_HEADER, $this->testpage->state);
@ -377,16 +377,16 @@ class moodle_page_test extends UnitTestCase {
$this->assertEqual('a title', $this->testpage->title);
}
public function test_default_generaltype() {
public function test_default_pagelayout() {
// Exercise SUT and Validate
$this->assertEqual('normal', $this->testpage->generaltype);
$this->assertEqual('normal', $this->testpage->pagelayout);
}
public function test_set_generaltype() {
public function test_set_pagelayout() {
// Exercise SUT
$this->testpage->set_generaltype('type');
$this->testpage->set_pagelayout('type');
// Validate
$this->assertEqual('type', $this->testpage->generaltype);
$this->assertEqual('type', $this->testpage->pagelayout);
}
}

View File

@ -949,7 +949,7 @@ function upgrade_started($preinstall=false) {
} else {
if (!CLI_SCRIPT and !$PAGE->headerprinted) {
$strupgrade = get_string('upgradingversion', 'admin');
$PAGE->set_generaltype('maintenance');
$PAGE->set_pagelayout('maintenance');
upgrade_get_javascript();
$PAGE->set_title($strupgrade.' - Moodle '.$CFG->target_release);
$PAGE->set_heading($strupgrade);

View File

@ -1909,69 +1909,8 @@ function user_login_string($course=NULL, $user=NULL) {
return $loggedinas;
}
/**
* Tests whether $THEME->rarrow, $THEME->larrow have been set (theme/-/config.php).
* If not it applies sensible defaults.
*
* Accessibility: right and left arrow Unicode characters for breadcrumb, calendar,
* search forum block, etc. Important: these are 'silent' in a screen-reader
* (unlike &gt; &raquo;), and must be accompanied by text.
*
* @global object
* @uses $_SERVER
*/
function check_theme_arrows() {
global $THEME;
if (!isset($THEME->rarrow) and !isset($THEME->larrow)) {
// Default, looks good in Win XP/IE 6, Win/Firefox 1.5, Win/Netscape 8...
// Also OK in Win 9x/2K/IE 5.x
$THEME->rarrow = '►'; // &#x25BA;
$THEME->larrow = '◄'; // &#x25C4;
if (empty($_SERVER['HTTP_USER_AGENT'])) {
$uagent = '';
} else {
$uagent = $_SERVER['HTTP_USER_AGENT'];
}
if (false !== strpos($uagent, 'Opera')
|| false !== strpos($uagent, 'Mac')) {
// Looks good in Win XP/Mac/Opera 8/9, Mac/Firefox 2, Camino, Safari.
// Not broken in Mac/IE 5, Mac/Netscape 7 (?).
$THEME->rarrow = '▶'; // &#x25B6;
$THEME->larrow = '◀'; // &#x25C0;
}
elseif (false !== strpos($uagent, 'Konqueror')) {
$THEME->rarrow = '→'; // &rarr;
$THEME->larrow = '←'; // &larr;
}
elseif (isset($_SERVER['HTTP_ACCEPT_CHARSET'])
&& false === stripos($_SERVER['HTTP_ACCEPT_CHARSET'], 'utf-8')) {
// (Win/IE 5 doesn't set ACCEPT_CHARSET, but handles Unicode.)
// To be safe, non-Unicode browsers!
$THEME->rarrow = '&gt;';
$THEME->larrow = '&lt;';
}
/// RTL support - in RTL languages, swap r and l arrows
if (right_to_left()) {
$t = $THEME->rarrow;
$THEME->rarrow = $THEME->larrow;
$THEME->larrow = $t;
}
} else {
if (strpos($THEME->rarrow, '&')===0 && strrpos($THEME->rarrow, ';')===strlen($THEME->rarrow)-1) {
$THEME->rarrow = html_entity_decode($THEME->rarrow, ENT_QUOTES, 'utf-8');
}
if (strpos($THEME->larrow, '&')===0 && strrpos($THEME->larrow, ';')===strlen($THEME->larrow)-1) {
$THEME->larrow = html_entity_decode($THEME->larrow, ENT_QUOTES, 'utf-8');
}
}
}
/**
* Return the right arrow with text ('next'), and optionally embedded in a link.
* See function above, check_theme_arrows.
*
* @global object
* @param string $text HTML/plain text label (set to blank only for breadcrumb separator cases).
@ -1982,7 +1921,6 @@ function check_theme_arrows() {
*/
function link_arrow_right($text, $url='', $accesshide=false, $addclass='') {
global $THEME;
check_theme_arrows();
$arrowclass = 'arrow ';
if (! $url) {
$arrowclass .= $addclass;
@ -2007,7 +1945,6 @@ function link_arrow_right($text, $url='', $accesshide=false, $addclass='') {
/**
* Return the left arrow with text ('previous'), and optionally embedded in a link.
* See function above, check_theme_arrows.
*
* @global object
* @param string $text HTML/plain text label (set to blank only for breadcrumb separator cases).
@ -2018,7 +1955,6 @@ function link_arrow_right($text, $url='', $accesshide=false, $addclass='') {
*/
function link_arrow_left($text, $url='', $accesshide=false, $addclass='') {
global $THEME;
check_theme_arrows();
$arrowclass = 'arrow ';
if (! $url) {
$arrowclass .= $addclass;
@ -2802,7 +2738,7 @@ function redirect($url, $message='', $delay=-1) {
}
// Include a redirect message, even with a HTTP redirect, because that is recommended practice.
$PAGE->set_generaltype('embedded'); // No header and footer needed
$PAGE->set_pagelayout('embedded'); // No header and footer needed
$CFG->docroot = false; // to prevent the link to moodle docs from being displayed on redirect page.
echo $OUTPUT->redirect_message($encodedurl, $message, $delay, $debugdisableredirect);
exit;
@ -2908,7 +2844,7 @@ function print_maintenance_message() {
global $CFG, $SITE, $PAGE, $OUTPUT;
$PAGE->set_pagetype('maintenance-message');
$PAGE->set_generaltype('maintenance');
$PAGE->set_pagelayout('maintenance');
$PAGE->set_title(strip_tags($SITE->fullname));
$PAGE->set_heading($SITE->fullname);
echo $OUTPUT->header();

View File

@ -4,9 +4,7 @@ from:
http://developer.yahoo.com/yui
Changes:
* MDL-20007 - commented out some styles from reset-fonts-grids.css,
this is just a temporary hack, we need to find better long term solution
Changes: NONE
Added to Moodle 13 July 2006
Updated to YUI 0.12.0, 23 November 2006

File diff suppressed because one or more lines are too long

View File

@ -32,6 +32,7 @@ $testcookies = optional_param('testcookies', 0, PARAM_BOOL); // request cookie t
$context = get_context_instance(CONTEXT_SYSTEM);
$PAGE->set_course($SITE);
$PAGE->set_pagelayout('form');
/// Initialize variables
$errormsg = '';

View File

@ -52,7 +52,7 @@
}
if ($user->deleted) {
$PAGE->set_generaltype('popup');
$PAGE->set_pagelayout('popup');
$PAGE->set_title(get_string('discussion', 'message').': '.fullname($user));
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('userdeleted'), 1);
@ -72,7 +72,7 @@
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title><?php echo get_string('discussion', 'message').': '.fullname($user) ?></title>
<link rel="shortcut icon" href="<?php echo $CFG->wwwroot.'/theme/'.$PAGE->theme->name; ?>/favicon.ico" />
<link rel="shortcut icon" href="<?php echo $CFG->wwwroot.'/theme/'.$PAGE->theme->name; ?>/pix/favicon.ico" />
</head>
<frameset rows="110,*,0,220">
<noframes><body><?php
@ -160,7 +160,7 @@
$userfullname = fullname($user);
$mefullname = fullname($USER);
$PAGE->set_generaltype('popup');
$PAGE->set_pagelayout('popup');
$PAGE->set_title(get_string('discussion', 'message').': '.fullname($user));
echo $OUTPUT->header();

View File

@ -68,7 +68,7 @@ $PAGE->set_url($url);
/// Popup a window if required and quit (usually from external links).
if ($popup) {
$PAGE->set_generaltype('popup');
$PAGE->set_pagelayout('popup');
$OUTPUT->header();
echo $PAGE->requires->js_function_call('openpopup', Array('/message/index.php', 'message', 'menubar=0,location=0,scrollbars,status,resizable,width=400,height=500', 0))->asap();
redirect("$CFG->wwwroot/", '', 0);
@ -99,7 +99,7 @@ if ($tab == 'contacts') {
$PAGE->set_periodic_refresh_delay($CFG->message_contacts_refresh);
}
$PAGE->set_generaltype('popup');
$PAGE->set_pagelayout('popup');
$PAGE->set_title(get_string('messages', 'message').' - '.format_string($SITE->fullname));
echo $OUTPUT->header();
echo '<table cellspacing="2" cellpadding="2" border="0" width="95%" class="boxaligncenter">';

View File

@ -25,7 +25,7 @@ require('../config.php');
@header('Content-Type: text/html; charset=utf-8');
$PAGE->set_generaltype('popup');
$PAGE->set_pagelayout('popup');
$PAGE->set_url(new moodle_url($CFG->wwwroot.'/message/messages.php'));
$PAGE->set_title(get_string('messages', 'message').' - '.format_string($SITE->fullname));
echo $OUTPUT->header();

View File

@ -36,7 +36,7 @@ if (empty($CFG->messaging)) {
print_error('disabled', 'message');
}
$PAGE->set_generaltype('popup');
$PAGE->set_pagelayout('popup');
$PAGE->set_title(get_string('messages', 'message').' - '.format_string($SITE->fullname));
$PAGE->set_url(new moodle_url($CFG->wwwroot.'/message/refresh.php'));
header('Expires: Sun, 28 Dec 1997 09:32:45 GMT');

View File

@ -37,7 +37,7 @@ if (empty($CFG->messaging)) {
if (has_capability('moodle/site:sendmessage', get_context_instance(CONTEXT_SYSTEM))) {
$PAGE->set_generaltype('popup');
$PAGE->set_pagelayout('popup');
$PAGE->set_title('send');
$PAGE->requires->js('message/message.js');

View File

@ -86,7 +86,7 @@ if ($unblockcontact and confirm_sesskey()) {
}
//$PAGE->set_title('Message History');
$PAGE->set_generaltype('popup');
$PAGE->set_pagelayout('popup');
echo $OUTPUT->header();
echo '<table width="100%" cellpadding="0" cellspacing="0"><tr>';
echo '<td width="100">';

BIN
mod/assignment/pix/icon.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 B

View File

@ -39,7 +39,7 @@ if ($assignment->assignmenttype != 'online') {
$assignmentinstance = new assignment_online($cm->id, $assignment, $cm, $course);
if ($submission = $assignmentinstance->get_submission($user->id)) {
$PAGE->set_generaltype('popup');
$PAGE->set_pagelayout('popup');
$PAGE->set_title(fullname($user,true).': '.$assignment->name);
echo $OUTPUT->header();
echo $OUTPUT->box_start('generalbox boxaligcenter', 'dates');

View File

@ -1,44 +0,0 @@
#messages-list, #users-list{list-style-type:none;padding:0;margin:0}
#chat-header {
background: transparent;
font-size: 200%;
overflow: hidden;
}
#chat-header p {
display:inline;
font-size: 50%;
color: grey;
}
.time{
font-weight: bold;
}
.user{
color:blue;
}
.chat-event{
text-align:center;
color:grey;
}
.yui-skin-sam .yui-layout .yui-layout-unit div.yui-layout-bd {
background: transparent;
}
.yui-layout-unit-top {
background: #FFE39D;
}
.yui-layout-unit-right {
border-top: 5px solid white;
background: #FFD46B;
}
.yui-layout-unit-bottom {
border-top: 5px solid white;
background: #FFCB44;
}
.yui-skin-sam .yui-layout .yui-layout-unit div.yui-layout-unit-right {
background: white;
}
.yui-skin-sam .yui-layout .yui-layout-unit div.yui-layout-bd {
border:0;
}
.yui-skin-sam .yui-layout .yui-layout-hd {
border:0;
}

View File

@ -56,7 +56,7 @@ $str_title = format_string($course->shortname) . ": ".format_string($chat->name,
$str_send = get_string('send', 'chat');
$str_themes = get_string('themes');
$PAGE->set_generaltype('popup');
$PAGE->set_pagelayout('popup');
$PAGE->set_title('Chat');
$PAGE->requires->yui_lib('dragdrop');
$PAGE->requires->yui_lib('resize');
@ -93,9 +93,8 @@ $PAGE->requires->string_for_js('talk', 'chat');
$PAGE->requires->js('mod/chat/gui_ajax/script.js');
$PAGE->requires->yui_lib('animation')->in_head();
$PAGE->requires->css('mod/chat/gui_ajax/theme/'.$theme.'/chat.css');
$PAGE->add_body_class('yui-skin-sam');
$PAGE->set_generaltype('embedded');
$PAGE->set_pagelayout('embedded');
echo $OUTPUT->header();
$intro = format_text($chat->intro, $chat->introformat);

View File

@ -43,8 +43,7 @@ if (!$cm = get_coursemodule_from_instance('chat', $chat->id, $course->id)) {
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
require_login($course->id, false, $cm);
require_capability('mod/chat:chat',$context);
$PAGE->set_generaltype('form');
$PAGE->requires->css('mod/chat/chat.css');
$PAGE->set_pagelayout('form');
/// Check to see if groups are being used here
if ($groupmode = groups_get_activity_groupmode($cm)) { // Groups are being used

View File

@ -33,7 +33,7 @@ $USER = $DB->get_record('user', array('id'=>$chatuser->userid));
//Setup course, lang and theme
$PAGE->set_course($course);
$PAGE->requires->js('mod/chat/gui_header_js/chat_gui_header.js')->in_head();
$PAGE->set_generaltype('embedded');
$PAGE->set_pagelayout('embedded');
$PAGE->set_focuscontrol('input_chat_message');
$PAGE->set_cacheable(false);
echo $OUTPUT->header();

View File

@ -84,9 +84,10 @@ header("Refresh: $CFG->chat_refresh_room; url=$refreshurl");
/// required stylesheets
$stylesheetshtml = '';
foreach ($CFG->stylesheets as $stylesheet) {
/*foreach ($CFG->stylesheets as $stylesheet) {
//TODO: MDL-21120
$stylesheetshtml .= '<link rel="stylesheet" type="text/css" href="'.$stylesheet.'" />';
}
}*/
// use ob to be able to send Content-Length headers
// needed for Keep-Alive to work

View File

@ -79,9 +79,10 @@ header('Content-Type: text/html; charset=utf-8');
/// required stylesheets
$stylesheetshtml = '';
foreach ($CFG->stylesheets as $stylesheet) {
/*foreach ($CFG->stylesheets as $stylesheet) {
//TODO: MDL-21120
$stylesheetshtml .= '<link rel="stylesheet" type="text/css" href="'.$stylesheet.'" />';
}
}*/
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

View File

@ -24,7 +24,7 @@ if (!$USER = $DB->get_record('user', array('id'=>$chatuser->userid))) { // no op
print_error('invaliduser');
}
$PAGE->set_generaltype('embedded');
$PAGE->set_pagelayout('embedded');
$USER->description = '';

BIN
mod/chat/pix/icon.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 B

View File

Before

Width:  |  Height:  |  Size: 206 B

After

Width:  |  Height:  |  Size: 206 B

View File

@ -1,9 +0,0 @@
.mod-choice .results {
border-collapse: separate;
}
.mod-choice .results .data {
border-width:1px;
border-style:solid;
border-color:#999;
}

View File

@ -430,7 +430,7 @@ class data_field_base { // Base class for Database Field Types (see field/*/
global $OUTPUT;
$str = '<a href="field.php?d='.$this->data->id.'&amp;fid='.$this->field->id.'&amp;mode=display&amp;sesskey='.sesskey().'">';
$str .= '<img src="'.$OUTPUT->mod_icon_url('/field/' . $this->type . '/icon', 'data') . '" ';
$str .= '<img src="'.$OUTPUT->old_icon_url('/field/' . $this->type . '/icon', 'data') . '" ';
$str .= 'height="'.$this->iconheight.'" width="'.$this->iconwidth.'" alt="'.$this->type.'" title="'.$this->type.'" /></a>';
return $str;
}

BIN
mod/data/pix/icon.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 B

View File

@ -329,13 +329,13 @@ function feedback_print_recent_mod_activity($activity, $courseid, $detail, $modn
if ($detail) {
$modname = $modnames[$activity->type];
echo '<div class="title">';
echo "<img src=\"" . $OUTPUT->mod_icon_url('icon', $activity->type) . "\" ".
echo "<img src=\"" . $OUTPUT->old_icon_url('icon', $activity->type) . "\" ".
"class=\"icon\" alt=\"$modname\" />";
echo "<a href=\"$CFG->wwwroot/mod/feedback/view.php?id={$activity->cmid}\">{$activity->name}</a>";
echo '</div>';
}
echo '<div class="title">';
echo '<div class="title">';
echo '</div>';
echo '<div class="user">';
@ -970,7 +970,7 @@ function feedback_create_item($data) {
$item->template=0;
if (isset($data->templateid)) {
$item->template = intval($data->templateid);
$item->template = intval($data->templateid);
}
$itemname = trim($data->itemname);
@ -1024,7 +1024,7 @@ function feedback_update_item($item, $data = null){
$item->required=0;
if (isset($data->required)) {
$item->required=$data->required;
$item->required=$data->required;
}
}else {
$item->name = $item->name;
@ -2299,7 +2299,7 @@ function feedback_print_errors() {
feedback_init_feedback_session();
if(empty($SESSION->feedback->errors)) {
return;
return;
}
echo $OUTPUT->box_start('generalbox errorboxcontent boxaligncenter boxwidthnormal');

BIN
mod/feedback/pix/icon.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 B

View File

@ -73,17 +73,19 @@ function folder_htmllize_tree($dir, $folder, $context) {
* @return string html link
*/
function folder_get_file_link($file, $folder, $context) {
global $CFG;
global $CFG, $OUTPUT;
$strfile = get_string('file');
$strdownload = get_string('download');
$icon = mimeinfo_from_type("icon", $file->get_mimetype());
$urlbase = "$CFG->wwwroot/pluginfile.php";
$path = '/'.$context->id.'/folder_content/'.$folder->revision.$file->get_filepath().$file->get_filename();
$viewurl = file_encode_url($urlbase, $path, false);
$downloadurl = file_encode_url($urlbase, $path, true);
$downloadurl = "&nbsp;<a href=\"$downloadurl\" title=\"" . get_string('downloadfile') . "\"><img src=\"$CFG->pixpath/t/down.gif\" class=\"iconsmall\" alt=\"$strdownload\" /></a>";
return "<a href=\"$viewurl\" title=\"\"><img src=\"$CFG->pixpath/f/$icon\" class=\"icon\" alt=\"$strfile\" />&nbsp;".s($file->get_filename()).'</a>'.$downloadurl;
$downicon = $OUTPUT->old_icon_url('t/down');
$mimeicon = $OUTPUT->old_icon_url(file_mimetype_icon($file->get_mimetype()));
$downloadurl = "&nbsp;<a href=\"$downloadurl\" title=\"" . get_string('downloadfile') . "\"><img src=\"$downicon\" class=\"iconsmall\" alt=\"$strdownload\" /></a>";
return "<a href=\"$viewurl\" title=\"\"><img src=\"$mimeicon\" class=\"icon\" alt=\"$strfile\" />&nbsp;".s($file->get_filename()).'</a>'.$downloadurl;
}
/**

View File

Before

Width:  |  Height:  |  Size: 159 B

After

Width:  |  Height:  |  Size: 159 B

View File

@ -1,26 +0,0 @@
#mod-forum-subscribers .subscriberdiv,
#mod-forum-subscribers .subscribertable {
width:100%;
background-color:#EEEEEE;
border:1px solid #BBBBBB;
}
#mod-forum-subscribers .subscriberdiv,
#mod-forum-subscribers .subscribertable tr td {
vertical-align:top;
padding:0.2em 0.3em;
}
#mod-forum-subscribers .subscribertable tr td.existing {
width:42%;
}
#mod-forum-subscribers .subscribertable tr td.actions {
width:16%;
padding-top:3em;
}
#mod-forum-subscribers .subscribertable tr td.actions .actionbutton {
margin:0.3em 0;
padding:0.5em 0;
width:100%;
}
#mod-forum-subscribers .subscribertable tr td.potential {
width:42%;
}

View File

@ -783,9 +783,10 @@ function forum_cron() {
$headerdata->userprefs = '<a target="_blank" href="'.$headerdata->userprefs.'">'.get_string('digestmailprefs', 'forum').'</a>';
$posthtml = "<head>";
foreach ($CFG->stylesheets as $stylesheet) {
/* foreach ($CFG->stylesheets as $stylesheet) {
//TODO: MDL-21120
$posthtml .= '<link rel="stylesheet" type="text/css" href="'.$stylesheet.'" />'."\n";
}
}*/
$posthtml .= "</head>\n<body id=\"email\">\n";
$posthtml .= '<p>'.get_string('digestmailheader', 'forum', $headerdata).'</p><br /><hr size="1" noshade="noshade" />';
@ -1055,9 +1056,10 @@ function forum_make_mail_html($course, $cm, $forum, $discussion, $post, $userfro
$canunsubscribe = ! forum_is_forcesubscribed($forum);
$posthtml = '<head>';
foreach ($CFG->stylesheets as $stylesheet) {
/* foreach ($CFG->stylesheets as $stylesheet) {
//TODO: MDL-21120
$posthtml .= '<link rel="stylesheet" type="text/css" href="'.$stylesheet.'" />'."\n";
}
}*/
$posthtml .= '</head>';
$posthtml .= "\n<body id=\"email\">\n\n";
@ -6197,7 +6199,7 @@ function forum_print_recent_mod_activity($activity, $courseid, $detail, $modname
echo '<div class="title">';
if ($detail) {
$aname = s($activity->name);
echo "<img src=\"" . $OUTPUT->mod_icon_url('icon', $activity->type) . "\" ".
echo "<img src=\"" . $OUTPUT->old_icon_url('icon', $activity->type) . "\" ".
"class=\"icon\" alt=\"{$aname}\" />";
}
echo "<a href=\"$CFG->wwwroot/mod/forum/discuss.php?d={$activity->content->discussion}"

Some files were not shown because too many files have changed in this diff Show More