Removed the 'align' property

This commit is contained in:
Mark Nelson 2015-12-06 20:54:18 +08:00
parent 87d1ecfcc7
commit e441b7051b
6 changed files with 21 additions and 25 deletions

View file

@ -55,8 +55,8 @@ class backup_customcert_activity_structure_step extends backup_activity_structur
// The elements. // The elements.
$element = new backup_nested_element('element', array('id'), array( $element = new backup_nested_element('element', array('id'), array(
'pageid', 'name', 'element', 'data', 'font', 'size', 'pageid', 'name', 'element', 'data', 'font', 'size',
'colour', 'width', 'refpoint', 'align', 'posx', 'colour', 'width', 'refpoint', 'posx', 'posy', 'sequence',
'posy', 'sequence', 'timecreated', 'timemodified')); 'timecreated', 'timemodified'));
// Build the tree. // Build the tree.
$customcert->add_child($issues); $customcert->add_child($issues);

View file

@ -63,7 +63,6 @@
<FIELD NAME="posy" 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="width" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="refpoint" TYPE="int" LENGTH="4" 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="sequence" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" 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"/> <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
@ -114,7 +113,6 @@
<FIELD NAME="posy" 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="width" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="refpoint" TYPE="int" LENGTH="4" 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="sequence" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" 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"/> <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>

View file

@ -83,5 +83,22 @@ function xmldb_customcert_upgrade($oldversion=0) {
upgrade_mod_savepoint(true, 2015073000, 'customcert'); upgrade_mod_savepoint(true, 2015073000, 'customcert');
} }
if ($oldversion < 2015120800) {
// Remove the align column from both the 'customcert_elements' and 'customcert_template_elements' table.
$table = new xmldb_table('customcert_elements');
$field = new xmldb_field('align');
if ($dbman->field_exists($table, $field)) {
$dbman->drop_field($table, $field);
}
$table = new xmldb_table('customcert_template_elements');
if ($dbman->field_exists($table, $field)) {
$dbman->drop_field($table, $field);
}
// Customcert savepoint reached.
upgrade_mod_savepoint(true, 2015120800, 'customcert');
}
return true; return true;
} }

View file

@ -115,7 +115,6 @@ abstract class customcert_element_base {
$element->posy = (isset($data->posy)) ? $data->posy : null; $element->posy = (isset($data->posy)) ? $data->posy : null;
$element->width = (isset($data->width)) ? $data->width : null; $element->width = (isset($data->width)) ? $data->width : null;
$element->refpoint = (isset($data->refpoint)) ? $data->refpoint : null; $element->refpoint = (isset($data->refpoint)) ? $data->refpoint : null;
$element->align = (isset($data->align)) ? $data->align : null;
$element->timemodified = time(); $element->timemodified = time();
// Check if we are updating, or inserting a new element. // Check if we are updating, or inserting a new element.
@ -191,7 +190,6 @@ abstract class customcert_element_base {
$x = $this->element->posx; $x = $this->element->posx;
$y = $this->element->posy; $y = $this->element->posy;
$w = $this->element->width; $w = $this->element->width;
$align = $this->element->align;
$refpoint = $this->element->refpoint; $refpoint = $this->element->refpoint;
$actualwidth = $pdf->GetStringWidth($content); $actualwidth = $pdf->GetStringWidth($content);
@ -224,7 +222,7 @@ abstract class customcert_element_base {
$w += 0.0001; $w += 0.0001;
} }
$pdf->setCellPaddings(0, 0, 0, 0); $pdf->setCellPaddings(0, 0, 0, 0);
$pdf->writeHTMLCell($w, 0, $x, $y, $content, 0, 0, false, true, $align); $pdf->writeHTMLCell($w, 0, $x, $y, $content, 0, 0, false, true);
} }
/** /**
@ -351,17 +349,6 @@ abstract class customcert_element_base {
$mform->setType('refpoint', PARAM_INT); $mform->setType('refpoint', PARAM_INT);
$mform->setDefault('refpoint', ''); $mform->setDefault('refpoint', '');
$mform->addHelpButton('refpoint', 'refpoint', 'customcert'); $mform->addHelpButton('refpoint', 'refpoint', 'customcert');
$alignoptions = array();
$alignoptions[''] = get_string('alignnone', 'customcert');
$alignoptions['L'] = get_string('alignleft', 'customcert');
$alignoptions['C'] = get_string('aligncenter', 'customcert');
$alignoptions['R'] = get_string('alignright', 'customcert');
$mform->addElement('select', 'align', get_string('align', 'customcert'), $alignoptions);
$mform->setType('align', PARAM_ALPHA);
$mform->setDefault('align', '');
$mform->addHelpButton('align', 'align', 'customcert');
} }
/** /**

View file

@ -24,12 +24,6 @@
$string['addcertpage'] = 'Add another certificate page'; $string['addcertpage'] = 'Add another certificate page';
$string['addelement'] = 'Add element'; $string['addelement'] = 'Add element';
$string['align'] = 'Alignment';
$string['align_help'] = 'Alignment Help';
$string['aligncenter'] = 'Center';
$string['alignleft'] = 'Left align';
$string['alignnone'] = 'No alignment';
$string['alignright'] = 'Right align';
$string['applypositions'] = 'Save positions & continue'; $string['applypositions'] = 'Save positions & continue';
$string['awardedto'] = 'Awarded to'; $string['awardedto'] = 'Awarded to';
$string['code'] = 'Code'; $string['code'] = 'Code';

View file

@ -24,7 +24,7 @@
defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.'); defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.');
$plugin->version = 2015080500; // The current module version (Date: YYYYMMDDXX). $plugin->version = 2015120800; // The current module version (Date: YYYYMMDDXX).
$plugin->requires = 2015051100; // Requires this Moodle version (2.9). $plugin->requires = 2015051100; // Requires this Moodle version (2.9).
$plugin->cron = 0; // Period for cron to check this module (secs). $plugin->cron = 0; // Period for cron to check this module (secs).
$plugin->component = 'mod_customcert'; $plugin->component = 'mod_customcert';