ILIAS  trunk Revision v11.0_alpha-1749-g1a06bdef097
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilBlockGUI Class Reference

This class represents a block method of a block. More...

+ Inheritance diagram for ilBlockGUI:
+ Collaboration diagram for ilBlockGUI:

Public Member Functions

 __construct ()
 
 getBlockType ()
 
 setData (array $a_data)
 
 getData ()
 
 setPresentation (int $type)
 
 getPresentation ()
 
 setBlockId (string $a_block_id="0")
 
 getBlockId ()
 
 setGuiObject (object $a_gui_object)
 Set GuiObject. More...
 
 getGuiObject ()
 
 setTitle (string $a_title)
 
 getTitle ()
 
 setOffset (int $a_offset)
 
 getOffset ()
 
 checkOffset (int $offset)
 
 setLimit (int $a_limit)
 
 getLimit ()
 
 setEnableEdit (bool $a_enableedit)
 
 getEnableEdit ()
 
 setRepositoryMode (bool $a_repositorymode)
 
 getRepositoryMode ()
 
 setSubtitle (string $a_subtitle)
 
 getSubtitle ()
 
 setRefId (int $a_refid)
 Set Ref Id (only used if isRepositoryObject() is true). More...
 
 getRefId ()
 
 setAdminCommands (bool $a_admincommands)
 
 getAdminCommands ()
 
 setEnableNumInfo (bool $a_enablenuminfo)
 
 getEnableNumInfo ()
 
 setProperties (array $a_properties)
 This function is supposed to be used for block type specific properties, that should be inherited through ilColumnGUI->setBlockProperties. More...
 
 getProperty (string $a_property)
 
 setProperty (string $a_property, string $a_value)
 
 setRowTemplate (string $a_rowtemplatename, string $a_rowtemplatedir="")
 Set Row Template Name. More...
 
 getNavParameter ()
 
 getConfigParameter ()
 
 getMoveParameter ()
 
 getRowTemplateName ()
 
 getRowTemplateDir ()
 
 addBlockCommand (string $a_href, string $a_text, string $a_onclick="", ?RoundTrip $modal=null)
 
 getBlockCommands ()
 
 getHTML ()
 
 getAsynch ()
 Use this for final get before sending asynchronous output (ajax) per echo to output. More...
 
 getPaginationViewControl ()
 Fill previous/next row. More...
 
 getViewControlsForPanel ()
 
 sortObject ()
 
 addSortOption (string $option, string $label, bool $active)
 
 setSortTarget (string $target)
 
 addPresentation (string $label, string $target, bool $active)
 
 getNoItemFoundContent ()
 

Static Public Member Functions

static getScreenMode ()
 

Data Fields

const PRES_MAIN_LEG = 0
 
const PRES_SEC_LEG = 1
 
const PRES_SEC_LIST = 2
 
const PRES_MAIN_LIST = 3
 
const PRES_MAIN_TILE = 4
 

Protected Member Functions

 isRepositoryObject ()
 Returns whether block has a corresponding repository object. More...
 
 specialCharsAsEntities (string $string)
 
 initCommands ()
 
 preloadData (array $data)
 Can be overwritten in subclasses. More...
 
 getLegacyContent ()
 Get legacy content. More...
 
 getListItemForData (array $data)
 Get list item for data array. More...
 
 handleNavigation ()
 Handle navigation. More...
 
 loadData ()
 Load data for current page. More...
 
 getListItemGroups ()
 Get items. More...
 
 addRepoCommands ()
 Add repo commands. More...
 
 getActionsForPanel ()
 
 send (string $output)
 Send. More...
 

Protected Attributes

ILIAS UI Renderer $renderer
 
Factory $factory
 
object $gui_object
 
ILIAS Block StandardGUIRequest $request
 
ILIAS Block BlockManager $block_manager
 
bool $repositorymode = false
 
ILIAS DI UIServices $ui
 
array $data = array()
 
bool $enablenuminfo = true
 
array $footer_links = array()
 
string $block_id = "0"
 
bool $allow_moving = true
 
array $move = array("left" => false, "right" => false, "up" => false, "down" => false)
 
array $block_commands = array()
 
int $max_count = 0
 
bool $close_command = false
 
bool $image = false
 
array $property = []
 
string $nav_value = ""
 
string $css_row = ""
 
string $title = ""
 
bool $admincommands = false
 
array $dropdown
 
ilTemplate $tpl
 
ilGlobalTemplateInterface $main_tpl
 
ilObjUser $user
 
ilCtrl $ctrl
 
ilAccessHandler $access
 
ilLanguage $lng
 
ilObjectDefinition $obj_def
 
int $presentation
 
int $requested_ref_id
 

Private Attributes

int $offset = 0
 
int $limit
 
bool $enableedit
 
string $subtitle
 
int $refid
 
string $rowtemplatename
 
string $rowtemplatedir
 
array $modals = []
 
array $sort_options = []
 
array $presentations = []
 
string $activePresentation = ''
 
string $activeSortOption = ''
 
string $sort_target = ''
 
ILIAS HTTP GlobalHttpState $http
 

Detailed Description

This class represents a block method of a block.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

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

Constructor & Destructor Documentation

◆ __construct()

ilBlockGUI::__construct ( )

Definition at line 97 of file class.ilBlockGUI.php.

References $DIC, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), factory(), getBlockType(), ILIAS\FileDelivery\http(), isRepositoryObject(), ILIAS\Repository\lng(), renderer(), setLimit(), ILIAS\Repository\ui(), and ILIAS\Repository\user().

Referenced by ilPDNewsBlockGUI\__construct().

98  {
99  global $DIC;
100  $this->factory = $DIC->ui()->factory();
101  $this->renderer = $DIC->ui()->renderer();
102 
103  $this->http = $DIC->http();
104  $block_service = new ILIAS\Block\Service($DIC);
105  $this->block_manager = $block_service->internal()
106  ->domain()
107  ->block();
108  $this->request = $block_service->internal()
109  ->gui()
110  ->standardRequest();
111 
112 
113  // default presentation
114  $this->presentation = self::PRES_SEC_LEG;
115 
116  $this->user = $DIC->user();
117  $this->ctrl = $DIC->ctrl();
118  $this->access = $DIC->access();
119  $this->lng = $DIC->language();
120  $this->main_tpl = $DIC["tpl"];
121  $this->obj_def = $DIC["objDefinition"];
122  $this->ui = $DIC->ui();
123 
124  $this->main_tpl->addJavaScript("./assets/js/ilblockcallback.js");
125 
126  $this->setLimit(25);
127 
128  $this->requested_ref_id = $this->request->getRefId();
129  }
setLimit(int $a_limit)
factory()
renderer()
static http()
Fetches the global http state from ILIAS.
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Function Documentation

◆ addBlockCommand()

ilBlockGUI::addBlockCommand ( string  $a_href,
string  $a_text,
string  $a_onclick = "",
?RoundTrip  $modal = null 
)

Definition at line 352 of file class.ilBlockGUI.php.

Referenced by ilCalendarSelectionBlockGUI\__construct(), ilDashboardBlockGUI\addCommandActions(), addRepoCommands(), ilWikiImportantPagesBlockGUI\getHTML(), ilPollBlockGUI\getHTML(), ilPDNewsBlockGUI\getHTML(), ilNewsForContextBlockGUI\getHTML(), ilCalendarBlockGUI\getHTML(), and ilCalendarBlockGUI\initCommands().

352  : void
353  {
354  $this->block_commands[] = [
355  "href" => $a_href,
356  "text" => $a_text,
357  "onclick" => $a_onclick,
358  "modal" => $modal
359  ];
360  }
+ Here is the caller graph for this function:

◆ addPresentation()

ilBlockGUI::addPresentation ( string  $label,
string  $target,
bool  $active 
)

Definition at line 789 of file class.ilBlockGUI.php.

Referenced by ilDashboardBlockGUI\addCommandActions().

789  : void
790  {
791  $this->presentations[$label] = $target;
792  if ($active) {
793  $this->activePresentation = $label;
794  }
795  }
+ Here is the caller graph for this function:

◆ addRepoCommands()

ilBlockGUI::addRepoCommands ( )
protected

Add repo commands.

Definition at line 638 of file class.ilBlockGUI.php.

References $access, $ctrl, $lng, $obj_def, ilObject\_lookupType(), addBlockCommand(), ilRBACAccessHandler\checkAccess(), ILIAS\Repository\ctrl(), ilObjectDefinition\getClassName(), ilCtrl\getLinkTargetByClass(), getRefId(), getRepositoryMode(), isRepositoryObject(), ilCtrl\setParameterByClass(), and ilLanguage\txt().

Referenced by getHTML().

638  : void
639  {
641  $lng = $this->lng;
642  $ctrl = $this->ctrl;
644 
645  if ($this->getRepositoryMode() && $this->isRepositoryObject()) {
646  // #10993
647  // @todo: fix this in new presentation somehow
648  /*
649  if ($this->getAdminCommands()) {
650  $this->tpl->setCurrentBlock("block_check");
651  $this->tpl->setVariable("BL_REF_ID", $this->getRefId());
652  $this->tpl->parseCurrentBlock();
653  }*/
654 
655  $parent_type = ilObject::_lookupType($this->requested_ref_id, true);
656  $parent_gui = "ilObj" . $obj_def->getClassName($parent_type) . "GUI";
657 
658  if ($access->checkAccess("delete", "", $this->getRefId())) {
659  $this->ctrl->setParameterByClass($parent_gui, 'ref_id', $this->requested_ref_id);
660  $this->ctrl->setParameterByClass($parent_gui, 'item_ref_id', $this->getRefId());
661 
662  $this->addBlockCommand(
663  $this->ctrl->getLinkTargetByClass($parent_gui, 'delete'),
664  $lng->txt("delete")
665  );
666 
667  $this->addBlockCommand(
668  $this->ctrl->getLinkTargetByClass($parent_gui, 'link'),
669  $lng->txt("link")
670  );
671 
672  // see ilObjectListGUI::insertCutCommand();
673  $this->addBlockCommand(
674  $this->ctrl->getLinkTargetByClass($parent_gui, 'cut'),
675  $lng->txt("move")
676  );
677 
678  $this->ctrl->clearParameterByClass($parent_gui, 'ref_id');
679  $this->ctrl->clearParameterByClass($parent_gui, 'item_ref_id');
680  }
681 
682  // #14595 - see ilObjectListGUI::insertCopyCommand()
683  if ($access->checkAccess("copy", "", $this->getRefId())) {
684  $ctrl->setParameterByClass("ilobjectcopygui", "source_id", $this->getRefId());
685  $copy_cmd = $ctrl->getLinkTargetByClass(
686  array("ilrepositorygui", $parent_gui, "ilobjectcopygui"),
687  "initTargetSelection"
688  );
689 
690  // see ilObjectListGUI::insertCopyCommand();
691  $this->addBlockCommand(
692  $copy_cmd,
693  $lng->txt("copy")
694  );
695  }
696  }
697  }
ilObjectDefinition $obj_def
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...
ilLanguage $lng
checkAccess(string $a_permission, string $a_cmd, int $a_ref_id, string $a_type="", ?int $a_obj_id=null, ?int $a_tree_id=null)
check access for an object (provide $a_type and $a_obj_id if available for better performance) ...
setParameterByClass(string $a_class, string $a_parameter, $a_value)
getClassName(string $obj_name)
isRepositoryObject()
Returns whether block has a corresponding repository object.
addBlockCommand(string $a_href, string $a_text, string $a_onclick="", ?RoundTrip $modal=null)
ilAccessHandler $access
static _lookupType(int $id, bool $reference=false)
getLinkTargetByClass( $a_class, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addSortOption()

ilBlockGUI::addSortOption ( string  $option,
string  $label,
bool  $active 
)

Definition at line 776 of file class.ilBlockGUI.php.

Referenced by ilDashboardBlockGUI\addCommandActions().

776  : void
777  {
778  if ($active) {
779  $this->activeSortOption = $option;
780  }
781  $this->sort_options[$option] = $label;
782  }
+ Here is the caller graph for this function:

◆ checkOffset()

ilBlockGUI::checkOffset ( int  $offset)

Definition at line 219 of file class.ilBlockGUI.php.

Referenced by setOffset().

219  : bool
220  {
221  return $offset <= $this->max_count && $offset >= 0;
222  }
+ Here is the caller graph for this function:

◆ getActionsForPanel()

ilBlockGUI::getActionsForPanel ( )
protected

Definition at line 699 of file class.ilBlockGUI.php.

References $id, factory(), getBlockCommands(), getBlockType(), getTitle(), ILIAS\Repository\lng(), null, and specialCharsAsEntities().

Referenced by getHTML().

699  : ?Dropdown
700  {
701  // actions
702  $actions = [];
703  $modals = [];
704 
705  foreach ($this->getBlockCommands() as $command) {
706  $href = ($command['onclick'] !== '')
707  ? ''
708  : $command['href'];
709  $button = $this->factory->button()->shy($command['text'], $href);
710  if ($command['onclick']) {
711  $button = $button->withOnLoadCode(function ($id) use ($command) {
712  return
713  "$(\"#$id\").click(function() { ilBlockJSHandler('" . "block_" . $this->getBlockType() . "_" . $this->block_id .
714  "','" . $command["onclick"] . "');});";
715  });
716  }
717 
718  if (isset($command['modal']) && $command['modal'] instanceof Modal) {
719  $button = $button->withOnClick($command['modal']->getShowSignal());
720  $this->modals[] = $command['modal'];
721  }
722  $actions[] = $button;
723  }
724 
725  if (count($actions) > 0) {
726  $actions = $this->factory->dropdown()->standard($actions)
727  ->withAriaLabel(sprintf(
728  $this->lng->txt('actions_for'),
729  $this->specialCharsAsEntities($this->getTitle())
730  ));
731  return $actions;
732  }
733  return null;
734  }
This describes commonalities between the different modals.
Definition: Modal.php:34
factory()
specialCharsAsEntities(string $string)
This describes commonalities between all types of Dropdowns.
Definition: Dropdown.php:34
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAdminCommands()

ilBlockGUI::getAdminCommands ( )

Definition at line 282 of file class.ilBlockGUI.php.

References $admincommands.

Referenced by ilPollBlockGUI\fillRow().

282  : bool
283  {
284  return $this->admincommands;
285  }
+ Here is the caller graph for this function:

◆ getAsynch()

ilBlockGUI::getAsynch ( )

Use this for final get before sending asynchronous output (ajax) per echo to output.

Definition at line 488 of file class.ilBlockGUI.php.

References ILIAS\UI\examples\Symbol\Glyph\Header\header().

488  : string
489  {
490  header("Content-type: text/html; charset=UTF-8");
491  return $this->tpl->get();
492  }
header()
expected output: > ILIAS shows the rendered Component.
Definition: header.php:29
+ Here is the call graph for this function:

◆ getBlockCommands()

ilBlockGUI::getBlockCommands ( )

Definition at line 362 of file class.ilBlockGUI.php.

References $block_commands.

Referenced by getActionsForPanel().

362  : array
363  {
364  return $this->block_commands;
365  }
array $block_commands
+ Here is the caller graph for this function:

◆ getBlockId()

ilBlockGUI::getBlockId ( )

Definition at line 173 of file class.ilBlockGUI.php.

References $block_id.

Referenced by ilCalendarBlockGUI\__construct(), getConfigParameter(), ilNewsForContextBlockGUI\getDynamicReload(), ilNewsForContextBlockGUI\getJSEnabler(), getMoveParameter(), getNavParameter(), and ilCalendarBlockGUI\setSeed().

173  : string
174  {
175  return $this->block_id;
176  }
+ Here is the caller graph for this function:

◆ getBlockType()

ilBlockGUI::getBlockType ( )
abstract

◆ getConfigParameter()

ilBlockGUI::getConfigParameter ( )
final

Definition at line 332 of file class.ilBlockGUI.php.

References getBlockId(), and getBlockType().

332  : string
333  {
334  return $this->getBlockType() . "_" . $this->getBlockId() . "_blconf";
335  }
+ Here is the call graph for this function:

◆ getData()

ilBlockGUI::getData ( )

Definition at line 153 of file class.ilBlockGUI.php.

References $data.

Referenced by ilNewsForContextBlockGUI\getHTML(), ilPollBlockGUI\getLegacyContent(), ilNewsForContextBlockGUI\getOverview(), loadData(), setOffset(), and ilNewsForContextBlockGUI\showNews().

153  : array
154  {
155  return $this->data;
156  }
+ Here is the caller graph for this function:

◆ getEnableEdit()

ilBlockGUI::getEnableEdit ( )

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

References $enableedit.

Referenced by ilNewsForContextBlockGUI\executeCommand(), and ilNewsForContextBlockGUI\getHTML().

239  : bool
240  {
241  return $this->enableedit;
242  }
+ Here is the caller graph for this function:

◆ getEnableNumInfo()

ilBlockGUI::getEnableNumInfo ( )

Definition at line 292 of file class.ilBlockGUI.php.

References $enablenuminfo.

292  : bool
293  {
294  return $this->enablenuminfo;
295  }

◆ getGuiObject()

ilBlockGUI::getGuiObject ( )

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

References $gui_object.

188  : object
189  {
190  return $this->gui_object;
191  }
object $gui_object

◆ getHTML()

ilBlockGUI::getHTML ( )

Definition at line 376 of file class.ilBlockGUI.php.

References $access, $ctrl, addRepoCommands(), ilRBACAccessHandler\checkAccess(), factory(), getActionsForPanel(), getBlockType(), getLegacyContent(), getListItemGroups(), getNoItemFoundContent(), getPresentation(), getTitle(), getViewControlsForPanel(), handleNavigation(), initCommands(), ilCtrl\isAsynch(), isRepositoryObject(), null, renderer(), send(), and specialCharsAsEntities().

Referenced by ilTutorialSupportBlockGUI\createTutorItem(), ilPDNewsBlockGUI\getHTML(), and sortObject().

376  : string
377  {
378  $this->initCommands();
379 
381  $panel = null;
382 
383  $ctrl = $this->ctrl;
384 
385  if ($this->isRepositoryObject()) {
386  if (!$access->checkAccess("read", "", $this->getRefId())) {
387  return "";
388  }
389  }
390 
391  $this->addRepoCommands();
392 
393  switch ($this->getPresentation()) {
394  case self::PRES_SEC_LEG:
395  $panel = $this->factory->panel()->secondary()->legacy(
396  $this->specialCharsAsEntities($this->getTitle()),
397  $this->factory->legacy()->content($this->getLegacyContent())
398  );
399  break;
400 
401  case self::PRES_MAIN_LEG:
402  $panel = $this->factory->panel()->standard(
403  $this->specialCharsAsEntities($this->getTitle()),
404  $this->factory->legacy()->content($this->getLegacyContent())
405  );
406  break;
407 
408  case self::PRES_SEC_LIST:
409  $this->handleNavigation();
410  $panel = $this->factory->panel()->secondary()->listing(
411  $this->specialCharsAsEntities($this->getTitle()),
412  $this->getListItemGroups()
413  );
414  break;
415 
416  case self::PRES_MAIN_TILE:
417  case self::PRES_MAIN_LIST:
418  $this->handleNavigation();
419  $panel = $this->factory->panel()->listing()->standard(
420  $this->specialCharsAsEntities($this->getTitle()),
421  $this->getListItemGroups()
422  );
423  break;
424  }
425 
426  // check for empty list panel
427  if (in_array($this->getPresentation(), [self::PRES_SEC_LIST, self::PRES_MAIN_LIST], true) &&
428  ($panel->getItemGroups() === [] || (count($panel->getItemGroups()) === 1 && $panel->getItemGroups()[0]->getItems() === []))) {
429  if ($this->getPresentation() === self::PRES_SEC_LIST) {
430  $panel = $this->factory->panel()->secondary()->legacy(
431  $this->specialCharsAsEntities($this->getTitle()),
432  $this->factory->legacy()->content($this->getNoItemFoundContent())
433  );
434  } else {
435  $panel = $this->factory->panel()->standard(
436  $this->specialCharsAsEntities($this->getTitle()),
437  $this->factory->legacy()->content($this->getNoItemFoundContent())
438  );
439  }
440  }
441 
442  $actions = $this->getActionsForPanel();
443  if ($actions !== null) {
444  $panel = $panel->withActions($actions);
445  }
446  $viewControls = $this->getViewControlsForPanel();
447  if ($viewControls !== [] &&
448  (
449  $panel instanceof StandardPanel ||
450  $panel instanceof SecondaryListingPanel ||
451  $panel instanceof SecondaryLegacyPanel ||
452  $panel instanceof StandardListingPanel
453  )
454  ) {
455  $panel = $panel->withViewControls($viewControls);
456  }
457 
458  if ($ctrl->isAsynch()) {
459  $html = $this->renderer->renderAsync([$panel, ...$this->modals]);
460  } else {
461  $html = $this->renderer->render([$panel, ...$this->modals]);
462  }
463 
464 
465  if ($ctrl->isAsynch()) {
466  $this->send($html);
467  } else {
468  // return incl. wrapping div with id
469  $html = '<div id="' . 'block_' . $this->getBlockType() . '_' . $this->block_id . '">' .
470  $html . '</div>';
471  }
472 
473  return $html;
474  }
handleNavigation()
Handle navigation.
send(string $output)
Send.
factory()
addRepoCommands()
Add repo commands.
checkAccess(string $a_permission, string $a_cmd, int $a_ref_id, string $a_type="", ?int $a_obj_id=null, ?int $a_tree_id=null)
check access for an object (provide $a_type and $a_obj_id if available for better performance) ...
renderer()
specialCharsAsEntities(string $string)
getLegacyContent()
Get legacy content.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getListItemGroups()
Get items.
isRepositoryObject()
Returns whether block has a corresponding repository object.
ilAccessHandler $access
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLegacyContent()

ilBlockGUI::getLegacyContent ( )
protected

Get legacy content.

Returns
string

Definition at line 500 of file class.ilBlockGUI.php.

Referenced by getHTML().

500  : string
501  {
502  return "";
503  }
+ Here is the caller graph for this function:

◆ getLimit()

ilBlockGUI::getLimit ( )

Definition at line 229 of file class.ilBlockGUI.php.

References $limit.

Referenced by getPaginationViewControl(), handleNavigation(), and loadData().

229  : int
230  {
231  return $this->limit;
232  }
+ Here is the caller graph for this function:

◆ getListItemForData()

ilBlockGUI::getListItemForData ( array  $data)
protected

Get list item for data array.

Parameters
array$data
Returns
null|

Definition at line 511 of file class.ilBlockGUI.php.

References null.

Referenced by getListItemGroups().

511  : ?\ILIAS\UI\Component\Item\Item
512  {
513  return null;
514  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the caller graph for this function:

◆ getListItemGroups()

ilBlockGUI::getListItemGroups ( )
protected

Get items.

Returns
[]

Definition at line 563 of file class.ilBlockGUI.php.

References $DIC, getListItemForData(), loadData(), and null.

Referenced by getHTML().

563  : array
564  {
565  global $DIC;
566  $factory = $DIC->ui()->factory();
567 
568  $data = $this->loadData();
569 
570  $items = [];
571 
572  foreach ($data as $record) {
573  $item = $this->getListItemForData($record);
574  if ($item !== null) {
575  $items[] = $item;
576  }
577  }
578 
579  $item_group = $factory->item()->group("", $items);
580 
581  return [$item_group];
582  }
Factory $factory
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getListItemForData(array $data)
Get list item for data array.
global $DIC
Definition: shib_login.php:22
loadData()
Load data for current page.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMoveParameter()

ilBlockGUI::getMoveParameter ( )
final

Definition at line 337 of file class.ilBlockGUI.php.

References getBlockId(), and getBlockType().

337  : string
338  {
339  return $this->getBlockType() . "_" . $this->getBlockId() . "_blmove";
340  }
+ Here is the call graph for this function:

◆ getNavParameter()

ilBlockGUI::getNavParameter ( )
final

Definition at line 327 of file class.ilBlockGUI.php.

References getBlockId(), and getBlockType().

Referenced by getPaginationViewControl(), and handleNavigation().

327  : string
328  {
329  return $this->getBlockType() . "_" . $this->getBlockId() . "_blnav";
330  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNoItemFoundContent()

ilBlockGUI::getNoItemFoundContent ( )

Definition at line 810 of file class.ilBlockGUI.php.

References ILIAS\Repository\lng().

Referenced by getHTML().

810  : string
811  {
812  return $this->lng->txt("no_items");
813  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getOffset()

ilBlockGUI::getOffset ( )

Definition at line 214 of file class.ilBlockGUI.php.

References $offset.

Referenced by getPaginationViewControl(), and loadData().

214  : int
215  {
216  return $this->offset;
217  }
+ Here is the caller graph for this function:

◆ getPaginationViewControl()

ilBlockGUI::getPaginationViewControl ( )

Fill previous/next row.

Definition at line 587 of file class.ilBlockGUI.php.

References $block_id, $ctrl, $DIC, getBlockType(), getLimit(), getNavParameter(), getOffset(), null, and ILIAS\UI\Component\ViewControl\Factory\pagination().

Referenced by getViewControlsForPanel().

587  : ?\ILIAS\UI\Component\ViewControl\Pagination
588  {
589  global $DIC;
590  $factory = $DIC->ui()->factory();
591 
592  $ilCtrl = $this->ctrl;
593 
594  if ($this->max_count <= $this->getLimit()) {
595  return null;
596  }
597 
598 
599  // $ilCtrl->setParameterByClass("ilcolumngui",
600  // $this->getNavParameter(), "::" . $prevoffset);
601 
602  // ajax link
603  $ilCtrl->setParameterByClass(
604  "ilcolumngui",
605  "block_id",
606  "block_" . $this->getBlockType() . "_" . $this->block_id
607  );
608  $block_id = "block_" . $this->getBlockType() . "_" . $this->block_id;
609  $onclick = $ilCtrl->getLinkTargetByClass(
610  "ilcolumngui",
611  "updateBlock",
612  "",
613  true
614  );
615  $ilCtrl->setParameterByClass(
616  "ilcolumngui",
617  "block_id",
618  ""
619  );
620 
621  // normal link
622  $href = $ilCtrl->getLinkTargetByClass("ilcolumngui", "", "", false, false);
623 
624  //$ilCtrl->setParameterByClass("ilcolumngui",
625  // $this->getNavParameter(), "");
626 
627  return $factory->viewControl()->pagination()
628  ->withTargetURL($href, $this->getNavParameter() . "page")
629  ->withTotalEntries($this->max_count)
630  ->withPageSize($this->getLimit())
631  ->withMaxPaginationButtons(1)
632  ->withCurrentPage($this->getOffset() / $this->getLimit());
633  }
Factory $factory
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:22
pagination()
description: purpose: > Pagination allows structured data being displayed in chunks by limiting the ...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPresentation()

ilBlockGUI::getPresentation ( )

Definition at line 163 of file class.ilBlockGUI.php.

References $presentation.

Referenced by getHTML(), getViewControlsForPanel(), and ilCalendarBlockGUI\getViewControlsForPanel().

163  : int
164  {
165  return $this->presentation;
166  }
+ Here is the caller graph for this function:

◆ getProperty()

ilBlockGUI::getProperty ( string  $a_property)

Definition at line 306 of file class.ilBlockGUI.php.

References null.

Referenced by ilNewsForContextBlockGUI\getHTML(), ilCalendarBlockGUI\getHTML(), ilNewsForContextBlockGUI\initSettingsForm(), ilNewsForContextBlockGUI\saveSettings(), and ilNewsForContextBlockGUI\showNews().

306  : ?string
307  {
308  return $this->property[$a_property] ?? null;
309  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the caller graph for this function:

◆ getRefId()

ilBlockGUI::getRefId ( )

Definition at line 272 of file class.ilBlockGUI.php.

References $refid.

Referenced by addRepoCommands(), ilPollBlockGUI\fillRow(), ilPollBlockGUI\getHTML(), ilPollBlockGUI\getVoteURL(), and ilPollBlockGUI\initContentRenderer().

272  : int
273  {
274  return $this->refid;
275  }
+ Here is the caller graph for this function:

◆ getRepositoryMode()

ilBlockGUI::getRepositoryMode ( )

◆ getRowTemplateDir()

ilBlockGUI::getRowTemplateDir ( )

Definition at line 347 of file class.ilBlockGUI.php.

References $rowtemplatedir.

Referenced by ilPollBlockGUI\getLegacyContent().

347  : string
348  {
349  return $this->rowtemplatedir;
350  }
string $rowtemplatedir
+ Here is the caller graph for this function:

◆ getRowTemplateName()

ilBlockGUI::getRowTemplateName ( )

Definition at line 342 of file class.ilBlockGUI.php.

References $rowtemplatename.

Referenced by ilPollBlockGUI\getLegacyContent().

342  : string
343  {
344  return $this->rowtemplatename;
345  }
string $rowtemplatename
+ Here is the caller graph for this function:

◆ getScreenMode()

static ilBlockGUI::getScreenMode ( )
static

Definition at line 367 of file class.ilBlockGUI.php.

References IL_SCREEN_SIDE.

367  : string
368  {
369  return IL_SCREEN_SIDE;
370  }
const IL_SCREEN_SIDE

◆ getSubtitle()

ilBlockGUI::getSubtitle ( )

Definition at line 259 of file class.ilBlockGUI.php.

References $subtitle.

259  : string
260  {
261  return $this->subtitle;
262  }

◆ getTitle()

ilBlockGUI::getTitle ( )

Definition at line 198 of file class.ilBlockGUI.php.

References $title.

Referenced by ilMembershipBlockGUI\emptyHandling(), ilSelectedItemsBlockGUI\emptyHandling(), getActionsForPanel(), getHTML(), and ilWikiFunctionsBlockGUI\getLegacyContent().

198  : string
199  {
200  return $this->title;
201  }
+ Here is the caller graph for this function:

◆ getViewControlsForPanel()

ilBlockGUI::getViewControlsForPanel ( )
Returns
ViewControl[]|ViewControl[]

Definition at line 737 of file class.ilBlockGUI.php.

References $presentation, factory(), getPaginationViewControl(), getPresentation(), and null.

Referenced by getHTML().

737  : array
738  {
739  $viewControls = [];
740  if (count($this->presentations) > 1) {
741  $presentation = $this->factory->viewControl()->mode(
742  $this->presentations,
743  'label'
744  )->withActive($this->activePresentation);
745  $viewControls[] = $presentation;
746  }
747 
748  if ($this->sort_options !== []) {
749  if (! array_key_exists($this->activeSortOption, $this->sort_options)) {
750  $this->activeSortOption = current(array_keys($this->sort_options));
751  }
752  $sortation = $this->factory->viewControl()->sortation(
753  $this->sort_options,
754  $this->activeSortOption
755  )->withTargetURL(
756  $this->sort_target,
757  'sorting'
758  );
759  $viewControls[] = $sortation;
760  }
761 
762  if ($this->getPresentation() === self::PRES_SEC_LIST) {
763  $pg_view_control = $this->getPaginationViewControl();
764  if ($pg_view_control !== null) {
765  $viewControls[] = $pg_view_control;
766  }
767  }
768  return $viewControls;
769  }
factory()
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getPaginationViewControl()
Fill previous/next row.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleNavigation()

ilBlockGUI::handleNavigation ( )
protected

Handle navigation.

Definition at line 520 of file class.ilBlockGUI.php.

References getLimit(), getNavParameter(), and setOffset().

Referenced by getHTML().

520  : void
521  {
522  $reg_page = $this->request->getNavPage($this->getNavParameter());
523  if ($reg_page !== "") {
524  $this->nav_value = "::" . ($reg_page * $this->getLimit());
525  }
526 
527  if ($this->nav_value == "") {
528  $this->nav_value = $this->block_manager->getNavPar($this->getNavParameter());
529  }
530 
531  $this->block_manager->setNavPar(
532  $this->getNavParameter(),
533  $this->nav_value
534  );
535 
536  $nav = explode(":", $this->nav_value);
537  if (isset($nav[2])) {
538  $this->setOffset((int) $nav[2]);
539  } else {
540  $this->setOffset(0);
541  }
542  }
setOffset(int $a_offset)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initCommands()

ilBlockGUI::initCommands ( )
protected

Definition at line 372 of file class.ilBlockGUI.php.

Referenced by getHTML().

372  : void
373  {
374  }
+ Here is the caller graph for this function:

◆ isRepositoryObject()

ilBlockGUI::isRepositoryObject ( )
abstractprotected

Returns whether block has a corresponding repository object.

Referenced by __construct(), addRepoCommands(), and getHTML().

+ Here is the caller graph for this function:

◆ loadData()

ilBlockGUI::loadData ( )
protected

Load data for current page.

Returns
array

Definition at line 548 of file class.ilBlockGUI.php.

References $data, getData(), getLimit(), getOffset(), and preloadData().

Referenced by ilDashboardBlockGUI\getLegacyContent(), ilDashboardBlockGUI\getListItemGroups(), and getListItemGroups().

548  : array
549  {
550  $data = $this->getData();
551  $this->max_count = count($data);
552  $data = array_slice($data, $this->getOffset(), $this->getLimit(), true);
553  $this->preloadData($data);
554  return $data;
555  }
preloadData(array $data)
Can be overwritten in subclasses.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ preloadData()

ilBlockGUI::preloadData ( array  $data)
protected

Can be overwritten in subclasses.

Only the visible part of the complete data was passed so a preload of the visible data is possible.

Parameters
array$data

Definition at line 480 of file class.ilBlockGUI.php.

Referenced by loadData().

480  : void
481  {
482  }
+ Here is the caller graph for this function:

◆ send()

ilBlockGUI::send ( string  $output)
protected

Send.

Exceptions
ResponseSendingException

Definition at line 801 of file class.ilBlockGUI.php.

References ILIAS\FileDelivery\http().

Referenced by ilNewsForContextBlockGUI\enableJS(), getHTML(), ilNewsForContextBlockGUI\hideNotifications(), and ilNewsForContextBlockGUI\showNotifications().

801  : void
802  {
803  $this->http->saveResponse($this->http->response()->withBody(
804  Streams::ofString($output)
805  ));
806  $this->http->sendResponse();
807  $this->http->close();
808  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setAdminCommands()

ilBlockGUI::setAdminCommands ( bool  $a_admincommands)

Definition at line 277 of file class.ilBlockGUI.php.

277  : void
278  {
279  $this->admincommands = $a_admincommands;
280  }

◆ setBlockId()

ilBlockGUI::setBlockId ( string  $a_block_id = "0")

◆ setData()

ilBlockGUI::setData ( array  $a_data)

◆ setEnableEdit()

ilBlockGUI::setEnableEdit ( bool  $a_enableedit)

Definition at line 234 of file class.ilBlockGUI.php.

234  : void
235  {
236  $this->enableedit = $a_enableedit;
237  }

◆ setEnableNumInfo()

◆ setGuiObject()

ilBlockGUI::setGuiObject ( object  $a_gui_object)

Set GuiObject.

Only used for repository blocks, that are represented as real repository objects (have a ref id and permissions)

Definition at line 183 of file class.ilBlockGUI.php.

183  : void
184  {
185  $this->gui_object = $a_gui_object;
186  }

◆ setLimit()

◆ setOffset()

ilBlockGUI::setOffset ( int  $a_offset)

Definition at line 203 of file class.ilBlockGUI.php.

References checkOffset(), and getData().

Referenced by handleNavigation().

203  : void
204  {
205  // see https://github.com/ILIAS-eLearning/ILIAS/pull/6551/files
206  $this->max_count = count($this->getData());
207  if ($this->checkOffset($a_offset)) {
208  $this->offset = $a_offset;
209  } else {
210  throw new ilException("ilBlockGUI::setOffset(): Offset out of range.");
211  }
212  }
checkOffset(int $offset)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setPresentation()

◆ setProperties()

ilBlockGUI::setProperties ( array  $a_properties)

This function is supposed to be used for block type specific properties, that should be inherited through ilColumnGUI->setBlockProperties.

Definition at line 301 of file class.ilBlockGUI.php.

301  : void
302  {
303  $this->property = $a_properties;
304  }

◆ setProperty()

ilBlockGUI::setProperty ( string  $a_property,
string  $a_value 
)

Definition at line 311 of file class.ilBlockGUI.php.

311  : void
312  {
313  $this->property[$a_property] = $a_value;
314  }

◆ setRefId()

ilBlockGUI::setRefId ( int  $a_refid)

Set Ref Id (only used if isRepositoryObject() is true).

Definition at line 267 of file class.ilBlockGUI.php.

267  : void
268  {
269  $this->refid = $a_refid;
270  }

◆ setRepositoryMode()

ilBlockGUI::setRepositoryMode ( bool  $a_repositorymode)

Definition at line 244 of file class.ilBlockGUI.php.

244  : void
245  {
246  $this->repositorymode = $a_repositorymode;
247  }

◆ setRowTemplate()

ilBlockGUI::setRowTemplate ( string  $a_rowtemplatename,
string  $a_rowtemplatedir = "" 
)

Set Row Template Name.

Definition at line 319 of file class.ilBlockGUI.php.

Referenced by ilPDNewsBlockGUI\__construct(), ilPollBlockGUI\__construct(), and ilNewsForContextBlockGUI\__construct().

322  : void {
323  $this->rowtemplatename = $a_rowtemplatename;
324  $this->rowtemplatedir = $a_rowtemplatedir;
325  }
+ Here is the caller graph for this function:

◆ setSortTarget()

ilBlockGUI::setSortTarget ( string  $target)

Definition at line 784 of file class.ilBlockGUI.php.

Referenced by ilDashboardBlockGUI\addCommandActions().

784  : void
785  {
786  $this->sort_target = $target;
787  }
+ Here is the caller graph for this function:

◆ setSubtitle()

ilBlockGUI::setSubtitle ( string  $a_subtitle)

Definition at line 254 of file class.ilBlockGUI.php.

254  : void
255  {
256  $this->subtitle = $a_subtitle;
257  }

◆ setTitle()

◆ sortObject()

ilBlockGUI::sortObject ( )

Definition at line 771 of file class.ilBlockGUI.php.

References getHTML().

771  : string
772  {
773  return $this->getHTML();
774  }
+ Here is the call graph for this function:

◆ specialCharsAsEntities()

ilBlockGUI::specialCharsAsEntities ( string  $string)
protected

Definition at line 138 of file class.ilBlockGUI.php.

Referenced by getActionsForPanel(), and getHTML().

138  : string
139  {
140  // Should be replaced by a proper refinery transformation once https://github.com/ILIAS-eLearning/ILIAS/pull/6314 is merged
141  return htmlspecialchars(
142  $string,
143  ENT_QUOTES | ENT_SUBSTITUTE,
144  'utf-8'
145  );
146  }
+ Here is the caller graph for this function:

Field Documentation

◆ $access

◆ $activePresentation

string ilBlockGUI::$activePresentation = ''
private

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

◆ $activeSortOption

string ilBlockGUI::$activeSortOption = ''
private

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

◆ $admincommands

bool ilBlockGUI::$admincommands = false
protected

Definition at line 85 of file class.ilBlockGUI.php.

Referenced by getAdminCommands().

◆ $allow_moving

bool ilBlockGUI::$allow_moving = true
protected

Definition at line 75 of file class.ilBlockGUI.php.

◆ $block_commands

array ilBlockGUI::$block_commands = array()
protected

Definition at line 77 of file class.ilBlockGUI.php.

Referenced by getBlockCommands().

◆ $block_id

string ilBlockGUI::$block_id = "0"
protected

◆ $block_manager

ILIAS Block BlockManager ilBlockGUI::$block_manager
protected

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

◆ $close_command

bool ilBlockGUI::$close_command = false
protected

Definition at line 79 of file class.ilBlockGUI.php.

◆ $css_row

string ilBlockGUI::$css_row = ""
protected

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

◆ $ctrl

◆ $data

◆ $dropdown

array ilBlockGUI::$dropdown
protected

Definition at line 86 of file class.ilBlockGUI.php.

Referenced by ilTutorialSupportBlockGUI\createTutorItem().

◆ $enableedit

bool ilBlockGUI::$enableedit
private

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

Referenced by getEnableEdit().

◆ $enablenuminfo

bool ilBlockGUI::$enablenuminfo = true
protected

Definition at line 72 of file class.ilBlockGUI.php.

Referenced by getEnableNumInfo().

◆ $factory

◆ $footer_links

array ilBlockGUI::$footer_links = array()
protected

Definition at line 73 of file class.ilBlockGUI.php.

◆ $gui_object

object ilBlockGUI::$gui_object
protected

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

Referenced by getGuiObject().

◆ $http

ILIAS HTTP GlobalHttpState ilBlockGUI::$http
private

Definition at line 67 of file class.ilBlockGUI.php.

◆ $image

bool ilBlockGUI::$image = false
protected

Definition at line 80 of file class.ilBlockGUI.php.

◆ $limit

int ilBlockGUI::$limit
private

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

Referenced by getLimit().

◆ $lng

◆ $main_tpl

◆ $max_count

int ilBlockGUI::$max_count = 0
protected

Definition at line 78 of file class.ilBlockGUI.php.

◆ $modals

array ilBlockGUI::$modals = []
private

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

◆ $move

array ilBlockGUI::$move = array("left" => false, "right" => false, "up" => false, "down" => false)
protected

Definition at line 76 of file class.ilBlockGUI.php.

◆ $nav_value

string ilBlockGUI::$nav_value = ""
protected

Definition at line 82 of file class.ilBlockGUI.php.

◆ $obj_def

ilObjectDefinition ilBlockGUI::$obj_def
protected

Definition at line 93 of file class.ilBlockGUI.php.

Referenced by addRepoCommands(), and ilNewsForContextBlockGUI\getHTML().

◆ $offset

int ilBlockGUI::$offset = 0
private

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

Referenced by getOffset().

◆ $presentation

◆ $presentations

array ilBlockGUI::$presentations = []
private

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

Referenced by ilDashboardBlockGUI\addCommandActions().

◆ $property

array ilBlockGUI::$property = []
protected

Definition at line 81 of file class.ilBlockGUI.php.

◆ $refid

int ilBlockGUI::$refid
private

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

Referenced by getRefId().

◆ $renderer

ILIAS UI Renderer ilBlockGUI::$renderer
protected

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

Referenced by ilNewsForContextBlockGUI\showNews().

◆ $repositorymode

bool ilBlockGUI::$repositorymode = false
protected

Definition at line 69 of file class.ilBlockGUI.php.

Referenced by getRepositoryMode().

◆ $request

ILIAS Block StandardGUIRequest ilBlockGUI::$request
protected

◆ $requested_ref_id

int ilBlockGUI::$requested_ref_id
protected

Definition at line 95 of file class.ilBlockGUI.php.

Referenced by ilClassificationBlockGUI\__construct().

◆ $rowtemplatedir

string ilBlockGUI::$rowtemplatedir
private

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

Referenced by getRowTemplateDir().

◆ $rowtemplatename

string ilBlockGUI::$rowtemplatename
private

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

Referenced by getRowTemplateName().

◆ $sort_options

array ilBlockGUI::$sort_options = []
private

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

◆ $sort_target

string ilBlockGUI::$sort_target = ''
private

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

◆ $subtitle

string ilBlockGUI::$subtitle
private

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

Referenced by getSubtitle().

◆ $title

◆ $tpl

◆ $ui

◆ $user

◆ PRES_MAIN_LEG

const ilBlockGUI::PRES_MAIN_LEG = 0

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

◆ PRES_MAIN_LIST

const ilBlockGUI::PRES_MAIN_LIST = 3

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

◆ PRES_MAIN_TILE

const ilBlockGUI::PRES_MAIN_TILE = 4

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

◆ PRES_SEC_LEG

const ilBlockGUI::PRES_SEC_LEG = 1

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

◆ PRES_SEC_LIST

const ilBlockGUI::PRES_SEC_LIST = 2

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


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