ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilDclRecordEditGUI Class Reference

Class ilDclRecordEditGUI. More...

+ Collaboration diagram for ilDclRecordEditGUI:

Public Member Functions

 __construct (ilObjDataCollectionGUI $parent_obj)
 
 executeCommand ()
 
 getRecord ()
 
 create ()
 Create new record gui. More...
 
 edit ()
 Record edit gui. More...
 
 confirmDelete ()
 Delete confirmation. More...
 
 cancelDelete ()
 Cancel deletion. More...
 
 delete ()
 Remove record. More...
 
 getRecordData ($record_id=0)
 Return All fields and values from a record ID. More...
 
 initForm ()
 init Form More...
 
 setFormValues ()
 Set values from object to form. More...
 
 cancelUpdate ()
 Cancel Update. More...
 
 cancelSave ()
 Cancel Save. More...
 
 save ()
 Save record. More...
 
 searchObjects ()
 This function is only used by the ajax request if searching for ILIAS references. More...
 
 getForm ()
 

Data Fields

const REDIRECT_RECORD_LIST = 1
 Possible redirects after saving/updating a record - use GET['redirect'] to set constants. More...
 
const REDIRECT_DETAIL = 2
 

Protected Member Functions

 checkAndPerformRedirect ($force_redirect=false)
 Checkes to what view (table or detail) should be redirected and performs redirect. More...
 
 accessDenied ()
 
 sendFailure ($message)
 
 getLanguageJsKeys ()
 
 parseSearchResults ($a_res)
 Parse search results. More...
 
 cleanupTempFiles ()
 Cleanup temp-files. More...
 

Protected Attributes

 $record_id
 
 $table_id
 
 $table
 
 $parent_obj
 
 $record
 
 $ctrl
 
 $tpl
 
 $lng
 
 $user
 
 $form
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilDclRecordEditGUI::__construct ( ilObjDataCollectionGUI  $parent_obj)
Parameters
ilObjDataCollectionGUI$parent_obj

Definition at line 70 of file class.ilDclRecordEditGUI.php.

71 {
72 global $DIC;
73 $ilCtrl = $DIC['ilCtrl'];
74 $tpl = $DIC['tpl'];
75 $lng = $DIC['lng'];
76 $ilUser = $DIC['ilUser'];
77
78 $this->ctrl = $ilCtrl;
79 $this->tpl = $tpl;
80 $this->lng = $lng;
81 $this->user = $ilUser;
82 $this->parent_obj = $parent_obj;
83 $this->record_id = $_REQUEST['record_id'];
84 $this->table_id = $_REQUEST['table_id'];
85 $this->tableview_id = $_REQUEST['tableview_id'];
86 }
user()
Definition: user.php:4
global $ilCtrl
Definition: ilias.php:18
global $DIC
Definition: saml.php:7
$ilUser
Definition: imgupload.php:18

References $DIC, $ilCtrl, $ilUser, $lng, $parent_obj, $tpl, and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ accessDenied()

ilDclRecordEditGUI::accessDenied ( )
protected

Definition at line 633 of file class.ilDclRecordEditGUI.php.

634 {
635 if (!$this->ctrl->isAsynch()) {
636 ilUtil::sendFailure($this->lng->txt('dcl_msg_no_perm_edit'), true);
637 $this->ctrl->redirectByClass('ildclrecordlistgui', 'listRecords');
638 } else {
639 echo $this->lng->txt('dcl_msg_no_perm_edit');
640 exit();
641 }
642 }
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.

References exit, and ilUtil\sendFailure().

Referenced by delete(), getRecord(), and save().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cancelDelete()

ilDclRecordEditGUI::cancelDelete ( )

Cancel deletion.

Definition at line 203 of file class.ilDclRecordEditGUI.php.

204 {
205 $this->ctrl->redirectByClass("ildclrecordlistgui", "listRecords");
206 }

◆ cancelSave()

ilDclRecordEditGUI::cancelSave ( )

Cancel Save.

Definition at line 359 of file class.ilDclRecordEditGUI.php.

360 {
361 $this->cancelUpdate();
362 }

References cancelUpdate().

+ Here is the call graph for this function:

◆ cancelUpdate()

ilDclRecordEditGUI::cancelUpdate ( )

Cancel Update.

Definition at line 350 of file class.ilDclRecordEditGUI.php.

351 {
352 $this->checkAndPerformRedirect(true);
353 }
checkAndPerformRedirect($force_redirect=false)
Checkes to what view (table or detail) should be redirected and performs redirect.

References checkAndPerformRedirect().

Referenced by cancelSave().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkAndPerformRedirect()

ilDclRecordEditGUI::checkAndPerformRedirect (   $force_redirect = false)
protected

Checkes to what view (table or detail) should be redirected and performs redirect.

Definition at line 613 of file class.ilDclRecordEditGUI.php.

614 {
615 if ($force_redirect || (isset($_GET['redirect']) && !$this->ctrl->isAsynch())) {
616 switch ((int) $_GET['redirect']) {
618 $this->ctrl->setParameterByClass('ilDclDetailedViewGUI', 'record_id', $this->record_id);
619 $this->ctrl->setParameterByClass('ilDclDetailedViewGUI', 'table_id', $this->table_id);
620 $this->ctrl->setParameterByClass('ilDclDetailedViewGUI', 'tableview_id', $this->tableview_id);
621 $this->ctrl->redirectByClass("ilDclDetailedViewGUI", "renderRecord");
622 break;
624 $this->ctrl->redirectByClass("ildclrecordlistgui", "listRecords");
625 break;
626 default:
627 $this->ctrl->redirectByClass("ildclrecordlistgui", "listRecords");
628 }
629 }
630 }
$_GET["client_id"]
const REDIRECT_RECORD_LIST
Possible redirects after saving/updating a record - use GET['redirect'] to set constants.

References $_GET, REDIRECT_DETAIL, and REDIRECT_RECORD_LIST.

Referenced by cancelUpdate(), and save().

+ Here is the caller graph for this function:

◆ cleanupTempFiles()

ilDclRecordEditGUI::cleanupTempFiles ( )
protected

Cleanup temp-files.

Definition at line 740 of file class.ilDclRecordEditGUI.php.

741 {
742 $ilfilehash = (isset($_POST['ilfilehash'])) ? $_POST['ilfilehash'] : null;
743 if ($ilfilehash != null) {
744 $this->form->cleanupTempFiles($ilfilehash);
745 }
746 }
$_POST["username"]

References $_POST.

Referenced by edit().

+ Here is the caller graph for this function:

◆ confirmDelete()

ilDclRecordEditGUI::confirmDelete ( )

Delete confirmation.

Exceptions
ilDclException

Definition at line 174 of file class.ilDclRecordEditGUI.php.

175 {
176 $conf = new ilConfirmationGUI();
177 $conf->setFormAction($this->ctrl->getFormAction($this));
178 $conf->setHeaderText($this->lng->txt('dcl_confirm_delete_record'));
179 $record = ilDclCache::getRecordCache($this->record_id);
180
181 $all_fields = $this->table->getRecordFields();
182 $record_data = "";
183 foreach ($all_fields as $key=>$field) {
184 $field_record = ilDclCache::getRecordFieldCache($record, $field);
185
186 $record_representation = ilDclCache::getRecordRepresentation($field_record);
187 if ($record_representation->getConfirmationHTML() !== false) {
188 $record_data .= $field->getTitle() . ": " . $record_representation->getConfirmationHTML() . "<br />";
189 }
190 }
191 $conf->addItem('record_id', $record->getId(), $record_data);
192 $conf->addHiddenItem('table_id', $this->table_id);
193 $conf->addHiddenItem('tableview_id', $this->tableview_id);
194 $conf->setConfirm($this->lng->txt('delete'), 'delete');
195 $conf->setCancel($this->lng->txt('cancel'), 'cancelDelete');
196 $this->tpl->setContent($conf->getHTML());
197 }
Confirmation screen class.
static getRecordFieldCache($record, $field)
static getRecordCache($record_id=0)
static getRecordRepresentation(ilDclBaseRecordFieldModel $record_field)
Returns a record representation.
$key
Definition: croninfo.php:18

References $key, $record, ilDclCache\getRecordCache(), ilDclCache\getRecordFieldCache(), and ilDclCache\getRecordRepresentation().

+ Here is the call graph for this function:

◆ create()

ilDclRecordEditGUI::create ( )

Create new record gui.

Definition at line 137 of file class.ilDclRecordEditGUI.php.

138 {
139 $this->initForm();
140 if ($this->ctrl->isAsynch()) {
141 echo $this->form->getHTML();
142 exit();
143 } else {
144 $this->tpl->setContent($this->getLanguageJsKeys()
145 . $this->form->getHTML());
146 }
147 }

References exit, getLanguageJsKeys(), and initForm().

+ Here is the call graph for this function:

◆ delete()

ilDclRecordEditGUI::delete ( )

Remove record.

Definition at line 212 of file class.ilDclRecordEditGUI.php.

213 {
214 $record = ilDclCache::getRecordCache($this->record_id);
215
216 if (!$this->table->hasPermissionToDeleteRecord($this->parent_obj->ref_id, $record)) {
217 $this->accessDenied();
218
219 return;
220 }
221
222 $record->doDelete();
223 ilUtil::sendSuccess($this->lng->txt("dcl_record_deleted"), true);
224 $this->ctrl->redirectByClass("ildclrecordlistgui", "listRecords");
225 }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.

References $record, accessDenied(), ilDclCache\getRecordCache(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ edit()

ilDclRecordEditGUI::edit ( )

Record edit gui.

Definition at line 153 of file class.ilDclRecordEditGUI.php.

154 {
155 $this->initForm();
156 $this->cleanupTempFiles();
157
158 $this->setFormValues();
159 if ($this->ctrl->isAsynch()) {
160 echo $this->form->getHTML();
161 exit();
162 } else {
163 $this->tpl->setContent($this->getLanguageJsKeys()
164 . $this->form->getHTML());
165 }
166 }
setFormValues()
Set values from object to form.
cleanupTempFiles()
Cleanup temp-files.

References cleanupTempFiles(), exit, getLanguageJsKeys(), initForm(), and setFormValues().

+ Here is the call graph for this function:

◆ executeCommand()

ilDclRecordEditGUI::executeCommand ( )
Returns
bool

Definition at line 92 of file class.ilDclRecordEditGUI.php.

93 {
94 $this->getRecord();
95
96 $cmd = $this->ctrl->getCmd();
97 switch ($cmd) {
98 default:
99 $this->$cmd();
100 break;
101 }
102
103 return true;
104 }

References getRecord().

+ Here is the call graph for this function:

◆ getForm()

ilDclRecordEditGUI::getForm ( )
Returns
ilDclPropertyFormGUI

Definition at line 752 of file class.ilDclRecordEditGUI.php.

753 {
754 return $this->form;
755 }

References $form.

◆ getLanguageJsKeys()

ilDclRecordEditGUI::getLanguageJsKeys ( )
protected

Definition at line 708 of file class.ilDclRecordEditGUI.php.

709 {
710 return "<script>ilDataCollection.strings.add_value='" . $this->lng->txt('add_value') . "';</script>";
711 }

Referenced by create(), edit(), save(), and sendFailure().

+ Here is the caller graph for this function:

◆ getRecord()

ilDclRecordEditGUI::getRecord ( )

Definition at line 110 of file class.ilDclRecordEditGUI.php.

111 {
112 if ($_GET['mode']) {
113 $this->ctrl->saveParameter($this, 'mode');
114 $this->ctrl->setParameterByClass("ildclrecordlistgui", "mode", $_GET['mode']);
115 }
116 $this->ctrl->setParameterByClass('ildclrecordlistgui', 'tableview_id', $this->tableview_id);
117 $this->ctrl->saveParameter($this, 'redirect');
118 if ($this->record_id) {
119 $this->record = ilDclCache::getRecordCache($this->record_id);
120 if (!$this->record->hasPermissionToEdit($this->parent_obj->ref_id) or !$this->record->hasPermissionToView($this->parent_obj->ref_id)) {
121 $this->accessDenied();
122 }
123 $this->table = $this->record->getTable();
124 $this->table_id = $this->table->getId();
125 } else {
126 $this->table = ilDclCache::getTableCache($this->table_id);
128 $this->accessDenied();
129 }
130 }
131 }
static getTableCache($table_id=0)

References $_GET, accessDenied(), ilDclCache\getRecordCache(), ilDclCache\getTableCache(), and ilObjDataCollectionAccess\hasAddRecordAccess().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRecordData()

ilDclRecordEditGUI::getRecordData (   $record_id = 0)

Return All fields and values from a record ID.

If this method is requested over AJAX, data is returned in JSON format

Parameters
int$record_id
Returns
array

Definition at line 236 of file class.ilDclRecordEditGUI.php.

237 {
238 $record_id = ($record_id) ? $record_id : $_GET['record_id'];
239 $return = array();
240 if ($record_id) {
242 if (is_object($record)) {
243 $return = $record->getRecordFieldValues();
244 }
245 }
246 if ($this->ctrl->isAsynch()) {
247 echo json_encode($return);
248 exit();
249 }
250
251 return $return;
252 }

References $_GET, $record, $record_id, exit, and ilDclCache\getRecordCache().

+ Here is the call graph for this function:

◆ initForm()

ilDclRecordEditGUI::initForm ( )

init Form

@move move parts to RecordRepresentationGUI

Definition at line 260 of file class.ilDclRecordEditGUI.php.

261 {
262 $this->form = new ilDclPropertyFormGUI();
263 $prefix = ($this->ctrl->isAsynch()) ? 'dclajax' : 'dcl'; // Used by datacolleciton.js to select input elements
264 $this->form->setId($prefix . $this->table_id . $this->record_id);
265
266 $hidden_prop = new ilHiddenInputGUI("table_id");
267 $hidden_prop->setValue($this->table_id);
268 $this->form->addItem($hidden_prop);
269 $hidden_prop = new ilHiddenInputGUI("tableview_id");
270 $hidden_prop->setValue($this->tableview_id);
271 $this->form->addItem($hidden_prop);
272 if ($this->record_id) {
273 $hidden_prop = new ilHiddenInputGUI("record_id");
274 $hidden_prop->setValue($this->record_id);
275 $this->form->addItem($hidden_prop);
276 }
277
278 $this->ctrl->setParameter($this, "record_id", $this->record_id);
279 $this->form->setFormAction($this->ctrl->getFormAction($this));
280 $allFields = $this->table->getRecordFields();
281 $inline_css = '';
282 foreach ($allFields as $field) {
283 $item = ilDclCache::getFieldRepresentation($field)->getInputField($this->form, $this->record_id);
284 if ($item === null) {
285 continue; // Fields calculating values at runtime, e.g. ilDclFormulaFieldModel do not have input
286 }
287
288 if (!ilObjDataCollectionAccess::hasWriteAccess($this->parent_obj->ref_id) && $field->getLocked()) {
289 $item->setDisabled(true);
290 }
291 $this->form->addItem($item);
292 }
293
294 $this->tpl->addInlineCss($inline_css);
295
296 // Add possibility to change the owner in edit mode
297 if ($this->record_id) {
298 $ownerField = $this->table->getField('owner');
299 $inputfield = ilDclCache::getFieldRepresentation($ownerField)->getInputField($this->form);
300 $this->form->addItem($inputfield);
301 }
302
303
304 // save and cancel commands
305 if ($this->record_id) {
306 $this->form->setTitle($this->lng->txt("dcl_update_record"));
307 $this->form->addCommandButton("save", $this->lng->txt("dcl_update_record"));
308 if (!$this->ctrl->isAsynch()) {
309 $this->form->addCommandButton("cancelUpdate", $this->lng->txt("cancel"));
310 }
311 } else {
312 $this->form->setTitle($this->lng->txt("dcl_add_new_record"));
313 $this->form->addCommandButton("save", $this->lng->txt("save"));
314 if (!$this->ctrl->isAsynch()) {
315 $this->form->addCommandButton("cancelSave", $this->lng->txt("cancel"));
316 }
317 }
318 $this->ctrl->setParameter($this, "tableview_id", $this->tableview_id);
319 $this->ctrl->setParameter($this, "table_id", $this->table_id);
320 $this->ctrl->setParameter($this, "record_id", $this->record_id);
321 }
static getFieldRepresentation(ilDclBaseFieldModel $field)
Class ilDclPropertyFormGUI.
This class represents a hidden form property in a property form.

References ilDclCache\getFieldRepresentation(), and ilObjDataCollectionAccess\hasWriteAccess().

Referenced by create(), edit(), and save().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseSearchResults()

ilDclRecordEditGUI::parseSearchResults (   $a_res)
protected

Parse search results.

Parameters
ilObject[]$a_res
Returns
array

Definition at line 721 of file class.ilDclRecordEditGUI.php.

722 {
723 $rows = array();
724 foreach ($a_res as $obj_id => $references) {
725 $r = array();
726 $r['title'] = ilObject::_lookupTitle($obj_id);
727 $r['desc'] = ilObject::_lookupDescription($obj_id);
728 $r['obj_id'] = $obj_id;
729 $r['refs'] = $references;
730 $rows[] = $r;
731 }
732
733 return $rows;
734 }
static _lookupTitle($a_id)
lookup object title
static _lookupDescription($a_id)
lookup object description
$r
Definition: example_031.php:79
$rows
Definition: xhr_table.php:10

References $r, $rows, ilObject\_lookupDescription(), and ilObject\_lookupTitle().

Referenced by searchObjects().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilDclRecordEditGUI::save ( )

Save record.

Definition at line 426 of file class.ilDclRecordEditGUI.php.

427 {
428 global $DIC;
429 $ilAppEventHandler = $DIC['ilAppEventHandler'];
430 $ilUser = $DIC['ilUser'];
431
432 $this->initForm();
433
434 // if save confirmation is enabled: Temporary file-uploads need to be handled
435 if ($this->table->getSaveConfirmation() && isset($_POST['save_confirmed']) && isset($_POST['ilfilehash']) && !isset($this->record_id) && !$this->ctrl->isAsynch()) {
437
438 //handle empty fileuploads, since $_FILES has to have an entry for each fileuploadGUI
439 if (json_decode($_POST['empty_fileuploads']) && $_POST['empty_fileuploads'] != '') {
440 $_FILES = $_FILES + json_decode($_POST['empty_fileuploads'], true);
441 }
442
443 unset($_SESSION['record_form_values']);
444 }
445
446 $valid = $this->form->checkInput();
447
448 $record_obj = ilDclCache::getRecordCache($this->record_id);
449 $unchanged_obj = $record_obj;
450 $date_obj = new ilDateTime(time(), IL_CAL_UNIX);
451 $record_obj->setTableId($this->table_id);
452 $record_obj->setLastUpdate($date_obj->get(IL_CAL_DATETIME));
453 $record_obj->setLastEditBy($this->user->getId());
454
455 $create_mode = false;
456
457 if (ilObjDataCollectionAccess::hasWriteAccess($this->parent_obj->ref_id)) {
458 $all_fields = $this->table->getRecordFields();
459 } else {
460 $all_fields = $this->table->getEditableFields();
461 }
462
463 //Check if we can create this record.
464 foreach ($all_fields as $field) {
465 try {
466 $field->checkValidityFromForm($this->form, $this->record_id);
467 } catch (ilDclInputException $e) {
468 $valid = false;
469 $item = $this->form->getItemByPostVar('field_' . $field->getId());
470 $item->setAlert($e);
471 }
472 }
473
474 if (!$valid) {
475 $this->sendFailure($this->lng->txt('form_input_not_valid'));
476 return;
477 }
478
479 if ($valid) {
480 if (!isset($this->record_id)) {
481 if (!(ilObjDataCollectionAccess::hasPermissionToAddRecord($this->parent_obj->ref_id, $this->table_id))) {
482 $this->accessDenied();
483 return;
484 }
485
486 // when save_confirmation is enabled, not yet confirmed and we have not an async-request => prepare for displaying confirmation
487 if ($this->table->getSaveConfirmation() && $this->form->getInput('save_confirmed') == null && !$this->ctrl->isAsynch()) {
488 // temporary store fileuploads (reuse code from ilPropertyFormGUI)
489 $hash = $_POST["ilfilehash"];
490 foreach ($_FILES as $field => $data) {
491 if (is_array($data["tmp_name"])) {
492 foreach ($data["tmp_name"] as $idx => $upload) {
493 if (is_array($upload)) {
494 foreach ($upload as $idx2 => $file) {
495 if ($file && is_uploaded_file($file)) {
496 $file_name = $data["name"][$idx][$idx2];
497 $file_type = $data["type"][$idx][$idx2];
498 $this->form->keepTempFileUpload($hash, $field, $file, $file_name, $file_type, $idx, $idx2);
499 }
500 }
501 } elseif ($upload && is_uploaded_file($upload)) {
502 $file_name = $data["name"][$idx];
503 $file_type = $data["type"][$idx];
504 $this->form->keepTempFileUpload($hash, $field, $upload, $file_name, $file_type, $idx);
505 }
506 }
507 } else {
508 $this->form->keepTempFileUpload($hash, $field, $data["tmp_name"], $data["name"], $data["type"]);
509 }
510 }
511
512 //edit values, they are valid we already checked them above
513 foreach ($all_fields as $field) {
514 $record_obj->setRecordFieldValueFromForm($field->getId(), $this->form);
515 }
516
517 $this->saveConfirmation($record_obj, $hash);
518 return;
519 }
520
521 $record_obj->setOwner($this->user->getId());
522 $record_obj->setCreateDate($date_obj->get(IL_CAL_DATETIME));
523 $record_obj->setTableId($this->table_id);
524 $record_obj->doCreate();
525
526 $this->record_id = $record_obj->getId();
527 $create_mode = true;
528 } else {
529 if (!$record_obj->hasPermissionToEdit($this->parent_obj->ref_id)) {
530 $this->accessDenied();
531
532 return;
533 }
534 }
535
536 //edit values, they are valid we already checked them above
537 foreach ($all_fields as $field) {
538 $record_obj->setRecordFieldValueFromForm($field->getId(), $this->form);
539 }
540
541 // Do we need to set a new owner for this record?
542 if (!$create_mode) {
543 $owner_id = ilObjUser::_lookupId($_POST['field_owner']);
544 if (!$owner_id) {
545 $this->sendFailure($this->lng->txt('user_not_known'));
546
547 return;
548 }
549 $record_obj->setOwner($owner_id);
550 }
551
552 $dispatchEvent = "update";
553
554 $dispatchEventData = array(
555 'dcl' => $this->parent_obj->getDataCollectionObject(),
556 'table_id' => $this->table_id,
557 'record_id' => $record_obj->getId(),
558 'record' => $record_obj,
559 );
560
561 if ($create_mode) {
562 $dispatchEvent = "create";
563 ilObjDataCollection::sendNotification("new_record", $this->table_id, $record_obj->getId());
564 } else {
565 $dispatchEventData['prev_record'] = $unchanged_obj;
566 }
567
568 $record_obj->doUpdate($create_mode);
569
570 $ilAppEventHandler->raise(
571 'Modules/DataCollection',
572 $dispatchEvent . 'Record',
573 $dispatchEventData
574 );
575
576 $this->ctrl->setParameter($this, "table_id", $this->table_id);
577 $this->ctrl->setParameter($this, "tableview_id", $this->tableview_id);
578 $this->ctrl->setParameter($this, "record_id", $this->record_id);
579
580 if (!$this->ctrl->isAsynch()) {
581 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
582 }
583
585 if ($this->ctrl->isAsynch()) {
586 // If ajax request, return the form in edit mode again
587 $this->record_id = $record_obj->getId();
588 $this->initForm();
589 $this->setFormValues();
590 echo $this->tpl->getMessageHTML($this->lng->txt('msg_obj_modified'), 'success') . $this->form->getHTML();
591 exit();
592 } else {
593 $this->ctrl->redirectByClass("ildclrecordlistgui", "listRecords");
594 }
595 } else {
596 // Form not valid...
597 //TODO: URL title flushes on invalid form
598 $this->form->setValuesByPost();
599 if ($this->ctrl->isAsynch()) {
600 echo $this->form->getHTML();
601 exit();
602 } else {
603 $this->tpl->setContent($this->getLanguageJsKeys() . $this->form->getHTML());
604 }
605 }
606 }
$_SESSION["AccountId"]
const IL_CAL_UNIX
const IL_CAL_DATETIME
@classDescription Date and time handling
Class ilDclBaseFieldModel.
static rebuildTempFileByHash($hash)
Return temp files.
static hasPermissionToAddRecord($ref_id, $table_id)
static _lookupId($a_user_str)
Lookup id by login.
$valid
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file

References $_POST, $_SESSION, $data, $DIC, $file, $ilUser, $valid, ilObjUser\_lookupId(), accessDenied(), checkAndPerformRedirect(), ilDclBaseRecordModel\doCreate(), ilDclBaseRecordModel\doUpdate(), exit, ilDclBaseRecordModel\getId(), getLanguageJsKeys(), ilDclCache\getRecordCache(), ilObjDataCollectionAccess\hasPermissionToAddRecord(), ilDclBaseRecordModel\hasPermissionToEdit(), ilObjDataCollectionAccess\hasWriteAccess(), IL_CAL_DATETIME, IL_CAL_UNIX, initForm(), ilDclPropertyFormGUI\rebuildTempFileByHash(), sendFailure(), ilUtil\sendSuccess(), ilDclBaseRecordModel\setCreateDate(), setFormValues(), ilDclBaseRecordModel\setLastEditBy(), ilDclBaseRecordModel\setLastUpdate(), ilDclBaseRecordModel\setOwner(), ilDclBaseRecordModel\setRecordFieldValueFromForm(), ilDclBaseRecordModel\setTableId(), and user().

+ Here is the call graph for this function:

◆ searchObjects()

ilDclRecordEditGUI::searchObjects ( )

This function is only used by the ajax request if searching for ILIAS references.

It builds the html for the search results.

Definition at line 664 of file class.ilDclRecordEditGUI.php.

665 {
666 $search = $_POST['search_for'];
667 $dest = $_POST['dest'];
668 $html = "";
669 include_once './Services/Search/classes/class.ilQueryParser.php';
670 $query_parser = new ilQueryParser($search);
671 $query_parser->setMinWordLength(1, true);
672 $query_parser->setCombination(QP_COMBINATION_AND);
673 $query_parser->parse();
674 if (!$query_parser->validate()) {
675 $html .= $query_parser->getMessage() . "<br />";
676 }
677
678 // only like search since fulltext does not support search with less than 3 characters
679 include_once 'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
680 $object_search = new ilLikeObjectSearch($query_parser);
681 $res = $object_search->performSearch();
682 //$res->setRequiredPermission('copy');
683 $res->filter(ROOT_FOLDER_ID, true);
684
685 if (!count($results = $res->getResultsByObjId())) {
686 $html .= $this->lng->txt('dcl_no_search_results_found_for') . ' ' . $search . "<br />";
687 }
689
690 foreach ($results as $entry) {
691 $tpl = new ilTemplate("tpl.dcl_tree.html", true, true, "Modules/DataCollection");
692 foreach ((array) $entry['refs'] as $reference) {
693 include_once './Services/Tree/classes/class.ilPathGUI.php';
694 $path = new ilPathGUI();
695 $tpl->setCurrentBlock('result');
696 $tpl->setVariable('RESULT_PATH', $path->getPath(ROOT_FOLDER_ID, $reference) . " ยป " . $entry['title']);
697 $tpl->setVariable('RESULT_REF', $reference);
698 $tpl->setVariable('FIELD_ID', $dest);
699 $tpl->parseCurrentBlock();
700 }
701 $html .= $tpl->get();
702 }
703
704 echo $html;
705 exit;
706 }
const QP_COMBINATION_AND
parseSearchResults($a_res)
Parse search results.
Creates a path for a start and endnode.
special template class to simplify handling of ITX/PEAR
$html
Definition: example_001.php:87
foreach($_POST as $key=> $value) $res
$results
Definition: svg-scanner.php:47

References $_POST, $html, $path, $res, $results, $tpl, exit, parseSearchResults(), and QP_COMBINATION_AND.

+ Here is the call graph for this function:

◆ sendFailure()

ilDclRecordEditGUI::sendFailure (   $message)
protected
Parameters
$message

Definition at line 648 of file class.ilDclRecordEditGUI.php.

649 {
650 $keep = ($this->ctrl->isAsynch()) ? false : true;
651 $this->form->setValuesByPost();
652 if ($this->ctrl->isAsynch()) {
653 echo $this->tpl->getMessageHTML($message, 'failure') . $this->form->getHTML();
654 exit();
655 } else {
657 $this->tpl->setContent($this->getLanguageJsKeys() . $this->form->getHTML());
658 }
659 }
catch(Exception $e) $message

References $message, exit, getLanguageJsKeys(), and ilUtil\sendFailure().

Referenced by save().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setFormValues()

ilDclRecordEditGUI::setFormValues ( )

Set values from object to form.

Returns
bool

Definition at line 329 of file class.ilDclRecordEditGUI.php.

330 {
331 //Get Record-Values
332 $record_obj = ilDclCache::getRecordCache($this->record_id);
333 if ($record_obj->getId()) {
334 //Get Table Field Definitions
335 $allFields = $this->table->getFields();
336 foreach ($allFields as $field) {
337 $record_obj->fillRecordFieldFormInput($field->getId(), $this->form);
338 }
339 } else {
340 $this->form->setValuesByPost();
341 }
342
343 return true;
344 }

References ilDclCache\getRecordCache().

Referenced by edit(), and save().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

ilDclRecordEditGUI::$ctrl
protected

Definition at line 48 of file class.ilDclRecordEditGUI.php.

◆ $form

ilDclRecordEditGUI::$form
protected

Definition at line 64 of file class.ilDclRecordEditGUI.php.

Referenced by getForm().

◆ $lng

ilDclRecordEditGUI::$lng
protected

Definition at line 56 of file class.ilDclRecordEditGUI.php.

Referenced by __construct().

◆ $parent_obj

ilDclRecordEditGUI::$parent_obj
protected

Definition at line 40 of file class.ilDclRecordEditGUI.php.

Referenced by __construct().

◆ $record

ilDclRecordEditGUI::$record
protected

Definition at line 44 of file class.ilDclRecordEditGUI.php.

Referenced by confirmDelete(), delete(), and getRecordData().

◆ $record_id

ilDclRecordEditGUI::$record_id
protected

Definition at line 28 of file class.ilDclRecordEditGUI.php.

Referenced by getRecordData().

◆ $table

ilDclRecordEditGUI::$table
protected

Definition at line 36 of file class.ilDclRecordEditGUI.php.

◆ $table_id

ilDclRecordEditGUI::$table_id
protected

Definition at line 32 of file class.ilDclRecordEditGUI.php.

◆ $tpl

ilDclRecordEditGUI::$tpl
protected

Definition at line 52 of file class.ilDclRecordEditGUI.php.

Referenced by __construct(), and searchObjects().

◆ $user

ilDclRecordEditGUI::$user
protected

Definition at line 60 of file class.ilDclRecordEditGUI.php.

◆ REDIRECT_DETAIL

const ilDclRecordEditGUI::REDIRECT_DETAIL = 2

◆ REDIRECT_RECORD_LIST

const ilDclRecordEditGUI::REDIRECT_RECORD_LIST = 1

Possible redirects after saving/updating a record - use GET['redirect'] to set constants.

Definition at line 23 of file class.ilDclRecordEditGUI.php.

Referenced by checkAndPerformRedirect().


The documentation for this class was generated from the following file: