Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ class ilDclRecordListGUI
public const MODE_MANAGE = "manage";
public const CMD_LIST_RECORDS = 'listRecords';
public const CMD_SHOW = 'show';
public const CMD_CONFIRM_DELETE_RECORDS = 'confirmDeleteRecords';
public const CMD_CANCEL_DELETE = 'cancelDelete';
public const CMD_DELETE_RECORDS = 'deleteRecords';
public const CMD_SHOW_IMPORT_EXCEL = 'showImportExcel';
Expand Down Expand Up @@ -131,9 +130,6 @@ public function executeCommand(): void
$this->setSubTabs($this->mode);
$this->listRecords();
break;
case self::CMD_CONFIRM_DELETE_RECORDS:
$this->confirmDeleteRecords();
break;
case self::CMD_DELETE_RECORDS:
$this->deleteRecords();
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

declare(strict_types=1);

use ILIAS\UI\Component\Modal\Modal;

class ilDclRecordListTableGUI extends ilTable2GUI
{
public const EXPORT_EXCEL_ASYNC = 10;
Expand All @@ -37,6 +39,8 @@ class ilDclRecordListTableGUI extends ilTable2GUI
protected ilLanguage $lng;
protected \ILIAS\DI\UIServices $ui;
protected bool $page_active = false;
/** @var Modal[] */
protected array $table_modals = [];

public function __construct(
ilDclRecordListGUI $a_parent_obj,
Expand Down Expand Up @@ -168,7 +172,6 @@ private function buildData(): void
$title = $field->getTitle();
$record_data[$title] = $record->getRecordFieldHTML($field->getId(), ['tableview_id' => $this->tableview->getId()]);

// Additional column filled in ::fillRow() method, showing the learning progress
if ($field->getProperty(ilDclBaseFieldModel::PROP_LEARNING_PROGRESS)) {
$record_data["_status_" . $title] = $this->getStatus($record, $field);
}
Expand All @@ -183,6 +186,7 @@ private function buildData(): void
$this->ctrl->setParameterByClass(ilDclRecordEditGUI::class, "record_id", $record->getId());
$this->ctrl->setParameterByClass(ilDclRecordEditGUI::class, "mode", $this->mode);

$content = [];
$action_links = [];

if ($this->page_active) {
Expand All @@ -201,10 +205,18 @@ private function buildData(): void
}

if ($record->hasPermissionToDelete($this->parent_obj->getRefId())) {
$action_links[] = $this->ui->factory()->link()->standard(
$this->ctrl->setParameterByClass(ilDclRecordEditGUI::class, "record_id", $record->getId());
$modal = $this->ui->factory()->modal()->interruptive(
$this->lng->txt('delete'),
sprintf($this->lng->txt('dcl_confirm_delete_record'), $record->getId()),
$this->ctrl->getLinkTargetByClass(ilDclRecordEditGUI::class, 'delete')
);
$this->ctrl->clearParameterByClass(ilDclRecordEditGUI::class, "record_id");
$action_links[] = $this->ui->factory()->button()->shy(
$this->lng->txt('delete'),
$this->ctrl->getLinkTargetByClass(ilDclRecordEditGUI::class, 'confirmDelete')
$modal->getShowSignal()
);
$this->table_modals[] = $modal;
}

if ($this->table->getPublicCommentsEnabled()) {
Expand All @@ -228,6 +240,11 @@ private function buildData(): void
$this->setData($data);
}

public function getHTML(): string
{
return parent::getHTML() . $this->ui->renderer()->render($this->table_modals);
}

protected function fillRow(array $a_set): void
{
$record_obj = $a_set['_record'];
Expand Down Expand Up @@ -296,9 +313,6 @@ protected function needsActionRow(): bool
return false;
}

/**
* @description This adds the column for status.
*/
protected function getStatus(ilDclBaseRecordModel $record, ilDclBaseFieldModel $field): string
{
$record_field = ilDclCache::getRecordFieldCache($record, $field);
Expand Down Expand Up @@ -343,10 +357,6 @@ public function applyFilter($field_id, $filter_value)
}
}

/**
* @param string $type
* @return string
*/
public function loadProperty(string $type): string
{
if ($this->getId() && $this->userId > 0) {
Expand All @@ -356,9 +366,6 @@ public function loadProperty(string $type): string
return "";
}

/**
* @description Get the ajax link for displaying the comments in the right panel (to be wrapped in an onclick attr)
*/
protected function getCommentJsLinkCode(int $recordId): string
{
$ajax_hash = ilCommonActionDispatcherGUI::buildAjaxHash(
Expand All @@ -373,9 +380,6 @@ protected function getCommentJsLinkCode(int $recordId): string
return ilNoteGUI::getListCommentsJSCall($ajax_hash, '');
}

/**
* Exports the table
*/
public function exportData(
int $format,
bool $send = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,16 @@
class ilDclCreateViewTableGUI extends ilTable2GUI
{
public const VALID_DEFAULT_VALUE_TYPES = [
ilDclDatatype::INPUTFORMAT_NUMBER,
ilDclDatatype::INPUTFORMAT_TEXT,
ilDclDatatype::INPUTFORMAT_NUMBER,
ilDclDatatype::INPUTFORMAT_BOOLEAN,
ilDclDatatype::INPUTFORMAT_DATE,
ilDclDatatype::INPUTFORMAT_DATETIME,
ilDclDatatype::INPUTFORMAT_TEXT_SELECTION,
ilDclDatatype::INPUTFORMAT_DATE_SELECTION,
ilDclDatatype::INPUTFORMAT_DATETIME_SELECTION,
ilDclDatatype::INPUTFORMAT_REFERENCE,
ilDclDatatype::INPUTFORMAT_COPY,
];

public function __construct(ilDclCreateViewDefinitionGUI $a_parent_obj)
Expand Down Expand Up @@ -176,8 +183,7 @@ public function fillRowFromObject(ilDclTableViewFieldSetting $a_set): void
$field = $a_set->getFieldObject();
$match = ilDclTableViewBaseDefaultValue::findSingle($field->getDatatypeId(), $a_set->getId());

/** @var ilDclTextInputGUI $item */
$item = ilDclCache::getFieldRepresentation($field)->getInputField(new ilPropertyFormGUI());
$item = ilDclCache::getFieldRepresentation($field)->getInputField();

if (!is_null($match)) {
if ($item instanceof ilDclCheckboxInputGUI) {
Expand All @@ -198,21 +204,22 @@ public function fillRowFromObject(ilDclTableViewFieldSetting $a_set): void
$this->tpl->setVariable('IS_VISIBLE', $a_set->isVisibleCreate() ? 'checked' : '');
$this->tpl->setVariable('IS_NOT_VISIBLE', !$a_set->isVisibleCreate() ? 'checked' : '');
if (!is_null($item) && in_array($field->getDatatypeId(), self::VALID_DEFAULT_VALUE_TYPES)) {
$name = "default_" . $a_set->getId() . "_" . $field->getDatatypeId();
$item->setPostVar($name);
if ($item instanceof ilTextAreaInputGUI) {
$replacement_box = new ilTextInputGUI();
$replacement_box->setPostVar($item->getPostVar());
$replacement_box->setValue($item->getValue());
$this->tpl->setVariable('INPUT', $replacement_box->render());
} else {
$this->tpl->setVariable('INPUT', $item->render());
}

// Workaround as empty checkboxes do not get posted
if ($item instanceof ilDclCheckboxInputGUI) {
$this->tpl->setVariable('EXTRA_INPUT', "<input type=\"hidden\" name=\"$name\" value=\"0\" />");
}
/* $name = "default_" . $a_set->getId() . "_" . $field->getDatatypeId();
$item->setPostVar($name);
if ($item instanceof ilTextAreaInputGUI) {
$replacement_box = new ilTextInputGUI();
$replacement_box->setPostVar($item->getPostVar());
$replacement_box->setValue($item->getValue());
$this->tpl->setVariable('INPUT', $replacement_box->render());
} else {
$this->tpl->setVariable('INPUT', $item->render());
}

// Workaround as empty checkboxes do not get posted
if ($item instanceof ilDclCheckboxInputGUI) {
$this->tpl->setVariable('EXTRA_INPUT', "<input type=\"hidden\" name=\"$name\" value=\"0\" />");
}*/
$this->tpl->setVariable('INPUT', 'TBD');
}
} else {
$this->tpl->setVariable('HIDDEN', 'hidden');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public function renderRecord(bool $editComments = false): void
$DIC->toolbar()->addSpacer('100%');
$this->ctrl->setParameterByClass(ilDclRecordEditGUI::class, 'table_id', $this->table->getId());
$this->ctrl->setParameterByClass(ilDclRecordEditGUI::class, 'tableview_id', $this->tableview_id);
$this->ctrl->setParameterByClass(ilDclRecordEditGUI::class, 'redirect', ilDclRecordEditGUI::REDIRECT_DETAIL);
$this->ctrl->setParameterByClass(ilDclRecordEditGUI::class, 'detail', 1);
$this->ctrl->saveParameterByClass(ilDclRecordEditGUI::class, 'record_id');
$DIC->toolbar()->addComponent($DIC->ui()->factory()->button()->standard(
$this->lng->txt('edit'),
Expand Down
Loading