34 protected \ILIAS\DI\UIServices
$ui;
47 $this->main_tpl =
$DIC->ui()->mainTemplate();
49 $this->
user = $DIC->user();
52 $this->objDefinition =
$DIC[
"objDefinition"];
53 $this->
ui = $DIC->ui();
54 $this->
lng = $DIC->language();
55 $this->
ctrl = $DIC->ctrl();
58 $this->
lng->loadLanguageModule(
"rep");
60 $request =
$DIC->repository()->internal()->gui()->standardRequest();
61 $this->requested_item_ref_id = $request->getItemRefId();
63 $this->recommendations = $this->rec_manager->getOpenRecommendationsOfUser($this->
user->getId());
73 switch ($next_class) {
75 if (in_array($cmd, [
"remove",
"makeFavourite"])) {
83 if (count($this->recommendations) === 0) {
86 return $this->
ui->renderer()->render(
87 $this->
ui->factory()->panel()->listing()->standard(
88 $this->lng->txt(
"rep_recommended_content"),
89 $this->getListItemGroups()
105 foreach ($this->recommendations as
$ref_id) {
107 if (!
$DIC->access()->checkAccess(
'visible',
'',
$ref_id)) {
110 $list_items[] = $this->getListItemForData(
$ref_id);
116 $item_groups[] =
$factory->item()->group(
"", $list_items);
121 protected function getListItemForData(
int $ref_id): ?
Item
123 $short_desc = $this->
settings->get(
"rep_shorten_description");
124 $short_desc_max_length = (
int) $this->
settings->get(
"rep_shorten_description_length");
131 if ($short_desc && $short_desc_max_length !== 0) {
139 "description" => $desc,
143 $item_gui = $this->byType(
$type);
148 $item_gui->addCustomCommand(
150 "dash_remove_from_list"
153 $item_gui->addCustomCommand(
155 "dash_make_favourite"
161 $list_item = $item_gui->getAsListItem(
178 if (!array_key_exists($a_type, self::$list_by_type)) {
179 $class = $this->objDefinition->getClassName($a_type);
181 throw new ilException(sprintf(
"Could not find a class for object type: %s", $a_type));
184 $location = $this->objDefinition->getLocation($a_type);
186 throw new ilException(sprintf(
"Could not find a class location for object type: %s", $a_type));
189 $full_class =
'ilObj' . $class .
'ListGUI';
190 $item_list_gui =
new $full_class();
192 $item_list_gui->setContainerObject($this);
193 $item_list_gui->enableNotes(
false);
194 $item_list_gui->enableComments(
false);
195 $item_list_gui->enableTags(
false);
197 $item_list_gui->enableIcon(
true);
198 $item_list_gui->enableDelete(
false);
199 $item_list_gui->enableCut(
false);
200 $item_list_gui->enableCopy(
false);
201 $item_list_gui->enableLink(
false);
202 $item_list_gui->enableInfoScreen(
true);
205 $item_list_gui->enableCommands(
true,
true);
207 self::$list_by_type[$a_type] = $item_list_gui;
210 return (clone self::$list_by_type[$a_type]);
213 protected function remove():
void
218 $this->main_tpl->setOnScreenMessage(
'success',
$lng->
txt(
"dash_item_removed"),
true);
226 $this->fav_manager->add($this->
user->getId(), $this->requested_item_ref_id);
227 $this->main_tpl->setOnScreenMessage(
'success',
$lng->
txt(
"dash_added_to_favs"),
true);
$location
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilCtrl provides processing control methods.
returnToParent(object $a_gui_obj, string $a_anchor=null)
@inheritDoc
getNextClass($a_gui_class=null)
@inheritDoc
setParameter(object $a_gui_obj, string $a_parameter, $a_value)
@inheritDoc
clearParameterByClass(string $a_class, string $a_parameter)
@inheritDoc
getCmd(string $fallback_command=null)
@inheritDoc
getLinkTarget(object $a_gui_obj, string $a_cmd=null, string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
@inheritDoc
Dashboard recommended content UI.
int $requested_item_ref_id
ilRecommendedContentManager $rec_manager
static array $list_by_type
ilFavouritesManager $fav_manager
ilObjectDefinition $objDefinition
ilGlobalTemplateInterface $main_tpl
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static addListGUIActivationProperty(ilObjectListGUI $list_gui, array &$item)
Get timing details for list gui.
parses the objects.xml it handles the xml-description of all ilias objects
static _lookupObjectId(int $ref_id)
static _lookupType(int $id, bool $reference=false)
static _lookupTitle(int $obj_id)
static _lookupDescription(int $obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static shortenTextExtended(string $a_str, int $a_len, bool $a_dots=false, bool $a_next_blank=false, bool $a_keep_extension=false)
Common interface to all items.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc