Commit 151a8c90 authored by Richard Mansfield's avatar Richard Mansfield

Allow institutions to have different priorities when setting the user theme

Signed-off-by: default avatarRichard Mansfield <richard.mansfield@catalyst.net.nz>
parent 51a5b70b
......@@ -795,7 +795,7 @@ class User {
if ($i->staff) {
$staffinstitutions[$i->institution] = $i->institution;
}
if (!empty($i->theme) && $i->theme != get_config('theme')) {
if (!empty($i->theme) && $this->theme == get_config('theme') && $i->theme != $this->theme) {
$this->theme = $i->theme;
}
}
......
......@@ -45,6 +45,7 @@
<FIELD NAME="expiry" TYPE="datetime" NOTNULL="false" />
<FIELD NAME="expirymailsent" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0"/>
<FIELD NAME="suspended" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0"/>
<FIELD NAME="priority" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="1"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="name" />
......
......@@ -2220,5 +2220,13 @@ function xmldb_core_upgrade($oldversion=0) {
}
}
if ($oldversion < 2010122200) {
$table = new XMLDBTable('institution');
$field = new XMLDBField('priority');
$field->setAttributes(XMLDB_TYPE_INTEGER, 10, null, XMLDB_NOTNULL, null, null, null, 1);
add_field($table, $field);
set_field('institution', 'priority', 0, 'name', 'mahara');
}
return $status;
}
......@@ -620,6 +620,7 @@ function core_install_lastcoredata_defaults() {
$institution->displayname = 'No Institution';
$institution->authplugin = 'internal';
$institution->theme = 'default';
$institution->priority = 0;
insert_record('institution', $institution);
$auth_instance = new StdClass;
......
......@@ -1247,7 +1247,7 @@ function load_user_institutions($userid) {
if ($institutions = get_records_sql_assoc('
SELECT u.institution,'.db_format_tsfield('ctime').','.db_format_tsfield('u.expiry', 'membership_expiry').',u.studentid,u.staff,u.admin,i.theme,i.registerallowed
FROM {usr_institution} u INNER JOIN {institution} i ON u.institution = i.name
WHERE u.usr = ?', array($userid))) {
WHERE u.usr = ? ORDER BY i.priority DESC', array($userid))) {
return $institutions;
}
return array();
......
......@@ -28,7 +28,7 @@
defined('INTERNAL') || die();
$config = new StdClass;
$config->version = 2010110800;
$config->version = 2010122200;
$config->release = '1.4.0dev';
$config->minupgradefrom = 2008040200;
$config->minupgraderelease = '1.0.0 (release tag 1.0.0_RELEASE)';
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment