ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilDataCollectionRecordEditGUI Class Reference

Class ilDataCollectionRecordEditGUI. More...

+ Collaboration diagram for ilDataCollectionRecordEditGUI:

Public Member Functions

 __construct (ilObjDataCollectionGUI $parent_obj)
 
 executeCommand ()
 
 create ()
 
 edit ()
 
 confirmDelete ()
 
 cancelDelete ()
 
 delete ()
 
 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...
 

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)
 
 parseSearchResults ($a_res)
 Parse search results. More...
 

Protected Attributes

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

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

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

Definition at line 77 of file class.ilDataCollectionRecordEditGUI.php.

References $_REQUEST, $ilCtrl, $ilUser, $lng, $parent_obj, and $tpl.

77  {
78  global $ilCtrl, $tpl, $lng, $ilUser;
79 
80  $this->ctrl = $ilCtrl;
81  $this->tpl = $tpl;
82  $this->lng = $lng;
83  $this->user = $ilUser;
84  $this->parent_obj = $parent_obj;
85  $this->record_id = $_REQUEST['record_id'];
86  $this->table_id = $_REQUEST['table_id'];
87  }
global $ilCtrl
Definition: ilias.php:18
global $ilUser
Definition: imgupload.php:15
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7

Member Function Documentation

◆ accessDenied()

ilDataCollectionRecordEditGUI::accessDenied ( )
protected

Definition at line 525 of file class.ilDataCollectionRecordEditGUI.php.

References exit, and ilUtil\sendFailure().

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

525  {
526  if (!$this->ctrl->isAsynch()) {
527  ilUtil::sendFailure($this->lng->txt('dcl_msg_no_perm_edit'), true);
528  $this->ctrl->redirectByClass('ildatacollectionrecordlistgui', 'listRecords');
529  } else {
530  echo $this->lng->txt('dcl_msg_no_perm_edit');
531  exit();
532  }
533  }
exit
Definition: login.php:54
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cancelDelete()

ilDataCollectionRecordEditGUI::cancelDelete ( )

Definition at line 171 of file class.ilDataCollectionRecordEditGUI.php.

171  {
172  $this->ctrl->redirectByClass("ildatacollectionrecordlistgui", "listRecords");
173  }

◆ cancelSave()

ilDataCollectionRecordEditGUI::cancelSave ( )

Cancel Save.

Definition at line 390 of file class.ilDataCollectionRecordEditGUI.php.

References cancelUpdate().

390  {
391  $this->cancelUpdate();
392  }
+ Here is the call graph for this function:

◆ cancelUpdate()

ilDataCollectionRecordEditGUI::cancelUpdate ( )

Cancel Update.

Definition at line 382 of file class.ilDataCollectionRecordEditGUI.php.

References checkAndPerformRedirect().

Referenced by cancelSave().

382  {
383  $this->checkAndPerformRedirect(true);
384  }
checkAndPerformRedirect($force_redirect=false)
Checkes to what view (table or detail) should be redirected and performs redirect.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkAndPerformRedirect()

ilDataCollectionRecordEditGUI::checkAndPerformRedirect (   $force_redirect = false)
protected

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

Definition at line 507 of file class.ilDataCollectionRecordEditGUI.php.

References $_GET.

Referenced by cancelUpdate(), and save().

507  {
508  if ($force_redirect || (isset($_GET['redirect']) && !$this->ctrl->isAsynch())) {
509  switch ((int)$_GET['redirect']) {
510  case self::REDIRECT_DETAIL:
511  $this->ctrl->setParameterByClass('ildatacollectionrecordviewgui', 'record_id', $this->record_id);
512  $this->ctrl->setParameterByClass('ildatacollectionrecordviewgui', 'table_id', $this->table_id);
513  $this->ctrl->redirectByClass("ildatacollectionrecordviewgui", "renderRecord");
514  break;
515  case self::REDIRECT_RECORD_LIST:
516  $this->ctrl->redirectByClass("ildatacollectionrecordlistgui", "listRecords");
517  break;
518  default:
519  $this->ctrl->redirectByClass("ildatacollectionrecordlistgui", "listRecords");
520  }
521  }
522  }
$_GET["client_id"]
+ Here is the caller graph for this function:

◆ confirmDelete()

ilDataCollectionRecordEditGUI::confirmDelete ( )

Definition at line 149 of file class.ilDataCollectionRecordEditGUI.php.

References $record, $text, and ilDataCollectionCache\getRecordCache().

149  {
150  $conf = new ilConfirmationGUI();
151  $conf->setFormAction($this->ctrl->getFormAction($this));
152  $conf->setHeaderText($this->lng->txt('dcl_confirm_delete_record'));
154  $text = '';
155  foreach ($record->getRecordFields() as $record_field) {
156  $value = $record_field->getExportValue();
157  // cut long texts
158  if (strlen($value) > 150) {
159  $value = substr($value, 0, 100) . ' ...';
160  }
161  $text .= $record_field->getField()->getTitle() . ': ' . $value . "<br>";
162  }
163  $conf->addItem('record_id', $record->getId(), $text);
164  $conf->addHiddenItem('table_id', $this->table_id);
165  $conf->setConfirm($this->lng->txt('delete'), 'delete');
166  $conf->setCancel($this->lng->txt('cancel'), 'cancelDelete');
167  $this->tpl->setContent($conf->getHTML());
168  }
static getRecordCache($record_id=0)
$text
Confirmation screen class.
+ Here is the call graph for this function:

◆ create()

ilDataCollectionRecordEditGUI::create ( )

Definition at line 124 of file class.ilDataCollectionRecordEditGUI.php.

References exit, and initForm().

124  {
125  $this->initForm();
126  if ($this->ctrl->isAsynch()) {
127  echo $this->form->getHTML();
128  exit();
129  } else {
130  $this->tpl->setContent("<script>ilDataCollection.strings.add_value='" . $this->lng->txt('add_value') . "';</script>"
131  . $this->form->getHTML());
132  }
133  }
exit
Definition: login.php:54
+ Here is the call graph for this function:

◆ delete()

ilDataCollectionRecordEditGUI::delete ( )

Definition at line 176 of file class.ilDataCollectionRecordEditGUI.php.

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

176  {
178 
179  if (!$this->table->hasPermissionToDeleteRecord($this->parent_obj->ref_id, $record)) {
180  $this->accessDenied();
181 
182  return;
183  }
184 
185  $record->doDelete();
186  ilUtil::sendSuccess($this->lng->txt("dcl_record_deleted"), true);
187  $this->ctrl->redirectByClass("ildatacollectionrecordlistgui", "listRecords");
188  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static getRecordCache($record_id=0)
+ Here is the call graph for this function:

◆ edit()

ilDataCollectionRecordEditGUI::edit ( )

Definition at line 136 of file class.ilDataCollectionRecordEditGUI.php.

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

136  {
137  $this->initForm();
138  $this->setFormValues();
139  if ($this->ctrl->isAsynch()) {
140  echo $this->form->getHTML();
141  exit();
142  } else {
143  $this->tpl->setContent("<script>ilDataCollection.strings.add_value='" . $this->lng->txt('add_value') . "';</script>"
144  . $this->form->getHTML());
145  }
146  }
setFormValues()
Set values from object to form.
exit
Definition: login.php:54
+ Here is the call graph for this function:

◆ executeCommand()

ilDataCollectionRecordEditGUI::executeCommand ( )
Returns
bool

Definition at line 93 of file class.ilDataCollectionRecordEditGUI.php.

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

93  {
94  if ($_GET['mode']) {
95  $this->ctrl->saveParameter($this, 'mode');
96  $this->ctrl->setParameterByClass("ildatacollectionrecordlistgui", "mode", $_GET['mode']);
97  }
98  $this->ctrl->saveParameter($this, 'redirect');
99  if ($this->record_id) {
100  $this->record = ilDataCollectionCache::getRecordCache($this->record_id);
101  if (!$this->record->hasPermissionToEdit($this->parent_obj->ref_id) OR !$this->record->hasPermissionToView($this->parent_obj->ref_id)) {
102  $this->accessDenied();
103  }
104  $this->table = $this->record->getTable();
105  $this->table_id = $this->table->getId();
106  } else {
107  $this->table = ilDataCollectionCache::getTableCache($this->table_id);
109  $this->accessDenied();
110  }
111  }
112 
113  $cmd = $this->ctrl->getCmd();
114  switch ($cmd) {
115  default:
116  $this->$cmd();
117  break;
118  }
119 
120  return true;
121  }
static getRecordCache($record_id=0)
$_GET["client_id"]
$cmd
Definition: sahs_server.php:35
+ Here is the call graph for this function:

◆ getRecordData()

ilDataCollectionRecordEditGUI::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 199 of file class.ilDataCollectionRecordEditGUI.php.

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

199  {
200  $record_id = ($record_id) ? $record_id : $_GET['record_id'];
201  $return = array();
202  if ($record_id) {
204  if (is_object($record)) {
205  $return = $record->getRecordFieldValues();
206  }
207  }
208  if ($this->ctrl->isAsynch()) {
209  echo json_encode($return);
210  exit();
211  }
212 
213  return $return;
214  }
static getRecordCache($record_id=0)
exit
Definition: login.php:54
$_GET["client_id"]
+ Here is the call graph for this function:

◆ initForm()

ilDataCollectionRecordEditGUI::initForm ( )

init Form

Definition at line 220 of file class.ilDataCollectionRecordEditGUI.php.

References $_GET, $options, $record, ilObjDataCollection\_hasWriteAccess(), ilDataCollectionCache\getFieldCache(), ilDataCollectionDatatype\getInputField(), ilDataCollectionCache\getRecordCache(), ilDataCollectionCache\getTableCache(), ilObject2\getTitle(), ilDataCollectionDatatype\INPUTFORMAT_DATETIME, ilDataCollectionDatatype\INPUTFORMAT_FILE, ilDataCollectionDatatype\INPUTFORMAT_MOB, ilDataCollectionDatatype\INPUTFORMAT_REFERENCE, and ilDataCollectionDatatype\INPUTFORMAT_TEXT.

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

220  {
221  $this->form = new ilPropertyFormGUI();
222  $prefix = ($this->ctrl->isAsynch()) ? 'dclajax' : 'dcl'; // Used by datacolleciton.js to select input elements
223  $this->form->setId($prefix . $this->table_id . $this->record_id);
224 
225  $hidden_prop = new ilHiddenInputGUI("table_id");
226  $hidden_prop->setValue($this->table_id);
227  $this->form->addItem($hidden_prop);
228  if ($this->record_id) {
229  $hidden_prop = new ilHiddenInputGUI("record_id");
230  $hidden_prop->setValue($this->record_id);
231  $this->form->addItem($hidden_prop);
232  }
233 
234  $this->ctrl->setParameter($this, "record_id", $this->record_id);
235  $this->form->setFormAction($this->ctrl->getFormAction($this));
236  $allFields = $this->table->getRecordFields();
237 
238  $inline_css = '';
239  foreach ($allFields as $field) {
241  if ($item === NULL) {
242  continue; // Fields calculating values at runtime, e.g. ilDataCollectionFormulaField do not have input
243  }
244  if ($field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_REFERENCE) {
245  $fieldref = $field->getFieldRef();
246  $reffield = ilDataCollectionCache::getFieldCache($fieldref);
247  $options = array();
248  if (!$field->isNRef()) {
249  $options[""] = $this->lng->txt('dcl_please_select');
250  }
251  $reftable = ilDataCollectionCache::getTableCache($reffield->getTableId());
252  foreach ($reftable->getRecords() as $record) {
253  // If the referenced field is MOB or FILE, we display the filename in the dropdown
254  switch ($reffield->getDatatypeId()) {
256  $file_obj = new ilObjFile($record->getRecordFieldValue($fieldref), false);
257  $options[$record->getId()] = $file_obj->getFileName();
258  break;
260  $media_obj = new ilObjMediaObject($record->getRecordFieldValue($fieldref), false);
261  $options[$record->getId()] = $media_obj->getTitle();
262  break;
264  $options[$record->getId()] = strtotime($record->getRecordFieldSingleHTML($fieldref));
265  // TT #0019091: options2 are the actual values, options the timestamp for sorting
266  $options2[$record->getId()] = $record->getRecordFieldSingleHTML($fieldref);
267  break;
269  $value = $record->getRecordFieldValue($fieldref);
270  if (($json = json_decode($value)) && (json_decode($value) instanceof stdClass)) {
271  $value = $json->title ? $json->title : $json->link;
272  }
273  $options[$record->getId()] = $value;
274  break;
275  default:
276  $options[$record->getId()] = $record->getRecordFieldValue($fieldref);
277  break;
278  }
279  }
280  asort($options);
281 
282  // TT #0019091: restore the actual values after sorting with timestamp
283  if ($reffield->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_DATETIME) {
284  foreach ($options as $key => $opt) {
285  $options[$key] = $options2[$key];
286  }
287  // the option 'please select' messes with the order, therefore we reset it
288  unset($options[""]);
289  $options = array("" => $this->lng->txt('dcl_please_select')) + $options;
290  }
291 
292  $item->setOptions($options);
293  if ($field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_REFERENCE) { // FSX use this to apply to MultiSelectInputGUI
294  if ($reftable->hasPermissionToAddRecord($_GET['ref_id'])) {
295  $item->addCustomAttribute('data-ref="1"');
296  $item->addCustomAttribute('data-ref-table-id="' . $reftable->getId() . '"');
297  $item->addCustomAttribute('data-ref-field-id="' . $reffield->getId() . '"');
298  }
299  }
300  }
301 
302  if ($this->record_id) {
304  }
305 
306  $item->setRequired($field->getRequired());
307  //WORKAROUND. If field is from type file: if it's required but already has a value it is no longer required as the old value is taken as default without the form knowing about it.
308  if ($field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_FILE
309  || $field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_MOB
310  ) {
311  if ($this->record_id AND $record->getId()) {
312  $field_value = $record->getRecordFieldValue($field->getId());
313  if ($field_value) {
314  $item->setRequired(false);
315  }
316  }
317  // If this is an ajax request to return the form, input files are currently not supported
318  if ($this->ctrl->isAsynch()) {
319  $item->setDisabled(true);
320  }
321  }
322 
323  if (!ilObjDataCollection::_hasWriteAccess($this->parent_obj->ref_id) && $field->getLocked()) {
324  $item->setDisabled(true);
325  }
326  $this->form->addItem($item);
327  }
328 
329  $this->tpl->addInlineCss($inline_css);
330 
331  // Add possibility to change the owner in edit mode
332  if ($this->record_id) {
333  $ownerField = $this->table->getField('owner');
334  $inputfield = ilDataCollectionDatatype::getInputField($ownerField);
335  $this->form->addItem($inputfield);
336  }
337 
338  // save and cancel commands
339  if ($this->record_id) {
340  $this->form->setTitle($this->lng->txt("dcl_update_record"));
341  $this->form->addCommandButton("save", $this->lng->txt("dcl_update_record"));
342  if (!$this->ctrl->isAsynch()) {
343  $this->form->addCommandButton("cancelUpdate", $this->lng->txt("cancel"));
344  }
345  } else {
346  $this->form->setTitle($this->lng->txt("dcl_add_new_record"));
347  $this->form->addCommandButton("save", $this->lng->txt("save"));
348  if (!$this->ctrl->isAsynch()) {
349  $this->form->addCommandButton("cancelSave", $this->lng->txt("cancel"));
350  }
351  }
352  $this->ctrl->setParameter($this, "table_id", $this->table_id);
353  $this->ctrl->setParameter($this, "record_id", $this->record_id);
354  }
static getRecordCache($record_id=0)
This class represents a property form user interface.
$_GET["client_id"]
This class represents a hidden form property in a property form.
if(!is_array($argv)) $options
Class ilObjFile.
Class ilObjMediaObject.
static getInputField(ilDataCollectionField $field)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseSearchResults()

ilDataCollectionRecordEditGUI::parseSearchResults (   $a_res)
protected

Parse search results.

Parameters
ilObject[]$a_res
Returns
array

Definition at line 606 of file class.ilDataCollectionRecordEditGUI.php.

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

Referenced by searchObjects().

606  {
607  $rows = array();
608  foreach ($a_res as $obj_id => $references) {
609  $r = array();
610  $r['title'] = ilObject::_lookupTitle($obj_id);
611  $r['desc'] = ilObject::_lookupDescription($obj_id);
612  $r['obj_id'] = $obj_id;
613  $r['refs'] = $references;
614  $rows[] = $r;
615  }
616 
617  return $rows;
618  }
static _lookupTitle($a_id)
lookup object title
$r
Definition: example_031.php:79
static _lookupDescription($a_id)
lookup object description
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilDataCollectionRecordEditGUI::save ( )

Save record.

Definition at line 398 of file class.ilDataCollectionRecordEditGUI.php.

References $_POST, $form, $valid, ilObjUser\_lookupId(), accessDenied(), checkAndPerformRedirect(), exit, ilDataCollectionCache\getRecordCache(), ilObjDataCollectionAccess\hasWriteAccess(), IL_CAL_DATETIME, IL_CAL_UNIX, initForm(), sendFailure(), ilObjDataCollection\sendNotification(), ilUtil\sendSuccess(), and setFormValues().

398  {
399  $this->initForm();
400 
401  $valid = $this->form->checkInput();
402 
403  $record_obj = ilDataCollectionCache::getRecordCache($this->record_id);
404  $date_obj = new ilDateTime(time(), IL_CAL_UNIX);
405  $record_obj->setTableId($this->table_id);
406  $record_obj->setLastUpdate($date_obj->get(IL_CAL_DATETIME));
407  $record_obj->setLastEditBy($this->user->getId());
408 
409  $create_mode = false;
410 
411  if (ilObjDataCollectionAccess::hasWriteAccess($this->parent_obj->ref_id)) {
412  $all_fields = $this->table->getRecordFields();
413  } else {
414  $all_fields = $this->table->getEditableFields();
415  }
416 
417  //Check if we can create this record.
418  foreach ($all_fields as $field) {
419  try {
420  $value = $this->form->getInput("field_" . $field->getId());
421  $field->checkValidity($value, $this->record_id);
422  } catch (ilDataCollectionInputException $e) {
423  $valid = false;
424  $item = $this->form->getItemByPostVar('field_'.$field->getId());
425  $item->setAlert($e);
426  }
427  }
428 
429  if ($valid) {
430  if (!isset($this->record_id)) {
431  if (!($this->table->hasPermissionToAddRecord($this->parent_obj->ref_id))) {
432  $this->accessDenied();
433 
434  return;
435  }
436  $record_obj->setOwner($this->user->getId());
437  $record_obj->setCreateDate($date_obj->get(IL_CAL_DATETIME));
438  $record_obj->setTableId($this->table_id);
439  $record_obj->doCreate();
440  $this->record_id = $record_obj->getId();
441  $create_mode = true;
442  } else {
443  if (!$record_obj->hasPermissionToEdit($this->parent_obj->ref_id)) {
444  $this->accessDenied();
445 
446  return;
447  }
448  }
449 
450  //edit values, they are valid we already checked them above
451  foreach ($all_fields as $field) {
452  $record_obj->setRecordFieldValueFromForm($field->getId(), $this->form);
453  }
454 
455  // Do we need to set a new owner for this record?
456  if (!$create_mode) {
457  $owner_id = ilObjUser::_lookupId($_POST['field_owner']);
458  if (!$owner_id) {
459  $this->sendFailure($this->lng->txt('user_not_known'));
460 
461  return;
462  }
463  $record_obj->setOwner($owner_id);
464  }
465 
466  if ($create_mode) {
467  ilObjDataCollection::sendNotification("new_record", $this->table_id, $record_obj->getId());
468  }
469  $record_obj->doUpdate();
470 
471  $this->ctrl->setParameter($this, "table_id", $this->table_id);
472  $this->ctrl->setParameter($this, "record_id", $this->record_id);
473 
474  if (!$this->ctrl->isAsynch()) {
475  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
476  }
477 
478  $this->checkAndPerformRedirect();
479  if ($this->ctrl->isAsynch()) {
480  // If ajax request, return the form in edit mode again
481  $this->record_id = $record_obj->getId();
482  $this->initForm();
483  $this->setFormValues();
484  echo $this->tpl->getMessageHTML($this->lng->txt('msg_obj_modified'), 'success') . $this->form->getHTML();
485  exit();
486  } else {
487  $this->ctrl->redirectByClass("ildatacollectionrecordlistgui", "listRecords");
488  }
489  } else {
490  // Form not valid...
491  //TODO: URL title flushes on invalid form
492  $this->form->setValuesByPost();
493  if ($this->ctrl->isAsynch()) {
494  echo $this->form->getHTML();
495  exit();
496  } else {
497  $this->tpl->setContent($this->form->getHTML());
498  }
499  }
500  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
setFormValues()
Set values from object to form.
static getRecordCache($record_id=0)
exit
Definition: login.php:54
$_POST['username']
Definition: cron.php:12
const IL_CAL_DATETIME
$valid
static _lookupId($a_user_str)
Lookup id by login.
checkAndPerformRedirect($force_redirect=false)
Checkes to what view (table or detail) should be redirected and performs redirect.
const IL_CAL_UNIX
Date and time handling
static sendNotification($a_action, $a_table_id, $a_record_id=NULL)
+ Here is the call graph for this function:

◆ searchObjects()

ilDataCollectionRecordEditGUI::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 555 of file class.ilDataCollectionRecordEditGUI.php.

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

555  {
556  $search = $_POST['search_for'];
557  $dest = $_POST['dest'];
558  $html = "";
559  include_once './Services/Search/classes/class.ilQueryParser.php';
560  $query_parser = new ilQueryParser($search);
561  $query_parser->setMinWordLength(1, true);
562  $query_parser->setCombination(QP_COMBINATION_AND);
563  $query_parser->parse();
564  if (!$query_parser->validate()) {
565  $html .= $query_parser->getMessage() . "<br />";
566  }
567 
568  // only like search since fulltext does not support search with less than 3 characters
569  include_once 'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
570  $object_search = new ilLikeObjectSearch($query_parser);
571  $res = $object_search->performSearch();
572  //$res->setRequiredPermission('copy');
573  $res->filter(ROOT_FOLDER_ID, true);
574 
575  if (!count($results = $res->getResultsByObjId())) {
576  $html .= $this->lng->txt('dcl_no_search_results_found_for') . ' ' . $search . "<br />";
577  }
579 
580  foreach ($results as $entry) {
581  $tpl = new ilTemplate("tpl.dcl_tree.html", true, true, "Modules/DataCollection");
582  foreach ((array)$entry['refs'] as $reference) {
583  include_once './Services/Tree/classes/class.ilPathGUI.php';
584  $path = new ilPathGUI();
585  $tpl->setCurrentBlock('result');
586  $tpl->setVariable('RESULT_PATH', $path->getPath(ROOT_FOLDER_ID, $reference) . " ยป " . $entry['title']);
587  $tpl->setVariable('RESULT_REF', $reference);
588  $tpl->setVariable('FIELD_ID', $dest);
589  $tpl->parseCurrentBlock();
590  }
591  $html .= $tpl->get();
592  }
593 
594  echo $html;
595  exit;
596  }
Creates a path for a start and endnode.
exit
Definition: login.php:54
$_POST['username']
Definition: cron.php:12
special template class to simplify handling of ITX/PEAR
$results
$path
Definition: index.php:22
const QP_COMBINATION_AND
$html
Definition: example_001.php:87
+ Here is the call graph for this function:

◆ sendFailure()

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

Definition at line 539 of file class.ilDataCollectionRecordEditGUI.php.

References exit, and ilUtil\sendFailure().

Referenced by save().

539  {
540  $keep = ($this->ctrl->isAsynch()) ? false : true;
541  $this->form->setValuesByPost();
542  if ($this->ctrl->isAsynch()) {
543  echo $this->tpl->getMessageHTML($message, 'failure') . $this->form->getHTML();
544  exit();
545  } else {
546  ilUtil::sendFailure($message, $keep);
547  $this->tpl->setContent($this->form->getHTML());
548  }
549  }
exit
Definition: login.php:54
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setFormValues()

ilDataCollectionRecordEditGUI::setFormValues ( )

Set values from object to form.

Returns
bool

Definition at line 362 of file class.ilDataCollectionRecordEditGUI.php.

References $form, and ilDataCollectionCache\getRecordCache().

Referenced by edit(), and save().

362  {
363  //Get Record-Values
364  $record_obj = ilDataCollectionCache::getRecordCache($this->record_id);
365  if ($record_obj->getId()) {
366  //Get Table Field Definitions
367  $allFields = $this->table->getFields();
368  foreach ($allFields as $field) {
369  $record_obj->fillRecordFieldFormInput($field->getId(), $this->form);
370  }
371  } else {
372  $this->form->setValuesByPost();
373  }
374 
375  return true;
376  }
static getRecordCache($record_id=0)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

ilDataCollectionRecordEditGUI::$ctrl
protected

Definition at line 55 of file class.ilDataCollectionRecordEditGUI.php.

◆ $form

ilDataCollectionRecordEditGUI::$form
protected

Definition at line 71 of file class.ilDataCollectionRecordEditGUI.php.

Referenced by save(), and setFormValues().

◆ $lng

ilDataCollectionRecordEditGUI::$lng
protected

Definition at line 63 of file class.ilDataCollectionRecordEditGUI.php.

Referenced by __construct().

◆ $parent_obj

ilDataCollectionRecordEditGUI::$parent_obj
protected

Definition at line 47 of file class.ilDataCollectionRecordEditGUI.php.

Referenced by __construct().

◆ $record

ilDataCollectionRecordEditGUI::$record
protected

◆ $record_id

ilDataCollectionRecordEditGUI::$record_id
protected

Definition at line 35 of file class.ilDataCollectionRecordEditGUI.php.

Referenced by getRecordData().

◆ $table

ilDataCollectionRecordEditGUI::$table
protected

Definition at line 43 of file class.ilDataCollectionRecordEditGUI.php.

◆ $table_id

ilDataCollectionRecordEditGUI::$table_id
protected

Definition at line 39 of file class.ilDataCollectionRecordEditGUI.php.

◆ $tpl

ilDataCollectionRecordEditGUI::$tpl
protected

Definition at line 59 of file class.ilDataCollectionRecordEditGUI.php.

Referenced by __construct(), and searchObjects().

◆ $user

ilDataCollectionRecordEditGUI::$user
protected

Definition at line 67 of file class.ilDataCollectionRecordEditGUI.php.

◆ REDIRECT_DETAIL

const ilDataCollectionRecordEditGUI::REDIRECT_DETAIL = 2

◆ REDIRECT_RECORD_LIST

const ilDataCollectionRecordEditGUI::REDIRECT_RECORD_LIST = 1

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

Definition at line 30 of file class.ilDataCollectionRecordEditGUI.php.


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