ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
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 524 of file class.ilDataCollectionRecordEditGUI.php.

References exit, and ilUtil\sendFailure().

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

524  {
525  if (!$this->ctrl->isAsynch()) {
526  ilUtil::sendFailure($this->lng->txt('dcl_msg_no_perm_edit'), true);
527  $this->ctrl->redirectByClass('ildatacollectionrecordlistgui', 'listRecords');
528  } else {
529  echo $this->lng->txt('dcl_msg_no_perm_edit');
530  exit();
531  }
532  }
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 162 of file class.ilDataCollectionRecordEditGUI.php.

162  {
163  $this->ctrl->redirectByClass("ildatacollectionrecordlistgui", "listRecords");
164  }

◆ cancelSave()

ilDataCollectionRecordEditGUI::cancelSave ( )

Cancel Save.

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

References cancelUpdate().

373  {
374  $this->cancelUpdate();
375  }
+ Here is the call graph for this function:

◆ cancelUpdate()

ilDataCollectionRecordEditGUI::cancelUpdate ( )

Cancel Update.

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

References checkAndPerformRedirect().

Referenced by cancelSave().

365  {
366  $this->checkAndPerformRedirect(true);
367  }
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 506 of file class.ilDataCollectionRecordEditGUI.php.

References $_GET.

Referenced by cancelUpdate(), and save().

506  {
507  if ($force_redirect || (isset($_GET['redirect']) && !$this->ctrl->isAsynch())) {
508  switch ((int)$_GET['redirect']) {
509  case self::REDIRECT_DETAIL:
510  $this->ctrl->setParameterByClass('ildatacollectionrecordviewgui', 'record_id', $this->record_id);
511  $this->ctrl->setParameterByClass('ildatacollectionrecordviewgui', 'table_id', $this->table_id);
512  $this->ctrl->redirectByClass("ildatacollectionrecordviewgui", "renderRecord");
513  break;
514  case self::REDIRECT_RECORD_LIST:
515  $this->ctrl->redirectByClass("ildatacollectionrecordlistgui", "listRecords");
516  break;
517  default:
518  $this->ctrl->redirectByClass("ildatacollectionrecordlistgui", "listRecords");
519  }
520  }
521  }
$_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, 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  $conf->addItem('record_id', $record->getId(), implode(", ", $record->getRecordFieldValues()));
155  $conf->addHiddenItem('table_id', $this->table_id);
156  $conf->setConfirm($this->lng->txt('delete'), 'delete');
157  $conf->setCancel($this->lng->txt('cancel'), 'cancelDelete');
158  $this->tpl->setContent($conf->getHTML());
159  }
static getRecordCache($record_id=0)
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 167 of file class.ilDataCollectionRecordEditGUI.php.

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

167  {
169 
170  if (!$this->table->hasPermissionToDeleteRecord($this->parent_obj->ref_id, $record)) {
171  $this->accessDenied();
172 
173  return;
174  }
175 
176  $record->doDelete();
177  ilUtil::sendSuccess($this->lng->txt("dcl_record_deleted"), true);
178  $this->ctrl->redirectByClass("ildatacollectionrecordlistgui", "listRecords");
179  }
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 190 of file class.ilDataCollectionRecordEditGUI.php.

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

190  {
191  $record_id = ($record_id) ? $record_id : $_GET['record_id'];
192  $return = array();
193  if ($record_id) {
195  if (is_object($record)) {
196  $return = $record->getRecordFieldValues();
197  }
198  }
199  if ($this->ctrl->isAsynch()) {
200  echo json_encode($return);
201  exit();
202  }
203 
204  return $return;
205  }
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 211 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, and ilDataCollectionDatatype\INPUTFORMAT_REFERENCE.

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

211  {
212  $this->form = new ilPropertyFormGUI();
213  $prefix = ($this->ctrl->isAsynch()) ? 'dclajax' : 'dcl'; // Used by datacolleciton.js to select input elements
214  $this->form->setId($prefix . $this->table_id . $this->record_id);
215 
216  $hidden_prop = new ilHiddenInputGUI("table_id");
217  $hidden_prop->setValue($this->table_id);
218  $this->form->addItem($hidden_prop);
219  if ($this->record_id) {
220  $hidden_prop = new ilHiddenInputGUI("record_id");
221  $hidden_prop->setValue($this->record_id);
222  $this->form->addItem($hidden_prop);
223  }
224 
225  $this->ctrl->setParameter($this, "record_id", $this->record_id);
226  $this->form->setFormAction($this->ctrl->getFormAction($this));
227  $allFields = $this->table->getRecordFields();
228  $inline_css = '';
229  foreach ($allFields as $field) {
231  if ($item === NULL) {
232  continue; // Fields calculating values at runtime, e.g. ilDataCollectionFormulaField do not have input
233  }
234  if ($field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_REFERENCE) {
235  $fieldref = $field->getFieldRef();
236  $reffield = ilDataCollectionCache::getFieldCache($fieldref);
237  $options = array();
238  if (!$field->isNRef()) {
239  $options[""] = $this->lng->txt('dcl_please_select');
240  }
241  $reftable = ilDataCollectionCache::getTableCache($reffield->getTableId());
242  foreach ($reftable->getRecords() as $record) {
243  // If the referenced field is MOB or FILE, we display the filename in the dropdown
244  switch ($reffield->getDatatypeId()) {
246  $file_obj = new ilObjFile($record->getRecordFieldValue($fieldref), false);
247  $options[$record->getId()] = $file_obj->getFileName();
248  break;
250  $media_obj = new ilObjMediaObject($record->getRecordFieldValue($fieldref), false);
251  $options[$record->getId()] = $media_obj->getTitle();
252  break;
254  $options[$record->getId()] = strtotime($record->getRecordFieldSingleHTML($fieldref));
255  // TT #0019091: options2 are the actual values, options the timestamp for sorting
256  $options2[$record->getId()] = $record->getRecordFieldSingleHTML($fieldref);
257  break;
258  default:
259  $options[$record->getId()] = $record->getRecordFieldValue($fieldref);
260  break;
261  }
262  }
263  asort($options);
264 
265  // TT #0019091: restore the actual values after sorting with timestamp
266  if ($reffield->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_DATETIME) {
267  foreach ($options as $key => $opt) {
268  $options[$key] = $options2[$key];
269  }
270  // the option 'please select' messes with the order, therefore we reset it
271  unset($options[""]);
272  $options = array("" => $this->lng->txt('dcl_please_select')) + $options;
273  }
274 
275  $item->setOptions($options);
276  if ($field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_REFERENCE) { // FSX use this to apply to MultiSelectInputGUI
277  if ($reftable->hasPermissionToAddRecord($_GET['ref_id'])) {
278  $item->addCustomAttribute('data-ref="1"');
279  $item->addCustomAttribute('data-ref-table-id="' . $reftable->getId() . '"');
280  $item->addCustomAttribute('data-ref-field-id="' . $reffield->getId() . '"');
281  }
282  }
283  }
284 
285  if ($this->record_id) {
287  }
288 
289  $item->setRequired($field->getRequired());
290  //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.
291  if ($field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_FILE
292  || $field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_MOB
293  ) {
294  if ($this->record_id AND $record->getId()) {
295  $field_value = $record->getRecordFieldValue($field->getId());
296  if ($field_value) {
297  $item->setRequired(false);
298  }
299  }
300  // If this is an ajax request to return the form, input files are currently not supported
301  if ($this->ctrl->isAsynch()) {
302  $item->setDisabled(true);
303  }
304  }
305 
306  if (!ilObjDataCollection::_hasWriteAccess($this->parent_obj->ref_id) && $field->getLocked()) {
307  $item->setDisabled(true);
308  }
309  $this->form->addItem($item);
310  }
311 
312  $this->tpl->addInlineCss($inline_css);
313 
314  // Add possibility to change the owner in edit mode
315  if ($this->record_id) {
316  $ownerField = $this->table->getField('owner');
317  $inputfield = ilDataCollectionDatatype::getInputField($ownerField);
318  $this->form->addItem($inputfield);
319  }
320 
321  // save and cancel commands
322  if ($this->record_id) {
323  $this->form->setTitle($this->lng->txt("dcl_update_record"));
324  $this->form->addCommandButton("save", $this->lng->txt("dcl_update_record"));
325  if (!$this->ctrl->isAsynch()) {
326  $this->form->addCommandButton("cancelUpdate", $this->lng->txt("cancel"));
327  }
328  } else {
329  $this->form->setTitle($this->lng->txt("dcl_add_new_record"));
330  $this->form->addCommandButton("save", $this->lng->txt("save"));
331  if (!$this->ctrl->isAsynch()) {
332  $this->form->addCommandButton("cancelSave", $this->lng->txt("cancel"));
333  }
334  }
335  $this->ctrl->setParameter($this, "table_id", $this->table_id);
336  $this->ctrl->setParameter($this, "record_id", $this->record_id);
337  }
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 605 of file class.ilDataCollectionRecordEditGUI.php.

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

Referenced by searchObjects().

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

◆ save()

ilDataCollectionRecordEditGUI::save ( )

Save record.

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

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

381  {
382  $this->initForm();
383 
384  $valid = $this->form->checkInput();
385 
386 
387  $record_obj = ilDataCollectionCache::getRecordCache($this->record_id);
388  $date_obj = new ilDateTime(time(), IL_CAL_UNIX);
389  $record_obj->setTableId($this->table_id);
390  $record_obj->setLastUpdate($date_obj->get(IL_CAL_DATETIME));
391  $record_obj->setLastEditBy($this->user->getId());
392 
393  $create_mode = false;
394 
395  if (ilObjDataCollectionAccess::hasWriteAccess($this->parent_obj->ref_id)) {
396  $all_fields = $this->table->getRecordFields();
397  } else {
398  $all_fields = $this->table->getEditableFields();
399  }
400 
401  //Check if we can create this record.
402  foreach ($all_fields as $field) {
403  try {
404  $value = $this->form->getInput("field_" . $field->getId());
405  $field->checkValidity($value, $this->record_id);
406  } catch (ilDataCollectionInputException $e) {
407  $valid = false;
408  $item = $this->form->getItemByPostVar('field_'.$field->getId());
409  $item->setAlert($e);
410  }
411  }
412 
413 
414  if ($valid) {
415  if (!isset($this->record_id)) {
416  if (!($this->table->hasPermissionToAddRecord($this->parent_obj->ref_id))) {
417  $this->accessDenied();
418 
419  return;
420  }
421  $record_obj->setOwner($this->user->getId());
422  $record_obj->setCreateDate($date_obj->get(IL_CAL_DATETIME));
423  $record_obj->setTableId($this->table_id);
424  $record_obj->doCreate();
425  $this->record_id = $record_obj->getId();
426  $create_mode = true;
427  } else {
428  if (!$record_obj->hasPermissionToEdit($this->parent_obj->ref_id)) {
429  $this->accessDenied();
430 
431  return;
432  }
433  }
434  //edit values, they are valid we already checked them above
435  foreach ($all_fields as $field) {
436  $value = $this->form->getInput("field_" . $field->getId());
437 
438  switch (true) {
439  //deletion flag on MOB inputs.
440  case ($field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_MOB
441  && $this->form->getItemByPostVar("field_" . $field->getId())->getDeletionFlag()):
442  $value = - 1;
443  $record_obj->setRecordFieldValue($field->getId(), $value);
444  break;
445  // mantis 0018064
446  case ($field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_FILE && $value['tmp_name']):
447  $record_obj->setRecordFieldValue($field->getId(), $value);
448  break;
449  default:
450  $record_obj->setRecordFieldValue($field->getId(), $value);
451  break;
452  }
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  $this->form->setValuesByPost();
492  if ($this->ctrl->isAsynch()) {
493  echo $this->form->getHTML();
494  exit();
495  } else {
496  $this->tpl->setContent($this->form->getHTML());
497  }
498  }
499  }
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 554 of file class.ilDataCollectionRecordEditGUI.php.

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

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

◆ sendFailure()

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

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

References exit, and ilUtil\sendFailure().

Referenced by save().

538  {
539  $keep = ($this->ctrl->isAsynch()) ? false : true;
540  $this->form->setValuesByPost();
541  if ($this->ctrl->isAsynch()) {
542  echo $this->tpl->getMessageHTML($message, 'failure') . $this->form->getHTML();
543  exit();
544  } else {
545  ilUtil::sendFailure($message, $keep);
546  $this->tpl->setContent($this->form->getHTML());
547  }
548  }
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 345 of file class.ilDataCollectionRecordEditGUI.php.

References ilDataCollectionCache\getRecordCache().

Referenced by edit(), and save().

345  {
346  //Get Record-Values
347  $record_obj = ilDataCollectionCache::getRecordCache($this->record_id);
348  //Get Table Field Definitions
349  $allFields = $this->table->getFields();
350  $values = array();
351  foreach ($allFields as $field) {
352  $value = $record_obj->getRecordFieldFormInput($field->getId());
353  $values['field_' . $field->getId()] = $value;
354  }
355  $values['record_id'] = $record_obj->getId();
356  $this->form->setValuesByArray($values);
357 
358  return true;
359  }
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.

◆ $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: