/** * Hook for making sure that all resume artefacts are associated with a * blockinstance at blockinstance commit time */ public static function ensure_resume_artefacts_in_blockinstance($event, $blockinstance) { if ($blockinstance->get('blocktype') == 'entireresume') { safe_require('artefact', 'resume'); $artefacttypes = implode(', ', array_map('db_quote', PluginArtefactResume::get_artefact_types())); // Get all artefacts that are resume related and belong to the correct owner $artefacts = get_records_sql_array(' SELECT id FROM {artefact} WHERE artefacttype IN(' . $artefacttypes . ') AND "owner" = ( SELECT "owner" FROM {view} WHERE id = ? )', array($blockinstance->get('view'))); if ($artefacts) { // Make sure they're registered as being in this view foreach ($artefacts as $artefact) { $record = (object) array('view' => $blockinstance->get('view'), 'artefact' => $artefact->id, 'block' => $blockinstance->get('id')); ensure_record_exists('view_artefact', $record, $record); } } } }
public static function artefactchooser_element($default = null) { safe_require('artefact', 'resume'); return array('name' => 'artefactid', 'type' => 'artefactchooser', 'title' => get_string('fieldtoshow', 'blocktype.resume/resumefield'), 'defaultvalue' => $default, 'blocktype' => 'resumefield', 'limit' => 655360, 'selectone' => true, 'search' => false, 'artefacttypes' => PluginArtefactResume::get_artefact_types(), 'template' => 'artefact:resume:artefactchooser-element.tpl'); }