ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ilLPPersonalGUI Class Reference

@ilCtrl_IsCalledBy ilLPPersonalGUI: ilDashboardGUI More...

+ Collaboration diagram for ilLPPersonalGUI:

Public Member Functions

 __construct ()
 
 executeCommand ()
 

Protected Member Functions

 getCurrentPresentationModeFromQuery ()
 
 buildViewControls ()
 
 isPresentable (string $presentation_mode, ilDateTime|null $crs_start, ilDateTime|null $crs_end)
 
 listCourses ()
 
 hasReadAccess (int $obj_id)
 
 buildLinkToCourse (int $obj_id)
 

Protected Attributes

const PRESENTATION_OPTION_CURRENT = "current"
 
const PRESENTATION_OPTION_FUTURE = "future"
 
const PRESENTATION_OPTION_PAST = "past"
 
const PRESENTATION_OPTION_ALL = "all"
 
const URL_VAR_MODE = "viewcontrol_plp_mode"
 
const URL_VAR_ACTION_MODE = "mode"
 
const URL_NAMESPACE_PLP = "plp"
 
const URL_NAMESPACE_VIEWCONTROL = "viewcontrol"
 
const LNG_VAR_PRESENTATION_OPTION_CURRENT = "view_mode_current"
 
const LNG_VAR_PRESENTATION_OPTION_FUTURE = "view_mode_future"
 
const LNG_VAR_PRESENTATION_OPTION_PAST = "view_mode_past"
 
const LNG_VAR_PRESENTATION_OPTION_ALL = "view_mode_all"
 
const LNG_VAR_PROPERTY_CRS_START = "trac_begin_at"
 
const LNG_VAR_PROPERTY_CRS_END = "trac_end_at"
 
const LNG_VAR_PROPERTY_CRS_ONLINE = "online"
 
const LNG_VAR_PROPERTY_CRS_ONLINE_YES = "yes"
 
const LNG_VAR_PROPERTY_CRS_ONLINE_NO = "no"
 
const LNG_VAR_LISTING_TITLE = "courses"
 
HTTPServices $http
 
UIServices $ui
 
ilCtrl $ctrl
 
ilObjUser $user
 
ilLanguage $lng
 
RefineryFactory $refinery
 
DataFactory $data_factory
 
ilAccessHandler $access
 
StaticURL $static_url
 
ViewFactoryInterface $tracking_view
 

Detailed Description

@ilCtrl_IsCalledBy ilLPPersonalGUI: ilDashboardGUI

Definition at line 35 of file class.ilLPPersonalGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilLPPersonalGUI::__construct ( )

Definition at line 66 of file class.ilLPPersonalGUI.php.

67 {
68 global $DIC;
69
70 $this->ui = $DIC->ui();
71 $this->ctrl = $DIC->ctrl();
72 $this->user = $DIC->user();
73 $this->lng = $DIC->language();
74 $this->http = $DIC->http();
75 $this->refinery = $DIC->refinery();
76 $this->access = $DIC->access();
77 $this->data_factory = new DataFactory();
78 $this->static_url = $DIC['static_url'];
79 $this->tracking_view = new ViewFactory();
80 $this->lng->loadLanguageModule("trac");
81 }
static http()
Fetches the global http state from ILIAS.
global $DIC
Definition: shib_login.php:26

References $DIC, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), ILIAS\Repository\ui(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ buildLinkToCourse()

ilLPPersonalGUI::buildLinkToCourse ( int  $obj_id)
protected

Definition at line 249 of file class.ilLPPersonalGUI.php.

249 : ?URI
250 {
251 $ref_ids = ilObject::_getAllReferences($obj_id);
252 if (count($ref_ids) === 0) {
253 return null;
254 }
255 return $this->static_url->builder()->build(
256 'crs',
257 $this->data_factory->refId((int) current($ref_ids))
258 );
259 }
static _getAllReferences(int $id)
get all reference ids for object ID

References ilObject\_getAllReferences().

+ Here is the call graph for this function:

◆ buildViewControls()

ilLPPersonalGUI::buildViewControls ( )
protected

Definition at line 99 of file class.ilLPPersonalGUI.php.

99 : array
100 {
101 $current_presentation = $this->getCurrentPresentationModeFromQuery();
102 $presentation_options = [
103 self::PRESENTATION_OPTION_CURRENT => $this->lng->txt(self::LNG_VAR_PRESENTATION_OPTION_CURRENT),
104 self::PRESENTATION_OPTION_FUTURE => $this->lng->txt(self::LNG_VAR_PRESENTATION_OPTION_FUTURE),
105 self::PRESENTATION_OPTION_PAST => $this->lng->txt(self::LNG_VAR_PRESENTATION_OPTION_PAST),
106 self::PRESENTATION_OPTION_ALL => $this->lng->txt(self::LNG_VAR_PRESENTATION_OPTION_ALL),
107 ];
108 $uri = $this->http->request()->getUri()->__toString();
109 $url_builder = new URLBuilder($this->data_factory->uri($uri));
110 list($url_builder, $action_parameter_token) =
111 $url_builder->acquireParameters(
112 [self::URL_NAMESPACE_VIEWCONTROL, self::URL_NAMESPACE_PLP],
113 self::URL_VAR_ACTION_MODE
114 );
115 $modes = $this->ui->factory()->viewControl()->mode(
116 [
117 $presentation_options[self::PRESENTATION_OPTION_CURRENT] => (string) $url_builder->withParameter($action_parameter_token, self::PRESENTATION_OPTION_CURRENT)->buildURI(),
118 $presentation_options[self::PRESENTATION_OPTION_FUTURE] => (string) $url_builder->withParameter($action_parameter_token, self::PRESENTATION_OPTION_FUTURE)->buildURI(),
119 $presentation_options[self::PRESENTATION_OPTION_PAST] => (string) $url_builder->withParameter($action_parameter_token, self::PRESENTATION_OPTION_PAST)->buildURI(),
120 $presentation_options[self::PRESENTATION_OPTION_ALL] => (string) $url_builder->withParameter($action_parameter_token, self::PRESENTATION_OPTION_ALL)->buildURI(),
121 ],
122 'Presentation Mode'
123 )
124 ->withActive($presentation_options[$current_presentation]);
125 return [
126 $modes
127 ];
128 }

References getCurrentPresentationModeFromQuery(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), and ILIAS\Repository\ui().

+ Here is the call graph for this function:

◆ executeCommand()

ilLPPersonalGUI::executeCommand ( )

Definition at line 83 of file class.ilLPPersonalGUI.php.

83 : void
84 {
85 $this->listCourses();
86 }

References listCourses().

+ Here is the call graph for this function:

◆ getCurrentPresentationModeFromQuery()

ilLPPersonalGUI::getCurrentPresentationModeFromQuery ( )
protected

Definition at line 88 of file class.ilLPPersonalGUI.php.

88 : string
89 {
90 if ($this->http->wrapper()->query()->has(self::URL_VAR_MODE)) {
91 return $this->http->wrapper()->query()->retrieve(
92 self::URL_VAR_MODE,
93 $this->refinery->kindlyTo()->string()
94 );
95 }
97 }

References ILIAS\FileDelivery\http(), PRESENTATION_OPTION_CURRENT, and ILIAS\Repository\refinery().

Referenced by buildViewControls().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasReadAccess()

ilLPPersonalGUI::hasReadAccess ( int  $obj_id)
protected

Definition at line 239 of file class.ilLPPersonalGUI.php.

239 : bool
240 {
241 foreach (ilObject::_getAllReferences($obj_id) as $ref_id) {
242 if ($this->access->checkAccess("read", "", $ref_id)) {
243 return true;
244 }
245 }
246 return false;
247 }

References ilObject\_getAllReferences(), and ILIAS\Repository\access().

+ Here is the call graph for this function:

◆ isPresentable()

ilLPPersonalGUI::isPresentable ( string  $presentation_mode,
ilDateTime|null  $crs_start,
ilDateTime|null  $crs_end 
)
protected

Definition at line 188 of file class.ilLPPersonalGUI.php.

192 : bool {
193 $now = new ilDateTime(time(), IL_CAL_UNIX);
194 $crs_start = (is_null($crs_start) || $crs_start->isNull()) ? $now : $crs_start;
195 $crs_end = (is_null($crs_end) || $crs_end->isNull()) ? $now : $crs_end;
196 if ($presentation_mode === self::PRESENTATION_OPTION_ALL) {
197 return true;
198 }
199 // courses without end are never in the past
200 if (
201 $presentation_mode === self::PRESENTATION_OPTION_PAST &&
202 ilDateTime::_after($now, $crs_end)
203 ) {
204 return true;
205 }
206 // courses without start are never in the future
207 if (
208 $presentation_mode === self::PRESENTATION_OPTION_FUTURE &&
209 ilDateTime::_before($now, $crs_start)
210 ) {
211 return true;
212 }
213 // courses without start and end are always current
214 // courses without start or end are current if their end/start is not in the past/future
215 if (
216 $presentation_mode === self::PRESENTATION_OPTION_CURRENT &&
217 ilDateTime::_within($now, $crs_start, $crs_end)
218 ) {
219 return true;
220 }
221 return false;
222 }
const IL_CAL_UNIX
@classDescription Date and time handling
static _after(ilDateTime $start, ilDateTime $end, string $a_compare_field='', string $a_tz='')
compare two dates and check start is after end This method does not consider tz offsets.
static _within(ilDateTime $dt, ilDateTime $start, ilDateTime $end, string $a_compare_field='', string $a_tz='')
Check whether an date is within a date duration given by start and end.
static _before(ilDateTime $start, ilDateTime $end, string $a_compare_field='', string $a_tz='')
compare two dates and check start is before end This method does not consider tz offsets.

◆ listCourses()

ilLPPersonalGUI::listCourses ( )
protected

Definition at line 224 of file class.ilLPPersonalGUI.php.

224 : void
225 {
226 $view_controls = $this->buildViewControls();
227 $items = $this->buildPanelItems($this->getCurrentPresentationModeFromQuery());
228 $crs_item_group = $this->ui->factory()->item()->group("", $items);
229 $ui_panel = $this->ui->factory()->panel()->listing()->standard(
230 $this->lng->txt(self::LNG_VAR_LISTING_TITLE),
231 [
232 $crs_item_group
233 ]
234 )
235 ->withViewControls($view_controls);
236 $this->ui->mainTemplate()->setContent($this->ui->renderer()->render([$ui_panel]));
237 }

References ILIAS\Repository\lng(), and ILIAS\Repository\ui().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilLPPersonalGUI::$access
protected

Definition at line 62 of file class.ilLPPersonalGUI.php.

◆ $ctrl

ilCtrl ilLPPersonalGUI::$ctrl
protected

Definition at line 57 of file class.ilLPPersonalGUI.php.

◆ $data_factory

DataFactory ilLPPersonalGUI::$data_factory
protected

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

◆ $http

HTTPServices ilLPPersonalGUI::$http
protected

Definition at line 55 of file class.ilLPPersonalGUI.php.

◆ $lng

ilLanguage ilLPPersonalGUI::$lng
protected

Definition at line 59 of file class.ilLPPersonalGUI.php.

◆ $refinery

RefineryFactory ilLPPersonalGUI::$refinery
protected

Definition at line 60 of file class.ilLPPersonalGUI.php.

◆ $static_url

StaticURL ilLPPersonalGUI::$static_url
protected

Definition at line 63 of file class.ilLPPersonalGUI.php.

◆ $tracking_view

ViewFactoryInterface ilLPPersonalGUI::$tracking_view
protected

Definition at line 64 of file class.ilLPPersonalGUI.php.

◆ $ui

UIServices ilLPPersonalGUI::$ui
protected

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

◆ $user

ilObjUser ilLPPersonalGUI::$user
protected

Definition at line 58 of file class.ilLPPersonalGUI.php.

◆ LNG_VAR_LISTING_TITLE

const ilLPPersonalGUI::LNG_VAR_LISTING_TITLE = "courses"
protected

Definition at line 54 of file class.ilLPPersonalGUI.php.

◆ LNG_VAR_PRESENTATION_OPTION_ALL

const ilLPPersonalGUI::LNG_VAR_PRESENTATION_OPTION_ALL = "view_mode_all"
protected

Definition at line 48 of file class.ilLPPersonalGUI.php.

◆ LNG_VAR_PRESENTATION_OPTION_CURRENT

const ilLPPersonalGUI::LNG_VAR_PRESENTATION_OPTION_CURRENT = "view_mode_current"
protected

Definition at line 45 of file class.ilLPPersonalGUI.php.

◆ LNG_VAR_PRESENTATION_OPTION_FUTURE

const ilLPPersonalGUI::LNG_VAR_PRESENTATION_OPTION_FUTURE = "view_mode_future"
protected

Definition at line 46 of file class.ilLPPersonalGUI.php.

◆ LNG_VAR_PRESENTATION_OPTION_PAST

const ilLPPersonalGUI::LNG_VAR_PRESENTATION_OPTION_PAST = "view_mode_past"
protected

Definition at line 47 of file class.ilLPPersonalGUI.php.

◆ LNG_VAR_PROPERTY_CRS_END

const ilLPPersonalGUI::LNG_VAR_PROPERTY_CRS_END = "trac_end_at"
protected

Definition at line 50 of file class.ilLPPersonalGUI.php.

◆ LNG_VAR_PROPERTY_CRS_ONLINE

const ilLPPersonalGUI::LNG_VAR_PROPERTY_CRS_ONLINE = "online"
protected

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

◆ LNG_VAR_PROPERTY_CRS_ONLINE_NO

const ilLPPersonalGUI::LNG_VAR_PROPERTY_CRS_ONLINE_NO = "no"
protected

Definition at line 53 of file class.ilLPPersonalGUI.php.

◆ LNG_VAR_PROPERTY_CRS_ONLINE_YES

const ilLPPersonalGUI::LNG_VAR_PROPERTY_CRS_ONLINE_YES = "yes"
protected

Definition at line 52 of file class.ilLPPersonalGUI.php.

◆ LNG_VAR_PROPERTY_CRS_START

const ilLPPersonalGUI::LNG_VAR_PROPERTY_CRS_START = "trac_begin_at"
protected

Definition at line 49 of file class.ilLPPersonalGUI.php.

◆ PRESENTATION_OPTION_ALL

const ilLPPersonalGUI::PRESENTATION_OPTION_ALL = "all"
protected

Definition at line 40 of file class.ilLPPersonalGUI.php.

◆ PRESENTATION_OPTION_CURRENT

const ilLPPersonalGUI::PRESENTATION_OPTION_CURRENT = "current"
protected

Definition at line 37 of file class.ilLPPersonalGUI.php.

Referenced by getCurrentPresentationModeFromQuery().

◆ PRESENTATION_OPTION_FUTURE

const ilLPPersonalGUI::PRESENTATION_OPTION_FUTURE = "future"
protected

Definition at line 38 of file class.ilLPPersonalGUI.php.

◆ PRESENTATION_OPTION_PAST

const ilLPPersonalGUI::PRESENTATION_OPTION_PAST = "past"
protected

Definition at line 39 of file class.ilLPPersonalGUI.php.

◆ URL_NAMESPACE_PLP

const ilLPPersonalGUI::URL_NAMESPACE_PLP = "plp"
protected

Definition at line 43 of file class.ilLPPersonalGUI.php.

◆ URL_NAMESPACE_VIEWCONTROL

const ilLPPersonalGUI::URL_NAMESPACE_VIEWCONTROL = "viewcontrol"
protected

Definition at line 44 of file class.ilLPPersonalGUI.php.

◆ URL_VAR_ACTION_MODE

const ilLPPersonalGUI::URL_VAR_ACTION_MODE = "mode"
protected

Definition at line 42 of file class.ilLPPersonalGUI.php.

◆ URL_VAR_MODE

const ilLPPersonalGUI::URL_VAR_MODE = "viewcontrol_plp_mode"
protected

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


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