ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilObjLearningModuleSubItemListGUI.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 include_once './Services/Object/classes/class.ilSubItemListGUI.php';
24 
35 {
39  protected $user;
40 
41 
45  public function __construct($a_cmd_class)
46  {
47  global $DIC;
48  parent::__construct($a_cmd_class);
49 
50  $this->user = $DIC->user();
51  }
52 
53 
58  public function getHTML()
59  {
60  $lng = $this->lng;
62 
63  include_once 'Modules/LearningModule/classes/class.ilLMObject.php';
64  foreach ($this->getSubItemIds(true) as $sub_item) {
65  if (is_object($this->getHighlighter()) and strlen($this->getHighlighter()->getContent($this->getObjId(), $sub_item))) {
66  $this->tpl->setCurrentBlock('sea_fragment');
67  $this->tpl->setVariable('TXT_FRAGMENT', $this->getHighlighter()->getContent($this->getObjId(), $sub_item));
68  $this->tpl->parseCurrentBlock();
69  }
70  $this->tpl->setCurrentBlock('subitem');
71 
72  $this->tpl->setVariable('SEPERATOR', ':');
73 
74 
75  switch (ilLMObject::_lookupType($sub_item, $this->getObjId())) {
76  case 'pg':
77  $this->getItemListGUI()->setChildId($sub_item);
78  $this->tpl->setVariable("SUBITEM_TYPE", $lng->txt('obj_pg'));
79  $link = $this->getItemListGUI()->getCommandLink('page');
80  include_once './Services/Search/classes/class.ilUserSearchCache.php';
81  $link .= ('&srcstring=1');
82  $this->tpl->setVariable('LINK', $link);
83  $this->tpl->setVariable('TARGET', $this->getItemListGUI()->getCommandFrame('page'));
84  $this->tpl->setVariable('TITLE', ilLMObject::_lookupTitle($sub_item));
85  break;
86 
87  case 'st':
88 
89  $this->getItemListGUI()->setChildId($sub_item);
90  $this->tpl->setVariable("SUBITEM_TYPE", $lng->txt('obj_st'));
91  $link = $this->getItemListGUI()->getCommandLink('page');
92  include_once './Services/Search/classes/class.ilUserSearchCache.php';
93  $link .= ('&srcstring=1');
94  $this->tpl->setVariable('LINK', $link);
95  $this->tpl->setVariable('TARGET', $this->getItemListGUI()->getCommandFrame('page'));
96  $this->tpl->setVariable('TITLE', ilLMObject::_lookupTitle($sub_item));
97  break;
98 
99  default:
100 
101  if (ilObject::_lookupType($sub_item) != 'file') {
102  return '';
103  }
104 
105  $this->getItemListGUI()->setChildId('il__file_' . $sub_item);
106  $this->tpl->setVariable('SUBITEM_TYPE', $lng->txt('obj_file'));
107  $link = $this->getItemListGUI()->getCommandLink('downloadFile');
108  $this->tpl->setVariable('LINK', $link);
109  $this->tpl->setVariable('TITLE', ilObject::_lookupTitle($sub_item));
110  break;
111  }
112 
113  if (count($this->getSubItemIds(true)) > 1) {
114  $this->parseRelevance($sub_item);
115  }
116 
117  $this->tpl->parseCurrentBlock();
118  }
119 
120  $this->showDetailsLink();
121 
122  return $this->tpl->get();
123  }
124 }
static _lookupType($a_obj_id, $a_lm_id=0)
Lookup type.
global $DIC
Definition: saml.php:7
getHighlighter()
get highlighter
Base class for all sub item list gui&#39;s.
static _lookupTitle($a_id)
lookup object title
static _lookupTitle($a_obj_id)
Lookup title.
user()
Definition: user.php:4
showDetailsLink()
show details link
$ilUser
Definition: imgupload.php:18
static _lookupType($a_id, $a_reference=false)
lookup object type
getItemListGUI()
get item list gui
getSubItemIds($a_limited=false)
get sub item ids