ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ILIAS\Container\StartObjects\Content\ObjectsContent Class Reference
+ Collaboration diagram for ILIAS\Container\StartObjects\Content\ObjectsContent:

Public Member Functions

 __construct (ilContainerGUI $a_parent_obj, ilContainerStartObjects $a_start_objects, UIFactory $ui_factory, UIRenderer $ui_renderer, bool $a_enable_desktop=true)
 
 render ()
 

Protected Member Functions

 getData ()
 
 getItemListGUI (string $a_type)
 
 getListItem (array $a_item)
 
 getItemAsSubPanel (array $item)
 

Protected Attributes

ilObjUser $user
 
ilObjectDataCache $obj_data_cache
 
ilAccessHandler $access
 
ilObjectDefinition $obj_definition
 
ilLanguage $lng
 
ilCtrl $ctrl
 
UIFactory $ui_factory
 
UIRenderer $ui_renderer
 
ilContainerStartObjects $start_object
 
ilContainerGUI $parent_obj
 
array $item_list_guis
 
bool $enable_desktop
 
ilFavouritesManager $fav_manager
 

Detailed Description

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

Definition at line 41 of file ObjectsContent.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Container\StartObjects\Content\ObjectsContent::__construct ( ilContainerGUI  $a_parent_obj,
ilContainerStartObjects  $a_start_objects,
UIFactory  $ui_factory,
UIRenderer  $ui_renderer,
bool  $a_enable_desktop = true 
)

Definition at line 57 of file ObjectsContent.php.

References $DIC, ILIAS\Container\StartObjects\Content\ObjectsContent\$lng, ILIAS\Container\StartObjects\Content\ObjectsContent\$ui_factory, ILIAS\Container\StartObjects\Content\ObjectsContent\$ui_renderer, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\user().

63  {
64  global $DIC;
65 
66  $this->user = $DIC->user();
67  $this->obj_data_cache = $DIC["ilObjDataCache"];
68  $this->access = $DIC->access();
69  $this->obj_definition = $DIC["objDefinition"];
70  $this->ui_factory = $ui_factory;
71  $this->ui_renderer = $ui_renderer;
72  $lng = $DIC->language();
73  $ilCtrl = $DIC->ctrl();
74 
75  $this->lng = $lng;
76  $this->lng->loadLanguageModule('rep');
77  $this->ctrl = $ilCtrl;
78 
79  $this->parent_obj = $a_parent_obj;
80  $this->start_object = $a_start_objects;
81  $this->enable_desktop = $a_enable_desktop;
82 
83  $this->fav_manager = new ilFavouritesManager();
84  }
global $DIC
Definition: shib_login.php:26
+ Here is the call graph for this function:

Member Function Documentation

◆ getData()

ILIAS\Container\StartObjects\Content\ObjectsContent::getData ( )
protected

Definition at line 86 of file ObjectsContent.php.

References ILIAS\Container\StartObjects\Content\ObjectsContent\$access, ILIAS\Container\StartObjects\Content\ObjectsContent\$obj_data_cache, $ref_id, $url, ILIAS\Container\StartObjects\Content\ObjectsContent\$user, ilObjectListGUI\CONTEXT_REPOSITORY, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and null.

Referenced by ILIAS\Container\StartObjects\Content\ObjectsContent\render().

86  : array
87  {
88  $ilUser = $this->user;
89  $ilObjDataCache = $this->obj_data_cache;
90  $ilAccess = $this->access;
91 
92  $lm_continue = new ilCourseLMHistory($this->start_object->getRefId(), $ilUser->getId());
93  $continue_data = $lm_continue->getLMHistory();
94 
95  $items = [];
96  $counter = 0;
97  foreach ($this->start_object->getStartObjects() as $start) {
98  $obj_id = $ilObjDataCache->lookupObjId((int) $start['item_ref_id']);
99  $ref_id = $start['item_ref_id'];
100  $type = $ilObjDataCache->lookupType($obj_id);
101 
102  if (!$ilAccess->checkAccess("visible", "", $ref_id)) {
103  continue;
104  }
105 
106  // start object status
107  if ($this->start_object->isFullfilled($ilUser->getId(), $ref_id)) {
108  $accomplished = 'accomplished';
109  } else {
110  $accomplished = 'not_accomplished';
111  }
112 
113  // add/remove desktop
114  $actions = [];
115 
116  if (isset($continue_data[$ref_id])) {
117  $url = ilLink::_getLink($ref_id, '', [
118  'obj_id',
119  $continue_data[$ref_id]['lm_page_id']
120  ]);
121  $actions[$url] = $this->lng->txt('continue_work');
122  }
123 
124  if ($this->enable_desktop) {
125  // add to desktop link
126  if (!$this->fav_manager->ifIsFavourite($ilUser->getId(), $ref_id)) {
127  if ($ilAccess->checkAccess('read', '', $ref_id)) {
128  $this->ctrl->setParameter($this->parent_obj, 'item_ref_id', $ref_id);
129  $this->ctrl->setParameter($this->parent_obj, 'item_id', $ref_id);
130  $this->ctrl->setParameter($this->parent_obj, 'type', $type);
131  $url = $this->ctrl->getLinkTarget($this->parent_obj, 'addToDesk');
132  $actions[$url] = $this->lng->txt("rep_add_to_favourites");
133  }
134  } else {
135  $this->ctrl->setParameter($this->parent_obj, 'item_ref_id', $ref_id);
136  $this->ctrl->setParameter($this->parent_obj, 'item_id', $ref_id);
137  $this->ctrl->setParameter($this->parent_obj, 'type', $type);
138  $url = $this->ctrl->getLinkTarget($this->parent_obj, 'removeFromDesk');
139  $actions[$url] = $this->lng->txt("rep_remove_from_favourites");
140  }
141  }
142 
143  $default_params = null;
144  if ($type === "tst") {
145  $default_params["crs_show_result"] = $ref_id;
146  }
147  /* continue is currently inactive
148  if(isset($continue_data[$ref_id]))
149  {
150  // :TODO: should "continue" be default or 2nd link/action?
151  // $this->lng->txt('continue_work')
152  $default_params["obj_id"] = $continue_data[$ref_id]['lm_page_id'];
153  }
154  */
155 
156  if ($accomplished === 'accomplished') {
157  $icon = "assets/images/standard/icon_ok.svg";
158  } else {
159  $icon = "assets/images/standard/icon_not_ok.svg";
160  }
161 
162  $items[] = [
163  "nr" => ++$counter,
164  "obj_id" => $obj_id,
165  "ref_id" => $ref_id,
166  "type" => $type,
167  "append_default" => $default_params,
168  "title" => $ilObjDataCache->lookupTitle($obj_id),
169  "description" => $ilObjDataCache->lookupDescription($obj_id),
170  "status" => $this->lng->txt('crs_objective_' . $accomplished),
171  "status_img" => $icon,
172  "actions" => $actions
173  ];
174  }
175 
177  foreach ($items as $item) {
178  $preloader->addItem($item["obj_id"], $item["type"], $item["ref_id"]);
179  }
180  $preloader->preload();
181  unset($preloader);
182 
183  return $items;
184  }
$url
Definition: shib_logout.php:68
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$ref_id
Definition: ltiauth.php:65
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getItemAsSubPanel()

ILIAS\Container\StartObjects\Content\ObjectsContent::getItemAsSubPanel ( array  $item)
protected

Definition at line 261 of file ObjectsContent.php.

References $url, ILIAS\Container\StartObjects\Content\ObjectsContent\getListItem(), and ILIAS\Repository\lng().

Referenced by ILIAS\Container\StartObjects\Content\ObjectsContent\render().

261  : SubPanel
262  {
263  $status_icon = $this->ui_factory->symbol()->icon()->custom(
264  $item['status_img'],
265  $item['status']
266  );
267 
268  $actions = [];
269  foreach ($item['actions'] as $url => $caption) {
270  $actions[] = $this->ui_factory->button()->shy($caption, $url);
271  }
272 
273  $secondary_info = $this->ui_factory->listing()->property()->withItems([
274  [$this->lng->txt('crs_objective_accomplished'), $status_icon],
275  [$this->lng->txt('actions'), $this->ui_renderer->render($actions)]
276  ]);
277 
278  return $this->ui_factory->panel()->sub(
279  '',
280  $this->ui_factory->legacy()->content($this->getListItem($item))
281  )->withFurtherInformation(
282  $this->ui_factory->panel()->secondary()->legacy(
283  '',
284  $this->ui_factory->legacy()->content($this->ui_renderer->render($secondary_info))
285  )
286  );
287  }
$url
Definition: shib_logout.php:68
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getItemListGUI()

ILIAS\Container\StartObjects\Content\ObjectsContent::getItemListGUI ( string  $a_type)
protected

Definition at line 186 of file ObjectsContent.php.

References $location, ILIAS\Container\StartObjects\Content\ObjectsContent\$obj_definition, ilObjectDefinition\getClassName(), and null.

Referenced by ILIAS\Container\StartObjects\Content\ObjectsContent\getListItem().

186  : ?ilObjectListGUI
187  {
188  $objDefinition = $this->obj_definition;
189 
190  if (!isset($this->item_list_guis[$a_type])) {
191  $class = $objDefinition->getClassName($a_type);
192  // Fixed problem with deactivated plugins and existing repo. object plugin objects on the user's desktop
193  if (!$class) {
194  return null;
195  }
196  // Fixed problem with deactivated plugins and existing repo. object plugin objects on the user's desktop
197  $location = $objDefinition->getLocation($a_type);
198  if (!$location) {
199  return null;
200  }
201  $full_class = "ilObj" . $class . "ListGUI";
202  $item_list_gui = new $full_class();
203  $this->item_list_guis[$a_type] = $item_list_gui;
204  } else {
205  $item_list_gui = $this->item_list_guis[$a_type];
206  }
207 
208  $item_list_gui->setDefaultCommandParameters([]);
209 
210  return $item_list_gui;
211  }
$location
Definition: buildRTE.php:22
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getClassName(string $obj_name)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getListItem()

ILIAS\Container\StartObjects\Content\ObjectsContent::getListItem ( array  $a_item)
protected

Definition at line 214 of file ObjectsContent.php.

References ILIAS\Container\StartObjects\Content\ObjectsContent\getItemListGUI().

Referenced by ILIAS\Container\StartObjects\Content\ObjectsContent\getItemAsSubPanel().

214  : string
215  {
216  $item_list_gui = $this->getItemListGUI($a_item["type"]);
217  if (!$item_list_gui) {
218  return "";
219  }
220 
221  $item_list_gui->setContainerObject($this);
222  $item_list_gui->enableCommands(true, true);
223 
224  // ilObjectActivation::addListGUIActivationProperty($item_list_gui, $a_item);
225 
226  // notes, comment currently do not work properly
227  $item_list_gui->enableNotes(false);
228  $item_list_gui->enableComments(false);
229  $item_list_gui->enableTags(false);
230 
231  $item_list_gui->enableIcon(true);
232  $item_list_gui->enableDelete(false);
233  $item_list_gui->enableCut(false);
234  $item_list_gui->enableCopy(false);
235  $item_list_gui->enableLink(false);
236  $item_list_gui->enableInfoScreen(true);
237  $item_list_gui->enableSubscribe(false);
238 
239  $level = 3;
240 
241  if ($level < 3) {
242  $item_list_gui->enableDescription(false);
243  $item_list_gui->enableProperties(false);
244  $item_list_gui->enablePreconditions(false);
245  }
246 
247  if ($a_item["append_default"]) {
248  $item_list_gui->setDefaultCommandParameters($a_item["append_default"]);
249  }
250  if (is_object($item_list_gui)) {
251  return $item_list_gui->getListItemHTML(
252  $a_item["ref_id"],
253  $a_item["obj_id"],
254  $a_item["title"],
255  $a_item["description"]
256  );
257  }
258  return "";
259  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ render()

ILIAS\Container\StartObjects\Content\ObjectsContent::render ( )

Definition at line 289 of file ObjectsContent.php.

References $info, ILIAS\Container\StartObjects\Content\ObjectsContent\getData(), ILIAS\Container\StartObjects\Content\ObjectsContent\getItemAsSubPanel(), and ILIAS\Repository\lng().

289  : string
290  {
291  $info = $this->ui_factory->panel()->sub(
292  '',
293  $this->ui_factory->legacy()->content($this->lng->txt('crs_info_start'))
294  );
295  $items = [$info];
296  foreach ($this->getData() as $datum) {
297  $items[] = $this->getItemAsSubPanel($datum);
298  }
299 
300  $panel = $this->ui_factory->panel()->standard(
301  $this->lng->txt('crs_table_start_objects'),
302  $items
303  );
304  return $this->ui_renderer->render($panel);
305  }
$info
Definition: entry_point.php:21
+ Here is the call graph for this function:

Field Documentation

◆ $access

ilAccessHandler ILIAS\Container\StartObjects\Content\ObjectsContent::$access
protected

◆ $ctrl

ilCtrl ILIAS\Container\StartObjects\Content\ObjectsContent::$ctrl
protected

Definition at line 48 of file ObjectsContent.php.

◆ $enable_desktop

bool ILIAS\Container\StartObjects\Content\ObjectsContent::$enable_desktop
protected

Definition at line 54 of file ObjectsContent.php.

◆ $fav_manager

ilFavouritesManager ILIAS\Container\StartObjects\Content\ObjectsContent::$fav_manager
protected

Definition at line 55 of file ObjectsContent.php.

◆ $item_list_guis

array ILIAS\Container\StartObjects\Content\ObjectsContent::$item_list_guis
protected

Definition at line 53 of file ObjectsContent.php.

◆ $lng

ilLanguage ILIAS\Container\StartObjects\Content\ObjectsContent::$lng
protected

◆ $obj_data_cache

ilObjectDataCache ILIAS\Container\StartObjects\Content\ObjectsContent::$obj_data_cache
protected

◆ $obj_definition

ilObjectDefinition ILIAS\Container\StartObjects\Content\ObjectsContent::$obj_definition
protected

◆ $parent_obj

ilContainerGUI ILIAS\Container\StartObjects\Content\ObjectsContent::$parent_obj
protected

Definition at line 52 of file ObjectsContent.php.

◆ $start_object

ilContainerStartObjects ILIAS\Container\StartObjects\Content\ObjectsContent::$start_object
protected

Definition at line 51 of file ObjectsContent.php.

◆ $ui_factory

UIFactory ILIAS\Container\StartObjects\Content\ObjectsContent::$ui_factory
protected

◆ $ui_renderer

UIRenderer ILIAS\Container\StartObjects\Content\ObjectsContent::$ui_renderer
protected

◆ $user

ilObjUser ILIAS\Container\StartObjects\Content\ObjectsContent::$user
protected

The documentation for this class was generated from the following file: