65 public function __construct($a_mode, $a_obj_type =
'', $a_obj_id =
'', $a_sub_type =
'', $a_sub_id =
'')
72 $this->mode = $a_mode;
73 $this->obj_type = $a_obj_type;
74 $this->obj_id = $a_obj_id;
75 $this->sub_type = $a_sub_type;
76 $this->sub_id = $a_sub_id;
80 $this->ref_id = end($refs);
92 $this->adv_ref_id = $a_adv_ref_id;
93 $this->adv_type = $a_adv_type;
94 $this->adv_subtype = $a_adv_subtype;
104 if ($this->adv_type == null) {
118 $this->ref_id = $a_ref_id;
141 $this->search_values = $a_values;
166 switch ($this->mode) {
167 case self::MODE_EDITOR:
170 case self::MODE_SEARCH:
173 case self::MODE_INFO:
176 case self::MODE_APP_PRESENTATION:
179 case self::MODE_REC_SELECTION:
182 case self::MODE_FILTER:
185 case self::MODE_TABLE_HEAD:
188 case self::MODE_TABLE_CELLS:
192 die(
'Not implemented yet');
206 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php');
207 $this->editor_form = array();
217 $record_id = $record_obj->getRecordId();
221 $defs =
$values->getDefinitions();
224 if (!
sizeof($defs)) {
229 $adt_group_form->setForm($this->form);
230 $adt_group_form->setTitle($record_obj->getTitle());
231 $adt_group_form->setInfo($record_obj->getDescription());
233 foreach ($defs as
$def) {
234 $element = $adt_group_form->getElement($def->getFieldId());
235 $element->setTitle($def->getTitle());
236 $element->setInfo($def->getDescription());
239 $def->prepareElementForEditor($element);
241 if (
$values->isDisabled($def->getFieldId())) {
242 $element->setDisabled(
true);
246 $adt_group_form->addToForm();
248 $this->editor_form[$record_id] = array(
"values" =>
$values,
"form" => $adt_group_form);
260 if (!is_array($this->editor_form)) {
266 foreach ($this->editor_form as $item) {
267 $item[
"form"]->importFromPost();
268 if (!$item[
"form"]->validate()) {
285 if (!
sizeof($this->editor_form)) {
291 $this->obj_id = $a_obj_id;
294 $this->sub_id = $a_sub_id;
297 foreach ($this->editor_form as $item) {
298 if ($a_obj_id || $a_sub_id) {
300 $item[
"values"]->setActiveRecordPrimary($this->obj_id, $this->sub_type, $this->sub_id);
303 $item[
"values"]->write();
324 $this->lng->loadLanguageModule(
'search');
326 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
328 $this->search_form = array();
333 if (!
sizeof($fields)) {
338 $section->setTitle($record->getTitle());
339 $section->setInfo($record->getDescription());
342 foreach ($fields as $field) {
343 $field_form =
ilADTFactory::getInstance()->getSearchBridgeForDefinitionInstance($field->getADTDefinition(),
true,
false);
344 $field_form->setForm($this->form);
345 $field_form->setElementId(
"advmd[" . $field->getFieldId() .
"]");
346 $field_form->setTitle($field->getTitle());
348 if (is_array($this->search_form_values) &&
349 isset($this->search_form_values[$field->getFieldId()])) {
350 $field->setSearchValueSerialized($field_form, $this->search_form_values[$field->getFieldId()]);
353 $field->prepareElementForSearch($field_form);
355 $field_form->addToForm();
357 $this->search_form[$field->getFieldId()] = array(
"def" => $field,
"value" => $field_form);
369 if (!
sizeof($this->search_form)) {
376 foreach ($this->search_form as $field_id => $item) {
377 $item[
"value"]->importFromPost();
378 if (!$item[
"value"]->validate()) {
381 $value = $item[
"def"]->getSearchValueSerialized($item[
"value"]);
382 if ($value !== null) {
383 $res[$field_id] = $value;
394 $this->search_form_values = $a_values;
403 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php');
404 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
405 include_once(
'Services/ADT/classes/class.ilADTFactory.php');
413 $defs = $a_values->getDefinitions();
414 foreach ($a_values->getADTGroup()->getElements() as $element_id => $element) {
415 if (!$element->isNull()) {
416 $this->
info->addProperty(
417 $defs[$element_id]->getTitle(),
434 $definitions = $sub->sortDefinitions($definitions);
436 $positions = array();
437 foreach ($definitions as $position => $value) {
438 $positions[$value->getFieldId()] = $position;
441 $array_elements = array();
446 $defs = $a_values->getDefinitions();
447 foreach ($a_values->getADTGroup()->getElements() as $element_id => $element) {
448 if (!$element->isNull()) {
451 if (get_class($element) ==
'ilADTLocation') {
452 $presentation_bridge->setSize(
"100%",
"200px");
454 $presentation_value = $presentation_bridge->getHTML();
455 $presentation_value .=
"<script>ilInitMaps();</script>";
458 $presentation_value = strip_tags($presentation_bridge->getHTML());
460 $array_elements[$positions[$element_id]] =
462 "title" => $defs[$element_id]->getTitle(),
463 "value" => $presentation_value
470 return $array_elements;
486 include_once(
'./Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php');
487 include_once(
'./Services/WebServices/ECS/classes/class.ilECSServerSettings.php');
490 ($this->obj_type !=
'crs' and $this->obj_type !=
'rcrs')
509 $this->lng->loadLanguageModule(
'ecs');
511 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDValue.php');
512 $value_start = ilAdvancedMDValue::_getInstance($this->obj_id,
$def->getFieldId());
514 $unixtime = $value_start->getValue() ? $value_start->getValue() : mktime(8, 0, 0, date(
'm'), date(
'd'), date(
'Y'));
517 $time->setShowTime(
true);
524 $time->setDisabled($value_start->isDisabled());
527 if ($field_id = $mapping->getMappingByECSName(0,
'end')) {
528 $value_end = ilAdvancedMDValue::_getInstance($this->obj_id, $field_id);
530 list($hours, $minutes) = $this->
parseDuration($value_start->getValue(), $value_end->getValue());
534 $duration->setMinutes($minutes);
535 #$duration->setInfo($this->lng->txt('ecs_duration_info')); 536 $duration->setShowHours(
true);
537 $duration->setShowMinutes(
true);
538 $time->addSubItem($duration);
541 if ($field_id = $mapping->getMappingByECSName(0,
'cycle')) {
542 $value = ilAdvancedMDValue::_getInstance($this->obj_id, $field_id);
544 switch ($cycle_def->getFieldType()) {
546 $text =
new ilTextInputGUI($cycle_def->getTitle(),
'md[' . $cycle_def->getFieldId() .
']');
547 $text->setValue($value->getValue());
549 $text->setMaxLength(512);
550 $text->setDisabled($value->isDisabled());
555 $select =
new ilSelectInputGUI($cycle_def->getTitle(),
'md[' . $cycle_def->getFieldId() .
']');
556 $select->
setOptions($cycle_def->getFieldValuesForSelect());
557 $select->setValue($value->getValue());
558 $select->setDisabled($value->isDisabled());
559 $time->addSubItem($select);
563 if ($field_id = $mapping->getMappingByECSName(0,
'room')) {
564 $value = ilAdvancedMDValue::_getInstance($this->obj_id, $field_id);
566 switch ($room_def->getFieldType()) {
569 $text->setValue($value->getValue());
571 $text->setMaxLength(512);
572 $text->setDisabled($value->isDisabled());
577 $select =
new ilSelectInputGUI($room_def->getTitle(),
'md[' . $room_def->getFieldId() .
']');
578 $select->
setOptions($cycle_def->getFieldValuesForSelect());
579 $select->setValue($value->getValue());
580 $select->setDisabled($value->isDisabled());
581 $time->addSubItem($select);
585 $this->form->addItem(
$time);
597 if ($u_start >= $u_end) {
600 $diff = $u_end - $u_start;
601 $hours = (int) ($diff / (60 * 60));
602 $min = (int) (($diff % 3600) / 60);
603 return array($hours,$min);
623 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
630 $sec_tit = ($a_sec_head ==
"")
631 ? $this->lng->txt(
"meta_adv_records")
639 $cb->
setInfo($record_obj->getDescription());
640 $cb->setValue($record_obj->getRecordId());
641 if (in_array($record_obj->getRecordId(), $selected)) {
642 $cb->setChecked(
true);
644 $this->form->addItem($cb);
657 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
668 $this->table_gui = $a_val;
678 return $this->table_gui;
688 $this->row_data = $a_val;
698 return $this->row_data;
703 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
716 $this->adt_search = array();
718 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
720 $record_id = $record_obj->getRecordId();
723 foreach ($defs as
$def) {
725 if (!$def->isFilterSupported()) {
736 $this->adt_search[$def->getFieldId()] =
ilADTFactory::getInstance()->getSearchBridgeForDefinitionInstance($def->getADTDefinition(),
true,
false);
737 $this->adt_search[$def->getFieldId()]->setTableGUI($this->table_gui);
738 $this->adt_search[$def->getFieldId()]->setTitle($def->getTitle());
739 $this->adt_search[$def->getFieldId()]->setElementId(
'md_' . $def->getFieldId());
741 $this->adt_search[$def->getFieldId()]->loadFilter();
742 $this->adt_search[$def->getFieldId()]->addToForm();
752 if (!is_array($this->adt_search)) {
756 foreach ($this->adt_search as $element) {
757 $element->importFromPost();
768 if (!is_array($this->adt_search)) {
774 foreach ($this->adt_search as $def_id => $element) {
775 if (!$element->isNull() ||
776 !(bool) $a_only_non_empty) {
777 $res[$def_id] = $element;
794 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
796 $record_id = $record_obj->getRecordId();
799 foreach ($defs as
$def) {
804 $this->table_gui->addColumn($def->getTitle(),
'md_' . $def->getFieldId());
817 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
819 $record_id = $record_obj->getRecordId();
822 foreach ($defs as
$def) {
827 $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.
const MODE_APP_PRESENTATION
setRefId($a_ref_id)
Set ref_id for context.
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.
static _getAllReferences($a_id)
get all reference ids of object
static _getInstanceByObjectType($a_type)
Singleton: use this method to get an instance.
static _getSelectedRecordsByObject($a_obj_type, $a_ref_id, $a_sub_type="")
Get selected records by object.
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.
foreach($_POST as $key=> $value) $res
setInfoObject($info)
get info sections
__construct($a_mode, $a_obj_type='', $a_obj_id='', $a_sub_type='', $a_sub_id='')
Constructor.
static getInstancesByObjType($a_obj_type, $a_active_only=true)
static getInstance($a_field_id, $a_type=null)
Get definition instance by type.
This class represents a text property in a property form.
setSearchValues($a_values)
Set values for search form.
static _lookupTitle($a_record_id)
Lookup title.
parseFilter()
Parse property for filter (table)
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.
getAdvMdRecordObject()
Get adv md record type.
setAdvMdRecordObject($a_adv_ref_id, $a_adv_type, $a_adv_subtype="-")
Set object, that defines the adv md records being used.
parseAppointmentPresentation()
Presentation for calendar agenda list.
parseEditor()
Parse property form in editor mode.
static _getInstance()
Get Singleton instance.
parseSearch()
Parse search.
parseInfoPage()
Presentation for info page.
saveSelection()
Save selection per object.
static getObjRecSelection($a_obj_id, $a_sub_type="")
Get repository object record selection.
importFilter()
Import filter (post) values.