33 parent::initRenderer();
34 $this->
renderer->setBlockPostfixClosure(
function (
string $type) {
37 $this->
renderer->setBlockPrefixClosure(
function (
string $type) {
40 $this->
renderer->setItemHiddenClosure(
function (
string $type,
int $ref_id) {
47 if ($type ===
"sess") {
49 if ($this->session_link_next) {
58 if ($type ===
"sess") {
60 if ($this->session_link_prev) {
70 return $this->
renderer->renderItemBlockSequence($this->item_presentation->getItemBlockSequence());
74 bool $a_previous =
true
83 'tpl.container_list_item.html',
86 "components/ILIAS/Container"
96 $ilCtrl->setParameterByClass(get_class($this->
getContainerGUI()),
'crs_prev_sess', (
int) !$prefp);
100 $ilCtrl->setParameterByClass(get_class($this->
getContainerGUI()),
'crs_prev_sess', (
int) !$prefp);
112 $ilCtrl->setParameterByClass(get_class($this->
getContainerGUI()),
'crs_next_sess', (
int) !$prefn);
125 if ($this->session_limitation_initialised) {
128 $this->session_limitation_initialised =
true;
134 $mode_manager =
$DIC->container()->internal()->domain()->content()->mode(
$container);
135 $session_ref_ids = $this->item_presentation->getRefIdsOfType(
"sess");
138 if (!in_array(
$container->getType(), [
"grp",
"crs"])) {
139 $this->visible_sessions = $session_ref_ids;
143 $user =
$DIC->user();
144 $access =
$DIC->access();
145 $tree =
$DIC->repositoryTree();
146 $request =
$DIC->container()
151 $limit_sessions =
false;
152 if (!$mode_manager->isAdminMode() &&
153 count($session_ref_ids) > 0 &&
155 $limit_sessions =
true;
159 $parent = $tree->checkForParentType(
$container->getRefId(),
'crs');
166 $limit_sessions =
false;
168 $limit_next = $crs->getNumberOfNextSessions();
169 $limit_prev = $crs->getNumberOfPreviousSessions();
171 $limit_next =
$container->getNumberOfNextSessions();
172 $limit_prev =
$container->getNumberOfPreviousSessions();
175 if (!$limit_sessions) {
176 $this->visible_sessions = $session_ref_ids;
181 if ($request->getPreviousSession() !==
null) {
184 (
string) $request->getPreviousSession()
187 if ($request->getNextSession() !==
null) {
190 (
string) $request->getNextSession()
194 $sessions = array_map(
function (
$ref_id) {
195 return $this->item_presentation->getRawDataByRefId(
$ref_id);
196 }, $session_ref_ids);
200 $previous = $current = $next = [];
201 foreach ($sessions as $key => $item) {
214 $num_previous_remove = max(
215 count($previous) - $limit_prev,
218 while ($num_previous_remove--) {
219 if (!$user->getPref(
'crs_sess_show_prev_' .
$container->getId())) {
220 array_shift($previous);
222 $this->session_link_prev =
true;
225 $num_next_remove = max(
226 count($next) - $limit_next,
229 while ($num_next_remove--) {
230 if (!$user->getPref(
'crs_sess_show_next_' .
$container->getId())) {
234 $this->session_link_next =
true;
237 $sessions = array_merge($previous, $current, $next);
238 $this->visible_sessions = array_map(
static function ($item) {
239 return (
int) $item[
"ref_id"];
245 if ($type ===
"sess") {
246 $this->initSessionPresentationLimitation();
247 return !in_array(
$ref_id, $this->visible_sessions,
true);
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)
Parent class of all container content GUIs.
ilGlobalTemplateInterface $tpl
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
bool $session_limitation_initialised
getBlockPrefix(string $type)
getBlockPostfix(string $type)
isItemHidden(string $type, int $ref_id)
initRenderer()
Init container renderer.
renderSessionLimitLink(bool $a_previous=true)
initSessionPresentationLimitation()
@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.
loadLanguageModule(string $a_module)
Load language module.
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...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
special template class to simplify handling of ITX/PEAR
setVariable(string $variable, $value='')
Sets the given variable to the given value.
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.