19 declare(strict_types=1);
65 protected \ILIAS\Block\StandardGUIRequest
$request;
67 private \ILIAS\HTTP\GlobalHttpState
$http;
70 protected \ILIAS\DI\UIServices
$ui;
71 protected array
$data = array();
76 protected array
$move = array(
"left" =>
false,
"right" =>
false,
"up" =>
false,
"down" =>
false);
100 $this->factory = $DIC->ui()->factory();
101 $this->renderer = $DIC->ui()->renderer();
103 $this->
http = $DIC->http();
105 $this->block_manager = $block_service->internal()
108 $this->request = $block_service->internal()
114 $this->presentation = self::PRES_SEC_LEG;
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();
125 $this->main_tpl->addJavaScript(
"./Services/Block/js/ilblockcallback.js");
127 $this->
setLimit((
int) $this->
user->getPref(
"hits_per_page"));
129 $this->requested_ref_id = $this->request->getRefId();
142 return htmlspecialchars(
144 ENT_QUOTES | ENT_SUBSTITUTE,
151 $this->data = $a_data;
161 $this->presentation = $type;
171 $this->block_id = $a_block_id;
186 $this->gui_object = $a_gui_object;
196 $this->title = $a_title;
207 $this->max_count = count($this->
getData());
209 $this->offset = $a_offset;
211 throw new ilException(
"ilBlockGUI::setOffset(): Offset out of range.");
222 return $offset <= $this->max_count && $offset >= 0;
227 $this->limit = $a_limit;
237 $this->enableedit = $a_enableedit;
247 $this->repositorymode = $a_repositorymode;
257 $this->subtitle = $a_subtitle;
270 $this->refid = $a_refid;
280 $this->admincommands = $a_admincommands;
290 $this->enablenuminfo = $a_enablenuminfo;
304 $this->
property = $a_properties;
309 return $this->
property[$a_property] ?? null;
312 public function setProperty(
string $a_property,
string $a_value): void
314 $this->
property[$a_property] = $a_value;
321 string $a_rowtemplatename,
322 string $a_rowtemplatedir =
"" 324 $this->rowtemplatename = $a_rowtemplatename;
325 $this->rowtemplatedir = $a_rowtemplatedir;
355 $this->block_commands[] = [
358 "onclick" => $a_onclick,
387 if (!$access->
checkAccess(
"read",
"", $this->getRefId())) {
395 case self::PRES_SEC_LEG:
396 $panel = $this->factory->panel()->secondary()->legacy(
398 $this->factory->legacy($this->getLegacyContent())
402 case self::PRES_MAIN_LEG:
403 $panel = $this->factory->panel()->standard(
405 $this->factory->legacy($this->getLegacyContent())
409 case self::PRES_SEC_LIST:
411 $panel = $this->factory->panel()->secondary()->listing(
417 case self::PRES_MAIN_TILE:
418 case self::PRES_MAIN_LIST:
420 $panel = $this->factory->panel()->listing()->standard(
428 if (in_array($this->
getPresentation(), [self::PRES_SEC_LIST, self::PRES_MAIN_LIST],
true) &&
429 ($panel->getItemGroups() === [] || (count($panel->getItemGroups()) === 1 && $panel->getItemGroups()[0]->getItems() === []))) {
431 $panel = $this->factory->panel()->secondary()->legacy(
433 $this->factory->legacy($this->getNoItemFoundContent())
436 $panel = $this->factory->panel()->standard(
438 $this->factory->legacy($this->getNoItemFoundContent())
444 if ($actions !== null) {
445 $panel = $panel->withActions($actions);
448 if ($viewControls !== [] &&
451 $panel instanceof SecondaryListingPanel ||
452 $panel instanceof SecondaryLegacyPanel ||
453 $panel instanceof StandardListingPanel
456 $panel = $panel->withViewControls($viewControls);
460 $html = $this->renderer->renderAsync([$panel, ...$this->modals]);
462 $html = $this->renderer->render([$panel, ...$this->modals]);
470 $html =
'<div id="' .
'block_' . $this->
getBlockType() .
'_' . $this->block_id .
'">' .
491 header(
"Content-type: text/html; charset=UTF-8");
492 return $this->tpl->get();
524 if ($reg_page !==
"") {
525 $this->nav_value =
"::" . ($reg_page * $this->
getLimit());
528 if ($this->nav_value ==
"") {
529 $this->nav_value = $this->block_manager->getNavPar($this->
getNavParameter());
532 $this->block_manager->setNavPar(
537 $nav = explode(
":", $this->nav_value);
538 if (isset($nav[2])) {
552 $this->max_count = count($data);
567 $factory = $DIC->ui()->factory();
573 foreach ($data as $record) {
575 if ($item !== null) {
580 $item_group = $factory->item()->group(
"", $items);
582 return [$item_group];
591 $factory = $DIC->ui()->factory();
595 if ($this->max_count <= $this->
getLimit()) {
607 "block_" . $this->
getBlockType() .
"_" . $this->block_id
610 $onclick = $ilCtrl->getLinkTargetByClass(
616 $ilCtrl->setParameterByClass(
623 $href = $ilCtrl->getLinkTargetByClass(
"ilcolumngui",
"",
"",
false,
false);
630 ->withTotalEntries($this->max_count)
632 ->withMaxPaginationButtons(1)
656 if ($access->
checkAccess(
"delete",
"", $this->getRefId())) {
658 "ilias.php?baseClass=ilRepositoryGUI&ref_id=" . $this->requested_ref_id .
"&cmd=delete" .
659 "&item_ref_id=" . $this->
getRefId(),
664 "ilias.php?baseClass=ilRepositoryGUI&ref_id=" . $this->requested_ref_id .
"&cmd=link" .
665 "&item_ref_id=" . $this->
getRefId(),
671 "ilias.php?baseClass=ilRepositoryGUI&ref_id=" . $this->requested_ref_id .
"&cmd=cut" .
672 "&item_ref_id=" . $this->
getRefId(),
678 if ($access->
checkAccess(
"copy",
"", $this->getRefId())) {
680 $parent_gui =
"ilObj" . $obj_def->
getClassName($parent_type) .
"GUI";
684 array(
"ilrepositorygui", $parent_gui,
"ilobjectcopygui"),
685 "initTargetSelection" 704 $href = ($command[
'onclick'] !==
'')
707 $button = $this->factory->button()->shy($command[
'text'], $href);
708 if ($command[
'onclick']) {
711 "$(\"#$id\").click(function() { ilBlockJSHandler('" .
"block_" . $this->
getBlockType() .
"_" . $this->block_id .
712 "','" . $command[
"onclick"] .
"');});";
716 if (isset($command[
'modal']) && $command[
'modal'] instanceof
Modal) {
717 $button = $button->withOnClick($command[
'modal']->getShowSignal());
718 $this->modals[] = $command[
'modal'];
720 $actions[] = $button;
723 if (count($actions) > 0) {
724 $actions = $this->factory->dropdown()->standard($actions)
725 ->withAriaLabel(sprintf(
726 $this->
lng->txt(
'actions_for'),
738 if (count($this->presentations) > 1) {
739 $presentation = $this->factory->viewControl()->mode(
740 $this->presentations,
742 )->withActive($this->activePresentation);
746 if ($this->sort_options !== []) {
747 $sortation = $this->factory->viewControl()->sortation(
753 $this->activeSortOption
755 $viewControls[] = $sortation;
761 if ($pg_view_control !== null) {
762 $viewControls[] = $pg_view_control;
765 return $viewControls;
773 public function addSortOption(
string $option,
string $label,
bool $active): void
776 $this->activeSortOption = $label;
778 $this->sort_options[$option] = $label;
784 $this->sort_target = $target;
789 $this->presentations[$label] = $target;
791 $this->activePresentation = $label;
799 protected function send(
string $output): void
801 $this->
http->saveResponse($this->
http->response()->withBody(
802 Streams::ofString($output)
804 $this->
http->sendResponse();
805 $this->
http->close();
810 return $this->
lng->txt(
"no_items");
This describes commonalities between the different modals.
ILIAS Block BlockManager $block_manager
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getLinkTargetByClass( $a_class, string $a_cmd=null, string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
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...
addPresentation(string $label, string $target, bool $active)
setProperties(array $a_properties)
This function is supposed to be used for block type specific properties, that should be inherited thr...
setBlockId(string $a_block_id="0")
handleNavigation()
Handle navigation.
send(string $output)
Send.
Class ChatMainBarProvider .
addRepoCommands()
Add repo commands.
setEnableNumInfo(bool $a_enablenuminfo)
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) ...
setEnableEdit(bool $a_enableedit)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getViewControlsForPanel()
setSortTarget(string $target)
setParameterByClass(string $a_class, string $a_parameter, $a_value)
specialCharsAsEntities(string $string)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getLegacyContent()
Get legacy content.
setProperty(string $a_property, string $a_value)
withOnLoadCode(Closure $binder)
This describes commonalities between all types of Dropdowns.
ILIAS Block StandardGUIRequest $request
setRowTemplate(string $a_rowtemplatename, string $a_rowtemplatedir="")
Set Row Template Name.
parses the objects.xml it handles the xml-description of all ilias objects
ilGlobalTemplateInterface $main_tpl
static http()
Fetches the global http state from ILIAS.
preloadData(array $data)
Can be overwritten in subclasses.
getListItemForData(array $data)
Get list item for data array.
setAdminCommands(bool $a_admincommands)
getListItemGroups()
Get items.
getPaginationViewControl()
Fill previous/next row.
getClassName(string $obj_name)
getAsynch()
Use this for final get before sending asynchronous output (ajax) per echo to output.
setRefId(int $a_refid)
Set Ref Id (only used if isRepositoryObject() is true).
addBlockCommand(string $a_href, string $a_text, string $a_onclick="", RoundTrip $modal=null)
setGuiObject(object $a_gui_object)
Set GuiObject.
ILIAS HTTP GlobalHttpState $http
loadData()
Load data for current page.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
setTitle(string $a_title)
setSubtitle(string $a_subtitle)
isRepositoryObject()
Returns whether block has a corresponding repository object.
string $activePresentation
This class represents a block method of a block.
This describes a Standard Dropdown.
ILIAS UI Renderer $renderer
setRepositoryMode(bool $a_repositorymode)
static _lookupType(int $id, bool $reference=false)
addSortOption(string $option, string $label, bool $active)
getProperty(string $a_property)
static initConnection(?ilGlobalTemplateInterface $a_main_tpl=null)
Init YUI Connection module.
setPresentation(int $type)
pagination()
description: purpose: > Pagination allows structured data being displayed in chunks by limiting the ...