19declare(strict_types=1);
38 protected \ILIAS\DI\UIServices
$ui;
49 $this->
ctrl = $DIC->ctrl();
50 $this->userId =
$DIC->user()->getId();
51 $this->
lng = $DIC->language();
52 $this->
ui = $DIC->ui();
54 $this->tableview = ilDclTableView::find($tableview_id);
55 $identifier =
'dcl_rl_' .
$table->
getId() .
'_' . $tableview_id;
58 $this->
setId($identifier);
60 $this->page_active = $page->getPageObject()->isActive();
64 $this->parent_obj = $a_parent_obj;
65 $this->
setRowTemplate(
"tpl.record_list_row.html",
"components/ILIAS/DataCollection");
76 if ($this->page_active) {
80 $this->numeric_fields = [];
81 foreach ($this->tableview->getVisibleFields() as $field) {
82 $title = $field->getTitle();
83 $sort_field = ($field->getRecordQuerySortObject() !=
null) ? $field->getSortField() :
'';
85 if ($field->hasNumericSorting()) {
86 $this->numeric_fields[] =
$title;
91 $this->
addColumn($this->
lng->txt(
"dcl_status"),
"_status_" . $field->getTitle());
101 $default_sort_title =
'id';
102 if ($fieldId = $this->table->getDefaultSortField()) {
106 if ($stdField->getId() == $fieldId) {
107 $default_sort_title = $stdField->getTitle();
118 $this->parent_obj->getRefId(),
119 $this->table->getId()
124 $this->
ctrl->saveParameter($a_parent_obj,
'tableview_id');
126 $this->
setStyle(
'table', $this->
getStyle(
'table') .
' ' .
'dcl_record_list');
139 $this->object_data =
$data;
153 return in_array($a_field, $this->numeric_fields);
162 foreach ($this->object_data as $record) {
164 $record_data[
"_front"] =
null;
165 $record_data[
'_record'] = $record;
167 foreach ($this->tableview->getVisibleFields() as $field) {
168 $title = $field->getTitle();
169 $record_data[
$title] = $record->getRecordFieldHTML($field->getId(), [
'tableview_id' => $this->tableview->getId()]);
176 if ($field->getId() ==
'comments') {
177 $record_data[
'n_comments'] = $record->getNrOfComments();
181 $this->
ctrl->setParameterByClass(ilDclFieldEditGUI::class,
"record_id", $record->getId());
182 $this->
ctrl->setParameterByClass(ilDclDetailedViewGUI::class,
"table_id", $record->getTableId());
183 $this->
ctrl->setParameterByClass(ilDclDetailedViewGUI::class,
"record_id", $record->getId());
184 $this->
ctrl->setParameterByClass(ilDclDetailedViewGUI::class,
"tableview_id", $this->tableview->getId());
185 $this->
ctrl->setParameterByClass(ilDclRecordEditGUI::class,
"record_id", $record->getId());
186 $this->
ctrl->setParameterByClass(ilDclRecordEditGUI::class,
"tableview_id", $this->tableview->getId());
187 $this->
ctrl->setParameterByClass(ilDclRecordEditGUI::class,
"mode", $this->mode);
191 if ($this->page_active) {
192 $record_data[
"_front"] = $this->
ctrl->getLinkTargetByClass(ilDclDetailedViewGUI::class,
'renderRecord');
193 $action_links[] = $this->
ui->factory()->link()->standard(
194 $this->
lng->txt(
'view'),
195 $this->ctrl->getLinkTargetByClass(ilDclDetailedViewGUI::class,
'renderRecord')
199 if ($record->hasPermissionToEdit($this->parent_obj->getRefId())) {
200 $action_links[] = $this->
ui->factory()->link()->standard(
201 $this->
lng->txt(
'edit'),
202 $this->ctrl->getLinkTargetByClass(ilDclRecordEditGUI::class,
'edit')
206 if ($record->hasPermissionToDelete($this->parent_obj->getRefId())) {
207 $action_links[] = $this->
ui->factory()->link()->standard(
208 $this->
lng->txt(
'delete'),
209 $this->ctrl->getLinkTargetByClass(ilDclRecordEditGUI::class,
'confirmDelete')
213 if ($this->table->getPublicCommentsEnabled()) {
215 $action_links[] = $this->
ui->factory()->button()->shy(
216 $this->
lng->txt(
'dcl_comments'),
218 )->withAdditionalOnLoadCode(
function (
$id) use ($js_code) {
219 return "document.getElementById('$id').addEventListener('click',function()
225 $action_dropdown = $this->
ui->factory()->dropdown()->standard($action_links)
226 ->withLabel($this->
lng->txt(
"actions"));
227 $record_data[
"_actions"] = $this->
ui->renderer()->render($action_dropdown);
229 $data[] = $record_data;
234 protected function fillRow(array $a_set): void
236 $record_obj = $a_set[
'_record'];
242 foreach ($this->tableview->getVisibleFields() as $field) {
243 $title = $field->getTitle();
244 $this->tpl->setCurrentBlock(
"field");
245 $content = $a_set[
$title];
246 if ($content ===
false || $content ===
null) {
250 $this->tpl->setVariable(
"CONTENT", $content);
251 $this->tpl->parseCurrentBlock();
254 $this->tpl->setCurrentBlock(
"field");
255 $this->tpl->setVariable(
"CONTENT", $a_set[
"_status_" .
$title]);
256 $this->tpl->parseCurrentBlock();
260 if ($a_set[
"_front"]) {
261 $this->tpl->setCurrentBlock(
'view');
262 $this->tpl->setVariable(
264 $this->
ui->renderer()->render($this->ui->factory()->symbol()->glyph()->enlarge($a_set[
"_front"]))
266 $this->tpl->parseCurrentBlock();
269 if (strlen($a_set[
"_actions"]) > 0) {
270 $this->tpl->setCurrentBlock(
'actions');
271 $this->tpl->setVariable(
"ACTIONS", $a_set[
"_actions"]);
272 $this->tpl->parseCurrentBlock();
276 if ($record_obj->hasPermissionToDelete($this->parent_obj->getRefId())) {
277 $this->tpl->setCurrentBlock(
'mode_manage');
278 $this->tpl->setVariable(
'RECORD_ID', $record_obj->getId());
279 $this->tpl->parseCurrentBlock();
281 $this->tpl->touchBlock(
'mode_manage_no_owner');
288 if ($this->table->getPublicCommentsEnabled() || $this->page_active) {
292 foreach ($this->object_data as $record) {
293 if ($record->hasPermissionToEdit($this->parent_obj->getRefId()) ||
294 $record->hasPermissionToDelete($this->parent_obj->getRefId())) {
309 if ($status = $record_field->getStatus()) {
311 $return = $icons->renderIconForStatus($status->status);
319 foreach ($this->tableview->getFilterableFieldSettings() as $field_set) {
320 $field = $field_set->getFieldObject();
325 if (!$field_set->isFilterChangeable() || !$isset) {
326 $value = $field_set->getFilterValue();
327 $filter->setValueByArray($value);
330 if (!$field_set->isFilterChangeable()) {
333 $filter->__call(
'setDisabled', [
true]);
345 $this->
filter[
"filter_" . $field_id] = $filter_value;
355 if ($this->
getId() && $this->userId > 0) {
357 return $tab_prop->getProperty($this->
getId(), $this->userId, $type);
369 $this->parent_obj->getRefId(),
371 $this->parent_obj->getObjId(),
388 $this->parent_obj->getRefId(),
389 $this->table->getId(),
static buildAjaxHash(int $node_type, ?int $node_id, string $obj_type, int $obj_id, ?string $sub_type=null, ?int $sub_id=null, int $news_id=0)
Build ajax hash.
Class ilCtrl provides processing control methods.
const PROP_LEARNING_PROGRESS
static getRecordFieldCache(object $record, object $field)
static getFieldCache(int $field_id=0)
static getFieldRepresentation(ilDclBaseFieldModel $field)
@ilCtrl_Calls ilDclDetailedViewDefinitionGUI: ilPageEditorGUI, ilEditClipboardGUI,...
buildData()
@description Parse data from record objects to an array that is then set to this table with ::setData...
getFilter()
@description Return array of fields that are currently stored in the filter.
getCommentJsLinkCode(int $recordId)
@description Get the ajax link for displaying the comments in the right panel (to be wrapped in an on...
applyFilter($field_id, $filter_value)
exportData(int $format, bool $send=false)
Exports the table.
setRecordData(array $data)
numericOrdering(string $a_field)
Should this field be sorted numeric?
ilDclTableView $tableview
getStatus(ilDclBaseRecordModel $record, ilDclBaseFieldModel $field)
@description This adds the column for status.
loadProperty(string $type)
static _getStandardFields(int $table_id)
static _isStandardField($field_id)
static getInstance(int $variant=ilLPStatusIcons::ICON_VARIANT_DEFAULT, ?\ILIAS\UI\Renderer $renderer=null, ?\ILIAS\UI\Factory $factory=null)
static getListCommentsJSCall(string $a_hash, ?string $a_update_code=null)
Get list comments js call.
static hasAccessToFields(int $ref_id, int $table_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(?object $a_parent_obj, string $a_parent_cmd="", string $a_template_context="")
setShowRowsSelector(bool $a_value)
Toggle rows-per-page selector.
getFilterItemByPostVar(string $a_post_var)
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
setExportFormats(array $formats)
Set available export formats.
setEnableTitle(bool $a_enabletitle)
setFormName(string $a_name="")
addMultiCommand(string $a_cmd, string $a_text)
setPrefix(string $a_prefix)
set prefix for sort and offset fields (if you have two or more tables on a page that you want to sort...
setFormAction(string $a_form_action, bool $a_multipart=false)
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)
fillRow(array $a_set)
Standard Version of Fill Row.
setSelectAllCheckbox(string $a_select_all_checkbox, bool $a_select_all_on_top=false)
setTopCommands(bool $a_val)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setDefaultOrderDirection(string $a_defaultorderdirection)
setData(array $a_data)
Set table data.
setStyle(string $a_element, string $a_style)
getStyle(string $a_element)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
filter(string $filter_id, array $class_path, string $cmd, bool $activated=true, bool $expanded=true)
if(!file_exists('../ilias.ini.php'))