Merge branch 'wip-MDL-36014-master' of git://github.com/marinaglancy/moodle

Conflicts:
	lib/db/install.xml
	lib/db/upgrade.php
	version.php
This commit is contained in:
Damyon Wiese 2014-10-07 12:34:34 +08:00
commit 4a813f3959
26 changed files with 704 additions and 238 deletions

View file

@ -723,8 +723,7 @@ $capabilities = array(
)
),
// view members of a cohort, this can be used in course context too,
// this also controls the ability to actually use cohort
// View visible and hidden cohorts defined in the current context.
'moodle/cohort:view' => array(
'captype' => 'read',

View file

@ -2092,6 +2092,7 @@
<FIELD NAME="idnumber" TYPE="char" LENGTH="100" NOTNULL="false" SEQUENCE="false" COMMENT="Unique identifier of a cohort, useful especially for mapping to external entities"/>
<FIELD NAME="description" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Standard description text box"/>
<FIELD NAME="descriptionformat" TYPE="int" LENGTH="2" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="visible" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1" SEQUENCE="false" COMMENT="Visibility to teachers"/>
<FIELD NAME="component" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false" COMMENT="Component (plugintype_pluignname) that manages the cohort, manual modifications are allowed only when set to NULL"/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>

View file

@ -3949,5 +3949,20 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2014100700.00);
}
if ($oldversion < 2014100700.01) {
// Define field visible to be added to cohort.
$table = new xmldb_table('cohort');
$field = new xmldb_field('visible', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '1', 'descriptionformat');
// Conditionally launch add field visible.
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
// Main savepoint reached.
upgrade_main_savepoint(true, 2014100700.01);
}
return true;
}