Implemented support for element alignment

Also specifying the reference point location (the
location of the element that's put at posx and
posy) for each element.
This commit is contained in:
Shamim Rezaie 2015-07-30 14:51:50 +10:00 committed by Mark Nelson
parent 7634568df1
commit 039e8bca37
7 changed files with 115 additions and 10 deletions

View file

@ -62,6 +62,8 @@
<FIELD NAME="posx" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="posy" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="width" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="refpoint" TYPE="int" LENGTH="4" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="align" TYPE="char" LENGTH="1" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="sequence" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
@ -111,6 +113,8 @@
<FIELD NAME="posx" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="posy" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="width" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="refpoint" TYPE="int" LENGTH="4" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="align" TYPE="char" LENGTH="1" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="sequence" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>

View file

@ -28,7 +28,7 @@ function xmldb_customcert_upgrade($oldversion=0) {
global $CFG, $DB;
$dbman = $DB->get_manager();
if ($oldversion < 2015072700) {
if ($oldversion < 2015073000) {
// Add the margin fields to customcert_pages table
$table = new xmldb_table('customcert_pages');
$field = new xmldb_field('margin', XMLDB_TYPE_INTEGER, 10, null, null, null, 0, 'height');
@ -43,22 +43,44 @@ function xmldb_customcert_upgrade($oldversion=0) {
$dbman->add_field($table, $field);
}
// Add the width fields to customcert_elements table
// Retrieve the customcert_elements table to add some elements to it
$table = new xmldb_table('customcert_elements');
// Add the width fields to customcert_elements table
$field = new xmldb_field('width', XMLDB_TYPE_INTEGER, 10, null, null, null, 0, 'posy');
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
// Add the refpoint fields to customcert_elements table.
$field = new xmldb_field('refpoint', XMLDB_TYPE_INTEGER, 4, null, null, null, 0, 'width');
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
// Add the align fields to customcert_elements table.
$field = new xmldb_field('align', XMLDB_TYPE_CHAR, 1, null, null, null, 0, 'refpoint');
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
// Add the width fields to customcert_template_elements table
// Retrieve the customcert_template_elements table to add some elements to it
$table = new xmldb_table('customcert_template_elements');
// Add the width fields to customcert_template_elements table
$field = new xmldb_field('width', XMLDB_TYPE_INTEGER, 10, null, null, null, 0, 'posy');
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
// Add the refpoint fields to customcert_template_elements table.
$field = new xmldb_field('refpoint', XMLDB_TYPE_INTEGER, 4, null, null, null, 0, 'width');
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
// Add the align fields to customcert_template_elements table.
$field = new xmldb_field('align', XMLDB_TYPE_CHAR, 1, null, null, null, 0, 'refpoint');
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
// Customcert savepoint reached.
upgrade_mod_savepoint(true, 2015072700, 'customcert');
upgrade_mod_savepoint(true, 2015073000, 'customcert');
}
return true;