ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 78 of file class.ilDclRecordEditGUI.php.

78 {
79 global $DIC;
80 $ilCtrl = $DIC['ilCtrl'];
81 $tpl = $DIC['tpl'];
82 $lng = $DIC['lng'];
83 $ilUser = $DIC['ilUser'];
84
85 $this->ctrl = $ilCtrl;
86 $this->tpl = $tpl;
87 $this->lng = $lng;
88 $this->user = $ilUser;
89 $this->parent_obj = $parent_obj;
90 $this->record_id = $_REQUEST['record_id'];
91 $this->table_id = $_REQUEST['table_id'];
92 $this->tableview_id = $_REQUEST['tableview_id'];
93 }
user()
Definition: user.php:4
global $ilCtrl
Definition: ilias.php:18
global $DIC
$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 636 of file class.ilDclRecordEditGUI.php.

636 {
637 if (!$this->ctrl->isAsynch()) {
638 ilUtil::sendFailure($this->lng->txt('dcl_msg_no_perm_edit'), true);
639 $this->ctrl->redirectByClass('ildclrecordlistgui', 'listRecords');
640 } else {
641 echo $this->lng->txt('dcl_msg_no_perm_edit');
642 exit();
643 }
644 }
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 205 of file class.ilDclRecordEditGUI.php.

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

◆ cancelSave()

ilDclRecordEditGUI::cancelSave ( )

Cancel Save.

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

355 {
356 $this->cancelUpdate();
357 }

References cancelUpdate().

+ Here is the call graph for this function:

◆ cancelUpdate()

ilDclRecordEditGUI::cancelUpdate ( )

Cancel Update.

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

347 {
348 $this->checkAndPerformRedirect(true);
349 }
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 617 of file class.ilDclRecordEditGUI.php.

617 {
618 if ($force_redirect || (isset($_GET['redirect']) && !$this->ctrl->isAsynch())) {
619 switch ((int)$_GET['redirect']) {
621 $this->ctrl->setParameterByClass('ilDclDetailedViewGUI', 'record_id', $this->record_id);
622 $this->ctrl->setParameterByClass('ilDclDetailedViewGUI', 'table_id', $this->table_id);
623 $this->ctrl->setParameterByClass('ilDclDetailedViewGUI', 'tableview_id', $this->tableview_id);
624 $this->ctrl->redirectByClass("ilDclDetailedViewGUI", "renderRecord");
625 break;
627 $this->ctrl->redirectByClass("ildclrecordlistgui", "listRecords");
628 break;
629 default:
630 $this->ctrl->redirectByClass("ildclrecordlistgui", "listRecords");
631 }
632 }
633 }
$_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 738 of file class.ilDclRecordEditGUI.php.

738 {
739 $ilfilehash = (isset($_POST['ilfilehash'])) ? $_POST['ilfilehash'] : null;
740 if ($ilfilehash != null) {
741 $this->form->cleanupTempFiles($ilfilehash);
742 }
743 }
$_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 177 of file class.ilDclRecordEditGUI.php.

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

References $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 142 of file class.ilDclRecordEditGUI.php.

142 {
143 $this->initForm();
144 if ($this->ctrl->isAsynch()) {
145 echo $this->form->getHTML();
146 exit();
147 } else {
148 $this->tpl->setContent( $this->getLanguageJsKeys()
149 . $this->form->getHTML());
150 }
151 }

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

+ Here is the call graph for this function:

◆ delete()

ilDclRecordEditGUI::delete ( )

Remove record.

Definition at line 213 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 157 of file class.ilDclRecordEditGUI.php.

157 {
158 $this->initForm();
159 $this->cleanupTempFiles();
160
161 $this->setFormValues();
162 if ($this->ctrl->isAsynch()) {
163 echo $this->form->getHTML();
164 exit();
165 } else {
166 $this->tpl->setContent($this->getLanguageJsKeys()
167 . $this->form->getHTML());
168 }
169 }
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 99 of file class.ilDclRecordEditGUI.php.

99 {
100 $this->getRecord();
101
102 $cmd = $this->ctrl->getCmd();
103 switch ($cmd) {
104 default:
105 $this->$cmd();
106 break;
107 }
108
109 return true;
110 }
$cmd
Definition: sahs_server.php:35

References $cmd, and getRecord().

+ Here is the call graph for this function:

◆ getForm()

ilDclRecordEditGUI::getForm ( )
Returns
ilDclPropertyFormGUI

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

749 {
750 return $this->form;
751 }

References $form.

◆ getLanguageJsKeys()

ilDclRecordEditGUI::getLanguageJsKeys ( )
protected

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

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

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

+ Here is the caller graph for this function:

◆ getRecord()

ilDclRecordEditGUI::getRecord ( )

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

116 {
117 if ($_GET['mode']) {
118 $this->ctrl->saveParameter($this, 'mode');
119 $this->ctrl->setParameterByClass("ildclrecordlistgui", "mode", $_GET['mode']);
120 }
121 $this->ctrl->setParameterByClass('ildclrecordlistgui', 'tableview_id', $this->tableview_id);
122 $this->ctrl->saveParameter($this, 'redirect');
123 if ($this->record_id) {
124 $this->record = ilDclCache::getRecordCache($this->record_id);
125 if (!$this->record->hasPermissionToEdit($this->parent_obj->ref_id) OR !$this->record->hasPermissionToView($this->parent_obj->ref_id)) {
126 $this->accessDenied();
127 }
128 $this->table = $this->record->getTable();
129 $this->table_id = $this->table->getId();
130 } else {
131 $this->table = ilDclCache::getTableCache($this->table_id);
133 $this->accessDenied();
134 }
135 }
136 }
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.

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

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 259 of file class.ilDclRecordEditGUI.php.

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

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

References $r, 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 422 of file class.ilDclRecordEditGUI.php.

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

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 650 of file class.ilDclRecordEditGUI.php.

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

References 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 327 of file class.ilDclRecordEditGUI.php.

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

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 56 of file class.ilDclRecordEditGUI.php.

◆ $form

ilDclRecordEditGUI::$form
protected

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

Referenced by getForm().

◆ $lng

ilDclRecordEditGUI::$lng
protected

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

Referenced by __construct().

◆ $parent_obj

ilDclRecordEditGUI::$parent_obj
protected

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

Referenced by __construct().

◆ $record

ilDclRecordEditGUI::$record
protected

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

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

◆ $record_id

ilDclRecordEditGUI::$record_id
protected

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

Referenced by getRecordData().

◆ $table

ilDclRecordEditGUI::$table
protected

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

◆ $table_id

ilDclRecordEditGUI::$table_id
protected

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

◆ $tpl

ilDclRecordEditGUI::$tpl
protected

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

Referenced by __construct(), and searchObjects().

◆ $user

ilDclRecordEditGUI::$user
protected

Definition at line 68 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 31 of file class.ilDclRecordEditGUI.php.

Referenced by checkAndPerformRedirect().


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