41 protected $move = array(
"left" =>
false,
"right" =>
false,
"up" =>
false,
"down" =>
false);
115 $this->
user = $DIC->user();
116 $this->ctrl =
$DIC->ctrl();
117 $this->access =
$DIC->access();
118 $this->lng =
$DIC->language();
119 $this->main_tpl =
$DIC[
"tpl"];
120 $this->obj_def =
$DIC[
"objDefinition"];
121 $this->
ui = $DIC->ui();
123 include_once(
"./Services/YUI/classes/class.ilYuiUtil.php");
125 $this->main_tpl->addJavaScript(
"./Services/Block/js/ilblockcallback.js");
138 $this->data = $a_data;
158 $this->presentation =
$type;
178 $this->block_id = $a_block_id;
201 $this->gui_object = $a_gui_object;
211 return $this->gui_object;
222 $this->title = $a_title;
242 $this->offset = $a_offset;
252 return $this->offset;
257 if (!($this->offset < $this->max_count)) {
269 $this->limit = $a_limit;
289 $this->enableedit = $a_enableedit;
299 return $this->enableedit;
309 $this->repositorymode = $a_repositorymode;
319 return $this->repositorymode;
330 $this->subtitle = $a_subtitle;
340 return $this->subtitle;
350 $this->refid = $a_refid;
370 $this->admincommands = $a_admincommands;
390 $this->enablenuminfo = $a_enablenuminfo;
411 $this->
property = $a_properties;
416 return $this->
property[$a_property];
421 $this->
property[$a_property] = $a_value;
431 $this->rowtemplatename = $a_rowtemplatename;
432 $this->rowtemplatedir = $a_rowtemplatedir;
457 return $this->rowtemplatename;
467 return $this->rowtemplatedir;
477 public function addBlockCommand(
string $a_href,
string $a_text,
string $a_onclick =
"") : void
479 $this->block_commands[] = [
482 "onclick" => $a_onclick
521 if ($this->new_rendering) {
532 if (!$ilAccess->checkAccess(
"read",
"", $this->getRefId())) {
537 $this->tpl =
new ilTemplate(
"tpl.block.html",
true,
true,
"Services/Block");
546 $this->tpl->setCurrentBlock(
"block_check");
547 $this->tpl->setVariable(
"BL_REF_ID", $this->
getRefId());
548 $this->tpl->parseCurrentBlock();
551 if ($ilAccess->checkAccess(
"delete",
"", $this->getRefId())) {
553 "ilias.php?baseClass=ilRepositoryGUI&ref_id=" .
$_GET[
"ref_id"] .
"&cmd=delete" .
554 "&item_ref_id=" . $this->
getRefId(),
560 "ilias.php?baseClass=ilRepositoryGUI&ref_id=" .
$_GET[
"ref_id"] .
"&cmd=cut" .
561 "&item_ref_id=" . $this->
getRefId(),
567 if ($ilAccess->checkAccess(
"copy",
"", $this->getRefId())) {
569 $parent_gui =
"ilObj" . $objDefinition->getClassName($parent_type) .
"GUI";
571 $ilCtrl->setParameterByClass(
"ilobjectcopygui",
"source_id", $this->
getRefId());
572 $copy_cmd = $ilCtrl->getLinkTargetByClass(
573 array(
"ilrepositorygui", $parent_gui,
"ilobjectcopygui"),
574 "initTargetSelection"
585 $this->dropdown = array();
590 if ($command[
"onclick"]) {
591 $command[
"onclick"] =
"ilBlockJSHandler('" .
"block_" . $this->
getBlockType() .
"_" . $this->block_id .
592 "','" . $command[
"onclick"] .
"')";
594 $this->dropdown[] = $command;
609 if (is_object(
$ilUser) &&
$ilUser->getPref(
"screen_reader_optimization")) {
618 $this->tpl->touchBlock(
"hclassb");
620 $this->tpl->touchBlock(
"hclass");
623 if ($ilCtrl->isAsynch()) {
625 echo $this->tpl->get();
629 return '<div id="' .
"block_" . $this->
getBlockType() .
"_" . $this->block_id .
'">' .
630 $this->tpl->get() .
'</div>';
640 include_once
"Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php";
646 foreach ($this->dropdown as $item) {
647 if ($item[
"href"] || $item[
"onclick"]) {
648 if ($item[
"checked"]) {
665 $this->tpl->setCurrentBlock(
"header_dropdown");
666 $this->tpl->setVariable(
"ADV_DROPDOWN",
$dropdown);
667 $this->tpl->parseCurrentBlock();
669 $this->tpl->setCurrentBlock(
"hitem");
670 $this->tpl->parseCurrentBlock();
683 $this->tpl->setCurrentBlock(
"header_title");
684 $this->tpl->setVariable(
686 "block_" . $this->
getBlockType() .
"_" . $this->block_id
688 $this->tpl->setVariable(
692 $this->tpl->setVariable(
696 $this->tpl->parseCurrentBlock();
698 $this->tpl->setCurrentBlock(
"hitem");
699 $this->tpl->parseCurrentBlock();
708 $this->tpl->setCurrentBlock(
"data_section");
709 $this->tpl->setVariable(
"DATA", $a_content);
710 $this->tpl->parseCurrentBlock();
711 $this->tpl->setVariable(
"BLOCK_ROW",
"");
729 $nav = explode(
":", $this->nav_value);
730 if (isset($nav[2])) {
737 $this->tpl->addBlockFile(
745 $this->max_count = count(
$data);
751 foreach (
$data as $record) {
752 $this->tpl->setCurrentBlock(
"block_row");
755 $this->tpl->setCurrentBlock(
"block_row");
756 $this->tpl->parseCurrentBlock();
762 foreach ($a_set as $key => $value) {
763 $this->tpl->setVariable(
"VAL_" . strtoupper($key), $value);
773 $this->css_row = ($this->css_row !=
"ilBlockRow1")
776 $this->tpl->setVariable($a_placeholder, $this->css_row);
792 if ($end > $this->max_count or $this->
getLimit() == 0) {
796 $numinfo =
"(" . $start .
"-" . $end .
" " . strtolower(
$lng->txt(
"of")) .
" " . $this->max_count .
")";
800 $this->tpl->setVariable(
"NUMINFO", $numinfo);
825 $ilCtrl->setParameterByClass(
832 $ilCtrl->setParameterByClass(
835 "block_" . $this->
getBlockType() .
"_" . $this->block_id
838 $onclick = $ilCtrl->getLinkTargetByClass(
844 $ilCtrl->setParameterByClass(
851 $href = $ilCtrl->getLinkTargetByClass(
"ilcolumngui",
"");
852 $text =
$lng->txt(
"previous");
858 $pages = intval($this->max_count / $this->
getLimit());
861 if (($this->max_count % $this->
getLimit())) {
866 if (!(($this->
getOffset() / $this->
getLimit()) == ($pages - 1)) && ($pages != 1)) {
869 $ilCtrl->setParameterByClass(
876 $ilCtrl->setParameterByClass(
879 "block_" . $this->
getBlockType() .
"_" . $this->block_id
883 $onclick = $ilCtrl->getLinkTargetByClass(
891 $ilCtrl->setParameterByClass(
898 $href = $ilCtrl->getLinkTargetByClass(
"ilcolumngui",
"");
899 $text =
$lng->txt(
"next");
903 $ilCtrl->setParameterByClass(
928 header(
"Content-type: text/html; charset=UTF-8");
929 return $this->tpl->get();
959 if (!is_null($pg_view_control)) {
960 return [$pg_view_control];
984 if ($reg_page !==
"") {
985 $this->nav_value =
"::" . ($reg_page * $this->
getLimit());
994 $nav = explode(
":", $this->nav_value);
995 if (isset($nav[2])) {
1010 $this->max_count = count(
$data);
1032 foreach (
$data as $record) {
1034 if ($item !==
null) {
1039 $item_group =
$factory->item()->group(
"", $items);
1041 return [$item_group];
1059 $ilCtrl->setParameterByClass(
1062 "block_" . $this->
getBlockType() .
"_" . $this->block_id
1065 $onclick = $ilCtrl->getLinkTargetByClass(
1071 $ilCtrl->setParameterByClass(
1078 $href = $ilCtrl->getLinkTargetByClass(
"ilcolumngui",
"",
"",
false,
false);
1083 if ($this->max_count <= $this->
getLimit()) {
1087 return $factory->viewControl()->pagination()
1089 ->withTotalEntries($this->max_count)
1091 ->withMaxPaginationButtons(5)
1115 if (
$access->checkAccess(
"delete",
"", $this->getRefId())) {
1117 "ilias.php?baseClass=ilRepositoryGUI&ref_id=" .
$_GET[
"ref_id"] .
"&cmd=delete" .
1118 "&item_ref_id=" . $this->
getRefId(),
1124 "ilias.php?baseClass=ilRepositoryGUI&ref_id=" .
$_GET[
"ref_id"] .
"&cmd=cut" .
1125 "&item_ref_id=" . $this->
getRefId(),
1131 if (
$access->checkAccess(
"copy",
"", $this->getRefId())) {
1133 $parent_gui =
"ilObj" .
$obj_def->getClassName($parent_type) .
"GUI";
1135 $ctrl->setParameterByClass(
"ilobjectcopygui",
"source_id", $this->
getRefId());
1136 $copy_cmd =
$ctrl->getLinkTargetByClass(
1137 array(
"ilrepositorygui", $parent_gui,
"ilobjectcopygui"),
1138 "initTargetSelection"
1157 $renderer =
$DIC->ui()->renderer();
1163 if (!
$access->checkAccess(
"read",
"", $this->getRefId())) {
1174 $factory->legacy($this->getLegacyContent())
1181 $factory->legacy($this->getLegacyContent())
1201 case self::PRES_MAIN_TILE:
1214 $href = ($command[
"onclick"] !=
"")
1217 $button =
$factory->button()->shy($command[
"text"], $href);
1218 if ($command[
"onclick"]) {
1219 $button = $button->withOnLoadCode(
function ($id) use ($command) {
1221 "$(\"#$id\").click(function() { ilBlockJSHandler('" .
"block_" . $this->
getBlockType() .
"_" . $this->block_id .
1222 "','" . $command[
"onclick"] .
"');});";
1225 $actions[] = $button;
1229 if (in_array($this->
getPresentation(), [self::PRES_SEC_LIST, self::PRES_MAIN_LIST]) &&
1230 (count(
$panel->getItemGroups()) == 0 || (count(
$panel->getItemGroups()) == 1 && count(
$panel->getItemGroups()[0]->getItems()) == 0))) {
1245 if (count($actions) > 0) {
1246 $actions =
$factory->dropdown()->standard($actions)
1247 ->withAriaLabel(sprintf(
1248 $this->lng->txt(
'actions_for'),
1249 htmlspecialchars($this->
getTitle())
1259 if (
$ctrl->isAsynch()) {
1260 $html = $renderer->renderAsync(
$panel);
1262 $html = $renderer->render(
$panel);
1266 if (
$ctrl->isAsynch()) {
1271 $html =
'<div id="' .
"block_" . $this->
getBlockType() .
"_" . $this->block_id .
'">' .
1288 return $this->lng->txt(
"no_items");
An exception for terminatinating execution or to throw for unit testing.
User interface class for advanced drop-down selection lists.
This class represents a block method of a block.
setRowTemplate($a_rowtemplatename, $a_rowtemplatedir="")
Set Row Template Name.
initCommands()
Init commands.
setLimit($a_limit)
Set Limit.
getBlockCommands()
Get Block commands.
fillHeaderCommands()
Fill header commands block.
getNoItemFoundContent()
No item entry.
getBlockId()
Get Block Id.
setSubtitle($a_subtitle)
Set Subtitle.
isRepositoryObject()
Returns whether block has a corresponding repository object.
setData($a_data)
Set Data.
setRefId($a_refid)
Set Ref Id (only used if isRepositoryObject() is true).
getAsynch()
Use this for final get before sending asynchronous output (ajax) per echo to output.
getRepositoryMode()
Get RepositoryMode.
setPresentation(int $type)
Set presentation.
__construct()
Constructor.
setDataSection($a_content)
Call this from overwritten fillDataSection(), if standard row based data is not used.
getAdminCommands()
Get Administration Commmands.
setAdminCommands(bool $a_admincommands)
Set Administration Commmands.
handleNavigation()
Handle navigation.
preloadData(array $data)
Can be overwritten in subclasses.
fillHeaderTitleBlock()
Fill header title block (title and.
fillDataSection()
Standard implementation for row based data.
static getScreenMode()
Get Screen Mode for current command.
setOffset($a_offset)
Set Offset.
addBlockCommand(string $a_href, string $a_text, string $a_onclick="")
Add Block Command.
getRowTemplateDir()
Get Row Template Directory.
getGuiObject()
Get GuiObject.
fillRowColor($a_placeholder="CSS_ROW")
getRowTemplateName()
Get Row Template Name.
loadData()
Load data for current page.
getEnableEdit()
Get EnableEdit.
setEnableEdit($a_enableedit)
Set EnableEdit.
getListItemGroups()
Get items.
setTitle($a_title)
Set Title.
addRepoCommands()
Add repo commands.
getPresentation()
Get presentation type.
setBlockId($a_block_id=0)
Set Block Id.
setEnableNumInfo($a_enablenuminfo)
Set Enable Item Number Info.
getLegacyContent()
Get legacy content.
getEnableNumInfo()
Get Enable Item Number Info.
getViewControls()
Get view controls.
getRefId()
Get Ref Id (only used if isRepositoryObject() is true).
getPaginationViewControl()
Fill previous/next row.
fillPreviousNext()
Fill previous/next row.
setGuiObject(&$a_gui_object)
Set GuiObject.
setProperties($a_properties)
This function is supposed to be used for block type specific properties, that should be inherited thr...
getListItemForData(array $data)
Get list item for data array.
setRepositoryMode($a_repositorymode)
Set RepositoryMode.
setPreviousNextLinks()
Get previous/next linkbar.
setProperty($a_property, $a_value)
getSubtitle()
Get Subtitle.
static _lookupType($a_id, $a_reference=false)
lookup object type
special template class to simplify handling of ITX/PEAR
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static initConnection(ilGlobalTemplateInterface $a_main_tpl=null)
Init YUI Connection module.
if(isset($_FILES['img_file']) &&is_array($_FILES['img_file'])) $panel
Class ChatMainBarProvider \MainMenu\Provider.