/**
  * get data of parent node from tree and object_data
  * @access	private
  * @param	object	db	db result object containing node_data
  * @return	array		2-dim (int/str) node_data
  * TODO: select description twice for compability. Please use 'desc' in future only
  */
 function fetchNodeData($a_row)
 {
     global $objDefinition, $lng, $ilBench, $ilDB;
     //$ilBench->start("Tree", "fetchNodeData_getRow");
     $data = $a_row;
     $data["desc"] = $a_row["description"];
     // for compability
     //$ilBench->stop("Tree", "fetchNodeData_getRow");
     // multilingual support systemobjects (sys) & categories (db)
     //$ilBench->start("Tree", "fetchNodeData_readDefinition");
     if (is_object($objDefinition)) {
         $translation_type = $objDefinition->getTranslationType($data["type"]);
     }
     //$ilBench->stop("Tree", "fetchNodeData_readDefinition");
     if ($translation_type == "sys") {
         //$ilBench->start("Tree", "fetchNodeData_getLangData");
         if ($data["type"] == "rolf" and $data["obj_id"] != ROLE_FOLDER_ID) {
             $data["description"] = $lng->txt("obj_" . $data["type"] . "_local_desc") . $data["title"] . $data["desc"];
             $data["desc"] = $lng->txt("obj_" . $data["type"] . "_local_desc") . $data["title"] . $data["desc"];
             $data["title"] = $lng->txt("obj_" . $data["type"] . "_local");
         } else {
             $data["title"] = $lng->txt("obj_" . $data["type"]);
             $data["description"] = $lng->txt("obj_" . $data["type"] . "_desc");
             $data["desc"] = $lng->txt("obj_" . $data["type"] . "_desc");
         }
         //$ilBench->stop("Tree", "fetchNodeData_getLangData");
     } elseif ($translation_type == "db") {
         // Try to retrieve object translation from cache
         if ($this->isCacheUsed() && array_key_exists($data["obj_id"] . '.' . $lang_code, $this->translation_cache)) {
             $key = $data["obj_id"] . '.' . $lang_code;
             $data["title"] = $this->translation_cache[$key]['title'];
             $data["description"] = $this->translation_cache[$key]['description'];
             $data["desc"] = $this->translation_cache[$key]['desc'];
         } else {
             // Object translation is not in cache, read it from database
             //$ilBench->start("Tree", "fetchNodeData_getTranslation");
             $query = 'SELECT title,description FROM object_translation ' . 'WHERE obj_id = %s ' . 'AND lang_code = %s ' . 'AND NOT lang_default = %s';
             $res = $ilDB->queryF($query, array('integer', 'text', 'integer'), array($data['obj_id'], $this->lang_code, 1));
             $row = $ilDB->fetchObject($res);
             if ($row) {
                 $data["title"] = $row->title;
                 $data["description"] = ilUtil::shortenText($row->description, MAXLENGTH_OBJ_DESC, true);
                 $data["desc"] = $row->description;
             }
             //$ilBench->stop("Tree", "fetchNodeData_getTranslation");
             // Store up to 1000 object translations in cache
             if ($this->isCacheUsed() && count($this->translation_cache) < 1000) {
                 $key = $data["obj_id"] . '.' . $lang_code;
                 $this->translation_cache[$key] = array();
                 $this->translation_cache[$key]['title'] = $data["title"];
                 $this->translation_cache[$key]['description'] = $data["description"];
                 $this->translation_cache[$key]['desc'] = $data["desc"];
             }
         }
     }
     // TODO: Handle this switch by module.xml definitions
     if ($data['type'] == 'crsr' or $data['type'] == 'catr') {
         include_once './Services/ContainerReference/classes/class.ilContainerReference.php';
         $data['title'] = ilContainerReference::_lookupTargetTitle($data['obj_id']);
     }
     return $data ? $data : array();
 }
 /**
  * fill row
  *
  * @access protected
  * @param array row data
  * @return
  */
 protected function fillRow($a_set)
 {
     $this->tpl->setVariable('VAL_ID', $a_set['id']);
     $this->tpl->setVariable('VAL_POSITION', $a_set['position']);
     // begin-patch lok
     if ($a_set['online']) {
         $this->tpl->setVariable('VAL_ONOFFLINE', $this->lng->txt('online'));
         $this->tpl->setVariable('ONOFFLINE_CLASS', 'smallgreen');
     } else {
         $this->tpl->setVariable('VAL_ONOFFLINE', $this->lng->txt('offline'));
         $this->tpl->setVariable('ONOFFLINE_CLASS', 'smallred');
     }
     if ($a_set['passes']) {
         $this->tpl->setVariable('PASSES_TXT', $this->lng->txt('crs_loc_passes_info'));
         $this->tpl->setVariable('PASSES_VAL', $a_set['passes']);
     }
     // begin-patch lok
     $this->ctrl->setParameterByClass('ilcourseobjectivesgui', 'objective_id', $a_set['id']);
     $this->tpl->setVariable('VAL_TITLE_LINKED', $this->ctrl->getLinkTargetByClass('ilcourseobjectivesgui', 'edit'));
     // end-patch lok
     $this->tpl->setVariable('VAL_TITLE', $a_set['title']);
     if (strlen($a_set['description'])) {
         $this->tpl->setVariable('VAL_DESC', $a_set['description']);
     }
     // materials
     foreach ($a_set['materials'] as $ref_id => $data) {
         if ($data['items']) {
             $this->tpl->touchBlock('ul_begin');
             foreach ($data['items'] as $pg_st) {
                 $this->tpl->setCurrentBlock('st_pg');
                 $this->tpl->setVariable('MAT_IMG', ilObject::_getIcon($pg_st['obj_id'], "tiny", $pg_st['type']));
                 $this->tpl->setVariable('MAT_ALT', $this->lng->txt('obj_' . $pg_st['type']));
                 include_once 'Modules/LearningModule/classes/class.ilLMObject.php';
                 $title = ilLMObject::_lookupTitle($pg_st['obj_id']);
                 $this->tpl->setVariable('MAT_TITLE', $title);
                 $this->tpl->parseCurrentBlock();
             }
             $this->tpl->touchBlock('ul_end');
         } else {
             $this->tpl->touchBlock('new_line');
         }
         $this->tpl->setCurrentBlock('mat_row');
         $this->tpl->setVariable('LM_IMG', ilObject::_getIcon($data['obj_id'], "tiny", $data['type']));
         $this->tpl->setVariable('LM_ALT', $this->lng->txt('obj_' . $data['type']));
         if ($data['type'] == 'catr' or $data['type'] == 'crsr') {
             include_once './Services/ContainerReference/classes/class.ilContainerReference.php';
             $this->tpl->setVariable('LM_TITLE', ilContainerReference::_lookupTargetTitle($data['obj_id']));
         } else {
             $this->tpl->setVariable('LM_TITLE', ilObject::_lookupTitle($data['obj_id']));
         }
         $this->tpl->parseCurrentBlock();
     }
     // self assessment
     // begin-patch lok
     if ($this->getSettings()->worksWithInitialTest()) {
         foreach ($a_set['self'] as $test) {
             // begin-patch lok
             foreach ((array) $test['questions'] as $question) {
                 $this->tpl->setCurrentBlock('self_qst_row');
                 $this->tpl->setVariable('SELF_QST_TITLE', $question['title']);
                 $this->tpl->parseCurrentBlock();
             }
             #$this->tpl->setCurrentBlock('self_test_row');
             #$this->tpl->setVariable('SELF_TST_ALT',$this->lng->txt('obj_tst'));
             #$this->tpl->setVariable('SELF_TST_TITLE',ilObject::_lookupTitle($test['obj_id']));
             #$this->tpl->parseCurrentBlock();
             // end-patch lok
         }
         // begin-patch lok
         if (!count($a_set['self'])) {
             $this->tpl->touchBlock('self_qst_row');
         }
         // end-patch lok
     }
     // end-patch lok
     // final test questions
     foreach ((array) $a_set['final'] as $test) {
         foreach ((array) $test['questions'] as $question) {
             $this->tpl->setCurrentBlock('final_qst_row');
             $this->tpl->setVariable('FINAL_QST_TITLE', $question['title']);
             $this->tpl->parseCurrentBlock();
         }
         // begin-patch lok
         #$this->tpl->setCurrentBlock('final_test_row');
         #$this->tpl->setVariable('FINAL_TST_ALT',$this->lng->txt('obj_tst'));
         #$this->tpl->setVariable('FINAL_TST_TITLE',ilObject::_lookupTitle($test['obj_id']));
         #$this->tpl->parseCurrentBlock();
         // end-patch lok
     }
     // begin-patch lok
     // Edit Link
     #$this->ctrl->setParameterByClass(get_class($this->getParentObject()),'objective_id',$a_set['id']);
     $this->ctrl->setParameterByClass('ilcourseobjectivesgui', 'objective_id', $a_set['id']);
     #$this->tpl->setVariable('EDIT_LINK',$this->ctrl->getLinkTargetByClass(get_class($this->getParentObject()),'edit'));
     $this->tpl->setVariable('EDIT_LINK', $this->ctrl->getLinkTargetByClass('ilcourseobjectivesgui', 'edit'));
     // end-patch lok
     $this->tpl->setVariable('TXT_EDIT', $this->lng->txt('edit'));
     include_once "./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php";
     $alist = new ilAdvancedSelectionListGUI();
     $alist->setId($a_set['id']);
     $alist->setListTitle($this->lng->txt("actions"));
     $alist->addItem($this->lng->txt('edit'), '', $this->ctrl->getLinkTargetByClass('ilcourseobjectivesgui', 'edit'));
     // materials
     $alist->addItem($this->lng->txt('crs_objective_action_materials'), '', $this->ctrl->getLinkTargetByClass('ilcourseobjectivesgui', 'materialAssignment'));
     // itest
     if ($this->getSettings()->worksWithInitialTest()) {
         $alist->addItem($this->lng->txt('crs_objective_action_itest'), '', $this->ctrl->getLinkTargetByClass('ilcourseobjectivesgui', 'selfAssessmentAssignment'));
     }
     // qtest
     $alist->addItem($this->lng->txt('crs_objective_action_qtest'), '', $this->ctrl->getLinkTargetByClass('ilcourseobjectivesgui', 'finalTestAssignment'));
     if ($this->getSettings()->isQualifiedTestPerObjectiveVisible()) {
         $this->ctrl->setParameterByClass('ilconditionhandlerinterface', 'objective_id', $a_set['id']);
         $alist->addItem($this->lng->txt('preconditions'), '', $this->ctrl->getLinkTargetByClass('ilconditionhandlerinterface', 'listConditions'));
     }
     $this->ctrl->setParameterByClass('illopagegui', 'objective_id', $a_set['id']);
     $alist->addItem($this->lng->txt('edit_page'), '', $this->ctrl->getLinkTargetByClass('illopagegui', 'edit'));
     $this->tpl->setVariable('VAL_ACTIONS', $alist->getHTML());
     // end-patch lok
 }
 /**
  * Overwitten from base class
  * @param int $a_obj_id
  * @return 
  */
 public static function _lookupTitle($a_obj_id)
 {
     global $ilDB;
     $query = 'SELECT title,title_type FROM container_reference cr ' . 'JOIN object_data od ON cr.obj_id = od.obj_id ' . 'WHERE cr.obj_id = ' . $ilDB->quote($a_obj_id, 'integer');
     $res = $ilDB->query($query);
     while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) {
         if ($row->title_type == ilContainerReference::TITLE_TYPE_CUSTOM) {
             return $row->title;
         }
     }
     return ilContainerReference::_lookupTargetTitle($a_obj_id);
 }
 /**
  * fill row
  *
  * @access protected
  * @param array row data
  * @return
  */
 protected function fillRow($a_set)
 {
     $GLOBALS['ilLog']->write(__METHOD__ . ': ' . print_r($a_set, TRUE));
     $this->tpl->setVariable('VAL_ID', $a_set['id']);
     $this->tpl->setVariable('VAL_POSITION', $a_set['position']);
     // begin-patch lok
     if ($a_set['online']) {
         $this->tpl->setVariable('VAL_ONOFFLINE', $this->lng->txt('online'));
         $this->tpl->setVariable('ONOFFLINE_CLASS', 'smallgreen');
     } else {
         $this->tpl->setVariable('VAL_ONOFFLINE', $this->lng->txt('offline'));
         $this->tpl->setVariable('ONOFFLINE_CLASS', 'smallred');
     }
     if ($a_set['passes']) {
         $this->tpl->setVariable('PASSES_TXT', $this->lng->txt('crs_loc_passes_info'));
         $this->tpl->setVariable('PASSES_VAL', $a_set['passes']);
     }
     // begin-patch lok
     $this->ctrl->setParameterByClass('ilcourseobjectivesgui', 'objective_id', $a_set['id']);
     $this->tpl->setVariable('VAL_TITLE_LINKED', $this->ctrl->getLinkTargetByClass('ilcourseobjectivesgui', 'edit'));
     // end-patch lok
     $this->tpl->setVariable('VAL_TITLE', $a_set['title']);
     if (strlen($a_set['description'])) {
         $this->tpl->setVariable('VAL_DESC', $a_set['description']);
     }
     // materials
     foreach ($a_set['materials'] as $ref_id => $data) {
         if ($data['items']) {
             $this->tpl->touchBlock('ul_begin');
             foreach ($data['items'] as $pg_st) {
                 $this->tpl->setCurrentBlock('st_pg');
                 $this->tpl->setVariable('MAT_IMG', ilObject::_getIcon($pg_st['obj_id'], "tiny", $pg_st['type']));
                 $this->tpl->setVariable('MAT_ALT', $this->lng->txt('obj_' . $pg_st['type']));
                 include_once 'Modules/LearningModule/classes/class.ilLMObject.php';
                 $title = ilLMObject::_lookupTitle($pg_st['obj_id']);
                 $this->tpl->setVariable('MAT_TITLE', $title);
                 $this->tpl->parseCurrentBlock();
             }
             $this->tpl->touchBlock('ul_end');
         } else {
             $this->tpl->touchBlock('new_line');
         }
         $this->tpl->setCurrentBlock('mat_row');
         $this->tpl->setVariable('LM_IMG', ilObject::_getIcon($data['obj_id'], "tiny", $data['type']));
         $this->tpl->setVariable('LM_ALT', $this->lng->txt('obj_' . $data['type']));
         if ($data['type'] == 'catr' or $data['type'] == 'crsr') {
             include_once './Services/ContainerReference/classes/class.ilContainerReference.php';
             $this->tpl->setVariable('LM_TITLE', ilContainerReference::_lookupTargetTitle($data['obj_id']));
         } else {
             $this->tpl->setVariable('LM_TITLE', ilObject::_lookupTitle($data['obj_id']));
         }
         $this->tpl->parseCurrentBlock();
     }
     // self assessment
     // begin-patch lok
     if ($this->getSettings()->worksWithInitialTest()) {
         if ($this->getSettings()->hasSeparateInitialTests()) {
             if ($a_set['initial']) {
                 include_once './Services/Link/classes/class.ilLink.php';
                 $obj_id = ilObject::_lookupObjId($a_set['initial']);
                 $this->tpl->setCurrentBlock('initial_test_per_objective');
                 $this->tpl->setVariable('IT_IMG', ilObject::_getIcon($obj_id, 'tiny'));
                 $this->tpl->setVariable('IT_ALT', $this->lng->txt('obj_tst'));
                 $this->tpl->setVariable('IT_TITLE', ilObject::_lookupTitle($obj_id));
                 $this->tpl->setVariable('IT_TITLE_LINK', ilLink::_getLink($a_set['initial']));
                 include_once './Services/Link/classes/class.ilLink.php';
                 $this->ctrl->setParameterByClass('ilobjtestgui', 'ref_id', $a_set['initial']);
                 $this->ctrl->setParameterByClass('ilobjtestgui', 'cmd', 'questionsTabGateway');
                 $this->tpl->setVariable('IT_TITLE_LINK', $this->ctrl->getLinkTargetByClass('ilobjtestgui'));
                 $this->tpl->parseCurrentBlock();
             } else {
                 $this->tpl->touchBlock('initial_test_per_objective');
             }
         } else {
             foreach ($a_set['self'] as $test) {
                 // begin-patch lok
                 foreach ((array) $test['questions'] as $question) {
                     $this->tpl->setCurrentBlock('self_qst_row');
                     $this->tpl->setVariable('SELF_QST_TITLE', $question['title']);
                     $this->tpl->parseCurrentBlock();
                 }
                 // end-patch lok
             }
             // begin-patch lok
             if (!count($a_set['self'])) {
                 $this->tpl->touchBlock('self_qst_row');
             }
         }
         // end-patch lok
     }
     // end-patch lok
     // final test questions
     if ($this->getSettings()->getQualifyingTestType() == ilLOSettings::TYPE_QUALIFYING_SELECTED) {
         if ($a_set['final']) {
             $obj_id = ilObject::_lookupObjId($a_set['final']);
             $this->tpl->setCurrentBlock('final_test_per_objective');
             $this->tpl->setVariable('FT_IMG', ilObject::_getIcon($obj_id, 'tiny'));
             $this->tpl->setVariable('FT_ALT', $this->lng->txt('obj_tst'));
             $this->tpl->setVariable('FT_TITLE', ilObject::_lookupTitle($obj_id));
             include_once './Services/Link/classes/class.ilLink.php';
             $this->ctrl->setParameterByClass('ilobjtestgui', 'ref_id', $a_set['final']);
             $this->ctrl->setParameterByClass('ilobjtestgui', 'cmd', 'questionsTabGateway');
             $this->tpl->setVariable('FT_TITLE_LINK', $this->ctrl->getLinkTargetByClass('ilobjtestgui'));
             $this->tpl->parseCurrentBlock();
         } else {
             $this->tpl->touchBlock('final_test_per_objective');
         }
     } else {
         foreach ((array) $a_set['final'] as $test) {
             foreach ((array) $test['questions'] as $question) {
                 $this->tpl->setCurrentBlock('final_qst_row');
                 $this->tpl->setVariable('FINAL_QST_TITLE', $question['title']);
                 $this->tpl->parseCurrentBlock();
             }
             // begin-patch lok
             #$this->tpl->setCurrentBlock('final_test_row');
             #$this->tpl->setVariable('FINAL_TST_IMG',ilUtil::getImagePath('icon_tst_s.png'));
             #$this->tpl->setVariable('FINAL_TST_ALT',$this->lng->txt('obj_tst'));
             #$this->tpl->setVariable('FINAL_TST_TITLE',ilObject::_lookupTitle($test['obj_id']));
             #$this->tpl->parseCurrentBlock();
             // end-patch lok
         }
     }
     // begin-patch lok
     // Edit Link
     #$this->ctrl->setParameterByClass(get_class($this->getParentObject()),'objective_id',$a_set['id']);
     $this->ctrl->setParameterByClass('ilcourseobjectivesgui', 'objective_id', $a_set['id']);
     #$this->tpl->setVariable('EDIT_LINK',$this->ctrl->getLinkTargetByClass(get_class($this->getParentObject()),'edit'));
     $this->tpl->setVariable('EDIT_LINK', $this->ctrl->getLinkTargetByClass('ilcourseobjectivesgui', 'edit'));
     // end-patch lok
     $this->tpl->setVariable('TXT_EDIT', $this->lng->txt('edit'));
     include_once "./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php";
     $alist = new ilAdvancedSelectionListGUI();
     $alist->setId($a_set['id']);
     $alist->setListTitle($this->lng->txt("actions"));
     $alist->addItem($this->lng->txt('edit'), '', $this->ctrl->getLinkTargetByClass('ilcourseobjectivesgui', 'edit'));
     // materials
     $alist->addItem($this->lng->txt('crs_objective_action_materials'), '', $this->ctrl->getLinkTargetByClass('ilcourseobjectivesgui', 'materialAssignment'));
     // itest
     if ($this->getSettings()->worksWithInitialTest() && !$this->getSettings()->hasSeparateInitialTests()) {
         $alist->addItem($this->lng->txt('crs_objective_action_itest'), '', $this->ctrl->getLinkTargetByClass('ilcourseobjectivesgui', 'selfAssessmentAssignment'));
     }
     // qtest
     if ($this->getSettings()->hasSeparateQualifiedTests()) {
         #$alist->addItem(
         #		$this->lng->txt('crs_objective_action_qtest_sep'),
         #		'',
         #		$this->ctrl->getLinkTargetByClass('ilcourseobjectivesgui', 'finalSeparatedTestAssignment')
         #);
     } else {
         $alist->addItem($this->lng->txt('crs_objective_action_qtest'), '', $this->ctrl->getLinkTargetByClass('ilcourseobjectivesgui', 'finalTestAssignment'));
     }
     $this->ctrl->setParameterByClass('illopagegui', 'objective_id', $a_set['id']);
     $alist->addItem($this->lng->txt('edit_page'), '', $this->ctrl->getLinkTargetByClass('illopagegui', 'edit'));
     $this->tpl->setVariable('VAL_ACTIONS', $alist->getHTML());
     // end-patch lok
 }