Commit 242dbb39 authored by Robert Lyon's avatar Robert Lyon

Bug 1409546: Adding framework field to collection table

To hold the id of the smartevidence framework the collection is using

Defaults to null

behatnotneeded: to come later

Change-Id: Idb33e0d71adca8cc089f97aa48826e69e6f16fa8
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent f6997bdf
......@@ -28,6 +28,7 @@ class Collection {
private $submittedstatus;
private $views;
private $tags;
private $framework;
const UNSUBMITTED = 0;
const SUBMITTED = 1;
......@@ -553,6 +554,27 @@ class Collection {
return $this->views;
}
/**
* Check that a collection has a framework
* - The collection is not owned by a group
* - It has a framework id
* - It has views in the collection
*
* @return boolean
*/
public function has_framework() {
if (!empty($this->group)) {
return false;
}
if (empty($this->framework)) {
return false;
}
if (!$this->views()) {
return false;
}
return true;
}
/**
* Get the available views the current user can choose to add to their collections.
* Restrictions on this list include:
......
......@@ -1091,6 +1091,7 @@
<FIELD NAME="submittedstatus" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
<FIELD NAME="group" TYPE="int" LENGTH="10" NOTNULL="false" />
<FIELD NAME="institution" TYPE="char" LENGTH="255" NOTNULL="false" />
<FIELD NAME="framework" TYPE="int" LENGTH="10" NOTNULL="false" />
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" />
......
......@@ -4688,5 +4688,15 @@ function xmldb_core_upgrade($oldversion=0) {
}
}
if ($oldversion < 2016090200) {
log_debug('Add a "framework" field to the collection table');
$table = new XMLDBTable('collection');
$field = new XMLDBField('framework');
$field->setAttributes(XMLDB_TYPE_INTEGER, 10);
if (!field_exists($table, $field)) {
add_field($table, $field);
}
}
return $status;
}
......@@ -16,7 +16,7 @@ $config = new stdClass();
// See https://wiki.mahara.org/wiki/Developer_Area/Version_Numbering_Policy
// For upgrades on stable branches, increment the version by one. On master, use the date.
$config->version = 2016082900;
$config->version = 2016090200;
$config->series = '16.10';
$config->release = '16.10dev';
$config->minupgradefrom = 2012080604;
......
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