ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ilContainerSessionsContentGUI Class Reference

Shows all items in one block. More...

+ Inheritance diagram for ilContainerSessionsContentGUI:
+ Collaboration diagram for ilContainerSessionsContentGUI:

Public Member Functions

 __construct ($container_gui_obj)
 Constructor. More...
 
 getDetailsLevel ($a_session_id)
 get details level More...
 
 getMainContent ()
 Get content HTML for main column. More...
 
 __showMaterials ($a_tpl)
 Show Materials. More...
 
 addFooterRow ($tpl)
 add footer row More...
 
- Public Member Functions inherited from ilContainerContentGUI
 __construct (&$container_gui_obj)
 Constructor. More...
 
 getContainerObject ()
 Get container object. More...
 
 getContainerGUI ()
 Get container GUI object. More...
 
 setOutput ()
 Sets view output into column layout. More...
 
 getMainContent ()
 Get content HTML for main column, this one must be overwritten in derived classes. More...
 
 determinePageEmbeddedBlocks ($a_container_page_html)
 Determine all blocks that are embedded in the container page. More...
 
 addEmbeddedBlock ($block_type, $block_parameter)
 Add embedded block. More...
 
 getEmbeddedBlocks ()
 Get page embedded blocks. More...
 
 renderPageEmbeddedBlocks ()
 Render Page Embedded Blocks. More...
 
 renderItem ($a_item_data, $a_position=0, $a_force_icon=false, $a_pos_prefix="")
 Render an item. More...
 
 renderCard ($a_item_data, $a_position=0, $a_force_icon=false, $a_pos_prefix="")
 Render card. More...
 
 insertPageEmbeddedBlocks ($a_output_html)
 Insert blocks into container page. More...
 
 getSingleTypeBlockAsynch ($type)
 Render single block. More...
 
 getGroupedObjTypes ()
 Get grouped repository object types. More...
 
 getIntroduction ()
 Get introduction. More...
 
 getItemGroupsHTML ($a_pos=0)
 Get item groups HTML. More...
 
 renderItemGroup ($a_itgr)
 Render item group. More...
 

Static Public Member Functions

static prepareSessionPresentationLimitation (array $items, ilContainer $container, bool $admin_panel_enabled=false, bool $include_side_block=false)
 

Protected Member Functions

 renderSessionLimitLink ($a_previous=true)
 Show link to show/hide all previous/next sessions. More...
 
 initDetails ()
 init details More...
 
- Protected Member Functions inherited from ilContainerContentGUI
 getViewMode ()
 Get view mode. More...
 
 getDetailsLevel ($a_item_id)
 get details level More...
 
 getRightColumnHTML ()
 Get HTML for right column. More...
 
 getCenterColumnHTML ()
 Get HTML for center column. More...
 
 initRenderer ()
 Init container renderer. More...
 
 clearAdminCommandsDetermination ()
 cleaer administration commands determination More...
 
 determineAdminCommands ($a_ref_id, $a_admin_com_included_in_list=false)
 determin admin commands More...
 
 getItemGUI ($item_data, $a_show_path=false)
 Get ListGUI object for item. More...
 
 hasForcedOrderByStartDate (string $type)
 

Protected Attributes

 $tabs
 
 $force_details = array()
 
- Protected Attributes inherited from ilContainerContentGUI
 $tpl
 
 $ctrl
 
 $user
 
 $lng
 
 $access
 
 $plugin_admin
 
 $db
 
 $rbacsystem
 
 $settings
 
 $obj_definition
 
 $details_level = self::DETAILS_DEACTIVATED
 
 $renderer
 
 $log
 
 $view_mode
 

Additional Inherited Members

- Data Fields inherited from ilContainerContentGUI
const DETAILS_DEACTIVATED = 0
 
const DETAILS_TITLE = 1
 
const DETAILS_ALL = 2
 
const VIEW_MODE_LIST = 0
 
const VIEW_MODE_TILE = 1
 
 $container_gui
 
 $container_obj
 

Detailed Description

Shows all items in one block.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 33 of file class.ilContainerSessionsContentGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilContainerSessionsContentGUI::__construct (   $container_gui_obj)

Constructor.

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

References $DIC, ilContainerContentGUI\$lng, ILIAS\GlobalScreen\Provider\__construct(), initDetails(), and user().

47  {
48  global $DIC;
49 
50  $this->tabs = $DIC->tabs();
51  $this->user = $DIC->user();
52  $this->ctrl = $DIC->ctrl();
53  $lng = $DIC->language();
54 
55  parent::__construct($container_gui_obj);
56  $this->lng = $lng;
57  $this->initDetails();
58  }
user()
Definition: user.php:4
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ __showMaterials()

ilContainerSessionsContentGUI::__showMaterials (   $a_tpl)

Show Materials.

Definition at line 113 of file class.ilContainerSessionsContentGUI.php.

References ilContainerContentGUI\$lng, ilContainerContentGUI\clearAdminCommandsDetermination(), ilContainerContentGUI\getContainerGUI(), ilContainerContentGUI\getContainerObject(), ilContainerContentGUI\getItemGroupsHTML(), ilContainerContentGUI\initRenderer(), ilContainerContentGUI\insertPageEmbeddedBlocks(), ilContainerContentGUI\renderItem(), renderSessionLimitLink(), and ilUtil\sortArray().

Referenced by getMainContent().

114  {
115  $lng = $this->lng;
116 
117  $this->items = $this->getContainerObject()->getSubItems($this->getContainerGUI()->isActiveAdministrationPanel());
119 
120  $this->initRenderer();
121 
122  $output_html = $this->getContainerGUI()->getContainerPageHTML();
123 
124  // get embedded blocks
125  if ($output_html != "") {
126  $output_html = $this->insertPageEmbeddedBlocks($output_html);
127  }
128 
129  $prefix = $postfix = '';
130  if (is_array($this->items["sess"]) ||
131  $this->items['sess_link']['prev']['value'] ||
132  $this->items['sess_link']['next']['value']) {
133  $this->items['sess'] = ilUtil::sortArray($this->items['sess'], 'start', 'asc', true, false);
134 
135  if ($this->items['sess_link']['prev']['value']) {
136  $prefix = $this->renderSessionLimitLink(true);
137  }
138  if ($this->items['sess_link']['next']['value']) {
139  $postfix = $this->renderSessionLimitLink(false);
140  }
141 
142  $this->renderer->addTypeBlock("sess", $prefix, $postfix);
143  $this->renderer->setBlockPosition("sess", 1);
144 
145  $position = 1;
146  foreach ($this->items["sess"] as $item_data) {
147  if (!$this->renderer->hasItem($item_data["child"])) {
148  $html = $this->renderItem($item_data, $position++, true);
149  if ($html != "") {
150  $this->renderer->addItemToBlock("sess", $item_data["type"], $item_data["child"], $html);
151  }
152  }
153  }
154  #22328 render session block if previous or next session link is available
155  if (
156  !count($this->items['sess'] ?? []) &&
157  ($prefix !== '' || $postfix !== '')
158  ) {
159  $this->renderer->addItemToBlock('sess', '', 0, ' ');
160  }
161  }
162  $pos = $this->getItemGroupsHTML(1);
163  if (is_array($this->items["_all"])) {
164  $this->renderer->addCustomBlock("_all", $lng->txt("content"));
165  $this->renderer->setBlockPosition("_all", ++$pos);
166 
167  $position = 1;
168 
169  foreach ($this->items["_all"] as $item_data) {
170  // #14599
171  if ($item_data["type"] == "sess" || $item_data["type"] == "itgr") {
172  continue;
173  }
174 
175  if (!$this->renderer->hasItem($item_data["child"])) {
176  $html = $this->renderItem($item_data, $position++, true);
177  if ($html != "") {
178  $this->renderer->addItemToBlock("_all", $item_data["type"], $item_data["child"], $html);
179  }
180  }
181  }
182  }
183 
184  $output_html .= $this->renderer->getHTML();
185 
186  $a_tpl->setVariable("CONTAINER_PAGE_CONTENT", $output_html);
187  }
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
getItemGroupsHTML($a_pos=0)
Get item groups HTML.
initRenderer()
Init container renderer.
insertPageEmbeddedBlocks($a_output_html)
Insert blocks into container page.
renderSessionLimitLink($a_previous=true)
Show link to show/hide all previous/next sessions.
getContainerGUI()
Get container GUI object.
getContainerObject()
Get container object.
renderItem($a_item_data, $a_position=0, $a_force_icon=false, $a_pos_prefix="")
Render an item.
clearAdminCommandsDetermination()
cleaer administration commands determination
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addFooterRow()

ilContainerSessionsContentGUI::addFooterRow (   $tpl)

add footer row

public

Parameters

Definition at line 248 of file class.ilContainerSessionsContentGUI.php.

References $_GET, ilContainerContentGUI\$ctrl, and ilContainerContentGUI\$tpl.

249  {
250  $ilCtrl = $this->ctrl;
251 
252  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
253 
254  $tpl->setCurrentBlock('container_details_row');
255  $tpl->setVariable('TXT_DETAILS', $this->lng->txt('details'));
256  $tpl->parseCurrentBlock();
257  }
$_GET["client_id"]

◆ getDetailsLevel()

ilContainerSessionsContentGUI::getDetailsLevel (   $a_session_id)

get details level

public

Parameters
int$a_session_id
Returns
int DEATAILS_LEVEL

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

References $_SESSION, and ilContainerContentGUI\getContainerGUI().

69  {
70  if ($this->getContainerGUI()->isActiveAdministrationPanel()) {
71  return self::DETAILS_DEACTIVATED;
72  }
73  if (isset($_SESSION['sess']['expanded'][$a_session_id])) {
74  return $_SESSION['sess']['expanded'][$a_session_id];
75  }
76  if (in_array($a_session_id, $this->force_details)) {
77  return self::DETAILS_ALL;
78  } else {
79  return self::DETAILS_TITLE;
80  }
81  }
$_SESSION["AccountId"]
getContainerGUI()
Get container GUI object.
+ Here is the call graph for this function:

◆ getMainContent()

ilContainerSessionsContentGUI::getMainContent ( )

Get content HTML for main column.

Definition at line 87 of file class.ilContainerSessionsContentGUI.php.

References ilContainerContentGUI\$lng, $tabs, ilContainerContentGUI\$tpl, and __showMaterials().

88  {
89  $lng = $this->lng;
90  $ilTabs = $this->tabs;
91 
92  // see bug #7452
93  // $ilTabs->setSubTabActive($this->getContainerObject()->getType().'_content');
94 
95 
96  include_once 'Services/Object/classes/class.ilObjectListGUIFactory.php';
97 
98  $tpl = new ilTemplate(
99  "tpl.container_page.html",
100  true,
101  true,
102  "Services/Container"
103  );
104 
105  $this->__showMaterials($tpl);
106 
107  return $tpl->get();
108  }
+ Here is the call graph for this function:

◆ initDetails()

ilContainerSessionsContentGUI::initDetails ( )
protected

init details

protected

Parameters

Definition at line 266 of file class.ilContainerSessionsContentGUI.php.

References $_GET, $_SESSION, $ilUser, $session, ilContainerContentGUI\$user, ilContainerContentGUI\getContainerObject(), ilSessionAppointment\lookupLastSessionByCourse(), and ilSessionAppointment\lookupNextSessionByCourse().

Referenced by __construct().

267  {
269 
270  if ($_GET['expand']) {
271  if ($_GET['expand'] > 0) {
272  $_SESSION['sess']['expanded'][abs((int) $_GET['expand'])] = self::DETAILS_ALL;
273  } else {
274  $_SESSION['sess']['expanded'][abs((int) $_GET['expand'])] = self::DETAILS_TITLE;
275  }
276  }
277 
278  include_once('./Modules/Session/classes/class.ilSessionAppointment.php');
280  $this->force_details = $session;
282  $this->force_details = array($session);
283  }
284  }
$_SESSION["AccountId"]
$_GET["client_id"]
$session
getContainerObject()
Get container object.
static lookupLastSessionByCourse($a_ref_id)
public
$ilUser
Definition: imgupload.php:18
static lookupNextSessionByCourse($a_ref_id)
public
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ prepareSessionPresentationLimitation()

static ilContainerSessionsContentGUI::prepareSessionPresentationLimitation ( array  $items,
ilContainer  $container,
bool  $admin_panel_enabled = false,
bool  $include_side_block = false 
)
static
Parameters
array$items
ilContainer$container
Returns
array

Definition at line 291 of file class.ilContainerSessionsContentGUI.php.

References $_GET, ilContainerContentGUI\$access, $DIC, ilContainerContentGUI\$user, ilDateTime\_after(), ilDateTime\_before(), ilContainerSorting\_getInstance(), ilDateTime\_within(), ilObject\getId(), ilObjectFactory\getInstanceByRefId(), ilObject\getRefId(), ilContainer\getViewMode(), IL_CAL_DATE, IL_CAL_DAY, IL_CAL_UNIX, ilUtil\sortArray(), ilContainer\VIEW_INHERIT, and ilContainer\VIEW_SESSIONS.

Referenced by ilObjCourse\getSubItems(), and ilObjGroup\getSubItems().

296  : array {
297  global $DIC;
298 
299  $user = $DIC->user();
300  $access = $DIC->access();
301  $tree = $DIC->repositoryTree();
302 
303  $limit_sessions = false;
304  if (
305  !$admin_panel_enabled &&
306  !$include_side_block &&
307  $items['sess'] &&
308  is_array($items['sess']) &&
309  (($container->getViewMode() == ilContainer::VIEW_SESSIONS) || ($container->getViewMode() == ilContainer::VIEW_INHERIT)) &&
310  $container->isSessionLimitEnabled()
311  ) {
312  $limit_sessions = true;
313  }
314 
315  if ($container->getViewMode() == ilContainer::VIEW_INHERIT) {
316  $parent = $tree->checkForParentType($container->getRefId(), 'crs');
317  $crs = ilObjectFactory::getInstanceByRefId($parent, false);
318  if (!$crs instanceof ilObjCourse) {
319  return $items;
320  }
321 
322  if (!$container->isSessionLimitEnabled()) {
323  $limit_sessions = false;
324  }
325  $limit_next = $crs->getNumberOfNextSessions();
326  $limit_prev = $crs->getNumberOfPreviousSessions();
327  } else {
328  $limit_next = $container->getNumberOfNextSessions();
329  $limit_prev = $container->getNumberOfPreviousSessions();
330  }
331 
332  if (!$limit_sessions) {
333  return $items;
334  }
335 
336 
337 
338  // do session limit
339  if (isset($_GET['crs_prev_sess'])) {
340  $user->writePref('crs_sess_show_prev_' . $container->getId(), (string) (int) $_GET['crs_prev_sess']);
341  }
342  if (isset($_GET['crs_next_sess'])) {
343  $user->writePref('crs_sess_show_next_' . $container->getId(), (string) (int) $_GET['crs_next_sess']);
344  }
345 
346  $session_rbac_checked = [];
347  foreach ($items['sess'] as $session_tree_info) {
348  if ($access->checkAccess('visible', '', $session_tree_info['ref_id'])) {
349  $session_rbac_checked[] = $session_tree_info;
350  }
351  }
352  $sessions = ilUtil::sortArray($session_rbac_checked, 'start', 'ASC', true, false);
353  //$sessions = ilUtil::sortArray($this->items['sess'],'start','ASC',true,false);
354  $today = new ilDate(date('Ymd', time()), IL_CAL_DATE);
355  $previous = $current = $next = array();
356  foreach ($sessions as $key => $item) {
357  $start = new ilDateTime($item['start'], IL_CAL_UNIX);
358  $end = new ilDateTime($item['end'], IL_CAL_UNIX);
359 
360  if (ilDateTime::_within($today, $start, $end, IL_CAL_DAY)) {
361  $current[] = $item;
362  } elseif (ilDateTime::_before($start, $today, IL_CAL_DAY)) {
363  $previous[] = $item;
364  } elseif (ilDateTime::_after($start, $today, IL_CAL_DAY)) {
365  $next[] = $item;
366  }
367  }
368  $num_previous_remove = max(
369  count($previous) - $limit_prev,
370  0
371  );
372  while ($num_previous_remove--) {
373  if (!$user->getPref('crs_sess_show_prev_' . $container->getId())) {
374  array_shift($previous);
375  }
376  $items['sess_link']['prev']['value'] = 1;
377  }
378 
379  $num_next_remove = max(
380  count($next) - $limit_next,
381  0
382  );
383  while ($num_next_remove--) {
384  if (!$user->getPref('crs_sess_show_next_' . $container->getId())) {
385  array_pop($next);
386  }
387  // @fixme
388  $items['sess_link']['next']['value'] = 1;
389  }
390 
391  $sessions = array_merge($previous, $current, $next);
392  $items['sess'] = $sessions;
393 
394  // #15389 - see ilContainer::getSubItems()
395  $sort = ilContainerSorting::_getInstance($container->getId());
396  $items[(int) $admin_panel_enabled][(int) $include_side_block] = $sort->sortItems($items);
397  return $items;
398  }
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
$_GET["client_id"]
static _after(ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
compare two dates and check start is after end This method does not consider tz offsets.
static _before(ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
compare two dates and check start is before end This method does not consider tz offsets.
getViewMode()
Get container view mode.
const IL_CAL_UNIX
const IL_CAL_DAY
Class for single dates.
getId()
get object id public
global $DIC
Definition: goto.php:24
const IL_CAL_DATE
getRefId()
get reference id public
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
static _getInstance($a_obj_id)
get instance by obj_id
static _within(ilDateTime $dt, ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
Check whether an date is within a date duration given by start and end.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderSessionLimitLink()

ilContainerSessionsContentGUI::renderSessionLimitLink (   $a_previous = true)
protected

Show link to show/hide all previous/next sessions.

Returns
string

Definition at line 193 of file class.ilContainerSessionsContentGUI.php.

References ilContainerContentGUI\$ctrl, $ilUser, ilContainerContentGUI\$lng, ilContainerContentGUI\$tpl, ilContainerContentGUI\$user, ilContainerContentGUI\getContainerGUI(), and ilContainerContentGUI\getContainerObject().

Referenced by __showMaterials().

194  {
195  $lng = $this->lng;
197  $ilCtrl = $this->ctrl;
198 
199  $lng->loadLanguageModule('crs');
200 
201  $tpl = new ilTemplate(
202  'tpl.container_list_item.html',
203  true,
204  true,
205  "Services/Container"
206  );
207  $tpl->setVariable('DIV_CLASS', 'ilContainerListItemOuter');
208  $tpl->setCurrentBlock('item_title_linked');
209 
210  if ($a_previous) {
211  $prefp = $ilUser->getPref('crs_sess_show_prev_' . $this->getContainerObject()->getId());
212 
213  if ($prefp) {
214  $tpl->setVariable('TXT_TITLE_LINKED', $lng->txt('crs_link_hide_prev_sessions'));
215  $ilCtrl->setParameterByClass(get_class($this->getContainerGUI()), 'crs_prev_sess', (int) !$prefp);
216  $tpl->setVariable('HREF_TITLE_LINKED', $ilCtrl->getLinkTargetByClass(get_class($this->getContainerGUI()), 'view'));
217  } else {
218  $tpl->setVariable('TXT_TITLE_LINKED', $lng->txt('crs_link_show_all_prev_sessions'));
219  $ilCtrl->setParameterByClass(get_class($this->getContainerGUI()), 'crs_prev_sess', (int) !$prefp);
220  $tpl->setVariable('HREF_TITLE_LINKED', $ilCtrl->getLinkTargetByClass(get_class($this->getContainerGUI()), 'view'));
221  }
222  $ilCtrl->clearParametersByClass(get_class($this->getContainerGUI()));
223  } else {
224  $prefn = $ilUser->getPref('crs_sess_show_next_' . $this->getContainerObject()->getId());
225 
226  if ($prefn) {
227  $tpl->setVariable('TXT_TITLE_LINKED', $lng->txt('crs_link_hide_next_sessions'));
228  } else {
229  $tpl->setVariable('TXT_TITLE_LINKED', $lng->txt('crs_link_show_all_next_sessions'));
230  }
231  $ilCtrl->setParameterByClass(get_class($this->getContainerGUI()), 'crs_next_sess', (int) !$prefn);
232  $tpl->setVariable('HREF_TITLE_LINKED', $ilCtrl->getLinkTargetByClass(get_class($this->getContainerGUI()), 'view'));
233  $ilCtrl->clearParametersByClass(get_class($this->getContainerGUI()));
234  }
235  $tpl->parseCurrentBlock();
236 
237  return $tpl->get();
238  }
getContainerGUI()
Get container GUI object.
getContainerObject()
Get container object.
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $force_details

ilContainerSessionsContentGUI::$force_details = array()
protected

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

◆ $tabs

ilContainerSessionsContentGUI::$tabs
protected

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

Referenced by getMainContent().


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