80        $ilCtrl = 
$DIC[
'ilCtrl'];
 
   85        $this->ctrl = $ilCtrl;
 
   90        $this->record_id = $_REQUEST[
'record_id'];
 
   91        $this->table_id = $_REQUEST[
'table_id'];
 
   92        $this->tableview_id = $_REQUEST[
'tableview_id'];
 
   93        if (!$this->tableview_id) {
 
   95                                         ->getFirstTableViewId($this->parent_obj->ref_id);
 
  108        $cmd = $this->ctrl->getCmd();
 
  125            $this->ctrl->saveParameter($this, 
'mode');
 
  126            $this->ctrl->setParameterByClass(
"ildclrecordlistgui", 
"mode", 
$_GET[
'mode']);
 
  128        $this->ctrl->setParameterByClass(
'ildclrecordlistgui', 
'tableview_id', $this->tableview_id);
 
  129        $this->ctrl->saveParameter($this, 
'redirect');
 
  130        if ($this->record_id) {
 
  132            if (!($this->record->hasPermissionToEdit($this->parent_obj->ref_id) and $this->record->hasPermissionToView($this->parent_obj->ref_id)) && !$this->record->hasPermissionToDelete($this->parent_obj->ref_id)) {
 
  135            $this->table = $this->record->getTable();
 
  136            $this->table_id = $this->table->getId();
 
  152        if ($this->ctrl->isAsynch()) {
 
  153            echo $this->form->getHTML();
 
  156            $this->tpl->setContent(
 
  158                . $this->form->getHTML()
 
  173        if ($this->ctrl->isAsynch()) {
 
  174            echo $this->form->getHTML();
 
  177            $this->tpl->setContent(
 
  179                . $this->form->getHTML()
 
  193        $conf->setFormAction($this->ctrl->getFormAction($this));
 
  194        $conf->setHeaderText($this->lng->txt(
'dcl_confirm_delete_record'));
 
  197        $all_fields = $this->table->getRecordFields();
 
  199        foreach ($all_fields as $key => $field) {
 
  203            if ($record_representation->getConfirmationHTML() !== 
false) {
 
  204                $record_data .= $field->getTitle() . 
": " . $record_representation->getConfirmationHTML() . 
"<br />";
 
  207        $conf->addItem(
'record_id', 
$record->getId(), $record_data);
 
  208        $conf->addHiddenItem(
'table_id', $this->table_id);
 
  209        $conf->addHiddenItem(
'tableview_id', $this->tableview_id);
 
  210        $conf->setConfirm($this->lng->txt(
'delete'), 
'delete');
 
  211        $conf->setCancel($this->lng->txt(
'cancel'), 
'cancelDelete');
 
  212        $this->tpl->setContent($conf->getHTML());
 
  221        $this->ctrl->redirectByClass(
"ildclrecordlistgui", 
"listRecords");
 
  228    public function delete()
 
  232        if (!$this->table->hasPermissionToDeleteRecord($this->parent_obj->ref_id, 
$record)) {
 
  239        ilUtil::sendSuccess($this->lng->txt(
"dcl_record_deleted"), 
true);
 
  240        $this->ctrl->redirectByClass(
"ildclrecordlistgui", 
"listRecords");
 
  259                $return = 
$record->getRecordFieldValues();
 
  262        if ($this->ctrl->isAsynch()) {
 
  263            echo json_encode($return);
 
  279        $prefix = ($this->ctrl->isAsynch()) ? 
'dclajax' : 
'dcl'; 
 
  280        $this->form->setId($prefix . $this->table_id . $this->record_id);
 
  283        $hidden_prop->setValue($this->table_id);
 
  284        $this->form->addItem($hidden_prop);
 
  286        $hidden_prop->setValue($this->tableview_id);
 
  287        $this->form->addItem($hidden_prop);
 
  288        if ($this->record_id) {
 
  290            $hidden_prop->setValue($this->record_id);
 
  291            $this->form->addItem($hidden_prop);
 
  294        $this->ctrl->setParameter($this, 
"record_id", $this->record_id);
 
  295        $this->form->setFormAction($this->ctrl->getFormAction($this));
 
  296        $allFields = $this->table->getRecordFields();
 
  298        foreach ($allFields as $field) {
 
  299            $field_setting = $field->getViewSetting($this->tableview_id);
 
  300            if ($field_setting->isVisibleInForm(!$this->record_id)) {
 
  302                if ($item === 
null) {
 
  307                    $item->setDisabled(
true);
 
  310                $item->setRequired($field_setting->isRequired(!$this->record_id));
 
  311                $default_value = 
null;
 
  314                if (!$this->record_id) {
 
  317                    if ($default_value !== 
null) {
 
  319                            $item->setChecked($default_value->getValue());
 
  321                            $item->setValue($default_value->getValue());
 
  325                $this->form->addItem($item);
 
  329        $this->tpl->addInlineCss($inline_css);
 
  332        if ($this->record_id) {
 
  333            $field_setting = $this->tableview->getFieldSetting(
'owner');
 
  334            if ($field_setting->isVisibleEdit()) {
 
  335                $ownerField = $this->table->getField(
'owner');
 
  339                    $inputfield->setDisabled(
true);
 
  341                    $inputfield->setRequired(
true);
 
  344                $this->form->addItem($inputfield);
 
  349        if ($this->record_id) {
 
  350            $this->form->setTitle($this->lng->txt(
"dcl_update_record"));
 
  351            $this->form->addCommandButton(
"save", $this->lng->txt(
"dcl_update_record"));
 
  352            if (!$this->ctrl->isAsynch()) {
 
  353                $this->form->addCommandButton(
"cancelUpdate", $this->lng->txt(
"cancel"));
 
  356            $this->form->setTitle($this->lng->txt(
"dcl_add_new_record"));
 
  357            $this->form->addCommandButton(
"save", $this->lng->txt(
"save"));
 
  358            if (!$this->ctrl->isAsynch()) {
 
  359                $this->form->addCommandButton(
"cancelSave", $this->lng->txt(
"cancel"));
 
  362        $this->ctrl->setParameter($this, 
"tableview_id", $this->tableview_id);
 
  363        $this->ctrl->setParameter($this, 
"table_id", $this->table_id);
 
  364        $this->ctrl->setParameter($this, 
"record_id", $this->record_id);
 
  377        if ($record_obj->getId()) {
 
  379            $allFields = $this->table->getFields();
 
  380            foreach ($allFields as $field) {
 
  382                    $field->getViewSetting($this->tableview_id)->isVisibleEdit()) {
 
  383                    $record_obj->fillRecordFieldFormInput($field->getId(), $this->form);
 
  387            $this->form->setValuesByPost();
 
  416            $all_fields = $this->table->getRecordFields();
 
  418            $all_fields = $this->table->getEditableFields(!$this->record_id);
 
  427        $confirmation->setFormAction($this->ctrl->getFormAction($this));
 
  428        $header_text = $this->lng->txt(
'dcl_confirm_storing_records');
 
  430            && !$this->table->getEditByOwner()
 
  431            && !$this->table->getEditPerm()
 
  433            $header_text .= 
" " . $this->lng->txt(
'dcl_confirm_storing_records_no_permission');
 
  435        $confirmation->setHeaderText($header_text);
 
  437        $confirmation->setCancel($this->lng->txt(
'dcl_edit_record'), 
'edit');
 
  438        $confirmation->setConfirm($this->lng->txt(
'dcl_save_record'), 
'save');
 
  442        $empty_fileuploads = array();
 
  443        foreach ($all_fields as $field) {
 
  446            $record_field->addHiddenItemsToConfirmation($confirmation);
 
  449                && $record_field->getValue() == 
null 
  451                $empty_fileuploads[
'field_' . $field->getId()] = array(
"name" => 
"", 
"type" => 
"", 
"tmp_name" => 
"", 
"error" => 4, 
"size" => 0);
 
  455            if ($record_representation->getConfirmationHTML() !== 
false) {
 
  456                $record_data .= $field->getTitle() . 
": " . $record_representation->getConfirmationHTML() . 
"<br />";
 
  460        $confirmation->addHiddenItem(
'ilfilehash', $filehash);
 
  461        $confirmation->addHiddenItem(
'empty_fileuploads', htmlspecialchars(json_encode($empty_fileuploads)));
 
  462        $confirmation->addHiddenItem(
'table_id', $this->table_id);
 
  463        $confirmation->addHiddenItem(
'tableview_id', $this->tableview_id);
 
  464        $confirmation->addItem(
'save_confirmed', 1, $record_data);
 
  466        if ($this->ctrl->isAsynch()) {
 
  467            echo $confirmation->getHTML();
 
  470            $this->tpl->setContent($confirmation->getHTML());
 
  481        $ilAppEventHandler = 
$DIC[
'ilAppEventHandler'];
 
  486        if ($this->table->getSaveConfirmation() && isset(
$_POST[
'save_confirmed']) && isset(
$_POST[
'ilfilehash']) && !isset($this->record_id) && !$this->ctrl->isAsynch()) {
 
  490            if (json_decode(
$_POST[
'empty_fileuploads']) && 
$_POST[
'empty_fileuploads'] != 
'') {
 
  491                $_FILES = $_FILES + json_decode(
$_POST[
'empty_fileuploads'], 
true);
 
  497        $valid = $this->form->checkInput();
 
  500        $unchanged_obj = $record_obj;
 
  506        $create_mode = !isset($this->record_id);
 
  509            $all_fields = $this->table->getRecordFields();
 
  511            $all_fields = $this->table->getEditableFields(!$this->record_id);
 
  515        foreach ($all_fields as $field) {
 
  517                $field->checkValidityFromForm($this->form, $this->record_id);
 
  520                $item = $this->form->getItemByPostVar(
'field_' . $field->getId());
 
  526            $this->
sendFailure($this->lng->txt(
'form_input_not_valid'));
 
  540                if ($this->table->getSaveConfirmation() && $this->form->getInput(
'save_confirmed') == 
null && !$this->ctrl->isAsynch()) {
 
  542                    $hash = 
$_POST[
"ilfilehash"];
 
  543                    foreach ($_FILES as $field => 
$data) {
 
  544                        if (is_array(
$data[
"tmp_name"])) {
 
  545                            foreach (
$data[
"tmp_name"] as $idx => $upload) {
 
  546                                if (is_array($upload)) {
 
  547                                    foreach ($upload as $idx2 => $file) {
 
  548                                        if ($file && is_uploaded_file($file)) {
 
  549                                            $file_name = 
$data[
"name"][$idx][$idx2];
 
  550                                            $file_type = 
$data[
"type"][$idx][$idx2];
 
  551                                            $this->form->keepTempFileUpload($hash, $field, $file, $file_name, $file_type, $idx, $idx2);
 
  555                                    if ($upload && is_uploaded_file($upload)) {
 
  556                                        $file_name = 
$data[
"name"][$idx];
 
  557                                        $file_type = 
$data[
"type"][$idx];
 
  558                                        $this->form->keepTempFileUpload($hash, $field, $upload, $file_name, $file_type, $idx);
 
  563                            $this->form->keepTempFileUpload($hash, $field, 
$data[
"tmp_name"], 
$data[
"name"], 
$data[
"type"]);
 
  568                    foreach ($all_fields as $field) {
 
  572                    $this->saveConfirmation($record_obj, $hash);
 
  582                $this->record_id = $record_obj->
getId();
 
  593            foreach ($all_fields as $field) {
 
  594                $field_setting = $field->getViewSetting($this->tableview_id);
 
  596                if ($field_setting->isVisibleInForm($create_mode) &&
 
  600                } elseif ($create_mode) {
 
  603                        $field_setting->getFieldObject()->getDatatypeId(),
 
  604                        $field_setting->getId()
 
  606                    if ($default_value !== 
null) {
 
  613            if (!$create_mode && $this->tableview->getFieldSetting(
'owner')->isVisibleEdit()) {
 
  616                    $this->
sendFailure($this->lng->txt(
'user_not_known'));
 
  623            $dispatchEvent = 
"update";
 
  625            $dispatchEventData = array(
 
  626                'dcl' => $this->parent_obj->getDataCollectionObject(),
 
  627                'table_id' => $this->table_id,
 
  628                'record_id' => $record_obj->
getId(),
 
  629                'record' => $record_obj,
 
  633                $dispatchEvent = 
"create";
 
  635                $objDataCollection->sendNotification(
"new_record", $this->table_id, $record_obj->
getId());
 
  637                $dispatchEventData[
'prev_record'] = $unchanged_obj;
 
  640            $record_obj->
doUpdate($create_mode);
 
  642            $ilAppEventHandler->raise(
 
  643                'Modules/DataCollection',
 
  644                $dispatchEvent . 
'Record',
 
  648            $this->ctrl->setParameter($this, 
"table_id", $this->table_id);
 
  649            $this->ctrl->setParameter($this, 
"tableview_id", $this->tableview_id);
 
  650            $this->ctrl->setParameter($this, 
"record_id", $this->record_id);
 
  652            if (!$this->ctrl->isAsynch()) {
 
  653                ilUtil::sendSuccess($this->lng->txt(
"msg_obj_modified"), 
true);
 
  657            if ($this->ctrl->isAsynch()) {
 
  659                $this->record_id = $record_obj->
getId();
 
  665                $this->ctrl->redirectByClass(
"ildclrecordlistgui", 
"listRecords");
 
  670            $this->form->setValuesByPost();
 
  671            if ($this->ctrl->isAsynch()) {
 
  672                echo $this->form->getHTML();
 
  687        if ($force_redirect || (isset(
$_GET[
'redirect']) && !$this->ctrl->isAsynch())) {
 
  688            switch ((
int) 
$_GET[
'redirect']) {
 
  690                    $this->ctrl->setParameterByClass(
'ilDclDetailedViewGUI', 
'record_id', $this->record_id);
 
  691                    $this->ctrl->setParameterByClass(
'ilDclDetailedViewGUI', 
'table_id', $this->table_id);
 
  692                    $this->ctrl->setParameterByClass(
'ilDclDetailedViewGUI', 
'tableview_id', $this->tableview_id);
 
  693                    $this->ctrl->redirectByClass(
"ilDclDetailedViewGUI", 
"renderRecord");
 
  696                    $this->ctrl->redirectByClass(
"ildclrecordlistgui", 
"listRecords");
 
  699                    $this->ctrl->redirectByClass(
"ildclrecordlistgui", 
"listRecords");
 
  707        if (!$this->ctrl->isAsynch()) {
 
  709            $this->ctrl->redirectByClass(
'ildclrecordlistgui', 
'listRecords');
 
  711            echo $this->lng->txt(
'dcl_msg_no_perm_edit');
 
  722        $keep = ($this->ctrl->isAsynch()) ? 
false : 
true;
 
  723        $this->form->setValuesByPost();
 
  724        if ($this->ctrl->isAsynch()) {
 
  731            if (isset($this->record_id)) {
 
  733                if ($record_obj->
getId()) {
 
  735                    $allFields = $this->table->getFields();
 
  736                    foreach ($allFields as $field) {
 
  737                        $field_setting = $field->getViewSetting($this->tableview_id);
 
  739                            $field_setting->isLockedEdit() &&
 
  740                            $field_setting->isVisibleEdit()
 
  758        $search = 
$_POST[
'search_for'];
 
  762        $query_parser->setMinWordLength(1, 
true);
 
  764        $query_parser->parse();
 
  765        if (!$query_parser->validate()) {
 
  766            $html .= $query_parser->getMessage() . 
"<br />";
 
  771        $res = $object_search->performSearch();
 
  776            $html .= $this->lng->txt(
'dcl_no_search_results_found_for') . 
' ' . $search . 
"<br />";
 
  781            $tpl = 
new ilTemplate(
"tpl.dcl_tree.html", 
true, 
true, 
"Modules/DataCollection");
 
  782            foreach ((array) $entry[
'refs'] as $reference) {
 
  784                $tpl->setCurrentBlock(
'result');
 
  785                $tpl->setVariable(
'RESULT_PATH', $path->getPath(
ROOT_FOLDER_ID, $reference) . 
" ยป " . $entry[
'title']);
 
  786                $tpl->setVariable(
'RESULT_REF', $reference);
 
  787                $tpl->setVariable(
'FIELD_ID', $dest);
 
  788                $tpl->parseCurrentBlock();
 
  790            $html .= 
$tpl->get();
 
  800        return "<script>ilDataCollection.strings.add_value='" . $this->lng->txt(
'add_value') . 
"';</script>";
 
  814        foreach ($a_res as $obj_id => $references) {
 
  818            $r[
'obj_id'] = $obj_id;
 
  819            $r[
'refs'] = $references;
 
  832        $ilfilehash = (isset(
$_POST[
'ilfilehash'])) ? 
$_POST[
'ilfilehash'] : 
null;
 
  833        if ($ilfilehash != 
null) {
 
  834            $this->form->cleanupTempFiles($ilfilehash);
 
static findOrGetInstance($primary_key, array $add_constructor_args=array())
An exception for terminatinating execution or to throw for unit testing.
const QP_COMBINATION_AND
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Confirmation screen class.
@classDescription Date and time handling
Class ilDclBaseRecordModel.
setLastEditBy($last_edit_by)
fillRecordFieldFormInput($field_id, &$form)
hasPermissionToEdit($ref_id)
setLastUpdate($a_datetime)
Set Last Update Date.
setRecordFieldValueFromForm($field_id, &$form)
Set a field value.
setOwner($a_id)
Set Owner.
setCreateDate($a_datetime)
Set Creation Date.
doUpdate($omit_notification=false)
doUpdate
getRecordField($field_id)
setTableId($a_id)
Set Table ID.
setRecordFieldValue($field_id, $value)
Set a field value.
static getRecordFieldCache($record, $field)
static getTableCache($table_id=0)
static getRecordCache($record_id=0)
static getRecordRepresentation(ilDclBaseRecordFieldModel $record_field)
Returns a record representation.
static getFieldRepresentation(ilDclBaseFieldModel $field)
static getRecordRepresentationInstance(ilDclBaseRecordFieldModel $record_field)
Get RecordRepresentation from RecordFieldModel.
Class ilDclBaseFieldModel.
Class ilDclMobRecordFieldModel.
Class ilDclRecordEditGUI.
confirmDelete()
Delete confirmation.
parseSearchResults($a_res)
Parse search results.
__construct(ilObjDataCollectionGUI $parent_obj)
getRecordData($record_id=0)
Return All fields and values from a record ID.
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.
checkAndPerformRedirect($force_redirect=false)
Checkes to what view (table or detail) should be redirected and performs redirect.
cancelUpdate()
Cancel Update.
const REDIRECT_RECORD_LIST
Possible redirects after saving/updating a record - use GET['redirect'] to set constants.
create()
Create new record gui.
static findSingle($data_type_id, $tview_id)
static hasAddRecordAccess($ref, $user_id=0)
static hasEditAccess($ref, $user_id=0)
Has permission to view and edit all entries event when he is not the owner.
static hasPermissionToAddRecord($ref_id, $table_id)
static hasWriteAccess($ref, $user_id=0)
Class ilObjDataCollectionGUI.
Class ilObjDataCollection.
static _lookupId($a_user_str)
Lookup id by login.
static _lookupTitle($a_id)
lookup object title
static _lookupDescription($a_id)
lookup object description
Creates a path for a start and endnode.
special template class to simplify handling of ITX/PEAR
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static getSystemMessageHTML($a_txt, $a_type="info")
Get HTML for a system message.
foreach($_POST as $key=> $value) $res