Commit c47f7c6a authored by Nigel McNie's avatar Nigel McNie
Browse files

Implemented render_self for the resume artefact types, to satisfy the view...

Implemented render_self for the resume artefact types, to satisfy the view API. Basically stole the render_full methods from 0.8.
parent 74055c4e
......@@ -110,6 +110,13 @@ class ArtefactTypeResume extends ArtefactType {
public static function get_links($id) {
// @todo penny
}
/**
* Default render method for resume fields - show their description
*/
public function render_self($options) {
return array('html' => $this->description);
}
}
class ArtefactTypeCoverletter extends ArtefactTypeResume {
......@@ -137,24 +144,24 @@ class ArtefactTypeInterest extends ArtefactTypeResume {
class ArtefactTypeContactinformation extends ArtefactTypeResume {
public function get_html($editing=true) {
public function render_self($options) {
$smarty = smarty();
$fields = ArtefactTypeContactinformation::get_profile_fields();
foreach ($fields as $f) {
try {
$$f = artefact_instance_from_type($f);
$rendered = $$f->render_self(array());
$smarty->assign($f, $rendered['html']);
$smarty->assign($f, format_whitespace($rendered['html']));
}
catch (Exception $e) { }
}
$template = 'artefact:resume:fragments/contactinformation.';
if (!empty($editing)) {
if (!empty($options['editing'])) {
$template .= 'editing.';
}
$template .= 'tpl';
return $smarty->fetch($template);
return array('html' => $smarty->fetch($template));
}
public static function is_singular() {
......@@ -261,6 +268,16 @@ class ArtefactTypePersonalinformation extends ArtefactTypeResume {
return true;
}
public function render_self($options) {
$smarty = smarty();
$fields = array();
foreach (array_keys(ArtefactTypePersonalInformation::get_composite_fields()) as $field) {
$fields[get_string($field, 'artefact.resume')] = $this->get_composite($field);
}
$smarty->assign('fields', $fields);
return array('html' => $smarty->fetch('artefact:resume:fragments/personalinformation.tpl'));
}
}
......@@ -410,6 +427,36 @@ abstract class ArtefactTypeResumeComposite extends ArtefactTypeResume {
return 'artefact_resume_' . $this->get_artefact_type();
}
public function render_self($options) {
$smarty = smarty();
$smarty->assign('hidetitle', true);
$type = $this->get('artefacttype');
$content = array(
'html' => $smarty->fetch('artefact:resume:fragments/' . $type . '.tpl'),
'javascript' =>
$this->get_showhide_composite_js()
."
var {$type}list = new TableRenderer(
'{$type}list',
'" . get_config('wwwroot') . "artefact/resume/composite.json.php',
[
" . call_static_method(generate_artefact_class_name($type), 'get_tablerenderer_js') ."
]
);
{$type}list.type = '{$type}';
{$type}list.statevars.push('type');
" .
(( array_key_exists('viewid', $options))
? "{$type}list.view = " . $options['viewid'] . ";
{$type}list.statevars.push('view');"
: ""
) . "
{$type}list.updateOnLoad();
");
return $content;
}
static function get_tablerenderer_title_js($titlestring, $bodystring) {
return "
function (r, d) {
......
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