65 $this->
user = $DIC->user();
68 $this->objDefinition = $DIC[
"objDefinition"];
69 $this->
ui = $DIC->ui();
70 $this->lng = $DIC->language();
71 $this->ctrl = $DIC->ctrl();
74 $this->lng->loadLanguageModule(
"rep");
76 $this->requested_item_ref_id = (int)
$_GET[
"item_ref_id"];
78 $this->recommendations = $this->rec_manager->getOpenRecommendationsOfUser($this->
user->getId());
88 $next_class =
$ctrl->getNextClass($this);
89 $cmd =
$ctrl->getCmd();
91 switch ($next_class) {
93 if (in_array($cmd, array(
"remove",
"makeFavourite"))) {
106 if (count($this->recommendations) == 0) {
109 return $this->
ui->renderer()->render(
110 $this->
ui->factory()->panel()->listing()->standard(
111 $this->lng->txt(
"rep_recommended_content"),
130 foreach ($this->recommendations as $ref_id) {
132 if (!$DIC->access()->checkAccess(
'visible',
'', $ref_id)) {
135 $list_items[] = $this->getListItemForData($ref_id);
141 $item_groups[] =
$factory->item()->group(
"", $list_items);
152 $short_desc = $this->
settings->get(
"rep_shorten_description");
153 $short_desc_max_length = $this->
settings->get(
"rep_shorten_description_length");
160 if ($short_desc && $short_desc_max_length) {
168 "description" => $desc,
172 $item_gui = $this->byType(
$type);
175 $ctrl->setParameter($this,
"item_ref_id", $ref_id);
177 $item_gui->addCustomCommand(
178 $ctrl->getLinkTarget($this,
"remove"),
179 "dash_remove_from_list" 182 $item_gui->addCustomCommand(
183 $ctrl->getLinkTarget($this,
"makeFavourite"),
184 "dash_make_favourite" 187 $ctrl->clearParameterByClass(self::class,
"item_ref_id");
190 $list_item = $item_gui->getAsListItem(
206 public function byType($a_type)
209 if (!array_key_exists($a_type, self::$list_by_type)) {
210 $class = $this->objDefinition->getClassName($a_type);
212 throw new ilException(sprintf(
"Could not find a class for object type: %s", $a_type));
215 $location = $this->objDefinition->getLocation($a_type);
217 throw new ilException(sprintf(
"Could not find a class location for object type: %s", $a_type));
220 $full_class =
'ilObj' . $class .
'ListGUI';
221 $item_list_gui =
new $full_class();
223 $item_list_gui->setContainerObject($this);
224 $item_list_gui->enableNotes(
false);
225 $item_list_gui->enableComments(
false);
226 $item_list_gui->enableTags(
false);
228 $item_list_gui->enableIcon(
true);
229 $item_list_gui->enableDelete(
false);
230 $item_list_gui->enableCut(
false);
231 $item_list_gui->enableCopy(
false);
232 $item_list_gui->enableLink(
false);
233 $item_list_gui->enableInfoScreen(
true);
236 $item_list_gui->enableCommands(
true,
true);
238 self::$list_by_type[$a_type] = $item_list_gui;
241 return (clone self::$list_by_type[$a_type]);
247 protected function remove()
251 $this->rec_manager->declineObjectRecommendation($this->
user->getId(), $this->requested_item_ref_id);
252 ilUtil::sendSuccess(
$lng->txt(
"dash_item_removed"),
true);
253 $ctrl->returnToParent($this);
264 $this->fav_manager->add($this->
user->getId(), $this->requested_item_ref_id);
265 ilUtil::sendSuccess(
$lng->txt(
"dash_added_to_favs"),
true);
266 $ctrl->returnToParent($this);
__construct()
Constructor.
static shortenText( $a_str, $a_len, $a_dots=false, $a_next_blank=false, $a_keep_extension=false)
shorten a string to given length.
static _lookupTitle($a_id)
lookup object title
Manages favourites, currently the interface for other components, needs discussion.
executeCommand()
Execute command.
static _lookupObjectId($a_ref_id)
lookup object id
static _lookupDescription($a_id)
lookup object description
Common interface to all items.
static addListGUIActivationProperty(ilObjectListGUI $a_list_gui, array &$a_item)
Get timing details for list gui.
static _lookupType($a_id, $a_reference=false)
lookup object type
Dashboard recommended content UI.
getListItemGroups()
Get items.
makeFavourite()
Make favourite.
Recommended content manager (business logic)