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 ($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'].'.png')); $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); } }