/** * All users need one of these, but it's a "fake" artefact - it just * represents profile information. It's not exported. So we create one here * for imported users. */ public static function setup(PluginImportLeap $importer) { try { ArtefactTypeContactinformation::setup_new($importer->get('usr')); } catch (ParamOutOfRangeException $e) { } // probably already has one }
public function add_links() { $fields = ArtefactTypeContactinformation::get_profile_fields(); foreach ($fields as $f) { try { ${$f} = artefact_instance_from_type($f, $this->artefact->get('owner')); $this->add_artefact_link(${$f}, 'has_part'); } catch (MaharaException $e) { } // might not exist which is ok } }
public static function setup_new($userid) { try { return artefact_instance_from_type('contactinformation', $userid); } catch (ArtefactNotFoundException $e) { $artefact = new ArtefactTypeContactinformation(null, array('owner' => $userid, 'title' => get_string('contactinformation', 'artefact.resume'))); $artefact->commit(); } return $artefact; }
public static function setup_new($userid) { $artefact = new ArtefactTypeContactinformation(null, array('owner' => $userid, 'title' => get_string('contactinformation', 'artefact.resume'))); $artefact->commit(); return $artefact; }
$coverletter = null; $personalinformation = null; $contactinformation = null; $interest = null; try { $coverletter = artefact_instance_from_type('coverletter'); } catch (Exception $e) { } try { $personalinformation = artefact_instance_from_type('personalinformation'); } catch (Exception $e) { } try { $contactinformation = artefact_instance_from_type('contactinformation'); } catch (Exception $e) { $contactinformation = ArtefactTypeContactinformation::setup_new($USER->get('id')); } try { $interest = artefact_instance_from_type('interest'); } catch (Exception $e) { } $contactinformation_value = $contactinformation->render_self(array('editing' => true)); $contactinformation_value = $contactinformation_value['html']; $coverletterform = pieform(array('name' => 'coverletter', 'jsform' => true, 'plugintype' => 'artefact', 'pluginname' => 'resume', 'jsform' => true, 'method' => 'post', 'elements' => array('coverletterfs' => array('type' => 'fieldset', 'legend' => get_string('coverletter', 'artefact.resume'), 'elements' => array('coverletter' => array('type' => 'wysiwyg', 'cols' => 70, 'rows' => 10, 'defaultvalue' => !empty($coverletter) ? $coverletter->get('description') : null, 'help' => true), 'save' => array('type' => 'submit', 'value' => get_string('save'))))))); $interestsform = pieform(array('name' => 'interests', 'jsform' => true, 'plugintype' => 'artefact', 'pluginname' => 'resume', 'jsform' => true, 'method' => 'post', 'elements' => array('interestsfs' => array('type' => 'fieldset', 'legend' => get_string('interest', 'artefact.resume'), 'elements' => array('interest' => array('type' => 'wysiwyg', 'defaultvalue' => !empty($interest) ? $interest->get('description') : null, 'cols' => 70, 'rows' => 10, 'help' => true), 'save' => array('type' => 'submit', 'value' => get_string('save'))))))); $contactinformationform = pieform(array('name' => 'contactinformation', 'jsform' => true, 'plugintype' => 'artefact', 'pluginname' => 'resume', 'jsform' => true, 'method' => 'post', 'elements' => array('contactinformationfs' => array('type' => 'fieldset', 'legend' => get_string('contactinformation', 'artefact.resume'), 'elements' => array('contactinformation' => array('type' => 'html', 'value' => $contactinformation_value, 'help' => true)))))); $personalinformationform = pieform(array('name' => 'personalinformation', 'jsform' => true, 'plugintype' => 'artefact', 'pluginname' => 'resume', 'jsform' => true, 'method' => 'post', 'elements' => array('personalinformation' => array('type' => 'fieldset', 'legend' => get_string('personalinformation', 'artefact.resume'), 'elements' => array('dateofbirth' => array('type' => 'calendar', 'caloptions' => array('showsTime' => false, 'ifFormat' => '%Y/%m/%d'), 'defaultvalue' => !empty($personalinformation) ? $personalinformation->get_composite('dateofbirth') : null, 'title' => get_string('dateofbirth', 'artefact.resume'), 'help' => true), 'placeofbirth' => array('type' => 'text', 'defaultvalue' => !empty($personalinformation) ? $personalinformation->get_composite('placeofbirth') : null, 'title' => get_string('placeofbirth', 'artefact.resume')), 'citizenship' => array('type' => 'text', 'defaultvalue' => !empty($personalinformation) ? $personalinformation->get_composite('citizenship') : null, 'title' => get_string('citizenship', 'artefact.resume')), 'visastatus' => array('type' => 'text', 'defaultvalue' => !empty($personalinformation) ? $personalinformation->get_composite('visastatus') : null, 'title' => get_string('visastatus', 'artefact.resume'), 'help' => true), 'gender' => array('type' => 'radio', 'defaultvalue' => !empty($personalinformation) ? $personalinformation->get_composite('gender') : null, 'options' => array('female' => get_string('female', 'artefact.resume'), 'male' => get_string('male', 'artefact.resume')), 'title' => get_string('gender', 'artefact.resume')), 'maritalstatus' => array('type' => 'text', 'defaultvalue' => !empty($personalinformation) ? $personalinformation->get_composite('maritalstatus') : null, 'title' => get_string('maritalstatus', 'artefact.resume')), 'save' => array('type' => 'submit', 'value' => get_string('save'))))))); $cancelstr = get_string('cancel'); $addstr = get_string('add'); $editstr = get_string('edit'); $delstr = get_string('delete');