ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilObjectCopySearchResultTableGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
29{
30 protected ilObjUser $user;
32 protected string $type;
33 protected ?int $selected_reference = null;
34
35 public function __construct(?object $parent_class, string $parent_cmd, string $type)
36 {
37 global $DIC;
38
39 $this->user = $DIC->user();
40 $this->obj_definition = $DIC["objDefinition"];
41
42 $this->setId('obj_copy_' . $type);
43 parent::__construct($parent_class, $parent_cmd);
44 $this->type = $type;
45
46 if (!$this->obj_definition->isPlugin($this->type)) {
47 $title = $this->lng->txt('obj_' . $this->type . '_duplicate');
48 } else {
50 $title = $plugin->txt('obj_' . $this->type . '_duplicate');
51 }
52
53 $this->setTitle($title);
54 $this->user->getPref('search_max_hits');
55
56 $this->addColumn($this->lng->txt('search_title_description'), 'title', '99%');
57
58 $this->setEnableHeader(true);
59 $this->setRowTemplate("tpl.obj_copy_search_result_row.html", "components/ILIAS/ILIASObject");
60 $this->setEnableTitle(true);
61 $this->setEnableNumInfo(true);
62 $this->setDefaultOrderField('title');
63 $this->setShowRowsSelector(true);
64
65 if ($this->obj_definition->isContainer($this->type)) {
66 $this->addCommandButton('saveSource', $this->lng->txt('btn_next'));
67 } else {
68 $this->addCommandButton('saveSource', $title);
69 }
70
71 $this->addCommandButton('cancel', $this->lng->txt('cancel'));
72 }
73
74 public function setSelectedReference(int $selected_reference): void
75 {
76 $this->selected_reference = $selected_reference;
77 }
78
79 public function getSelectedReference(): ?int
80 {
82 }
83
84 public function parseSearchResults(array $res): void
85 {
86 $rows = [];
87 foreach ($res as $obj_id => $references) {
88 $r['title'] = ilObject::_lookupTitle($obj_id);
89 $r['desc'] = ilObject::_lookupDescription($obj_id);
90 $r['obj_id'] = $obj_id;
91 $r['refs'] = $references;
92
93 $rows[] = $r;
94 }
95
96 $this->setData($rows);
97 }
98
99 protected function fillRow(array $set): void
100 {
101 $this->tpl->setVariable('VAL_TITLE', $set['title']);
102 if (strlen($set['desc'])) {
103 $this->tpl->setVariable('VAL_DESC', $set['desc']);
104 }
105 $this->tpl->setVariable('TXT_PATHES', $this->lng->txt('pathes'));
106
107 foreach ((array) $set['refs'] as $reference) {
108 $path = new ilPathGUI();
109
110 $this->tpl->setCurrentBlock('path');
111 $this->tpl->setVariable('VAL_ID', $reference);
112 $this->tpl->setVariable('VAL_PATH', $path->getPath(ROOT_FOLDER_ID, (int) $reference));
113
114 if ($reference == $this->getSelectedReference()) {
115 $this->tpl->setVariable('VAL_CHECKED', 'checked="checked"');
116 }
117
118 $this->tpl->parseCurrentBlock();
119 }
120 }
121}
User class.
fillRow(array $set)
Standard Version of Fill Row.
__construct(?object $parent_class, string $parent_cmd, string $type)
parses the objects.xml it handles the xml-description of all ilias objects
static getPluginObjectByType(string $type)
Return either a repoObject plugin or a orgunit extension plugin or null if the type is not a plugin.
static _lookupTitle(int $obj_id)
static _lookupDescription(int $obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setShowRowsSelector(bool $a_value)
Toggle rows-per-page selector.
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
setEnableNumInfo(bool $a_val)
addCommandButton(string $a_cmd, string $a_text, string $a_onclick='', string $a_id="", string $a_class="")
setEnableTitle(bool $a_enabletitle)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
setEnableHeader(bool $a_enableheader)
setDefaultOrderField(string $a_defaultorderfield)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setId(string $a_val)
setData(array $a_data)
Set table data.
const ROOT_FOLDER_ID
Definition: constants.php:32
$path
Definition: ltiservices.php:30
$res
Definition: ltiservices.php:69
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26