/** * Init object creation form * * @param string $a_new_type * * @return ilPropertyFormGUI */ protected function initCreateForm($a_new_type) { global $lng; include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setTarget("_top"); $form->setFormAction($this->ctrl->getFormAction($this, "save")); $form->setTitle($this->lng->txt($a_new_type . "_new")); // title $ti = new ilTextInputGUI($this->lng->txt("title"), "title"); $ti->setSize(min(40, ilObject::TITLE_LENGTH)); $ti->setMaxLength(ilObject::TITLE_LENGTH); $ti->setRequired(true); $form->addItem($ti); // description $ta = new ilTextAreaInputGUI($this->lng->txt("description"), "desc"); $ta->setCols(40); $ta->setRows(2); $form->addItem($ta); $services_group = new ilRadioGroupInputGUI($lng->txt("cld_service"), "service"); $services_group->setRequired(true); foreach (ilCloudConnector::getActiveServices() as $service) { $option = new ilRadioOption($service, $service); $hook_object = ilCloudConnector::getPluginHookClass($option->getValue()); $option->setTitle($hook_object->txt($service)); $option->setInfo($hook_object->txt("create_info")); $this->plugin_service = ilCloudConnector::getServiceClass($service, 0, false); $init_gui = ilCloudConnector::getCreationGUIClass($this->plugin_service); if ($init_gui) { $init_gui->initPluginCreationFormSection($option); } $services_group->addOption($option); } //Select first radio-button by default $services_group->setValue(array_shift($services_group->getOptions())->getValue()); $form->addItem($services_group); $form = $this->initDidacticTemplate($form); $form->addCommandButton("save", $this->lng->txt($a_new_type . "_add")); $form->addCommandButton("cancel", $this->lng->txt("cancel")); return $form; }