/** * Parse timing info * @param object $a_ref_id * @param object $a_parent_id * @param object $timing * @return */ protected function parseTiming($a_ref_id, $a_parent_id, $timing) { $type = (string) $timing['Type']; $visible = (string) $timing['Visible']; $changeable = (string) $timing['Changeable']; include_once './Services/Object/classes/class.ilObjectActivation.php'; $crs_item = new ilObjectActivation(); $crs_item->setTimingType($type); $crs_item->toggleVisible((bool) $visible); $crs_item->toggleChangeable((bool) $changeable); foreach ($timing->children() as $sub) { switch ((string) $sub->getName()) { case 'Start': $dt = new ilDateTime((string) $sub, IL_CAL_DATETIME, ilTimeZone::UTC); $crs_item->setTimingStart($dt->get(IL_CAL_UNIX)); break; case 'End': $dt = new ilDateTime((string) $sub, IL_CAL_DATETIME, ilTimeZone::UTC); $crs_item->setTimingEnd($dt->get(IL_CAL_UNIX)); break; case 'SuggestionStart': $dt = new ilDateTime((string) $sub, IL_CAL_DATETIME, ilTimeZone::UTC); $crs_item->setSuggestionStart($dt->get(IL_CAL_UNIX)); break; case 'SuggestionEnd': $dt = new ilDateTime((string) $sub, IL_CAL_DATETIME, ilTimeZone::UTC); $crs_item->setSuggestionEnd($dt->get(IL_CAL_UNIX)); break; case 'EarliestStart': $dt = new ilDateTime((string) $sub, IL_CAL_DATETIME, ilTimeZone::UTC); $crs_item->setEarliestStart($dt->get(IL_CAL_UNIX)); break; case 'LatestEnd': $dt = new ilDateTime((string) $sub, IL_CAL_DATETIME, ilTimeZone::UTC); $crs_item->setLatestEnd($dt->get(IL_CAL_UNIX)); break; } } if ($crs_item->getTimingStart()) { $crs_item->update($a_ref_id, $a_parent_id); } }