19 declare(strict_types=0);
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();
78 $this->
access = $DIC->access();
80 $this->static_url = $DIC[
'static_url'];
81 $this->tracking_view =
new ViewFactory();
82 $this->
lng->loadLanguageModule(
"trac");
92 if ($this->
http->wrapper()->query()->has(self::URL_VAR_MODE)) {
93 return $this->
http->wrapper()->query()->retrieve(
95 $this->
refinery->kindlyTo()->string()
98 return self::PRESENTATION_OPTION_CURRENT;
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),
110 $uri = $this->
http->request()->getUri()->__toString();
111 $url_builder =
new URLBuilder($this->data_factory->uri($uri));
112 list($url_builder, $action_parameter_token) =
114 [self::URL_NAMESPACE_VIEWCONTROL, self::URL_NAMESPACE_PLP],
115 self::URL_VAR_ACTION_MODE
117 $modes = $this->
ui->factory()->viewControl()->mode(
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(),
126 ->withActive($presentation_options[$current_presentation]);
135 protected function buildPanelItems(
136 string $presentation_mode
140 $filter = $this->tracking_view->dataRetrieval()->filter()
141 ->withUserIds($this->
user->getId())
142 ->withObjectIds(...$ids)
143 ->withOnlyDataOfObjectWithLPEnabled(
false);
144 $view_info = $this->tracking_view->dataRetrieval()->service()->retrieveViewInfo($filter);
146 foreach ($view_info->combinedInfoIterator() as $combinedInfo) {
147 $obj_id = $combinedInfo->getObjectInfo()->getObjectId();
148 $ids_with_lp[] = $obj_id;
153 !$this->
isPresentable($presentation_mode, $crs->getCourseStart(), $crs->getCourseEnd())
157 $offline_str = $crs->getOfflineStatus()
158 ? $this->
lng->txt(self::LNG_VAR_PROPERTY_CRS_ONLINE_NO)
159 : $this->
lng->txt(self::LNG_VAR_PROPERTY_CRS_ONLINE_YES);
160 $property_builder = $this->tracking_view->propertyList()->builder();
161 if (!is_null($crs->getCourseStart())) {
163 $property_builder = $property_builder
164 ->withProperty($this->
lng->txt(self::LNG_VAR_PROPERTY_CRS_START), $crs_start);
166 if (!is_null($crs->getCourseEnd())) {
168 $property_builder = $property_builder
169 ->withProperty($this->
lng->txt(self::LNG_VAR_PROPERTY_CRS_END), $crs_end);
171 $property_builder = $property_builder
172 ->withProperty($this->
lng->txt(self::LNG_VAR_PROPERTY_CRS_ONLINE), $offline_str);
173 $item = $this->tracking_view->renderer()->service()->standardItem(
174 $combinedInfo->getObjectInfo(),
175 $property_builder->getList(),
182 $progress_chart = $this->tracking_view->renderer()->service()->standardProgressMeter($combinedInfo->getLPInfo());
183 $item = $item->withProgress($progress_chart);
185 $items[$obj_id] = $item;
191 string $presentation_mode,
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) {
203 $presentation_mode === self::PRESENTATION_OPTION_PAST &&
210 $presentation_mode === self::PRESENTATION_OPTION_FUTURE &&
218 $presentation_mode === self::PRESENTATION_OPTION_CURRENT &&
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),
237 ->withViewControls($view_controls);
238 $this->
ui->mainTemplate()->setContent($this->
ui->renderer()->render([$ui_panel]));
244 if ($this->
access->checkAccess(
"read",
"", $ref_id)) {
254 if (count($ref_ids) === 0) {
257 return $this->static_url->builder()->build(
259 $this->data_factory->refId((
int) current($ref_ids))
const LNG_VAR_PRESENTATION_OPTION_CURRENT
const LNG_VAR_PROPERTY_CRS_ONLINE_NO
const LNG_VAR_PROPERTY_CRS_END
const LNG_VAR_PROPERTY_CRS_START
const LNG_VAR_PRESENTATION_OPTION_FUTURE
buildLinkToCourse(int $obj_id)
const LNG_VAR_LISTING_TITLE
const LNG_VAR_PRESENTATION_OPTION_ALL
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.
static _getAllReferences(int $id)
get all reference ids for object ID
acquireParameters(array $namespace, string ... $names)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const PRESENTATION_OPTION_CURRENT
const LNG_VAR_PROPERTY_CRS_ONLINE_YES
isPresentable(string $presentation_mode, ilDateTime|null $crs_start, ilDateTime|null $crs_end)
const PRESENTATION_OPTION_PAST
RefineryFactory $refinery
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
Provides fluid interface to RBAC services.
static http()
Fetches the global http state from ILIAS.
ViewFactoryInterface $tracking_view
const LNG_VAR_PRESENTATION_OPTION_PAST
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.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const PRESENTATION_OPTION_FUTURE
const PRESENTATION_OPTION_ALL
const URL_NAMESPACE_VIEWCONTROL
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
const URL_VAR_ACTION_MODE
const LP_MODE_DEACTIVATED
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
const LNG_VAR_PROPERTY_CRS_ONLINE
static _getMembershipByType(int $a_usr_id, array $a_type, bool $a_only_member_role=false)
get membership by type Get course or group membership
getCurrentPresentationModeFromQuery()
DataFactory $data_factory
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.
hasReadAccess(int $obj_id)