Ejemplo n.º 1
0
 /**
  * Create or update a composite artefact for resume from an import entry request
  * @param PluginImport $importer
  * @param unknown_type $entry_request
  */
 private static function create_composite_artefact_from_request(PluginImport $importer, $entry_request)
 {
     global $USER;
     $aid = 0;
     $classname = generate_artefact_class_name($entry_request->entrytype);
     $values = unserialize($entry_request->entrycontent);
     switch ($entry_request->decision) {
         case PluginImport::DECISION_IGNORE:
             $duplicatedids = unserialize($entry_request->duplicateditemids);
             if (!empty($duplicatedids)) {
                 $aid = $duplicatedids[0];
             }
             break;
             // For composite artefacts, it only makes sense to ignore or replace them, and those are
             // the only options the form should have shown! To make things less crashy, though, we'll
             // just default to the same behavior as long as you specified anything other than
             // DECISION_IGNORE
         // For composite artefacts, it only makes sense to ignore or replace them, and those are
         // the only options the form should have shown! To make things less crashy, though, we'll
         // just default to the same behavior as long as you specified anything other than
         // DECISION_IGNORE
         case PluginImport::DECISION_REPLACE:
         case PluginImport::DECISION_ADDNEW:
         case PluginImport::DECISION_APPEND:
         default:
             $result = ArtefactTypeResumeComposite::ensure_composite_value($values, $entry_request->entrytype, $USER->get('id'));
             $aid = isset($result['error']) ? 0 : $result['artefactid'];
             break;
     }
     if ($aid) {
         $importer->add_artefactmapping($entry_request->entryid, $aid);
         return $aid;
     }
     return null;
 }