public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject) { $ajaxResponseObject->setStatus("ok"); $user = \lms_steam::get_current_user(); $description = strip_tags($this->params["desc"]); $name = strip_tags($this->params["name"]); $newArtefact = \ArtefactCertificate::create($name, $description); return parent::ajaxResponseNew($ajaxResponseObject, $newArtefact); }
function importFolder($directory) { $xmlDoc = simplexml_load_file($directory . "/leap2A.xml"); $author = $xmlDoc->author->name; $updated = $xmlDoc->updated; foreach ($xmlDoc->entry as $entry) { $fileUri = $directory . "/" . $entry->link['href']; $mimeType = detectMimeType($fileUri); $content = file_get_contents($fileUri, $mimeType); $name = $entry->title; $artefactType = $entry->category['type']; switch ($artefactType) { case "SCHOOL": $artefact = ArtefactSchool::create($name); case "EMPLOYMENT": $artefact = ArtefactEmployment::create($name); case "CERTIFICATE": $artefact = ArtefactCertificate::create($name); default: $artefact = ArtefactCertificate::create($name); } $artefact->setData($content, $mimeType); foreach ($entry->competence as $comp) { $artefact->addCompetenceString($comp->index, $comp->rating); } $updated = strtotime($entry->updated); $artefact->set_attribute("OBJ_LAST_MODIFIED", $updated); //"OBJ_MODIFICATION_TIME"? $published = strtotime($entry->published); } }