46 public function __construct($a_mode,$a_obj_type =
'',$a_obj_id =
'', $a_sub_type =
'', $a_sub_id =
'')
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;
78 $this->search_values = $a_values;
105 case self::MODE_EDITOR:
108 case self::MODE_SEARCH:
111 case self::MODE_INFO:
114 case self::MODE_REC_SELECTION:
117 case self::MODE_FILTER:
120 case self::MODE_TABLE_HEAD:
123 case self::MODE_TABLE_CELLS:
127 die(
'Not implemented yet');
141 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php');
142 $this->editor_form =
array();
153 $record_id = $record_obj->getRecordId();
155 $values =
new ilAdvancedMDValues($record_id, $this->obj_id, $this->sub_type, $this->sub_id);
157 $defs = $values->getDefinitions();
166 $adt_group_form->setForm($this->form);
167 $adt_group_form->setTitle($record_obj->getTitle());
168 $adt_group_form->setInfo($record_obj->getDescription());
170 foreach($defs as $def)
172 $element = $adt_group_form->getElement($def->getFieldId());
173 $element->setTitle($def->getTitle());
174 $element->setInfo($def->getDescription());
177 $def->prepareElementForEditor($element);
179 if($values->isDisabled($def->getFieldId()))
181 $element->setDisabled(
true);
185 $adt_group_form->addToForm();
187 $this->editor_form[$record_id] =
array(
"values"=>$values,
"form"=>$adt_group_form);
199 if(!is_array($this->editor_form))
206 foreach($this->editor_form as $item)
208 $item[
"form"]->importFromPost();
209 if(!$item[
"form"]->validate())
227 if(!
sizeof($this->editor_form))
235 $this->obj_id = $a_obj_id;
239 $this->sub_id = $a_sub_id;
242 foreach($this->editor_form as $item)
244 if($a_obj_id || $a_sub_id)
247 $item[
"values"]->setActiveRecordPrimary($this->obj_id, $this->sub_type, $this->sub_id);
250 $item[
"values"]->write();
271 $this->lng->loadLanguageModule(
'search');
273 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
275 $this->search_form =
array();
287 $section->setTitle($record->getTitle());
288 $section->setInfo($record->getDescription());
291 foreach($fields as $field)
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());
298 if(is_array($this->search_form_values) &&
299 isset($this->search_form_values[$field->getFieldId()]))
301 $field->setSearchValueSerialized($field_form, $this->search_form_values[$field->getFieldId()]);
304 $field->prepareElementForSearch($field_form);
306 $field_form->addToForm();
308 $this->search_form[$field->getFieldId()] =
array(
"def"=>$field,
"value"=>$field_form);
320 if(!
sizeof($this->search_form))
328 foreach($this->search_form as $field_id => $item)
330 $item[
"value"]->importFromPost();
331 if(!$item[
"value"]->validate())
335 $value = $item[
"def"]->getSearchValueSerialized($item[
"value"]);
338 $res[$field_id] = $value;
350 $this->search_form_values = $a_values;
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');
371 $defs = $a_values->getDefinitions();
372 foreach($a_values->getADTGroup()->getElements() as $element_id => $element)
374 if(!$element->isNull())
376 $this->info->addProperty($defs[$element_id]->getTitle(),
397 include_once(
'./Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php');
398 include_once(
'./Services/WebServices/ECS/classes/class.ilECSServerSettings.php');
401 ($this->obj_type !=
'crs' and $this->obj_type !=
'rcrs')
440 $this->lng->loadLanguageModule(
'ecs');
442 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDValue.php');
443 $value_start = ilAdvancedMDValue::_getInstance($this->obj_id,$def->getFieldId());
445 $unixtime = $value_start->getValue() ? $value_start->getValue() : mktime(8,0,0,
date(
'm'),
date(
'd'),
date(
'Y'));
447 $time =
new ilDateTimeInputGUI($this->lng->txt(
'ecs_event_appointment'),
'md['.$def->getFieldId().
']');
448 $time->setShowTime(
true);
455 $time->setDisabled($value_start->isDisabled());
458 if($field_id = $mapping->getMappingByECSName(0,
'end'))
460 $value_end = ilAdvancedMDValue::_getInstance($this->obj_id,$field_id);
462 list($hours,$minutes) = $this->
parseDuration($value_start->getValue(),$value_end->getValue());
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);
473 if($field_id = $mapping->getMappingByECSName(0,
'cycle'))
475 $value = ilAdvancedMDValue::_getInstance($this->obj_id,$field_id);
477 switch($cycle_def->getFieldType())
481 $text->setValue($value->getValue());
483 $text->setMaxLength(512);
484 $text->setDisabled($value->isDisabled());
485 $time->addSubItem(
$text);
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);
497 if($field_id = $mapping->getMappingByECSName(0,
'room'))
499 $value = ilAdvancedMDValue::_getInstance($this->obj_id,$field_id);
501 switch($room_def->getFieldType())
505 $text->setValue($value->getValue());
507 $text->setMaxLength(512);
508 $text->setDisabled($value->isDisabled());
509 $time->addSubItem(
$text);
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);
521 $this->form->addItem($time);
533 if($u_start >= $u_end)
537 $diff = $u_end - $u_start;
538 $hours = (int) ($diff / (60 * 60));
539 $min = (int) (($diff % 3600) / 60);
540 return array($hours,$min);
558 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
567 $sec_tit = ($a_sec_head ==
"")
568 ? $this->lng->txt(
"meta_adv_records")
576 $cb->
setInfo($record_obj->getDescription());
577 $cb->setValue($record_obj->getRecordId());
578 if (in_array($record_obj->getRecordId(), $selected))
580 $cb->setChecked(
true);
582 $this->form->addItem($cb);
595 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
606 $this->table_gui = $a_val;
616 return $this->table_gui;
626 $this->row_data = $a_val;
636 return $this->row_data;
641 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
653 $this->adt_search =
array();
655 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
658 $record_id = $record_obj->getRecordId();
661 foreach($defs as $def)
664 if(!$def->isFilterSupported())
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());
681 $this->adt_search[$def->getFieldId()]->loadFilter();
682 $this->adt_search[$def->getFieldId()]->addToForm();
692 if(!is_array($this->adt_search))
697 foreach($this->adt_search as $element)
699 $element->importFromPost();
710 if(!is_array($this->adt_search))
717 foreach($this->adt_search as $def_id => $element)
719 if(!$element->isNull() ||
720 !(bool)$a_only_non_empty)
722 $res[$def_id] = $element;
741 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
742 foreach(ilAdvancedMDFieldDefinition::_getDefinitionsByRecordId($record_obj->getRecordId()) as $def)
749 $this->table_gui->addColumn($def->getTitle(),
'md_'.$def->getFieldId());
765 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
766 foreach(ilAdvancedMDFieldDefinition::_getDefinitionsByRecordId($record_obj->getRecordId()) as $def)
773 $html.=
"<td class='std'>".$data[
'md_'.$def->getFieldId()].
"</td>";
parseDuration($u_start, $u_end)
parse hours and minutes from duration
setTableGUI($a_val)
Set table.
static getInstancesForObjectId($a_obj_id, $a_obj_type=null, $a_sub_type="-", $a_sub_id=0)
Get instances for given object id.
importSearchForm()
Load edit form values from post.
parseTableCells()
Parse table cells.
setPropertyForm($form)
set property form object
importEditFormPostValues()
Load edit form values from post.
static getInstance()
Get singleton instance.
handleECSDefinitions($a_definition)
handle ecs definitions
getRowData()
Get row data.
parseRecordSelection($a_sec_head="")
Parse property form in editor mode.
parseTableHead()
Parse property for table head.
static getInstance()
Get singleton.
setSearchFormValues(array $a_values)
static saveObjRecSelection($a_obj_id, $a_sub_type="", array $a_records=null, $a_delete_before=true)
Save repository object record selection.
writeEditForm($a_obj_id=null, $a_sub_id=null)
Write edit form values to db.
getFilterElements($a_only_non_empty=true)
Get SQL conditions for current filter value(s)
static getInstancesByRecordId($a_record_id, $a_only_searchable=false)
Get definitions by record id.
setInfoObject($info)
get info sections
__construct($a_mode, $a_obj_type='', $a_obj_id='', $a_sub_type='', $a_sub_id='')
Constructor.
static getInstance($a_field_id, $a_type=null)
Get definition instance by type.
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
This class represents a text property in a property form.
static _getSelectedRecordsByObject($a_obj_type, $a_obj_id, $a_sub_type="")
Get selected records by object.
setSearchValues($a_values)
Set values for search form.
static _lookupTitle($a_record_id)
Lookup title.
parseFilter()
Parse property for filter (table)
Create styles array
The data for the language used.
static _getActivatedRecordsByObjectType($a_obj_type, $a_sub_type="", $a_only_optional=false)
Get activated records by object type.
static stripSlashesArray($a_arr, $a_strip_html=true, $a_allow="")
Strip slashes from array.
showECSStart($def)
Show special form for ecs start.
setRowData($a_val)
Set row data.
parseEditor()
Parse property form in editor mode.
static _getInstance()
Get Singleton instance.
parseSearch()
Parse search.
saveSelection()
Save selection per object.
static getObjRecSelection($a_obj_id, $a_sub_type="")
Get repository object record selection.
importFilter()
Import filter (post) values.