Ejemplo n.º 1
0
 /**
  * Show special form for ecs start
  * 
  * @access private
  * @param object ilAdvMDFieldDefinition
  */
 private function showECSStart($def)
 {
     global $ilUser;
     $this->lng->loadLanguageModule('ecs');
     include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDValue.php';
     $value_start = ilAdvancedMDValue::_getInstance($this->obj_id, $def->getFieldId());
     $unixtime = $value_start->getValue() ? $value_start->getValue() : mktime(8, 0, 0, date('m'), date('d'), date('Y'));
     $time = new ilDateTimeInputGUI($this->lng->txt('ecs_event_appointment'), 'md[' . $def->getFieldId() . ']');
     $time->setShowTime(true);
     $time->setDate(new ilDateTime($unixtime, IL_CAL_UNIX));
     $time->enableDateActivation($this->lng->txt('enabled'), 'md_activated[' . $def->getFieldId() . ']', $value_start->getValue() ? true : false);
     $time->setDisabled($value_start->isDisabled());
     $mapping = ilECSDataMappingSettings::_getInstance();
     if ($field_id = $mapping->getMappingByECSName('end')) {
         $value_end = ilAdvancedMDValue::_getInstance($this->obj_id, $field_id);
         list($hours, $minutes) = $this->parseDuration($value_start->getValue(), $value_end->getValue());
         $duration = new ilDurationInputGUI($this->lng->txt('ecs_duration'), 'ecs_duration');
         $duration->setHours($hours);
         $duration->setMinutes($minutes);
         #$duration->setInfo($this->lng->txt('ecs_duration_info'));
         $duration->setShowHours(true);
         $duration->setShowMinutes(true);
         $time->addSubItem($duration);
     }
     if ($field_id = $mapping->getMappingByECSName('cycle')) {
         $value = ilAdvancedMDValue::_getInstance($this->obj_id, $field_id);
         $cycle_def = new ilAdvancedMDFieldDefinition($field_id);
         switch ($cycle_def->getFieldType()) {
             case ilAdvancedMDFieldDefinition::TYPE_TEXT:
                 $text = new ilTextInputGUI($cycle_def->getTitle(), 'md[' . $cycle_def->getFieldId() . ']');
                 $text->setValue($value->getValue());
                 $text->setSize(20);
                 $text->setMaxLength(512);
                 $text->setDisabled($value->isDisabled());
                 $time->addSubItem($text);
                 break;
             case ilAdvancedMDFieldDefinition::TYPE_SELECT:
                 $select = new ilSelectInputGUI($cycle_def->getTitle(), 'md[' . $cycle_def->getFieldId() . ']');
                 $select->setOptions($cycle_def->getFieldValuesForSelect());
                 $select->setValue($value->getValue());
                 $select->setDisabled($value->isDisabled());
                 $time->addSubItem($select);
                 break;
         }
     }
     if ($field_id = $mapping->getMappingByECSName('room')) {
         $value = ilAdvancedMDValue::_getInstance($this->obj_id, $field_id);
         $room_def = new ilAdvancedMDFieldDefinition($field_id);
         switch ($room_def->getFieldType()) {
             case ilAdvancedMDFieldDefinition::TYPE_TEXT:
                 $text = new ilTextInputGUI($room_def->getTitle(), 'md[' . $room_def->getFieldId() . ']');
                 $text->setValue($value->getValue());
                 $text->setSize(20);
                 $text->setMaxLength(512);
                 $text->setDisabled($value->isDisabled());
                 $time->addSubItem($text);
                 break;
             case ilAdvancedMDFieldDefinition::TYPE_SELECT:
                 $select = new ilSelectInputGUI($room_def->getTitle(), 'md[' . $room_def->getFieldId() . ']');
                 $select->setOptions($cycle_def->getFieldValuesForSelect());
                 $select->setValue($value->getValue());
                 $select->setDisabled($value->isDisabled());
                 $time->addSubItem($select);
                 break;
         }
     }
     $this->form->addItem($time);
 }