ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 37 of file class.ilLPPersonalGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilLPPersonalGUI::__construct ( )

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

69 {
70 global $DIC;
71
72 $this->ui = $DIC->ui();
73 $this->ctrl = $DIC->ctrl();
74 $this->user = $DIC->user();
75 $this->lng = $DIC->language();
76 $this->http = $DIC->http();
77 $this->refinery = $DIC->refinery();
78 $this->access = $DIC->access();
79 $this->data_factory = new DataFactory();
80 $this->static_url = $DIC['static_url'];
81 $this->tracking_view = new ViewFactory();
82 $this->lng->loadLanguageModule("trac");
83 }
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 251 of file class.ilLPPersonalGUI.php.

251 : ?URI
252 {
253 $ref_ids = ilObject::_getAllReferences($obj_id);
254 if (count($ref_ids) === 0) {
255 return null;
256 }
257 return $this->static_url->builder()->build(
258 'crs',
259 $this->data_factory->refId((int) current($ref_ids))
260 );
261 }
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 101 of file class.ilLPPersonalGUI.php.

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

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 85 of file class.ilLPPersonalGUI.php.

85 : void
86 {
87 $this->listCourses();
88 }

References listCourses().

+ Here is the call graph for this function:

◆ getCurrentPresentationModeFromQuery()

ilLPPersonalGUI::getCurrentPresentationModeFromQuery ( )
protected

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

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

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 241 of file class.ilLPPersonalGUI.php.

241 : bool
242 {
243 foreach (ilObject::_getAllReferences($obj_id) as $ref_id) {
244 if ($this->access->checkAccess("read", "", $ref_id)) {
245 return true;
246 }
247 }
248 return false;
249 }
$ref_id
Definition: ltiauth.php:66

References $ref_id, 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 190 of file class.ilLPPersonalGUI.php.

194 : bool {
195 $now = new ilDateTime(time(), IL_CAL_UNIX);
196 $crs_start = (is_null($crs_start) || $crs_start->isNull()) ? $now : $crs_start;
197 $crs_end = (is_null($crs_end) || $crs_end->isNull()) ? $now : $crs_end;
198 if ($presentation_mode === self::PRESENTATION_OPTION_ALL) {
199 return true;
200 }
201 // courses without end are never in the past
202 if (
203 $presentation_mode === self::PRESENTATION_OPTION_PAST &&
204 ilDateTime::_after($now, $crs_end)
205 ) {
206 return true;
207 }
208 // courses without start are never in the future
209 if (
210 $presentation_mode === self::PRESENTATION_OPTION_FUTURE &&
211 ilDateTime::_before($now, $crs_start)
212 ) {
213 return true;
214 }
215 // courses without start and end are always current
216 // courses without start or end are current if their end/start is not in the past/future
217 if (
218 $presentation_mode === self::PRESENTATION_OPTION_CURRENT &&
219 ilDateTime::_within($now, $crs_start, $crs_end)
220 ) {
221 return true;
222 }
223 return false;
224 }
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 226 of file class.ilLPPersonalGUI.php.

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

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 64 of file class.ilLPPersonalGUI.php.

◆ $ctrl

ilCtrl ilLPPersonalGUI::$ctrl
protected

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

◆ $data_factory

DataFactory ilLPPersonalGUI::$data_factory
protected

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

◆ $http

HTTPServices ilLPPersonalGUI::$http
protected

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

◆ $lng

ilLanguage ilLPPersonalGUI::$lng
protected

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

◆ $refinery

RefineryFactory ilLPPersonalGUI::$refinery
protected

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

◆ $static_url

StaticURL ilLPPersonalGUI::$static_url
protected

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

◆ $tracking_view

ViewFactoryInterface ilLPPersonalGUI::$tracking_view
protected

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

◆ $ui

UIServices ilLPPersonalGUI::$ui
protected

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

◆ $user

ilObjUser ilLPPersonalGUI::$user
protected

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

◆ LNG_VAR_LISTING_TITLE

const ilLPPersonalGUI::LNG_VAR_LISTING_TITLE = "courses"
protected

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

◆ LNG_VAR_PRESENTATION_OPTION_ALL

const ilLPPersonalGUI::LNG_VAR_PRESENTATION_OPTION_ALL = "view_mode_all"
protected

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

◆ LNG_VAR_PRESENTATION_OPTION_CURRENT

const ilLPPersonalGUI::LNG_VAR_PRESENTATION_OPTION_CURRENT = "view_mode_current"
protected

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

◆ LNG_VAR_PRESENTATION_OPTION_FUTURE

const ilLPPersonalGUI::LNG_VAR_PRESENTATION_OPTION_FUTURE = "view_mode_future"
protected

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

◆ LNG_VAR_PRESENTATION_OPTION_PAST

const ilLPPersonalGUI::LNG_VAR_PRESENTATION_OPTION_PAST = "view_mode_past"
protected

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

◆ LNG_VAR_PROPERTY_CRS_END

const ilLPPersonalGUI::LNG_VAR_PROPERTY_CRS_END = "trac_end_at"
protected

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

◆ LNG_VAR_PROPERTY_CRS_ONLINE

const ilLPPersonalGUI::LNG_VAR_PROPERTY_CRS_ONLINE = "online"
protected

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

◆ LNG_VAR_PROPERTY_CRS_ONLINE_NO

const ilLPPersonalGUI::LNG_VAR_PROPERTY_CRS_ONLINE_NO = "no"
protected

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

◆ LNG_VAR_PROPERTY_CRS_ONLINE_YES

const ilLPPersonalGUI::LNG_VAR_PROPERTY_CRS_ONLINE_YES = "yes"
protected

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

◆ LNG_VAR_PROPERTY_CRS_START

const ilLPPersonalGUI::LNG_VAR_PROPERTY_CRS_START = "trac_begin_at"
protected

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

◆ PRESENTATION_OPTION_ALL

const ilLPPersonalGUI::PRESENTATION_OPTION_ALL = "all"
protected

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

◆ PRESENTATION_OPTION_CURRENT

const ilLPPersonalGUI::PRESENTATION_OPTION_CURRENT = "current"
protected

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

Referenced by getCurrentPresentationModeFromQuery().

◆ PRESENTATION_OPTION_FUTURE

const ilLPPersonalGUI::PRESENTATION_OPTION_FUTURE = "future"
protected

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

◆ PRESENTATION_OPTION_PAST

const ilLPPersonalGUI::PRESENTATION_OPTION_PAST = "past"
protected

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

◆ URL_NAMESPACE_PLP

const ilLPPersonalGUI::URL_NAMESPACE_PLP = "plp"
protected

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

◆ URL_NAMESPACE_VIEWCONTROL

const ilLPPersonalGUI::URL_NAMESPACE_VIEWCONTROL = "viewcontrol"
protected

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

◆ URL_VAR_ACTION_MODE

const ilLPPersonalGUI::URL_VAR_ACTION_MODE = "mode"
protected

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

◆ URL_VAR_MODE

const ilLPPersonalGUI::URL_VAR_MODE = "viewcontrol_plp_mode"
protected

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


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