ILIAS  trunk Revision v12.0_alpha-1329-g1094ddb0c33
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.

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 }
Manages favourites, currently the interface for other components, needs discussion.
global $DIC
Definition: shib_login.php:26

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().

+ 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.

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 $this->lng->loadLanguageModule('dash');
126 // add to desktop link
127 if (!$this->fav_manager->ifIsFavourite($ilUser->getId(), $ref_id)) {
128 if ($ilAccess->checkAccess('read', '', $ref_id)) {
129 $this->ctrl->setParameter($this->parent_obj, 'item_ref_id', $ref_id);
130 $this->ctrl->setParameter($this->parent_obj, 'item_id', $ref_id);
131 $this->ctrl->setParameter($this->parent_obj, 'type', $type);
132 $url = $this->ctrl->getLinkTarget($this->parent_obj, 'addToDesk');
133 $actions[$url] = $this->lng->txt("add_to_favourites");
134 }
135 } else {
136 $this->ctrl->setParameter($this->parent_obj, 'item_ref_id', $ref_id);
137 $this->ctrl->setParameter($this->parent_obj, 'item_id', $ref_id);
138 $this->ctrl->setParameter($this->parent_obj, 'type', $type);
139 $url = $this->ctrl->getLinkTarget($this->parent_obj, 'removeFromDesk');
140 $actions[$url] = $this->lng->txt("remove_from_favourites");
141 }
142 }
143
144 $default_params = null;
145 if ($type === "tst") {
146 $default_params["crs_show_result"] = $ref_id;
147 }
148 /* continue is currently inactive
149 if(isset($continue_data[$ref_id]))
150 {
151 // :TODO: should "continue" be default or 2nd link/action?
152 // $this->lng->txt('continue_work')
153 $default_params["obj_id"] = $continue_data[$ref_id]['lm_page_id'];
154 }
155 */
156
157 if ($accomplished === 'accomplished') {
158 $icon = "assets/images/standard/icon_ok.svg";
159 } else {
160 $icon = "assets/images/standard/icon_not_ok.svg";
161 }
162
163 $items[] = [
164 "nr" => ++$counter,
165 "obj_id" => $obj_id,
166 "ref_id" => $ref_id,
167 "type" => $type,
168 "append_default" => $default_params,
169 "title" => $ilObjDataCache->lookupTitle($obj_id),
170 "description" => $ilObjDataCache->lookupDescription($obj_id),
171 "status" => $this->lng->txt('crs_objective_' . $accomplished),
172 "status_img" => $icon,
173 "actions" => $actions
174 ];
175 }
176
178 foreach ($items as $item) {
179 $preloader->addItem($item["obj_id"], $item["type"], $item["ref_id"]);
180 }
181 $preloader->preload();
182 unset($preloader);
183
184 return $items;
185 }
class ilCourseLMHistory
Preloader for object list GUIs.
$ref_id
Definition: ltiauth.php:66
$url
Definition: shib_logout.php:70
$counter

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

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

+ 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 262 of file ObjectsContent.php.

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

References $url, and ILIAS\Repository\lng().

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

+ 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 187 of file ObjectsContent.php.

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

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

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

+ 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 215 of file ObjectsContent.php.

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

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

+ Here is the call graph for this function:

◆ render()

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

Definition at line 290 of file ObjectsContent.php.

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

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

+ 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: