49        $this->
http = $DIC->http();
 
   52        $this->
ctrl = $DIC[
'ilCtrl'];
 
   53        $this->tpl = 
$DIC[
'tpl'];
 
   54        $this->
lng = $DIC[
'lng'];
 
   55        $this->
user = $DIC[
'ilUser'];
 
   57        $this->
http = $DIC->http();
 
   62        if ($this->
http->wrapper()->query()->has(
'record_id')) {
 
   63            $this->record_id = $this->
http->wrapper()->query()->retrieve(
 
   68        if ($this->
http->wrapper()->post()->has(
'record_id')) {
 
   69            $this->record_id = $this->
http->wrapper()->post()->retrieve(
 
   80        if ($has_ilfilehash) {
 
   82            $hash = $this->
http->wrapper()->post()->retrieve(
 
   84                $this->
refinery->kindlyTo()->string()
 
   86            foreach ($_FILES as $field => 
$data) {
 
   87                if (is_array(
$data[
"tmp_name"])) {
 
   88                    foreach (
$data[
"tmp_name"] as $idx => $upload) {
 
   89                        if (is_array($upload)) {
 
   90                            foreach ($upload as $idx2 => $file) {
 
   91                                if ($file && is_uploaded_file($file)) {
 
   92                                    $file_name = 
$data[
"name"][$idx][$idx2];
 
   93                                    $file_type = 
$data[
"type"][$idx][$idx2];
 
   94                                    $this->
form->keepTempFileUpload(
 
  106                            if ($upload && is_uploaded_file($upload)) {
 
  107                                $file_name = 
$data[
"name"][$idx];
 
  108                                $file_type = 
$data[
"type"][$idx];
 
  109                                $this->
form->keepTempFileUpload(
 
  121                    $this->
form->keepTempFileUpload(
 
  138        $cmd = $this->
ctrl->getCmd();
 
  144        $hasMode = $this->
http->wrapper()->query()->has(
'mode');
 
  146            $mode = $this->
http->wrapper()->query()->retrieve(
'mode', $this->
refinery->kindlyTo()->string());
 
  148            $this->
ctrl->saveParameter($this, 
'mode');
 
  149            $this->
ctrl->setParameterByClass(
"ildclrecordlistgui", 
"mode", $mode);
 
  151        $this->
ctrl->setParameterByClass(
'ildclrecordlistgui', 
'tableview_id', $this->tableview_id);
 
  152        $this->
ctrl->saveParameter($this, 
'redirect');
 
  153        if ($this->record_id) {
 
  155            if (!($this->record->hasPermissionToEdit($this->parent_obj->getRefId()) and $this->record->hasPermissionToView($this->parent_obj->getRefId())) && !$this->record->hasPermissionToDelete($this->parent_obj->getRefId())) {
 
  158            $this->table = $this->record->getTable();
 
  159            $this->table_id = $this->table->getId();
 
  162            $ref_id = $this->
http->wrapper()->query()->retrieve(
'ref_id', $this->
refinery->kindlyTo()->int());
 
  175        $this->tpl->setContent($this->
form->getHTML());
 
  187        $this->tpl->setContent($this->
form->getHTML());
 
  197        $conf->setFormAction($this->
ctrl->getFormAction($this));
 
  198        $conf->setHeaderText($this->
lng->txt(
'dcl_confirm_delete_record'));
 
  201        $all_fields = $this->table->getRecordFields();
 
  203        foreach ($all_fields as $field) {
 
  207            if ($record_representation->getConfirmationHTML() !== 
false) {
 
  208                $record_data .= $field->getTitle() . 
": " . $record_representation->getConfirmationHTML() . 
"<br />";
 
  211        $conf->addItem(
'record_id', 
$record->
getId(), $record_data);
 
  212        $conf->addHiddenItem(
'table_id', $this->table_id);
 
  213        $conf->addHiddenItem(
'tableview_id', $this->tableview_id);
 
  214        $conf->setConfirm($this->
lng->txt(
'delete'), 
'delete');
 
  215        $conf->setCancel($this->
lng->txt(
'cancel'), 
'cancelDelete');
 
  216        $this->tpl->setContent($conf->getHTML());
 
  224        $this->
ctrl->redirectByClass(
"ildclrecordlistgui", 
"listRecords");
 
  230    public function delete(): 
void 
  234        if (!$this->table->hasPermissionToDeleteRecord($this->parent_obj->getRefId(), 
$record)) {
 
  241        $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"dcl_record_deleted"), 
true);
 
  242        $this->
ctrl->redirectByClass(
"ildclrecordlistgui", 
"listRecords");
 
  253        $get_record_id = $this->
http->wrapper()->query()->retrieve(
'record_id', $this->
refinery->kindlyTo()->int());
 
  263        if ($this->
ctrl->isAsynch()) {
 
  264            echo json_encode($return);
 
  278        $prefix = ($this->
ctrl->isAsynch()) ? 
'dclajax' : 
'dcl'; 
 
  279        $this->
form->setId($prefix . $this->table_id . $this->record_id);
 
  282        $hidden_prop->setValue($this->table_id);
 
  283        $this->
form->addItem($hidden_prop);
 
  285        $hidden_prop->setValue($this->tableview_id);
 
  286        $this->
form->addItem($hidden_prop);
 
  287        if ($this->record_id) {
 
  289            $hidden_prop->setValue($this->record_id);
 
  290            $this->
form->addItem($hidden_prop);
 
  293        $this->
ctrl->setParameter($this, 
"record_id", $this->record_id);
 
  294        $this->
form->setFormAction($this->
ctrl->getFormAction($this));
 
  295        $allFields = $this->table->getRecordFields();
 
  297        foreach ($allFields as $field) {
 
  298            $field_setting = $field->getViewSetting($this->tableview_id);
 
  299            if ($field_setting->isVisibleInForm(!$this->record_id)) {
 
  301                if ($item === 
null) {
 
  306                    $item->setDisabled(
true);
 
  309                $item->setRequired($field_setting->isRequired(!$this->record_id));
 
  310                $default_value = 
null;
 
  313                if (!$this->record_id) {
 
  314                    $default_value = ilDclTableViewBaseDefaultValue::findSingle(
 
  315                        $field_setting->getFieldObject()->getDatatypeId(),
 
  316                        $field_setting->getId()
 
  319                    if ($default_value !== 
null) {
 
  321                            $item->setChecked($default_value->getValue());
 
  323                            $item->setValue($default_value->getValue());
 
  331                $this->
form->addItem($item);
 
  335        $this->tpl->addInlineCss($inline_css);
 
  338        if ($this->record_id) {
 
  339            $field_setting = $this->tableview->getFieldSetting(
'owner');
 
  340            if ($field_setting->isVisibleEdit()) {
 
  341                $ownerField = $this->table->getField(
'owner');
 
  345                    $inputfield->setDisabled(
true);
 
  347                    $inputfield->setRequired(
true);
 
  350                $this->
form->addItem($inputfield);
 
  355        if ($this->record_id) {
 
  356            $this->
form->setTitle($this->
lng->txt(
"dcl_update_record"));
 
  357            $this->
form->addCommandButton(
"save", $this->
lng->txt(
"dcl_update_record"));
 
  358            if (!$this->
ctrl->isAsynch()) {
 
  359                $this->
form->addCommandButton(
"cancelUpdate", $this->
lng->txt(
"cancel"));
 
  362            $this->
form->setTitle($this->
lng->txt(
"dcl_add_new_record"));
 
  363            $this->
form->addCommandButton(
"save", $this->
lng->txt(
"save"));
 
  364            if (!$this->
ctrl->isAsynch()) {
 
  365                $this->
form->addCommandButton(
"cancelSave", $this->
lng->txt(
"cancel"));
 
  368        $this->
ctrl->setParameter($this, 
"tableview_id", $this->tableview_id);
 
  369        $this->
ctrl->setParameter($this, 
"table_id", $this->table_id);
 
  370        $this->
ctrl->setParameter($this, 
"record_id", $this->record_id);
 
  380        if ($record_obj->getId()) {
 
  382            $allFields = $this->table->getFields();
 
  383            foreach ($allFields as $field) {
 
  385                    $field->getViewSetting($this->tableview_id)->isVisibleEdit()) {
 
  386                    $record_obj->fillRecordFieldFormInput($field->getId(), $this->form);
 
  390            $this->
form->setValuesByPost();
 
  421            $all_fields = $this->table->getRecordFields();
 
  423            $all_fields = $this->table->getEditableFields(!$this->record_id);
 
  432        $confirmation->setFormAction($this->
ctrl->getFormAction($this));
 
  433        $header_text = $this->
lng->txt(
'dcl_confirm_storing_records');
 
  435            && !$this->table->getEditByOwner()
 
  436            && !$this->table->getEditPerm()
 
  438            $header_text .= 
" " . $this->
lng->txt(
'dcl_confirm_storing_records_no_permission');
 
  440        $confirmation->setHeaderText($header_text);
 
  442        $confirmation->setCancel($this->
lng->txt(
'dcl_edit_record'), 
'edit');
 
  443        $confirmation->setConfirm($this->
lng->txt(
'dcl_save_record'), 
'save');
 
  447        $empty_fileuploads = array();
 
  448        foreach ($all_fields as $field) {
 
  451            $record_field->addHiddenItemsToConfirmation($confirmation);
 
  454                && $record_field->getValue() == 
null 
  456                $empty_fileuploads[
'field_' . $field->getId()] = [
 
  466            if ($record_representation->getConfirmationHTML() !== 
false) {
 
  467                $record_data .= $field->getTitle() . 
": " . $record_representation->getConfirmationHTML() . 
"<br />";
 
  471        $confirmation->addHiddenItem(
'ilfilehash', $filehash);
 
  472        $confirmation->addHiddenItem(
'empty_fileuploads', htmlspecialchars(json_encode($empty_fileuploads)));
 
  473        $confirmation->addHiddenItem(
'table_id', $this->table_id);
 
  474        $confirmation->addHiddenItem(
'tableview_id', $this->tableview_id);
 
  475        $confirmation->addItem(
'save_confirmed', 1, $record_data);
 
  477        if ($this->
ctrl->isAsynch()) {
 
  478            echo $confirmation->getHTML();
 
  481            $this->tpl->setContent($confirmation->getHTML());
 
  491        $ilAppEventHandler = 
$DIC[
'ilAppEventHandler'];
 
  497        $has_save_confirmed = $this->
http->wrapper()->post()->has(
'save_confirmed');
 
  498        $has_ilfilehash = $this->
http->wrapper()->post()->has(
'ilfilehash');
 
  499        $has_record_id = isset($this->record_id);
 
  500        $table_has_save_confirmation = $this->table->getSaveConfirmation();
 
  502        $ilfilehash = $has_ilfilehash ? $this->
http->wrapper()->post()->retrieve(
 
  504            $this->
refinery->kindlyTo()->string()
 
  509        if ($table_has_save_confirmation
 
  510            && $has_save_confirmed
 
  513            && !$this->
ctrl->isAsynch()
 
  515            $has_empty_fileuploads = $this->
http->wrapper()->post()->has(
'empty_fileuploads');
 
  518            if ($has_empty_fileuploads) {
 
  519                $empty_fileuploads = $this->
http->wrapper()->post()->retrieve(
 
  521                    $this->
refinery->kindlyTo()->string()
 
  523                if (json_decode($empty_fileuploads)) {
 
  524                    $_FILES = $_FILES + json_decode($empty_fileuploads, 
true);
 
  531        $create_mode = ($this->record_id == 
null);
 
  535        $unchanged_obj = $record_obj;
 
  541            $all_fields = $this->table->getRecordFields();
 
  543            $all_fields = $this->table->getEditableFields(!$this->record_id);
 
  547        foreach ($all_fields as $field) {
 
  549                $field->checkValidityFromForm($this->
form, $this->record_id);
 
  552                $item = $this->
form->getItemByPostVar(
'field_' . $field->getId());
 
  562            $this->
form->setValuesByPost();
 
  563            $this->tpl->setContent($this->
form->getHTML());
 
  571                $this->parent_obj->getRefId(),
 
  580            if ($table_has_save_confirmation && $this->
form->getInput(
'save_confirmed') == 
null && !$this->ctrl->isAsynch()) {
 
  584                foreach ($all_fields as $field) {
 
  588                $this->saveConfirmation($record_obj, $hash);
 
  598            $this->record_id = $record_obj->
getId();
 
  608        foreach ($all_fields as $field) {
 
  609            $field_setting = $field->getViewSetting($this->tableview_id);
 
  611            if ($field_setting->isVisibleInForm($create_mode) &&
 
  615            } elseif ($create_mode) {
 
  617                $default_value = ilDclTableViewBaseDefaultValue::findSingle(
 
  618                    $field_setting->getFieldObject()->getDatatypeId(),
 
  619                    $field_setting->getId()
 
  621                if ($default_value !== 
null) {
 
  628        if (!$create_mode && $this->tableview->getFieldSetting(
'owner')->isVisibleEdit()) {
 
  629            if ($this->
http->wrapper()->post()->has(
'field_owner')) {
 
  630                $field_owner = $this->
http->wrapper()->post()->retrieve(
 
  632                    $this->
refinery->kindlyTo()->string()
 
  644        $dispatchEvent = 
"update";
 
  646        $dispatchEventData = array(
 
  647                'dcl' => $this->parent_obj->getDataCollectionObject(),
 
  648                'table_id' => $this->table_id,
 
  649                'record_id' => $record_obj->
getId(),
 
  650                'record' => $record_obj,
 
  654            $dispatchEvent = 
"create";
 
  655            $ref_id = $this->
http->wrapper()->query()->retrieve(
'ref_id', $this->
refinery->kindlyTo()->int());
 
  657            $objDataCollection->sendNotification(
"new_record", $this->table_id, $record_obj->
getId());
 
  659            $dispatchEventData[
'prev_record'] = $unchanged_obj;
 
  662        $record_obj->
doUpdate($create_mode);
 
  664        $ilAppEventHandler->raise(
 
  665            'Modules/DataCollection',
 
  666            $dispatchEvent . 
'Record',
 
  670        $this->
ctrl->setParameter($this, 
"table_id", $this->table_id);
 
  671        $this->
ctrl->setParameter($this, 
"tableview_id", $this->tableview_id);
 
  672        $this->
ctrl->setParameter($this, 
"record_id", $this->record_id);
 
  674        if (!$this->
ctrl->isAsynch()) {
 
  675            $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"msg_obj_modified"), 
true);
 
  679        if ($this->
ctrl->isAsynch()) {
 
  681            $this->record_id = $record_obj->
getId();
 
  685                $this->
lng->txt(
'msg_obj_modified'),
 
  687            ) . $this->
form->getHTML();
 
  690            $this->
ctrl->redirectByClass(
"ildclrecordlistgui", 
"listRecords");
 
  699        $hasRedirect = $this->
http->wrapper()->query()->has(
'redirect');
 
  701        if ($force_redirect || ($hasRedirect && !$this->
ctrl->isAsynch())) {
 
  703                $redirect = $this->
http->wrapper()->query()->retrieve(
'redirect', $this->
refinery->kindlyTo()->int());
 
  706                        $this->
ctrl->setParameterByClass(
'ilDclDetailedViewGUI', 
'record_id', $this->record_id);
 
  707                        $this->
ctrl->setParameterByClass(
'ilDclDetailedViewGUI', 
'table_id', $this->table_id);
 
  708                        $this->
ctrl->setParameterByClass(
'ilDclDetailedViewGUI', 
'tableview_id', $this->tableview_id);
 
  709                        $this->
ctrl->redirectByClass(
"ilDclDetailedViewGUI", 
"renderRecord");
 
  712                        $this->
ctrl->redirectByClass(
"ildclrecordlistgui", 
"listRecords");
 
  716            $this->
ctrl->redirectByClass(
"ildclrecordlistgui", 
"listRecords");
 
  722        if (!$this->
ctrl->isAsynch()) {
 
  723            $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'dcl_msg_no_perm_edit'), 
true);
 
  724            $this->
ctrl->redirectByClass(
'ildclrecordlistgui', 
'listRecords');
 
  726            echo $this->
lng->txt(
'dcl_msg_no_perm_edit');
 
  733        $keep = !$this->
ctrl->isAsynch();
 
  734        $this->
form->setValuesByPost();
 
  735        if ($this->
ctrl->isAsynch()) {
 
  739            $this->tpl->setOnScreenMessage(
'failure', 
$message, $keep);
 
  742            if (isset($this->record_id) && $this->record_id) {
 
  744                if ($record_obj->
getId()) {
 
  746                    $allFields = $this->table->getFields();
 
  747                    foreach ($allFields as $field) {
 
  748                        $field_setting = $field->getViewSetting($this->tableview_id);
 
  750                            $field_setting->isLockedEdit() &&
 
  751                            $field_setting->isVisibleEdit()
 
  758            $this->tpl->setContent($this->
form->getHTML());
 
  767        $search = $this->
http->wrapper()->post()->retrieve(
'search_for', $this->
refinery->kindlyTo()->string());
 
  768        $dest = $this->
http->wrapper()->post()->retrieve(
'dest', $this->
refinery->kindlyTo()->string());
 
  771        $query_parser->setMinWordLength(1);
 
  773        $query_parser->parse();
 
  774        if (!$query_parser->validate()) {
 
  775            $html .= $query_parser->getMessage() . 
"<br />";
 
  780        $res = $object_search->performSearch();
 
  785            $html .= $this->
lng->txt(
'dcl_no_search_results_found_for') . 
' ' . $search . 
"<br />";
 
  790            $tpl = 
new ilTemplate(
"tpl.dcl_tree.html", 
true, 
true, 
"Modules/DataCollection");
 
  791            foreach ((array) $entry[
'refs'] as $reference) {
 
  818        foreach ($a_res as $obj_id => $references) {
 
  822            $r[
'obj_id'] = $obj_id;
 
  823            $r[
'refs'] = $references;
 
  835        $has_ilfilehash = $this->
http->wrapper()->post()->has(
'ilfilehash');
 
  836        if ($has_ilfilehash) {
 
  837            $ilfilehash = $this->
http->wrapper()->post()->retrieve(
'ilfilehash', $this->
refinery->kindlyTo()->string());
 
  838            $this->
form->cleanupTempFiles($ilfilehash);
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
Class ilCtrl provides processing control methods.
 
@classDescription Date and time handling
 
getRecordField(int $field_id)
 
setLastUpdate(ilDateTime $a_datetime)
 
doDelete(bool $omit_notification=false)
 
fillRecordFieldFormInput($field_id, ilPropertyFormGUI $form)
 
setLastEditBy(?int $last_edit_by)
 
hasPermissionToEdit(int $ref_id)
 
setCreateDate(ilDateTime $a_datetime)
 
doUpdate(bool $omit_notification=false)
 
setRecordFieldValueFromForm(int $field_id, ilPropertyFormGUI $form)
Set a field value.
 
setRecordFieldValue($field_id, $value)
 
static getRecordCache(?int $record_id)
 
static getRecordFieldCache(object $record, object $field)
 
static getRecordRepresentation(ilDclBaseRecordFieldModel $record_field)
Returns a record representation.
 
static getTableCache(int $table_id=null)
 
static getFieldRepresentation(ilDclBaseFieldModel $field)
 
static getRecordRepresentationInstance(ilDclBaseRecordFieldModel $record_field)
Get RecordRepresentation from RecordFieldModel.
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
ILIAS Refinery Factory $refinery
 
confirmDelete()
Delete confirmation.
 
initForm()
init Form @move move parts to RecordRepresentationGUI
 
ilGlobalPageTemplate $tpl
 
searchObjects()
This function is only used by the ajax request if searching for ILIAS references.
 
cancelDelete()
Cancel deletion.
 
setFormValues()
Set values from object to form.
 
cleanupTempFiles()
Cleanup temp-files.
 
ilDclPropertyFormGUI $form
 
rebuildUploadsForFileHash(bool $has_ilfilehash)
 
ilDclBaseRecordModel $record
 
checkAndPerformRedirect(bool $force_redirect=false)
Checks to what view (table or detail) should be redirected and performs redirect.
 
cancelUpdate()
Cancel Update.
 
sendFailure(string $message)
 
getRecordData(int $record_id=0)
Return All fields and values from a record ID.
 
__construct(ilObjDataCollectionGUI $parent_obj, int $table_id, int $tableview_id)
 
const REDIRECT_RECORD_LIST
Possible redirects after saving/updating a record - use GET['redirect'] to set constants.
 
create()
Create new record gui.
 
ILIAS HTTP Services $http
 
ilObjDataCollectionGUI $parent_obj
 
parseSearchResults(array $a_res)
Parse search results.
 
ilDclTableView $tableview
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
static findOrGetInstance($primary_key, array $add_constructor_args=array())
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
setCurrentBlock(string $blockname=self::DEFAULT_BLOCK)
Sets the template to the given block.
 
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
 
setVariable(string $variable, $value='')
Sets the given variable to the given value.
 
parseCurrentBlock(string $blockname=self::DEFAULT_BLOCK)
Parses the given block.
 
static hasWriteAccess(int $ref, ?int $user_id=0)
 
static hasPermissionToAddRecord(int $ref_id, int $table_id)
 
static hasEditAccess(int $ref, ?int $user_id=0)
 
static hasAddRecordAccess(int $ref, ?int $user_id=0)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
static _lookupId($a_user_str)
 
static _lookupTitle(int $obj_id)
 
static _lookupDescription(int $obj_id)
 
Creates a path for a start and endnode.
 
special template class to simplify handling of ITX/PEAR
 
static getSystemMessageHTML(string $a_txt, string $a_type="info")
Get HTML for a system message.
 
static http()
Fetches the global http state from ILIAS.
 
form( $class_path, string $cmd)