Commit a9cb4b01 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Make qualification name/type optional in resume (bug #503358)


Signed-off-by: default avatarRichard Mansfield <richardm@catalyst.net.nz>
parent 051bcf92
......@@ -42,8 +42,8 @@
<FIELD NAME="artefact" TYPE="int" LENGTH="10" NOTNULL="true" />
<FIELD NAME="startdate" TYPE="text" NOTNULL="true" />
<FIELD NAME="enddate" TYPE="text" NOTNULL="false" />
<FIELD NAME="qualtype" TYPE="text" NOTNULL="true" />
<FIELD NAME="qualname" TYPE="text" NOTNULL="true" />
<FIELD NAME="qualtype" TYPE="text" NOTNULL="false" />
<FIELD NAME="qualname" TYPE="text" NOTNULL="false" />
<FIELD NAME="institution" TYPE="text" NOTNULL="true" />
<FIELD NAME="institutionaddress" TYPE="text" NOTNULL="false" />
<FIELD NAME="qualdescription" TYPE="text" NOTNULL="false" />
......
......@@ -120,6 +120,18 @@ function xmldb_artefact_resume_upgrade($oldversion=0) {
add_field($table, $field);
}
if ($oldversion < 2010020300) {
$table = new XMLDBTable('artefact_resume_educationhistory');
$field = new XMLDBField('qualtype');
$field->setAttributes(XMLDB_TYPE_TEXT);
change_field_notnull($table, $field);
$table = new XMLDBTable('artefact_resume_educationhistory');
$field = new XMLDBField('qualname');
$field->setAttributes(XMLDB_TYPE_TEXT);
change_field_notnull($table, $field);
}
return $status;
}
......
......@@ -296,6 +296,7 @@ $inlinejs .= ArtefactTypeResumeComposite::get_showhide_composite_js();
$compositeforms = array();
foreach (ArtefactTypeResumeComposite::get_composite_artefact_types() as $compositetype) {
$inlinejs .= call_static_method(generate_artefact_class_name($compositetype), 'get_composite_js');
$inlinejs .= <<<EOF
tableRenderers.{$compositetype} = new TableRenderer(
'{$compositetype}list',
......
......@@ -576,6 +576,10 @@ abstract class ArtefactTypeResumeComposite extends ArtefactTypeResume {
}
";
}
static function get_composite_js() {
return '';
}
}
class ArtefactTypeEmploymenthistory extends ArtefactTypeResumeComposite {
......@@ -666,14 +670,23 @@ class ArtefactTypeEducationhistory extends ArtefactTypeResumeComposite {
}
public static function get_tablerenderer_title_js_string() {
$at = get_string('at');
return " r.qualname + ' (' + r.qualtype + ') {$at} ' + r.institution";
return " formatQualification(r.qualname, r.qualtype, r.institution)";
}
public static function format_render_self_data($data) {
$at = get_string('at');
foreach ($data as &$row) {
$row->qualification = $row->qualname . ' (' . $row->qualtype . ") $at " . $row->institution;
$row->qualification = '';
if (strlen($row->qualname) && strlen($row->qualtype)) {
$row->qualification = $row->qualname. ' (' . $row->qualtype . ') ' . $at . ' ';
}
else if (strlen($row->qualtype)) {
$row->qualification = $row->qualtype . ' ' . $at . ' ';
}
else if (strlen($row->qualname)) {
$row->qualification = $row->qualname . ' ' . $at . ' ';
}
$row->qualification .= $row->institution;
}
return $data;
}
......@@ -709,16 +722,10 @@ class ArtefactTypeEducationhistory extends ArtefactTypeResumeComposite {
),
'qualtype' => array(
'type' => 'text',
'rules' => array(
'required' => true,
),
'title' => get_string('qualtype', 'artefact.resume'),
),
'qualname' => array(
'type' => 'text',
'rules' => array(
'required' => true,
),
'title' => get_string('qualname', 'artefact.resume'),
),
'qualdescription' => array(
......@@ -730,6 +737,26 @@ class ArtefactTypeEducationhistory extends ArtefactTypeResumeComposite {
),
);
}
static function get_composite_js() {
$at = get_string('at');
return <<<EOF
function formatQualification(name, type, institution) {
var qual = '';
if (name && type) {
qual = name + ' (' + type + ') {$at} ';
}
else if (type) {
qual = type + ' {$at} ';
}
else if (name) {
qual = name + ' {$at} ';
}
qual += institution;
return qual;
}
EOF;
}
}
class ArtefactTypeCertification extends ArtefactTypeResumeComposite {
......
......@@ -28,7 +28,7 @@
defined('INTERNAL') || die();
$config = new StdClass;
$config->version = 2009122100;
$config->release = '1.0.0';
$config->version = 2010020300;
$config->release = '1.0.1';
?>
Supports Markdown
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