ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 ()
 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 619 of file class.ilAdvancedMDRecordGUI.php.

620 {
621 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
622 return ilAdvancedMDRecord::_getSelectedRecordsByObject($this->obj_type, $this->obj_id, $this->sub_type);
623 }
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 688 of file class.ilAdvancedMDRecordGUI.php.

689 {
690 if(!is_array($this->adt_search))
691 {
692 return;
693 }
694
695 $res = array();
696
697 foreach($this->adt_search as $def_id => $element)
698 {
699 if(!$element->isNull() ||
700 !(bool)$a_only_non_empty)
701 {
702 $res[$def_id] = $element;
703 }
704 }
705
706 return $res;
707 }

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 614 of file class.ilAdvancedMDRecordGUI.php.

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

Referenced by parseTableCells().

+ Here is the caller graph for this function:

◆ getTableGUI()

ilAdvancedMDRecordGUI::getTableGUI ( )

Get table.

Returns
object table gui class

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

595 {
596 return $this->table_gui;
597 }

◆ handleECSDefinitions()

ilAdvancedMDRecordGUI::handleECSDefinitions (   $a_definition)
private

handle ecs definitions

@access private

Parameters
objectilAdvMDFieldDefinition
Returns

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

378 {
379 include_once('./Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php');
380 include_once('./Services/WebServices/ECS/classes/class.ilECSServerSettings.php');
381
382 if(ilECSServerSettings::getInstance()->activeServerExists() or
383 ($this->obj_type != 'crs' and $this->obj_type != 'rcrs')
384 )
385 {
386 return false;
387 }
388 return false;
389 /*
390 $mapping = ilECSDataMappingSettings::_getInstance();
391
392 if($mapping->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'begin') == $a_definition->getFieldId())
393 {
394 $this->showECSStart($a_definition);
395 return true;
396 }
397 if($mapping->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'end') == $a_definition->getFieldId())
398 {
399 return true;
400 }
401 if($mapping->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'cycle') == $a_definition->getFieldId())
402 {
403 return true;
404 }
405 if($mapping->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'room') == $a_definition->getFieldId())
406 {
407 return true;
408 }
409 */
410 }
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 670 of file class.ilAdvancedMDRecordGUI.php.

671 {
672 if(!is_array($this->adt_search))
673 {
674 return;
675 }
676
677 foreach($this->adt_search as $element)
678 {
679 $element->importFromPost();
680 }
681 }

◆ importSearchForm()

ilAdvancedMDRecordGUI::importSearchForm ( )

Load edit form values from post.

Returns
array

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

301 {
302 if(!sizeof($this->search_form))
303 {
304 return false;
305 }
306
307 $valid = true;
308 $res = array();
309
310 foreach($this->search_form as $field_id => $item)
311 {
312 $item["value"]->importFromPost();
313 if(!$item["value"]->validate())
314 {
315 $valid = false;
316 }
317 $value = $item["def"]->getSearchValueSerialized($item["value"]);
318 if($value !== null)
319 {
320 $res[$field_id] = $value;
321 }
322 }
323
324 if($valid)
325 {
326 return $res;
327 }
328 }

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 511 of file class.ilAdvancedMDRecordGUI.php.

512 {
513 if($u_start >= $u_end)
514 {
515 return array(0,0);
516 }
517 $diff = $u_end - $u_start;
518 $hours = (int) ($diff / (60 * 60));
519 $min = (int) (($diff % 3600) / 60);
520 return array($hours,$min);
521 }

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 631 of file class.ilAdvancedMDRecordGUI.php.

632 {
633 $this->adt_search = array();
634
635 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
636 foreach($this->getActiveRecords() as $record_obj)
637 {
638 $record_id = $record_obj->getRecordId();
639
641 foreach($defs as $def)
642 {
643 // some input GUIs do NOT support filter rendering yet
644 if(!$def->isFilterSupported())
645 {
646 continue;
647 }
648
649 /* :TODO:
650 if($this->handleECSDefinitions($def))
651 {
652 continue;
653 }
654 */
655
656 $this->adt_search[$def->getFieldId()] = ilADTFactory::getInstance()->getSearchBridgeForDefinitionInstance($def->getADTDefinition(), true, false);
657 $this->adt_search[$def->getFieldId()]->setTableGUI($this->table_gui);
658 $this->adt_search[$def->getFieldId()]->setTitle($def->getTitle());
659 $this->adt_search[$def->getFieldId()]->setElementId('md_'.$def->getFieldId());
660
661 $this->adt_search[$def->getFieldId()]->loadFilter();
662 $this->adt_search[$def->getFieldId()]->addToForm();
663 }
664 }
665 }
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 340 of file class.ilAdvancedMDRecordGUI.php.

341 {
342 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php');
343 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
344 include_once('Services/ADT/classes/class.ilADTFactory.php');
345
346 foreach(ilAdvancedMDValues::getInstancesForObjectId($this->obj_id, $this->obj_type, $this->sub_type, $this->sub_id) as $record_id => $a_values)
347 {
348 // this correctly binds group and definitions
349 $a_values->read();
350
351 $this->info->addSection(ilAdvancedMDRecord::_lookupTitle($record_id));
352
353 $defs = $a_values->getDefinitions();
354 foreach($a_values->getADTGroup()->getElements() as $element_id => $element)
355 {
356 if(!$element->isNull())
357 {
358 $this->info->addProperty($defs[$element_id]->getTitle(),
359 ilADTFactory::getInstance()->getPresentationBridgeForInstance($element)->getHTML());
360 }
361 }
362 }
363 }
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 534 of file class.ilAdvancedMDRecordGUI.php.

535 {
536 global $ilUser;
537
538 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
539 $first = true;
540 foreach(ilAdvancedMDRecord::_getActivatedRecordsByObjectType($this->obj_type, $this->sub_type) as $record_obj)
541 {
542 $selected = ilAdvancedMDRecord::getObjRecSelection($this->obj_id, $this->sub_type);
543 if ($first)
544 {
545 $first = false;
547 $sec_tit = ($a_sec_head == "")
548 ? $this->lng->txt("meta_adv_records")
549 : $a_sec_head;
550 $section->setTitle($sec_tit);
551 $this->form->addItem($section);
552 }
553
554 // checkbox for each active record
555 $cb = new ilCheckboxInputGUI($record_obj->getTitle(), "amet_use_rec[]");
556 $cb->setInfo($record_obj->getDescription());
557 $cb->setValue($record_obj->getRecordId());
558 if (in_array($record_obj->getRecordId(), $selected))
559 {
560 $cb->setChecked(true);
561 }
562 $this->form->addItem($cb);
563 }
564 }
$section
Definition: Utf8Test.php:84
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.
global $ilUser
Definition: imgupload.php:15

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 246 of file class.ilAdvancedMDRecordGUI.php.

247 {
248 // this is NOT used for the global search, see ilLuceneAdvancedSearchFields::getFormElement()
249 // (so searchable flag is NOT relevant)
250 //
251 // current usage: wiki page element "[amd] page list"
252
253 $this->lng->loadLanguageModule('search');
254
255 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
256
257 $this->search_form = array();
258 foreach($this->getActiveRecords() as $record)
259 {
260 $fields = ilAdvancedMDFieldDefinition::getInstancesByRecordId($record->getRecordId(), true);
261
262 // empty record?
263 if(!sizeof($fields))
264 {
265 continue;
266 }
267
269 $section->setTitle($record->getTitle());
270 $section->setInfo($record->getDescription());
271 $this->form->addItem($section);
272
273 foreach($fields as $field)
274 {
275 $field_form = ilADTFactory::getInstance()->getSearchBridgeForDefinitionInstance($field->getADTDefinition(), true, false);
276 $field_form->setForm($this->form);
277 $field_form->setElementId("advmd[".$field->getFieldId()."]");
278 $field_form->setTitle($field->getTitle());
279
280 if(is_array($this->search_form_values) &&
281 isset($this->search_form_values[$field->getFieldId()]))
282 {
283 $field->setSearchValueSerialized($field_form, $this->search_form_values[$field->getFieldId()]);
284 }
285
286 $field->prepareElementForSearch($field_form);
287
288 $field_form->addToForm();
289
290 $this->search_form[$field->getFieldId()] = array("def"=>$field, "value"=>$field_form);
291 }
292 }
293 }

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 737 of file class.ilAdvancedMDRecordGUI.php.

738 {
739 $data = $this->getRowData();
740
741 $html = "";
742
743 foreach($this->getActiveRecords() as $record_obj)
744 {
745 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
746 foreach(ilAdvancedMDFieldDefinition::_getDefinitionsByRecordId($record_obj->getRecordId()) as $def)
747 {
748 if($this->handleECSDefinitions($def))
749 {
750 continue;
751 }
752
753 $html.= "<td class='std'>".$data['md_'.$def->getFieldId()]."</td>";
754 }
755 }
756 return $html;
757 }
handleECSDefinitions($a_definition)
handle ecs definitions
$html
Definition: example_001.php:87
$data

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 717 of file class.ilAdvancedMDRecordGUI.php.

718 {
719 foreach($this->getActiveRecords() as $record_obj)
720 {
721 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
722 foreach(ilAdvancedMDFieldDefinition::_getDefinitionsByRecordId($record_obj->getRecordId()) as $def)
723 {
724 if($this->handleECSDefinitions($def))
725 {
726 continue;
727 }
728
729 $this->table_gui->addColumn($def->getTitle(),'md_'.$def->getFieldId());
730 }
731 }
732 }

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 572 of file class.ilAdvancedMDRecordGUI.php.

573 {
574 $sel = ilUtil::stripSlashesArray($_POST["amet_use_rec"]);
575 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
576 ilAdvancedMDRecord::saveObjRecSelection($this->obj_id, $this->sub_type, $sel);
577 }
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.
$_POST['username']
Definition: cron.php:12

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 604 of file class.ilAdvancedMDRecordGUI.php.

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

◆ setSearchFormValues()

ilAdvancedMDRecordGUI::setSearchFormValues ( array  $a_values)

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

331 {
332 $this->search_form_values = $a_values;
333 }

◆ 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 584 of file class.ilAdvancedMDRecordGUI.php.

585 {
586 $this->table_gui = $a_val;
587 }

◆ showECSStart()

ilAdvancedMDRecordGUI::showECSStart (   $def)
private

Show special form for ecs start.

@access private

Parameters
objectilAdvMDFieldDefinition

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

419 {
420 global $ilUser;
421
422 $this->lng->loadLanguageModule('ecs');
423
424 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDValue.php');
425 $value_start = ilAdvancedMDValue::_getInstance($this->obj_id,$def->getFieldId());
426
427 $unixtime = $value_start->getValue() ? $value_start->getValue() : mktime(8,0,0,date('m'),date('d'),date('Y'));
428
429 $time = new ilDateTimeInputGUI($this->lng->txt('ecs_event_appointment'),'md['.$def->getFieldId().']');
430 $time->setShowTime(true);
431 $time->setDate(new ilDateTime($unixtime,IL_CAL_UNIX));
432 $time->enableDateActivation($this->lng->txt('enabled'),
433 'md_activated['.$def->getFieldId().']',
434 $value_start->getValue() ? true : false);
435 $time->setDisabled($value_start->isDisabled());
436
438 if($field_id = $mapping->getMappingByECSName(0,'end'))
439 {
440 $value_end = ilAdvancedMDValue::_getInstance($this->obj_id,$field_id);
441
442 list($hours,$minutes) = $this->parseDuration($value_start->getValue(),$value_end->getValue());
443
444 $duration = new ilDurationInputGUI($this->lng->txt('ecs_duration'),'ecs_duration');
445 $duration->setHours($hours);
446 $duration->setMinutes($minutes);
447 #$duration->setInfo($this->lng->txt('ecs_duration_info'));
448 $duration->setShowHours(true);
449 $duration->setShowMinutes(true);
450 $time->addSubItem($duration);
451 }
452
453 if($field_id = $mapping->getMappingByECSName(0,'cycle'))
454 {
455 $value = ilAdvancedMDValue::_getInstance($this->obj_id,$field_id);
456 $cycle_def = ilAdvancedMDFieldDefinition::getInstance($field_id);
457 switch($cycle_def->getFieldType())
458 {
460 $text = new ilTextInputGUI($cycle_def->getTitle(),'md['.$cycle_def->getFieldId().']');
461 $text->setValue($value->getValue());
462 $text->setSize(20);
463 $text->setMaxLength(512);
464 $text->setDisabled($value->isDisabled());
465 $time->addSubItem($text);
466 break;
467
469 $select = new ilSelectInputGUI($cycle_def->getTitle(),'md['.$cycle_def->getFieldId().']');
470 $select->setOptions($cycle_def->getFieldValuesForSelect());
471 $select->setValue($value->getValue());
472 $select->setDisabled($value->isDisabled());
473 $time->addSubItem($select);
474 break;
475 }
476 }
477 if($field_id = $mapping->getMappingByECSName(0,'room'))
478 {
479 $value = ilAdvancedMDValue::_getInstance($this->obj_id,$field_id);
480 $room_def = ilAdvancedMDFieldDefinition::getInstance($field_id);
481 switch($room_def->getFieldType())
482 {
484 $text = new ilTextInputGUI($room_def->getTitle(),'md['.$room_def->getFieldId().']');
485 $text->setValue($value->getValue());
486 $text->setSize(20);
487 $text->setMaxLength(512);
488 $text->setDisabled($value->isDisabled());
489 $time->addSubItem($text);
490 break;
491
493 $select = new ilSelectInputGUI($room_def->getTitle(),'md['.$room_def->getFieldId().']');
494 $select->setOptions($cycle_def->getFieldValuesForSelect());
495 $select->setValue($value->getValue());
496 $select->setDisabled($value->isDisabled());
497 $time->addSubItem($select);
498 break;
499 }
500 }
501 $this->form->addItem($time);
502 }
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 $ilUser, $text, ilECSDataMappingSettings\_getInstance(), ilAdvancedMDFieldDefinition\getInstance(), IL_CAL_UNIX, parseDuration(), ilAdvancedMDFieldDefinition\TYPE_SELECT, and ilAdvancedMDFieldDefinition\TYPE_TEXT.

+ Here is the call graph for this function:

◆ writeEditForm()

ilAdvancedMDRecordGUI::writeEditForm ( )

Write edit form values to db.

Returns
bool

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

224 {
225 if(!sizeof($this->editor_form))
226 {
227 return false;
228 }
229
230 foreach($this->editor_form as $item)
231 {
232 $item["values"]->write();
233 }
234
235 return true;
236 }

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: