ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilAdvancedMDRecordGUI Class Reference
+ Collaboration diagram for ilAdvancedMDRecordGUI:

Public Member Functions

 __construct ($a_mode, $a_obj_type='', $a_obj_id='', $a_sub_type='', $a_sub_id='')
 Constructor. More...
 
 setPropertyForm ($form)
 set property form object More...
 
 setSearchValues ($a_values)
 Set values for search form. More...
 
 setInfoObject ($info)
 get info sections More...
 
 parse ()
 Get HTML. More...
 
 importEditFormPostValues ()
 Load edit form values from post. More...
 
 writeEditForm ($a_obj_id=null, $a_sub_id=null)
 Write edit form values to db. More...
 
 importSearchForm ()
 Load edit form values from post. More...
 
 setSearchFormValues (array $a_values)
 
 parseRecordSelection ($a_sec_head="")
 Parse property form in editor mode. More...
 
 saveSelection ()
 Save selection per object. More...
 
 setTableGUI ($a_val)
 Set table. More...
 
 getTableGUI ()
 Get table. More...
 
 setRowData ($a_val)
 Set row data. More...
 
 getRowData ()
 Get row data. More...
 
 importFilter ()
 Import filter (post) values. More...
 
 getFilterElements ($a_only_non_empty=true)
 Get SQL conditions for current filter value(s) More...
 

Data Fields

const MODE_EDITOR = 1
 
const MODE_SEARCH = 2
 
const MODE_INFO = 3
 
const MODE_REC_SELECTION = 4
 
const MODE_FILTER = 5
 
const MODE_TABLE_HEAD = 6
 
const MODE_TABLE_CELLS = 7
 

Protected Member Functions

 parseEditor ()
 Parse property form in editor mode. More...
 
 parseDuration ($u_start, $u_end)
 parse hours and minutes from duration More...
 
 getActiveRecords ()
 

Protected Attributes

 $lng
 
 $editor_form
 

Private Member Functions

 parseSearch ()
 Parse search. More...
 
 parseInfoPage ()
 
 handleECSDefinitions ($a_definition)
 handle ecs definitions More...
 
 showECSStart ($def)
 Show special form for ecs start. More...
 
 parseFilter ()
 Parse property for filter (table) More...
 
 parseTableHead ()
 Parse property for table head. More...
 
 parseTableCells ()
 Parse table cells. More...
 

Private Attributes

 $mode
 
 $obj_type
 
 $sub_type
 
 $obj_id
 
 $form
 
 $search_values = array()
 

Detailed Description

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

@ilCtrl_Calls

Definition at line 14 of file class.ilAdvancedMDRecordGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilAdvancedMDRecordGUI::__construct (   $a_mode,
  $a_obj_type = '',
  $a_obj_id = '',
  $a_sub_type = '',
  $a_sub_id = '' 
)

Constructor.

@access public

Parameters
intmode either MODE_EDITOR or MODE_SEARCH
intobj_type

Definition at line 46 of file class.ilAdvancedMDRecordGUI.php.

47 {
48 global $lng;
49
50 $this->lng = $lng;
51 $this->mode = $a_mode;
52 $this->obj_type = $a_obj_type;
53 $this->obj_id = $a_obj_id;
54 $this->sub_type = $a_sub_type;
55 $this->sub_id = $a_sub_id;
56 }

References $lng.

Member Function Documentation

◆ getActiveRecords()

ilAdvancedMDRecordGUI::getActiveRecords ( )
protected

Definition at line 639 of file class.ilAdvancedMDRecordGUI.php.

640 {
641 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
642 return ilAdvancedMDRecord::_getSelectedRecordsByObject($this->obj_type, $this->obj_id, $this->sub_type);
643 }
static _getSelectedRecordsByObject($a_obj_type, $a_obj_id, $a_sub_type="")
Get selected records by object.

References ilAdvancedMDRecord\_getSelectedRecordsByObject().

Referenced by parseEditor(), parseFilter(), parseSearch(), parseTableCells(), and parseTableHead().

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

◆ getFilterElements()

ilAdvancedMDRecordGUI::getFilterElements (   $a_only_non_empty = true)

Get SQL conditions for current filter value(s)

Returns
array

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

709 {
710 if(!is_array($this->adt_search))
711 {
712 return;
713 }
714
715 $res = array();
716
717 foreach($this->adt_search as $def_id => $element)
718 {
719 if(!$element->isNull() ||
720 !(bool)$a_only_non_empty)
721 {
722 $res[$def_id] = $element;
723 }
724 }
725
726 return $res;
727 }

References $res.

Referenced by ilTable2GUI\isAdvMDFilter().

+ Here is the caller graph for this function:

◆ getRowData()

ilAdvancedMDRecordGUI::getRowData ( )

Get row data.

Returns
array assoc array of row data (containing md record data)

Definition at line 634 of file class.ilAdvancedMDRecordGUI.php.

635 {
636 return $this->row_data;
637 }

Referenced by parseTableCells().

+ Here is the caller graph for this function:

◆ getTableGUI()

ilAdvancedMDRecordGUI::getTableGUI ( )

Get table.

Returns
object table gui class

Definition at line 614 of file class.ilAdvancedMDRecordGUI.php.

615 {
616 return $this->table_gui;
617 }

◆ handleECSDefinitions()

ilAdvancedMDRecordGUI::handleECSDefinitions (   $a_definition)
private

handle ecs definitions

@access private

Parameters
objectilAdvMDFieldDefinition
Returns

Definition at line 395 of file class.ilAdvancedMDRecordGUI.php.

396 {
397 include_once('./Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php');
398 include_once('./Services/WebServices/ECS/classes/class.ilECSServerSettings.php');
399
400 if(ilECSServerSettings::getInstance()->activeServerExists() or
401 ($this->obj_type != 'crs' and $this->obj_type != 'rcrs')
402 )
403 {
404 return false;
405 }
406 return false;
407 /*
408 $mapping = ilECSDataMappingSettings::_getInstance();
409
410 if($mapping->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'begin') == $a_definition->getFieldId())
411 {
412 $this->showECSStart($a_definition);
413 return true;
414 }
415 if($mapping->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'end') == $a_definition->getFieldId())
416 {
417 return true;
418 }
419 if($mapping->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'cycle') == $a_definition->getFieldId())
420 {
421 return true;
422 }
423 if($mapping->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'room') == $a_definition->getFieldId())
424 {
425 return true;
426 }
427 */
428 }
static getInstance()
Get singleton instance.

References ilECSServerSettings\getInstance().

Referenced by parseTableCells(), and parseTableHead().

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

◆ importEditFormPostValues()

ilAdvancedMDRecordGUI::importEditFormPostValues ( )

Load edit form values from post.

Returns
bool

Definition at line 196 of file class.ilAdvancedMDRecordGUI.php.

197 {
198 // #13774
199 if(!is_array($this->editor_form))
200 {
201 return false;
202 }
203
204 $valid = true;
205
206 foreach($this->editor_form as $item)
207 {
208 $item["form"]->importFromPost();
209 if(!$item["form"]->validate())
210 {
211 $valid = false;
212 }
213 }
214
215 return $valid;
216 }
$valid

References $valid.

◆ importFilter()

ilAdvancedMDRecordGUI::importFilter ( )

Import filter (post) values.

Definition at line 690 of file class.ilAdvancedMDRecordGUI.php.

691 {
692 if(!is_array($this->adt_search))
693 {
694 return;
695 }
696
697 foreach($this->adt_search as $element)
698 {
699 $element->importFromPost();
700 }
701 }

◆ importSearchForm()

ilAdvancedMDRecordGUI::importSearchForm ( )

Load edit form values from post.

Returns
array

Definition at line 318 of file class.ilAdvancedMDRecordGUI.php.

319 {
320 if(!sizeof($this->search_form))
321 {
322 return false;
323 }
324
325 $valid = true;
326 $res = array();
327
328 foreach($this->search_form as $field_id => $item)
329 {
330 $item["value"]->importFromPost();
331 if(!$item["value"]->validate())
332 {
333 $valid = false;
334 }
335 $value = $item["def"]->getSearchValueSerialized($item["value"]);
336 if($value !== null)
337 {
338 $res[$field_id] = $value;
339 }
340 }
341
342 if($valid)
343 {
344 return $res;
345 }
346 }

References $res, and $valid.

◆ parse()

ilAdvancedMDRecordGUI::parse ( )

Get HTML.

@access public

Parameters

Definition at line 101 of file class.ilAdvancedMDRecordGUI.php.

102 {
103 switch($this->mode)
104 {
106 return $this->parseEditor();
107
109 return $this->parseSearch();
110
111 case self::MODE_INFO:
112 return $this->parseInfoPage();
113
115 return $this->parseRecordSelection();
116
118 return $this->parseFilter();
119
121 return $this->parseTableHead();
122
124 return $this->parseTableCells();
125
126 default:
127 die('Not implemented yet');
128 }
129 }
parseRecordSelection($a_sec_head="")
Parse property form in editor mode.
parseFilter()
Parse property for filter (table)
parseTableHead()
Parse property for table head.
parseEditor()
Parse property form in editor mode.

References MODE_EDITOR, MODE_FILTER, MODE_INFO, MODE_REC_SELECTION, MODE_SEARCH, MODE_TABLE_CELLS, MODE_TABLE_HEAD, parseEditor(), parseFilter(), parseInfoPage(), parseRecordSelection(), parseSearch(), parseTableCells(), and parseTableHead().

+ Here is the call graph for this function:

◆ parseDuration()

ilAdvancedMDRecordGUI::parseDuration (   $u_start,
  $u_end 
)
protected

parse hours and minutes from duration

@access protected

Parameters

return

Definition at line 531 of file class.ilAdvancedMDRecordGUI.php.

532 {
533 if($u_start >= $u_end)
534 {
535 return array(0,0);
536 }
537 $diff = $u_end - $u_start;
538 $hours = (int) ($diff / (60 * 60));
539 $min = (int) (($diff % 3600) / 60);
540 return array($hours,$min);
541 }

Referenced by showECSStart().

+ Here is the caller graph for this function:

◆ parseEditor()

ilAdvancedMDRecordGUI::parseEditor ( )
protected

Parse property form in editor mode.

Definition at line 139 of file class.ilAdvancedMDRecordGUI.php.

140 {
141 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php');
142 $this->editor_form = array();
143
144 foreach($this->getActiveRecords() as $record_obj)
145 {
146 /* :TODO:
147 if($this->handleECSDefinitions($def))
148 {
149 continue;
150 }
151 */
152
153 $record_id = $record_obj->getRecordId();
154
155 $values = new ilAdvancedMDValues($record_id, $this->obj_id, $this->sub_type, $this->sub_id);
156 $values->read();
157 $defs = $values->getDefinitions();
158
159 // empty record?
160 if(!sizeof($defs))
161 {
162 continue;
163 }
164
165 $adt_group_form = ilADTFactory::getInstance()->getFormBridgeForInstance($values->getADTGroup());
166 $adt_group_form->setForm($this->form);
167 $adt_group_form->setTitle($record_obj->getTitle());
168 $adt_group_form->setInfo($record_obj->getDescription());
169
170 foreach($defs as $def)
171 {
172 $element = $adt_group_form->getElement($def->getFieldId());
173 $element->setTitle($def->getTitle());
174 $element->setInfo($def->getDescription());
175
176 // definition may customize ADT form element
177 $def->prepareElementForEditor($element);
178
179 if($values->isDisabled($def->getFieldId()))
180 {
181 $element->setDisabled(true);
182 }
183 }
184
185 $adt_group_form->addToForm();
186
187 $this->editor_form[$record_id] = array("values"=>$values, "form"=>$adt_group_form);
188 }
189 }
static getInstance()
Get singleton.

References getActiveRecords(), and ilADTFactory\getInstance().

Referenced by parse().

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

◆ parseFilter()

ilAdvancedMDRecordGUI::parseFilter ( )
private

Parse property for filter (table)

@access private

Definition at line 651 of file class.ilAdvancedMDRecordGUI.php.

652 {
653 $this->adt_search = array();
654
655 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
656 foreach($this->getActiveRecords() as $record_obj)
657 {
658 $record_id = $record_obj->getRecordId();
659
661 foreach($defs as $def)
662 {
663 // some input GUIs do NOT support filter rendering yet
664 if(!$def->isFilterSupported())
665 {
666 continue;
667 }
668
669 /* :TODO:
670 if($this->handleECSDefinitions($def))
671 {
672 continue;
673 }
674 */
675
676 $this->adt_search[$def->getFieldId()] = ilADTFactory::getInstance()->getSearchBridgeForDefinitionInstance($def->getADTDefinition(), true, false);
677 $this->adt_search[$def->getFieldId()]->setTableGUI($this->table_gui);
678 $this->adt_search[$def->getFieldId()]->setTitle($def->getTitle());
679 $this->adt_search[$def->getFieldId()]->setElementId('md_'.$def->getFieldId());
680
681 $this->adt_search[$def->getFieldId()]->loadFilter();
682 $this->adt_search[$def->getFieldId()]->addToForm();
683 }
684 }
685 }
static getInstancesByRecordId($a_record_id, $a_only_searchable=false)
Get definitions by record id.

References getActiveRecords(), ilADTFactory\getInstance(), and ilAdvancedMDFieldDefinition\getInstancesByRecordId().

Referenced by parse().

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

◆ parseInfoPage()

ilAdvancedMDRecordGUI::parseInfoPage ( )
private

Definition at line 358 of file class.ilAdvancedMDRecordGUI.php.

359 {
360 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php');
361 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
362 include_once('Services/ADT/classes/class.ilADTFactory.php');
363
364 foreach(ilAdvancedMDValues::getInstancesForObjectId($this->obj_id, $this->obj_type, $this->sub_type, $this->sub_id) as $record_id => $a_values)
365 {
366 // this correctly binds group and definitions
367 $a_values->read();
368
369 $this->info->addSection(ilAdvancedMDRecord::_lookupTitle($record_id));
370
371 $defs = $a_values->getDefinitions();
372 foreach($a_values->getADTGroup()->getElements() as $element_id => $element)
373 {
374 if(!$element->isNull())
375 {
376 $this->info->addProperty($defs[$element_id]->getTitle(),
377 ilADTFactory::getInstance()->getPresentationBridgeForInstance($element)->getHTML());
378 }
379 }
380 }
381 }
static _lookupTitle($a_record_id)
Lookup title.
static getInstancesForObjectId($a_obj_id, $a_obj_type=null, $a_sub_type="-", $a_sub_id=0)
Get instances for given object id.

References ilAdvancedMDRecord\_lookupTitle(), ilADTFactory\getInstance(), and ilAdvancedMDValues\getInstancesForObjectId().

Referenced by parse().

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

◆ parseRecordSelection()

ilAdvancedMDRecordGUI::parseRecordSelection (   $a_sec_head = "")

Parse property form in editor mode.

@access private

Definition at line 554 of file class.ilAdvancedMDRecordGUI.php.

555 {
556 global $ilUser;
557
558 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
559 $first = true;
560 foreach(ilAdvancedMDRecord::_getActivatedRecordsByObjectType($this->obj_type, $this->sub_type) as $record_obj)
561 {
562 $selected = ilAdvancedMDRecord::getObjRecSelection($this->obj_id, $this->sub_type);
563 if ($first)
564 {
565 $first = false;
567 $sec_tit = ($a_sec_head == "")
568 ? $this->lng->txt("meta_adv_records")
569 : $a_sec_head;
570 $section->setTitle($sec_tit);
571 $this->form->addItem($section);
572 }
573
574 // checkbox for each active record
575 $cb = new ilCheckboxInputGUI($record_obj->getTitle(), "amet_use_rec[]");
576 $cb->setInfo($record_obj->getDescription());
577 $cb->setValue($record_obj->getRecordId());
578 if (in_array($record_obj->getRecordId(), $selected))
579 {
580 $cb->setChecked(true);
581 }
582 $this->form->addItem($cb);
583 }
584 }
$section
Definition: Utf8Test.php:83
static getObjRecSelection($a_obj_id, $a_sub_type="")
Get repository object record selection.
static _getActivatedRecordsByObjectType($a_obj_type, $a_sub_type="", $a_only_optional=false)
Get activated records by object type.
This class represents a checkbox property in a property form.
This class represents a section header in a property form.
$ilUser
Definition: imgupload.php:18

References $ilUser, $section, ilAdvancedMDRecord\_getActivatedRecordsByObjectType(), and ilAdvancedMDRecord\getObjRecSelection().

Referenced by parse().

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

◆ parseSearch()

ilAdvancedMDRecordGUI::parseSearch ( )
private

Parse search.

Definition at line 264 of file class.ilAdvancedMDRecordGUI.php.

265 {
266 // this is NOT used for the global search, see ilLuceneAdvancedSearchFields::getFormElement()
267 // (so searchable flag is NOT relevant)
268 //
269 // current usage: wiki page element "[amd] page list"
270
271 $this->lng->loadLanguageModule('search');
272
273 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
274
275 $this->search_form = array();
276 foreach($this->getActiveRecords() as $record)
277 {
278 $fields = ilAdvancedMDFieldDefinition::getInstancesByRecordId($record->getRecordId(), true);
279
280 // empty record?
281 if(!sizeof($fields))
282 {
283 continue;
284 }
285
287 $section->setTitle($record->getTitle());
288 $section->setInfo($record->getDescription());
289 $this->form->addItem($section);
290
291 foreach($fields as $field)
292 {
293 $field_form = ilADTFactory::getInstance()->getSearchBridgeForDefinitionInstance($field->getADTDefinition(), true, false);
294 $field_form->setForm($this->form);
295 $field_form->setElementId("advmd[".$field->getFieldId()."]");
296 $field_form->setTitle($field->getTitle());
297
298 if(is_array($this->search_form_values) &&
299 isset($this->search_form_values[$field->getFieldId()]))
300 {
301 $field->setSearchValueSerialized($field_form, $this->search_form_values[$field->getFieldId()]);
302 }
303
304 $field->prepareElementForSearch($field_form);
305
306 $field_form->addToForm();
307
308 $this->search_form[$field->getFieldId()] = array("def"=>$field, "value"=>$field_form);
309 }
310 }
311 }

References $section, getActiveRecords(), ilADTFactory\getInstance(), and ilAdvancedMDFieldDefinition\getInstancesByRecordId().

Referenced by parse().

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

◆ parseTableCells()

ilAdvancedMDRecordGUI::parseTableCells ( )
private

Parse table cells.

Definition at line 757 of file class.ilAdvancedMDRecordGUI.php.

758 {
759 $data = $this->getRowData();
760
761 $html = "";
762
763 foreach($this->getActiveRecords() as $record_obj)
764 {
765 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
766 foreach(ilAdvancedMDFieldDefinition::_getDefinitionsByRecordId($record_obj->getRecordId()) as $def)
767 {
768 if($this->handleECSDefinitions($def))
769 {
770 continue;
771 }
772
773 $html.= "<td class='std'>".$data['md_'.$def->getFieldId()]."</td>";
774 }
775 }
776 return $html;
777 }
handleECSDefinitions($a_definition)
handle ecs definitions
$html
Definition: example_001.php:87

References $data, $html, getActiveRecords(), getRowData(), and handleECSDefinitions().

Referenced by parse().

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

◆ parseTableHead()

ilAdvancedMDRecordGUI::parseTableHead ( )
private

Parse property for table head.

Definition at line 737 of file class.ilAdvancedMDRecordGUI.php.

738 {
739 foreach($this->getActiveRecords() as $record_obj)
740 {
741 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
742 foreach(ilAdvancedMDFieldDefinition::_getDefinitionsByRecordId($record_obj->getRecordId()) as $def)
743 {
744 if($this->handleECSDefinitions($def))
745 {
746 continue;
747 }
748
749 $this->table_gui->addColumn($def->getTitle(),'md_'.$def->getFieldId());
750 }
751 }
752 }

References getActiveRecords(), and handleECSDefinitions().

Referenced by parse().

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

◆ saveSelection()

ilAdvancedMDRecordGUI::saveSelection ( )

Save selection per object.

Parameters

return

Definition at line 592 of file class.ilAdvancedMDRecordGUI.php.

593 {
594 $sel = ilUtil::stripSlashesArray($_POST["amet_use_rec"]);
595 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
596 ilAdvancedMDRecord::saveObjRecSelection($this->obj_id, $this->sub_type, $sel);
597 }
$_POST["username"]
static saveObjRecSelection($a_obj_id, $a_sub_type="", array $a_records=null, $a_delete_before=true)
Save repository object record selection.
static stripSlashesArray($a_arr, $a_strip_html=true, $a_allow="")
Strip slashes from array.

References $_POST, ilAdvancedMDRecord\saveObjRecSelection(), and ilUtil\stripSlashesArray().

+ Here is the call graph for this function:

◆ setInfoObject()

ilAdvancedMDRecordGUI::setInfoObject (   $info)

get info sections

@access public

Parameters
objectinstance of ilInfoScreenGUI

Definition at line 89 of file class.ilAdvancedMDRecordGUI.php.

90 {
91 $this->info = $info;
92 }
$info
Definition: example_052.php:80

References $info.

◆ setPropertyForm()

ilAdvancedMDRecordGUI::setPropertyForm (   $form)

set property form object

@access public

Parameters

Definition at line 65 of file class.ilAdvancedMDRecordGUI.php.

66 {
67 $this->form = $form;
68 }

References $form.

◆ setRowData()

ilAdvancedMDRecordGUI::setRowData (   $a_val)

Set row data.

Parameters
array$a_valassoc array of row data (containing md record data)

Definition at line 624 of file class.ilAdvancedMDRecordGUI.php.

625 {
626 $this->row_data = $a_val;
627 }

◆ setSearchFormValues()

ilAdvancedMDRecordGUI::setSearchFormValues ( array  $a_values)

Definition at line 348 of file class.ilAdvancedMDRecordGUI.php.

349 {
350 $this->search_form_values = $a_values;
351 }

◆ setSearchValues()

ilAdvancedMDRecordGUI::setSearchValues (   $a_values)

Set values for search form.

@access public

Definition at line 76 of file class.ilAdvancedMDRecordGUI.php.

77 {
78 $this->search_values = $a_values;
79 }

◆ setTableGUI()

ilAdvancedMDRecordGUI::setTableGUI (   $a_val)

Set table.

Parameters
object$a_valtable gui class

Definition at line 604 of file class.ilAdvancedMDRecordGUI.php.

605 {
606 $this->table_gui = $a_val;
607 }

◆ showECSStart()

ilAdvancedMDRecordGUI::showECSStart (   $def)
private

Show special form for ecs start.

@access private

Parameters
objectilAdvMDFieldDefinition

Definition at line 436 of file class.ilAdvancedMDRecordGUI.php.

437 {
438 global $ilUser;
439
440 $this->lng->loadLanguageModule('ecs');
441
442 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDValue.php');
443 $value_start = ilAdvancedMDValue::_getInstance($this->obj_id,$def->getFieldId());
444
445 $unixtime = $value_start->getValue() ? $value_start->getValue() : mktime(8,0,0,date('m'),date('d'),date('Y'));
446
447 $time = new ilDateTimeInputGUI($this->lng->txt('ecs_event_appointment'),'md['.$def->getFieldId().']');
448 $time->setShowTime(true);
449 $time->setDate(new ilDateTime($unixtime,IL_CAL_UNIX));
450 /*
451 $time->enableDateActivation($this->lng->txt('enabled'),
452 'md_activated['.$def->getFieldId().']',
453 $value_start->getValue() ? true : false);
454 */
455 $time->setDisabled($value_start->isDisabled());
456
458 if($field_id = $mapping->getMappingByECSName(0,'end'))
459 {
460 $value_end = ilAdvancedMDValue::_getInstance($this->obj_id,$field_id);
461
462 list($hours,$minutes) = $this->parseDuration($value_start->getValue(),$value_end->getValue());
463
464 $duration = new ilDurationInputGUI($this->lng->txt('ecs_duration'),'ecs_duration');
465 $duration->setHours($hours);
466 $duration->setMinutes($minutes);
467 #$duration->setInfo($this->lng->txt('ecs_duration_info'));
468 $duration->setShowHours(true);
469 $duration->setShowMinutes(true);
470 $time->addSubItem($duration);
471 }
472
473 if($field_id = $mapping->getMappingByECSName(0,'cycle'))
474 {
475 $value = ilAdvancedMDValue::_getInstance($this->obj_id,$field_id);
476 $cycle_def = ilAdvancedMDFieldDefinition::getInstance($field_id);
477 switch($cycle_def->getFieldType())
478 {
480 $text = new ilTextInputGUI($cycle_def->getTitle(),'md['.$cycle_def->getFieldId().']');
481 $text->setValue($value->getValue());
482 $text->setSize(20);
483 $text->setMaxLength(512);
484 $text->setDisabled($value->isDisabled());
485 $time->addSubItem($text);
486 break;
487
489 $select = new ilSelectInputGUI($cycle_def->getTitle(),'md['.$cycle_def->getFieldId().']');
490 $select->setOptions($cycle_def->getFieldValuesForSelect());
491 $select->setValue($value->getValue());
492 $select->setDisabled($value->isDisabled());
493 $time->addSubItem($select);
494 break;
495 }
496 }
497 if($field_id = $mapping->getMappingByECSName(0,'room'))
498 {
499 $value = ilAdvancedMDValue::_getInstance($this->obj_id,$field_id);
500 $room_def = ilAdvancedMDFieldDefinition::getInstance($field_id);
501 switch($room_def->getFieldType())
502 {
504 $text = new ilTextInputGUI($room_def->getTitle(),'md['.$room_def->getFieldId().']');
505 $text->setValue($value->getValue());
506 $text->setSize(20);
507 $text->setMaxLength(512);
508 $text->setDisabled($value->isDisabled());
509 $time->addSubItem($text);
510 break;
511
513 $select = new ilSelectInputGUI($room_def->getTitle(),'md['.$room_def->getFieldId().']');
514 $select->setOptions($cycle_def->getFieldValuesForSelect());
515 $select->setValue($value->getValue());
516 $select->setDisabled($value->isDisabled());
517 $time->addSubItem($select);
518 break;
519 }
520 }
521 $this->form->addItem($time);
522 }
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
const IL_CAL_UNIX
static getInstance($a_field_id, $a_type=null)
Get definition instance by type.
parseDuration($u_start, $u_end)
parse hours and minutes from duration
This class represents a date/time property in a property form.
@classDescription Date and time handling
This class represents a duration (typical hh:mm:ss) property in a property form.
static _getInstance()
Get Singleton instance.
This class represents a selection list property in a property form.
This class represents a text property in a property form.
$text

References $duration, $ilUser, $text, ilECSDataMappingSettings\_getInstance(), date, ilAdvancedMDFieldDefinition\getInstance(), IL_CAL_UNIX, parseDuration(), ilAdvancedMDFieldDefinition\TYPE_SELECT, and ilAdvancedMDFieldDefinition\TYPE_TEXT.

+ Here is the call graph for this function:

◆ writeEditForm()

ilAdvancedMDRecordGUI::writeEditForm (   $a_obj_id = null,
  $a_sub_id = null 
)

Write edit form values to db.

Parameters
int$a_obj_id
int$a_sub_id
Returns
bool

Definition at line 225 of file class.ilAdvancedMDRecordGUI.php.

226 {
227 if(!sizeof($this->editor_form))
228 {
229 return false;
230 }
231
232 // switch ids?
233 if($a_obj_id)
234 {
235 $this->obj_id = $a_obj_id;
236 }
237 if($a_sub_id)
238 {
239 $this->sub_id = $a_sub_id;
240 }
241
242 foreach($this->editor_form as $item)
243 {
244 if($a_obj_id || $a_sub_id)
245 {
246 // switch active record to updated primary keys, e.g. after creation
247 $item["values"]->setActiveRecordPrimary($this->obj_id, $this->sub_type, $this->sub_id);
248 }
249
250 $item["values"]->write();
251 }
252
253 return true;
254 }

Field Documentation

◆ $editor_form

ilAdvancedMDRecordGUI::$editor_form
protected

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

◆ $form

ilAdvancedMDRecordGUI::$form
private

Definition at line 33 of file class.ilAdvancedMDRecordGUI.php.

Referenced by setPropertyForm().

◆ $lng

ilAdvancedMDRecordGUI::$lng
protected

Definition at line 26 of file class.ilAdvancedMDRecordGUI.php.

Referenced by __construct().

◆ $mode

ilAdvancedMDRecordGUI::$mode
private

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

◆ $obj_id

ilAdvancedMDRecordGUI::$obj_id
private

Definition at line 31 of file class.ilAdvancedMDRecordGUI.php.

◆ $obj_type

ilAdvancedMDRecordGUI::$obj_type
private

Definition at line 29 of file class.ilAdvancedMDRecordGUI.php.

◆ $search_values

ilAdvancedMDRecordGUI::$search_values = array()
private

Definition at line 34 of file class.ilAdvancedMDRecordGUI.php.

◆ $sub_type

ilAdvancedMDRecordGUI::$sub_type
private

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

◆ MODE_EDITOR

◆ MODE_FILTER

◆ MODE_INFO

◆ MODE_REC_SELECTION

const ilAdvancedMDRecordGUI::MODE_REC_SELECTION = 4

Definition at line 21 of file class.ilAdvancedMDRecordGUI.php.

Referenced by parse().

◆ MODE_SEARCH

const ilAdvancedMDRecordGUI::MODE_SEARCH = 2

◆ MODE_TABLE_CELLS

const ilAdvancedMDRecordGUI::MODE_TABLE_CELLS = 7

Definition at line 24 of file class.ilAdvancedMDRecordGUI.php.

Referenced by parse().

◆ MODE_TABLE_HEAD

const ilAdvancedMDRecordGUI::MODE_TABLE_HEAD = 6

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

Referenced by parse().


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