ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilDashboardRecommendedContentGUI Class Reference

Dashboard recommended content UI. More...

+ Collaboration diagram for ilDashboardRecommendedContentGUI:

Public Member Functions

 __construct ()
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 
 render ()
 Render. More...
 

Static Public Attributes

static $list_by_type = []
 

Protected Member Functions

 getListItemGroups ()
 Get items. More...
 
 remove ()
 Remove from list. More...
 
 makeFavourite ()
 Make favourite. More...
 

Protected Attributes

 $user
 
 $rec_manager
 
 $recommendations
 
 $ui
 
 $lng
 
 $ctrl
 
 $settings
 
 $fav_manager
 

Detailed Description

Dashboard recommended content UI.

Author
killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 10 of file class.ilDashboardRecommendedContentGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilDashboardRecommendedContentGUI::__construct ( )

Constructor.

Definition at line 61 of file class.ilDashboardRecommendedContentGUI.php.

References $_GET, $DIC, settings(), ui(), and user().

62  {
63  global $DIC;
64 
65  $this->user = $DIC->user();
66  $this->rec_manager = new ilRecommendedContentManager();
67  $this->fav_manager = new ilFavouritesManager();
68  $this->objDefinition = $DIC["objDefinition"];
69  $this->ui = $DIC->ui();
70  $this->lng = $DIC->language();
71  $this->ctrl = $DIC->ctrl();
72  $this->settings = $DIC->settings();
73 
74  $this->lng->loadLanguageModule("rep");
75 
76  $this->requested_item_ref_id = (int) $_GET["item_ref_id"];
77 
78  $this->recommendations = $this->rec_manager->getOpenRecommendationsOfUser($this->user->getId());
79  }
settings()
Definition: settings.php:2
$_GET["client_id"]
Manages favourites, currently the interface for other components, needs discussion.
user()
Definition: user.php:4
ui()
Definition: ui.php:5
$DIC
Definition: xapitoken.php:46
Recommended content manager (business logic)
+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilDashboardRecommendedContentGUI::executeCommand ( )

Execute command.

Definition at line 84 of file class.ilDashboardRecommendedContentGUI.php.

References $ctrl.

85  {
87 
88  $next_class = $ctrl->getNextClass($this);
89  $cmd = $ctrl->getCmd();
90 
91  switch ($next_class) {
92  default:
93  if (in_array($cmd, array("remove", "makeFavourite"))) {
94  $this->$cmd();
95  }
96  }
97  }

◆ getListItemGroups()

ilDashboardRecommendedContentGUI::getListItemGroups ( )
protected

Get items.

Returns
[]

Definition at line 122 of file class.ilDashboardRecommendedContentGUI.php.

References $a_type, $ctrl, $DIC, Vendor\Package\$e, $factory, $location, $type, ilObject\_lookupDescription(), ilObject\_lookupObjectId(), ilObject\_lookupTitle(), ilObject\_lookupType(), ilObjectActivation\addListGUIActivationProperty(), settings(), and ilUtil\shortenText().

Referenced by render().

122  : array
123  {
124  global $DIC;
125  $factory = $DIC->ui()->factory();
126 
127  $item_groups = [];
128  $list_items = [];
129 
130  foreach ($this->recommendations as $ref_id) {
131  try {
132  if (!$DIC->access()->checkAccess('visible', '', $ref_id)) {
133  continue;
134  }
135  $list_items[] = $this->getListItemForData($ref_id);
136  } catch (ilException $e) {
137  continue;
138  }
139  }
140 
141  $item_groups[] = $factory->item()->group("", $list_items);
142 
143  return $item_groups;
144  }
$DIC
Definition: xapitoken.php:46
$factory
Definition: metadata.php:58
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ makeFavourite()

ilDashboardRecommendedContentGUI::makeFavourite ( )
protected

Make favourite.

Definition at line 260 of file class.ilDashboardRecommendedContentGUI.php.

References $ctrl, $lng, and user().

261  {
262  $ctrl = $this->ctrl;
263  $lng = $this->lng;
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);
267  }
user()
Definition: user.php:4
+ Here is the call graph for this function:

◆ remove()

ilDashboardRecommendedContentGUI::remove ( )
protected

Remove from list.

Definition at line 247 of file class.ilDashboardRecommendedContentGUI.php.

References $ctrl, $lng, and user().

248  {
249  $ctrl = $this->ctrl;
250  $lng = $this->lng;
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);
254  }
user()
Definition: user.php:4
+ Here is the call graph for this function:

◆ render()

ilDashboardRecommendedContentGUI::render ( )

Render.

Returns
string

Definition at line 104 of file class.ilDashboardRecommendedContentGUI.php.

References getListItemGroups(), and ui().

105  {
106  if (count($this->recommendations) == 0) {
107  return "";
108  }
109  return $this->ui->renderer()->render(
110  $this->ui->factory()->panel()->listing()->standard(
111  $this->lng->txt("rep_recommended_content"),
112  $this->getListItemGroups()
113  )
114  );
115  }
ui()
Definition: ui.php:5
+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilDashboardRecommendedContentGUI::$ctrl
protected

◆ $fav_manager

ilDashboardRecommendedContentGUI::$fav_manager
protected

Definition at line 56 of file class.ilDashboardRecommendedContentGUI.php.

◆ $list_by_type

ilDashboardRecommendedContentGUI::$list_by_type = []
static

Definition at line 30 of file class.ilDashboardRecommendedContentGUI.php.

◆ $lng

ilDashboardRecommendedContentGUI::$lng
protected

Definition at line 41 of file class.ilDashboardRecommendedContentGUI.php.

Referenced by makeFavourite(), and remove().

◆ $rec_manager

ilDashboardRecommendedContentGUI::$rec_manager
protected

Definition at line 20 of file class.ilDashboardRecommendedContentGUI.php.

◆ $recommendations

ilDashboardRecommendedContentGUI::$recommendations
protected

Definition at line 25 of file class.ilDashboardRecommendedContentGUI.php.

◆ $settings

ilDashboardRecommendedContentGUI::$settings
protected

Definition at line 51 of file class.ilDashboardRecommendedContentGUI.php.

◆ $ui

ilDashboardRecommendedContentGUI::$ui
protected

Definition at line 36 of file class.ilDashboardRecommendedContentGUI.php.

◆ $user

ilDashboardRecommendedContentGUI::$user
protected

Definition at line 15 of file class.ilDashboardRecommendedContentGUI.php.


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