57 public function __construct($a_mode,$a_obj_type =
'',$a_obj_id =
'')
62 $this->mode = $a_mode;
63 $this->obj_type = $a_obj_type;
64 $this->obj_id = $a_obj_id;
87 $this->search_values = $a_values;
114 case self::MODE_EDITOR:
117 case self::MODE_SEARCH:
120 case self::MODE_INFO:
124 die(
'Not implemented yet');
136 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDValue.php');
137 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
143 foreach(
$_POST[
'md'] as $field_id => $value)
146 switch($def->getFieldType())
150 if(is_array($value) and
$_POST[
'md_activated'][$field_id])
152 $dt[
'year'] = (int) $value[
'date'][
'y'];
153 $dt[
'mon'] = (int) $value[
'date'][
'm'];
154 $dt[
'mday'] = (int) $value[
'date'][
'd'];
155 $dt[
'hours'] = (int) 0;
156 $dt[
'minutes'] = (int) 0;
157 $dt[
'seconds'] = (int) 0;
169 if(is_array($value) and
$_POST[
'md_activated'][$field_id])
171 $dt[
'year'] = (int) $value[
'date'][
'y'];
172 $dt[
'mon'] = (int) $value[
'date'][
'm'];
173 $dt[
'mday'] = (int) $value[
'date'][
'd'];
174 $dt[
'hours'] = (int) $value[
'time'][
'h'];
175 $dt[
'minutes'] = (int) $value[
'time'][
'm'];
176 $dt[
'seconds'] = (int) 0;
191 $val->setValue($value);
192 $this->values[] = $val;
207 include_once(
'./Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php');
208 include_once(
'./Services/WebServices/ECS/classes/class.ilECSSettings.php');
216 if(!$start_id = $mapping->getMappingByECSName(
'begin'))
220 if(!$end_id = $mapping->getMappingByECSName(
'end'))
224 if(!
$_POST[
'md_activated'][$start_id])
231 $end = $end + (60 * 60 *
$_POST[
'ecs_duration'][
'hh']) + (60 *
$_POST[
'ecs_duration'][
'mm']);
234 $val->setValue($end);
235 $this->values[] = $val;
247 foreach($this->values as $value)
264 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
268 $section->setTitle($record_obj->getTitle());
269 $section->setInfo($record_obj->getDescription());
270 $this->form->addItem($section);
272 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
280 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDValue.php');
283 switch($def->getFieldType())
286 $text =
new ilTextInputGUI($def->getTitle(),
'md['.$def->getFieldId().
']');
287 $text->setValue($value->getValue());
289 $text->setMaxLength(512);
290 $text->setDisabled($value->isDisabled());
291 $text->setInfo($def->getDescription());
292 $this->form->addItem($text);
296 $select =
new ilSelectInputGUI($def->getTitle(),
'md['.$def->getFieldId().
']');
297 $select->setOptions($def->getFieldValuesForSelect());
298 $select->setValue($value->getValue());
299 $select->setDisabled($value->isDisabled());
300 $select->setInfo($def->getDescription());
302 $this->form->addItem($select);
307 $unixtime = $value->getValue() ? $value->getValue() : mktime(8,0,0,date(
'm'),date(
'd'),date(
'Y'));
310 $time->setShowTime(
false);
312 $time->enableDateActivation($this->lng->txt(
'enabled'),
313 'md_activated['.$def->getFieldId().
']',
314 $value->getValue() ?
true :
false);
315 $time->setDisabled($value->isDisabled());
316 $time->setInfo($def->getDescription());
317 $this->form->addItem($time);
322 $unixtime = $value->getValue() ? $value->getValue() : mktime(8,0,0,date(
'm'),date(
'd'),date(
'Y'));
325 $time->setShowTime(
true);
327 $time->enableDateActivation($this->lng->txt(
'enabled'),
328 'md_activated['.$def->getFieldId().
']',
329 $value->getValue() ?
true :
false);
330 $time->setDisabled($value->isDisabled());
331 $this->form->addItem($time);
347 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
351 $section->setTitle($record->getTitle());
352 $this->form->addItem($section);
356 if(!$field->isSearchable())
360 switch($field->getFieldType())
365 $group->setValue(isset($this->search_values[
'boolean'][$field->getFieldId()]) ?
366 $this->search_values[
'boolean'][$field->getFieldId()] : 0);
367 $radio_option =
new ilRadioOption($this->lng->txt(
"search_any_word"),0);
369 $group->addOption($radio_option);
370 $radio_option =
new ilRadioOption($this->lng->txt(
"search_all_words"),1);
372 $group->addOption($radio_option);
374 $text =
new ilTextInputGUI($field->getTitle(),$field->getFieldId());
375 $text->
setValue(isset($this->search_values[$field->getFieldId()]) ?
376 $this->search_values[$field->getFieldId()] :
379 $text->setMaxLength(255);
382 $text->addSubItem($group);
383 $this->form->addItem($text);
388 $select->
setValue(isset($this->search_values[$field->getFieldId()]) ?
389 $this->search_values[$field->getFieldId()] :
391 $options = array(0 => $this->lng->txt(
'search_any'));
393 foreach($field->getFieldValues() as $key => $value)
395 $options[$counter++] = $value;
397 $select->setOptions($options);
398 $this->form->addItem($select);
405 $check->setChecked(isset($this->search_values[$field->getFieldId()]) ?
406 $this->search_values[$field->getFieldId()] : 0);
408 $time =
new ilDateTimeInputGUI($this->lng->txt(
'from'),
'date_start['.$field->getFieldId().
']');
411 $time->setShowTime(
false);
415 $time->setShowTime(
true);
417 if(isset($this->search_values[
'date_start'][$field->getFieldId()]) and 0)
419 #$time->setUnixTime($this->toUnixTime($this->search_values['date_start'][$field->getFieldId()]['date'],$this->search_values['date_start'][$field->getFieldId()]['time']));
425 $check->addSubItem($time);
427 $time =
new ilDateTimeInputGUI($this->lng->txt(
'until'),
'date_end['.$field->getFieldId().
']');
430 $time->setShowTime(
false);
434 $time->setShowTime(
true);
436 if(isset($this->search_values[
'date_end'][$field->getFieldId()]) and 0)
438 #$time->setUnixTime($this->toUnixTime($this->search_values['date_end'][$field->getFieldId()]['date'],$this->search_values['date_end'][$field->getFieldId()]['time']));
444 $check->addSubItem($time);
446 $this->form->addItem($check);
455 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
458 $this->info->addSection($record_obj->getTitle());
460 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
463 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDValue.php');
466 switch($def->getFieldType())
469 if($value->getValue())
471 $this->info->addProperty($def->getTitle(),$value->getValue());
476 if($value->getValue())
478 $this->info->addProperty($def->getTitle(),$value->getValue());
483 if($value->getValue())
489 if($value->getValue())
509 return mktime($time[
'h'],$time[
'm'],0,$date[
'm'],$date[
'd'],$date[
'y']);
521 include_once(
'./Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php');
522 include_once(
'./Services/WebServices/ECS/classes/class.ilECSSettings.php');
530 if($mapping->getMappingByECSName(
'begin') == $a_definition->getFieldId())
535 if($mapping->getMappingByECSName(
'end') == $a_definition->getFieldId())
539 if($mapping->getMappingByECSName(
'cycle') == $a_definition->getFieldId())
543 if($mapping->getMappingByECSName(
'room') == $a_definition->getFieldId())
559 $this->lng->loadLanguageModule(
'ecs');
561 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDValue.php');
564 $unixtime = $value_start->getValue() ? $value_start->getValue() : mktime(8,0,0,date(
'm'),date(
'd'),date(
'Y'));
566 $time =
new ilDateTimeInputGUI($this->lng->txt(
'ecs_event_appointment'),
'md['.$def->getFieldId().
']');
567 $time->setShowTime(
true);
569 $time->enableDateActivation($this->lng->txt(
'enabled'),
570 'md_activated['.$def->getFieldId().
']',
571 $value_start->getValue() ?
true :
false);
572 $time->setDisabled($value_start->isDisabled());
575 if($field_id = $mapping->getMappingByECSName(
'end'))
579 list($hours,$minutes) = $this->
parseDuration($value_start->getValue(),$value_end->getValue());
583 $duration->setMinutes($minutes);
584 #$duration->setInfo($this->lng->txt('ecs_duration_info'));
585 $duration->setShowHours(
true);
586 $duration->setShowMinutes(
true);
587 $time->addSubItem($duration);
590 if($field_id = $mapping->getMappingByECSName(
'cycle'))
594 switch($cycle_def->getFieldType())
597 $text =
new ilTextInputGUI($cycle_def->getTitle(),
'md['.$cycle_def->getFieldId().
']');
598 $text->setValue($value->getValue());
600 $text->setMaxLength(512);
601 $text->setDisabled($value->isDisabled());
602 $time->addSubItem($text);
606 $select =
new ilSelectInputGUI($cycle_def->getTitle(),
'md['.$cycle_def->getFieldId().
']');
607 $select->setOptions($cycle_def->getFieldValuesForSelect());
608 $select->setValue($value->getValue());
609 $select->setDisabled($value->isDisabled());
610 $time->addSubItem($select);
614 if($field_id = $mapping->getMappingByECSName(
'room'))
618 switch($room_def->getFieldType())
621 $text =
new ilTextInputGUI($room_def->getTitle(),
'md['.$room_def->getFieldId().
']');
622 $text->setValue($value->getValue());
624 $text->setMaxLength(512);
625 $text->setDisabled($value->isDisabled());
626 $time->addSubItem($text);
630 $select =
new ilSelectInputGUI($room_def->getTitle(),
'md['.$room_def->getFieldId().
']');
631 $select->setOptions($cycle_def->getFieldValuesForSelect());
632 $select->setValue($value->getValue());
633 $select->setDisabled($value->isDisabled());
634 $time->addSubItem($select);
638 $this->form->addItem($time);
650 if($u_start >= $u_end)
654 $diff = $u_end - $u_start;
655 $hours = (int) (
$diff / (60 * 60));
656 $min = (int) ((
$diff % 3600) / 60);
657 return array($hours,$min);