public static function createObject($name, $description = "", $content = "", $mimeType = "application/x-msdownload", $artefactClass, $user = null) { self::init(); if ($user == null) { $user = lms_steam::get_current_user(); } $newArtefact = steam_factory::create_room($GLOBALS["STEAM"]->get_id(), $name, Artefacts::getArtefactsContainer($user), "Artefact: " + $name); $newArtefact->set_attribute(PORTFOLIO_PREFIX . "TYPE", "ARTEFACT"); $newArtefact->set_attribute(PORTFOLIO_PREFIX . "ARTEFACTCLASS", $artefactClass); $dataPresent = $content == "" ? false : true; $newArtefact->set_attribute(PORTFOLIO_PREFIX . "DATAPRESENT", $dataPresent); $newArtefact->set_attribute(PORTFOLIO_PREFIX . "LINKED_LOCATIONS", array()); $newArtefact->set_attribute("OBJ_TYPE", PORTFOLIO_PREFIX . "ARTEFACT"); if ($dataPresent) { $data = steam_factory::create_document($GLOBALS["STEAM"]->get_id(), "data", $content, $mimeType, $newArtefact); } $newArtefactObject = Artefacts::getArtefactByRoom($newArtefact); $newArtefactObject->checkActivity(); $newArtefactObject->checkCompetence(); //Create Forum $newArtefactObject->createForum(); //create and assign groups // $newArtefact->createGroups(); return $newArtefactObject; }
public static function getLatestArtefacts($count = 10) { $all = self::getArtefactsContainer()->get_inventory_filtered(array(array('+', 'class', CLASS_ROOM)), array(array('>', 'attribute', 'OBJ_CREATION_TIME'), array('>', 'attribute', 'OBJ_LAST_CHANGED'))); $allArtefacts = array(); $i = 0; foreach ($all as $room) { $i++; if ($i > $count) { break; } $allArtefacts[] = Artefacts::getArtefactByRoom($room); } return $allArtefacts; }
public static function getById($id) { self::init(); $obj = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $id); if (!$obj instanceof \steam_object) { error_log("Object is null."); return null; } switch ($obj->get_attribute(PORTFOLIO_PREFIX . "TYPE")) { case "ARTEFACT": return Artefacts::getArtefactByRoom($obj); break; case "PORTFOLIO": return new PortfolioModel($obj); break; default: error_log("Object is no E-Portfolio Object. ID:" . $id); return null; } }