4 require_once(
"./Modules/DataCollection/classes/class.ilDataCollectionRecord.php");
5 require_once(
"./Modules/DataCollection/classes/class.ilDataCollectionField.php");
6 require_once(
"./Modules/DataCollection/classes/class.ilDataCollectionTable.php");
7 require_once(
"./Modules/DataCollection/classes/class.ilDataCollectionDatatype.php");
32 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
35 $this->record_id =
$_REQUEST[
'record_id'];
36 $this->table_id =
$_GET[
'table_id'];
38 include_once(
"class.ilDataCollectionDatatype.php");
53 $cmd = $ilCtrl->getCmd();
73 $tpl->setContent($this->form->getHTML());
86 $tpl->setContent($this->form->getHTML());
96 include_once
'./Services/Utilities/classes/class.ilConfirmationGUI.php';
98 $conf->setFormAction($ilCtrl->getFormAction($this));
99 $conf->setHeaderText($lng->txt(
'dcl_confirm_delete_record'));
103 $conf->addItem(
'record_id', $record->getId(), implode(
", ", $record->getRecordFieldValues()));
104 $conf->addHiddenItem(
'table_id', $this->table_id);
106 $conf->setConfirm($lng->txt(
'delete'),
'delete');
107 $conf->setCancel($lng->txt(
'cancel'),
'cancelDelete');
109 $tpl->setContent($conf->getHTML());
119 $ilCtrl->redirectByClass(
"ildatacollectionrecordlistgui",
"listRecords");
126 public function delete() {
130 if (! $this->table->hasPermissionToDeleteRecord($this->parent_obj->ref_id, $record)) {
138 $ilCtrl->redirectByClass(
"ildatacollectionrecordlistgui",
"listRecords");
152 $hidden_prop->setValue($this->table_id);
153 $this->form->addItem($hidden_prop);
155 $ilCtrl->setParameter($this,
"record_id", $this->record_id);
156 $this->form->setFormAction($ilCtrl->getFormAction($this));
157 $allFields = $this->table->getRecordFields();
160 foreach ($allFields as $field) {
164 $fieldref = $field->getFieldRef();
167 if (! $field->isNRef()) {
168 $options[
""] = $lng->txt(
'dcl_please_select');
171 foreach ($reftable->getRecords() as $record) {
172 switch($reffield->getDatatypeId()) {
174 $file_obj =
new ilObjFile($record->getRecordFieldValue($fieldref),
false);
175 $options[$record->getId()] = $file_obj->getFileName();
178 $media_obj =
new ilObjMediaObject($record->getRecordFieldValue($fieldref),
false);
179 $options[$record->getId()] = $media_obj->
getTitle();
182 $options[$record->getId()] = $record->getRecordFieldSingleHTML($fieldref);
185 $options[$record->getId()] = $record->getRecordFieldValue($fieldref);
194 $item->setWidth(400);
195 $item->setHeight(100);
196 $inline_css .=
'div#'.$item->getFieldId().
'{resize:both;} ';
199 $tpl->addInlineCss($inline_css);
201 if ($this->record_id) {
205 $item->setRequired($field->getRequired());
210 if ($this->record_id && $record->getId()) {
211 $field_value = $record->getRecordFieldValue($field->getId());
213 $item->setRequired(
false);
219 $item->setDisabled(
true);
221 $this->form->addItem($item);
225 if ($this->record_id) {
226 $ownerField = $this->table->getField(
'owner');
228 $this->form->addItem($inputfield);
232 if (isset($this->record_id)) {
233 $this->form->setTitle($lng->txt(
"dcl_update_record"));
234 $this->form->addCommandButton(
"save", $lng->txt(
"dcl_update_record"));
235 $this->form->addCommandButton(
"cancelUpdate", $lng->txt(
"cancel"));
237 $this->form->setTitle($lng->txt(
"dcl_add_new_record"));
238 $this->form->addCommandButton(
"save", $lng->txt(
"save"));
239 $this->form->addCommandButton(
"cancelSave", $lng->txt(
"cancel"));
242 $ilCtrl->setParameter($this,
"table_id", $this->table_id);
243 $ilCtrl->setParameter($this,
"record_id", $this->record_id);
257 $allFields = $this->table->getFields();
260 foreach ($allFields as $field) {
261 $value = $record_obj->getRecordFieldFormInput($field->getId());
262 $values[
'field_' . $field->getId()] = $value;
266 $this->form->getItemByPostVar(
'field_' . $field->getId())->setImage(
$img);
271 $this->form->setValuesByArray($values);
282 $ilCtrl->redirectByClass(
"ildatacollectionrecordlistgui",
"listRecords");
303 if ($this->form->checkInput()) {
307 $record_obj->setTableId($this->table_id);
309 $record_obj->setLastEditBy($ilUser->getId());
311 $create_mode =
false;
314 $all_fields = $this->table->getRecordFields();
316 $all_fields = $this->table->getEditableFields();
321 foreach ($all_fields as $field) {
323 $value = $this->form->getInput(
"field_" . $field->getId());
324 $field->checkValidity($value, $this->record_id);
326 $fail .= $field->getTitle() .
": " . $e .
"<br>";
337 if (! isset($this->record_id)) {
338 if (! ($this->table->hasPermissionToAddRecord($this->parent_obj->ref_id))) {
343 $record_obj->setOwner($ilUser->getId());
345 $record_obj->setTableId($this->table_id);
346 $record_obj->doCreate();
347 $this->record_id = $record_obj->getId();
350 if (! $record_obj->hasPermissionToEdit($this->parent_obj->ref_id)) {
357 foreach ($all_fields as $field) {
358 $value = $this->form->getInput(
"field_" . $field->getId());
361 && $this->form->getItemByPostVar(
"field_" . $field->getId())->getDeletionFlag()
365 $record_obj->setRecordFieldValue($field->getId(), $value);
369 if (! $create_mode) {
377 $record_obj->setOwner($owner_id);
384 $record_obj->doUpdate();
387 $ilCtrl->setParameter($this,
"table_id", $this->table_id);
388 $ilCtrl->setParameter($this,
"record_id", $this->record_id);
389 $ilCtrl->redirectByClass(
"ildatacollectionrecordlistgui",
"listRecords");
392 $this->form->setValuesByPost();
393 $tpl->setContent($this->form->getHTML());
403 $tpl->setContent(
"Access denied");
412 $this->form->setValuesByPost();
413 $tpl->setContent($this->form->getHTML());
423 $search =
$_POST[
'search_for'];
426 include_once
'./Services/Search/classes/class.ilQueryParser.php';
428 $query_parser->setMinWordLength(1,
true);
430 $query_parser->parse();
431 if (! $query_parser->validate()) {
432 $html .= $query_parser->getMessage() .
"<br />";
436 include_once
'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
438 $res = $object_search->performSearch();
440 $res->filter(ROOT_FOLDER_ID,
true);
443 $html .= $lng->txt(
'dcl_no_search_results_found_for') .
' ' . $search .
"<br />";
448 $tpl =
new ilTemplate(
"tpl.dcl_tree.html",
true,
true,
"Modules/DataCollection");
449 foreach ((array)$entry[
'refs'] as $reference) {
450 include_once
'./Services/Tree/classes/class.ilPathGUI.php';
453 $tpl->setCurrentBlock(
'result');
454 $tpl->setVariable(
'RESULT_PATH',
$path->getPath(ROOT_FOLDER_ID, $reference) .
" » " . $entry[
'title']);
455 $tpl->setVariable(
'RESULT_REF', $reference);
456 $tpl->setVariable(
'FIELD_ID', $dest);
457 $tpl->parseCurrentBlock();
459 $html .=
$tpl->get();
475 foreach ($a_res as $obj_id => $references) {
478 $r[
'obj_id'] = $obj_id;
479 $r[
'refs'] = $references;
484 return $rows ? $rows : array();
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static getRecordCache($record_id=0)
Creates a path for a start and endnode.
cancelDelete()
cancelDelete
const INPUTFORMAT_DATETIME
static _lookupId($a_user_str)
lookup id by login
static _lookupTitle($a_id)
lookup object title
searchObjects()
This function is only used by the ajax request if searching for ILIAS references. ...
Class ilObjDataCollectionGUI.
static getFieldCache($field_id=0)
if(!is_array($argv)) $options
static _lookupDescription($a_id)
lookup object description
confirmDelete()
confirmDelete
special template class to simplify handling of ITX/PEAR
executeCommand()
execute command
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
static getInputField(ilDataCollectionField $field)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Class ilDataCollectionRecordEditGUI.
static sendNotification($a_action, $a_table_id, $a_record_id=NULL)
__construct(ilObjDataCollectionGUI $parent_obj)
Constructor.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
parseSearchResults($a_res)
Parse search results.
const INPUTFORMAT_REFERENCE
static _hasWriteAccess($ref)
static getTableCache($table_id=0)
Confirmation screen class.