/** * Import record * * @param * @return */ function importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version) { switch ($a_entity) { case "sess": include_once "./Modules/Session/classes/class.ilObjSession.php"; include_once "./Modules/Session/classes/class.ilSessionAppointment.php"; if ($new_id = $a_mapping->getMapping('Services/Container', 'objs', $a_rec['Id'])) { $newObj = ilObjectFactory::getInstanceByObjId($new_id, false); } else { $newObj = new ilObjSession(); $newObj->setType("sess"); $newObj->create(true); } $newObj->setTitle($a_rec["Title"]); $newObj->setDescription($a_rec["Description"]); $newObj->setLocation($a_rec["Location"]); $newObj->setName($a_rec["TutorName"]); $newObj->setPhone($a_rec["TutorPhone"]); $newObj->setEmail($a_rec["TutorEmail"]); $newObj->setDetails($a_rec["Details"]); $newObj->update(); $start = new ilDateTime($a_rec["EventStart"], IL_CAL_DATETIME, "UTC"); $end = new ilDateTime($a_rec["EventEnd"], IL_CAL_DATETIME, "UTC"); //echo "<br>".$start->get(IL_CAL_UNIX); //echo "<br>".$start->get(IL_CAL_DATETIME); $app = new ilSessionAppointment(); $app->setStart($a_rec["EventStart"]); $app->setEnd($a_rec["EventEnd"]); $app->setStartingTime($start->get(IL_CAL_UNIX)); $app->setEndingTime($end->get(IL_CAL_UNIX)); $app->toggleFullTime($a_rec["Fulltime"]); $app->setSessionId($newObj->getId()); $app->create(); //$newObj->setAppointments(array($app)); //$newObj->update(); $this->current_obj = $newObj; $a_mapping->addMapping("Modules/Session", "sess", $a_rec["Id"], $newObj->getId()); //var_dump($a_mapping->mappings["Services/News"]["news_context"]); break; case "sess_item": if ($obj_id = $a_mapping->getMapping('Services/Container', 'objs', $a_rec['ItemId'])) { $ref_id = current(ilObject::_getAllReferences($obj_id)); include_once './Modules/Session/classes/class.ilEventItems.php'; $evi = new ilEventItems($this->current_obj->getId()); $evi->addItem($ref_id); $evi->update(); } break; } }
/** * clone settings * * @access public * @param ilObjSession * @return */ public function cloneSettings(ilObjSession $new_obj) { // @var $new_obj->setLocation($this->getLocation()); $new_obj->setName($this->getName()); $new_obj->setPhone($this->getPhone()); $new_obj->setEmail($this->getEmail()); $new_obj->setDetails($this->getDetails()); $new_obj->setRegistrationType($this->getRegistrationType()); $new_obj->enableRegistrationUserLimit($this->isRegistrationUserLimitEnabled()); $new_obj->enableRegistrationWaitingList($this->isRegistrationWaitingListEnabled()); $new_obj->setRegistrationMaxUsers($this->getRegistrationMaxUsers()); $new_obj->update(); return true; }