/**
  * 
  * @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 appointmentToString()
 {
     return ilSessionAppointment::_appointmentToString($this->getStartingTime(), $this->getEndingTime(), $this->enabledFullTime());
 }
 /**
  * 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;
 }
Exemplo n.º 4
0
 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);
     }
 }
 /**
  * get title
  * Overwritten since sessions prepend the date of the session
  * to the title
  *
  * @access public
  * @param
  * @return
  */
 public function getTitle()
 {
     $app_info = $this->getAppointmentInfo();
     $title = strlen($this->title) ? ': ' . $this->title : '';
     return ilSessionAppointment::_appointmentToString($app_info['start'], $app_info['end'], $app_info['fullday']) . $title;
 }