/** * * @param object $a_source * @return */ public function parseSource($a_source) { global $tree, $objDefinition, $ilAccess; $first = true; foreach ($tree->getSubTree($root = $tree->getNodeData($a_source)) as $node) { if ($node['type'] == 'rolf') { continue; } if (!$ilAccess->checkAccess('visible,read', '', $node['child'])) { continue; } $r = array(); $r['last'] = false; $r['source'] = $first; $r['ref_id'] = $node['child']; $r['depth'] = $node['depth'] - $root['depth']; $r['type'] = $node['type']; $r['title'] = $node['title']; $r['copy'] = $objDefinition->allowCopy($node['type']); $r['perm_copy'] = $ilAccess->checkAccess('copy', '', $node['child']); $r['link'] = $objDefinition->allowLink($node['type']); $r['perm_link'] = true; // #11905 if (!trim($r['title']) && $r['type'] == 'sess') { // use session date as title if no object title include_once './Modules/Session/classes/class.ilSessionAppointment.php'; $app_info = ilSessionAppointment::_lookupAppointment($node["obj_id"]); $r['title'] = ilSessionAppointment::_appointmentToString($app_info['start'], $app_info['end'], $app_info['fullday']); } $rows[] = $r; $first = false; } $rows[] = array('last' => true); $this->setData((array) $rows); }
function delete() { return ilSessionAppointment::_delete($this->getAppointmentId()); }
/** * Determine status * * @param integer object id * @param integer user id * @param object object (optional depends on object type) * @return integer status */ function determineStatus($a_obj_id, $a_user_id, $a_obj = null) { global $ilObjDataCache, $ilDB; $status = LP_STATUS_NOT_ATTEMPTED_NUM; switch ($ilObjDataCache->lookupType($a_obj_id)) { case 'sess': include_once './Modules/Session/classes/class.ilEventParticipants.php'; include_once './Modules/Session/classes/class.ilSessionAppointment.php'; include_once './Modules/Session/classes/class.ilObjSession.php'; $time_info = ilSessionAppointment::_lookupAppointment($a_obj_id); $registration = ilObjSession::_lookupRegistrationEnabled($a_obj_id); // If registration is disabled in_progress is not available // If event has occured in_progress is impossible if ($registration && $time_info['start'] >= time()) { // is user registered -> in progress if (ilEventParticipants::_isRegistered($a_user_id, $a_obj_id)) { $status = LP_STATUS_IN_PROGRESS_NUM; } } if (ilEventParticipants::_hasParticipated($a_user_id, $a_obj_id)) { $status = LP_STATUS_COMPLETED_NUM; } break; } return $status; }
/** * init details * * @access protected * @param * @return */ protected function initDetails() { global $ilUser; if ($_GET['expand']) { if ($_GET['expand'] > 0) { $_SESSION['sess']['expanded'][abs((int) $_GET['expand'])] = self::DETAILS_ALL; } else { $_SESSION['sess']['expanded'][abs((int) $_GET['expand'])] = self::DETAILS_TITLE; } } include_once './Modules/Session/classes/class.ilSessionAppointment.php'; if ($session = ilSessionAppointment::lookupNextSessionByCourse($this->getContainerObject()->getRefId())) { $this->force_details = $session; } elseif ($session = ilSessionAppointment::lookupLastSessionByCourse($this->getContainerObject()->getRefId())) { $this->force_details = array($session); } }
/** * 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; } }
/** * Parse item data for list entries * * @param array &$a_item */ public static function addAdditionalSubItemInformation(array &$a_item) { global $ilUser; $item = self::getItem($a_item['ref_id']); $a_item['obj_id'] = $a_item['obj_id'] > 0 ? $a_item['obj_id'] : ilObject::_lookupObjId($a_item['ref_id']); $a_item['type'] = $a_item['type'] != '' ? $a_item['type'] : ilObject::_lookupType($a_item['obj_id']); $a_item['timing_type'] = $item['timing_type']; if ($item['changeable'] && $item['timing_type'] == self::TIMINGS_PRESETTING) { include_once 'Modules/Course/classes/Timings/class.ilTimingPlaned.php'; $user_data = ilTimingPlaned::_getPlanedTimings($ilUser->getId(), $a_item['ref_id']); if ($user_data['planed_start']) { $a_item['start'] = $user_data['planed_start']; $a_item['end'] = $user_data['planed_end']; $a_item['activation_info'] = 'crs_timings_planed_info'; } else { $a_item['start'] = $item['suggestion_start']; $a_item['end'] = $item['suggestion_end']; $a_item['activation_info'] = 'crs_timings_suggested_info'; } } elseif ($item['timing_type'] == self::TIMINGS_PRESETTING) { $a_item['start'] = $item['suggestion_start']; $a_item['end'] = $item['suggestion_end']; $a_item['activation_info'] = 'crs_timings_suggested_info'; } elseif ($item['timing_type'] == self::TIMINGS_ACTIVATION) { $a_item['start'] = $item['timing_start']; $a_item['end'] = $item['timing_end']; $a_item['activation_info'] = 'obj_activation_list_gui'; } else { $a_item['start'] = 'abc'; } // #7359 - session sorting should always base on appointment date if ($a_item['type'] == 'sess') { include_once './Modules/Session/classes/class.ilSessionAppointment.php'; $info = ilSessionAppointment::_lookupAppointment($a_item['obj_id']); // #11987 $a_item['masked_start'] = $a_item['start']; $a_item['masked_end'] = $a_item['end']; $a_item['start'] = $info['start']; $a_item['end'] = $info['end']; } }
function __renderItem($item, $level) { global $ilUser, $ilAccess; include_once 'Modules/Course/classes/Timings/class.ilTimingPlaned.php'; include_once './Services/Link/classes/class.ilLink.php'; include_once './Services/MetaData/classes/class.ilMDEducational.php'; if (!$ilAccess->checkAccess('visible', '', $item['ref_id'])) { return false; } $this->lng->loadLanguageModule('meta'); $usr_planed = new ilTimingPlaned($item['ref_id'], $ilUser->getId()); for ($i = 0; $i < $level; $i++) { $this->tpl->touchBlock('start_indent'); $this->tpl->touchBlock('end_indent'); } if (strlen($item['description'])) { $this->tpl->setCurrentBlock("item_description"); $this->tpl->setVariable("DESC", $item['description']); $this->tpl->parseCurrentBlock(); } if ($tlt = ilMDEducational::_getTypicalLearningTimeSeconds($item['obj_id'])) { $this->tpl->setCurrentBlock("tlt"); $this->tpl->setVariable("TXT_TLT", $this->lng->txt('meta_typical_learning_time')); $this->tpl->setVariable("TLT_VAL", ilFormat::_secondsToString($tlt)); $this->tpl->parseCurrentBlock(); } if (!$item['title'] && $item['type'] == 'sess') { include_once './Modules/Session/classes/class.ilSessionAppointment.php'; $app_info = ilSessionAppointment::_lookupAppointment(ilObject::_lookupObjId($item["ref_id"])); $item['title'] = ilSessionAppointment::_appointmentToString($app_info['start'], $app_info['end'], $app_info['fullday']); } if ($ilAccess->checkAccess('read', '', $item['ref_id'])) { $this->tpl->setCurrentBlock("title_as_link"); $this->tpl->setVariable("TITLE_LINK", ilLink::_getLink($item['ref_id'], $item['type'])); $this->tpl->setVariable("TITLE_NAME", $item['title']); $this->tpl->parseCurrentBlock(); } else { $this->tpl->setCurrentBlock("title_plain"); $this->tpl->setVariable("TITLE", $item['title']); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("container_standard_row"); if (isset($this->invalid["{$item['ref_id']}"])) { $this->tpl->setVariable("ROWCLASS", 'tblrowmarked'); } else { $this->tpl->setVariable("ROWCLASS", ilUtil::switchColor($this->counter++, 'tblrow1', 'tblrow2')); } #$this->tpl->setVariable("TYPE_IMG",ilUtil::getImagePath('icon_'.$item['type'].'.svg')); $this->tpl->setVariable('TYPE_IMG', ilUtil::getTypeIconPath($item['type'], $item['obj_id'], 'small')); $this->tpl->setVariable("TYPE_ALT_IMG", $this->lng->txt('obj_' . $item['type'])); if ($item['timing_type'] == ilObjectActivation::TIMINGS_PRESETTING) { $this->tpl->setVariable('SUG_START', ilDatePresentation::formatDate(new ilDate($item['suggestion_start'], IL_CAL_UNIX))); $this->tpl->setVariable('SUG_END', ilDatePresentation::formatDate(new ilDate($item['suggestion_end'], IL_CAL_UNIX))); } if ($item['changeable']) { $item_prefix = "item[" . $item['ref_id'] . ']'; if (is_array($_POST['item']["{$item['ref_id']}"]['own_start'])) { #echo "Start post<br>"; $start = $this->__toUnix($_POST['item']["{$item['ref_id']}"]['own_start']); } elseif ($usr_planed->getPlanedStartingTime()) { #echo "Own start<br>"; $start = $usr_planed->getPlanedStartingTime(); } else { #echo "Empfehlung start<br>"; $start = $item['suggestion_start']; } $date = $this->__prepareDateSelect($start); $this->tpl->setVariable("OWN_START", ilUtil::makeDateSelect($item_prefix . "[own_start]", $date['y'], $date['m'], $date['d'], date('Y', time()), false)); if ($usr_planed->getPlanedEndingTime()) { #echo "Own End<br>"; $end = $usr_planed->getPlanedEndingTime(); } else { #echo "Empfehlung end<br>"; $end = $item['suggestion_end']; } $this->tpl->setVariable('OWN_END', ilDatePresentation::formatDate(new ilDate($end, IL_CAL_UNIX))); $this->tpl->setVariable("NAME_DURATION", $item_prefix . "[duration]"); // Duration if (isset($_POST['item']["{$item['ref_id']}"]['duration'])) { $this->tpl->setVariable("VAL_DURATION", $_POST['item']["{$item['ref_id']}"]['duration']); } else { $this->tpl->setVariable("VAL_DURATION", intval(($end - $start) / (60 * 60 * 24))); } $this->tpl->setVariable('LIM_START', ilDatePresentation::formatDate(new ilDate($item['earliest_start'], IL_CAL_UNIX))); $this->tpl->setVariable('LIM_END', ilDatePresentation::formatDate(new ilDate($item['latest_end'], IL_CAL_UNIX))); } $this->tpl->parseCurrentBlock(); if (!$_SESSION['crs_timings_user_hidden']) { return true; } foreach (ilObjectActivation::getTimingsItems($item['ref_id']) as $item_data) { $this->__renderItem($item_data, $level + 1); } }
/** * init appointments * * @access protected * @param * @return */ protected function initAppointments() { // get assigned appointments include_once './Modules/Session/classes/class.ilSessionAppointment.php'; $this->appointments = ilSessionAppointment::_readAppointmentsBySession($this->getId()); }
/** * Get node content * * @param array * @return */ function getNodeContent($a_node) { global $lng; $title = $a_node["title"]; if ($a_node["child"] == $this->getNodeId($this->getRootNode())) { if ($title == "ILIAS") { $title = $lng->txt("repository"); } } else { if ($a_node["type"] == "sess" && !trim($title)) { // #14367 - see ilObjSessionListGUI include_once './Modules/Session/classes/class.ilSessionAppointment.php'; $app_info = ilSessionAppointment::_lookupAppointment($a_node["obj_id"]); $title = ilSessionAppointment::_appointmentToString($app_info['start'], $app_info['end'], $app_info['fullday']); } } return $title; }
/** * get appointment info * * @access protected * @return array */ protected function getAppointmentInfo() { if (isset($this->app_info[$this->obj_id])) { return $this->app_info[$this->obj_id]; } include_once './Modules/Session/classes/class.ilSessionAppointment.php'; return $this->app_info[$this->obj_id] = ilSessionAppointment::_lookupAppointment($this->obj_id); }