/** * Add basic question form properties: * assessment: title, author, description, question, working time * * @return int Default Nr of Tries */ function addBasicQuestionFormProperties($form) { // title $title = new ilTextInputGUI($this->lng->txt("title"), "title"); $title->setValue($this->object->getTitle()); $title->setRequired(TRUE); $form->addItem($title); if (!$this->object->getSelfAssessmentEditingMode()) { // author $author = new ilTextInputGUI($this->lng->txt("author"), "author"); $author->setValue($this->object->getAuthor()); $author->setRequired(TRUE); $form->addItem($author); // description $description = new ilTextInputGUI($this->lng->txt("description"), "comment"); $description->setValue($this->object->getComment()); $description->setRequired(FALSE); $form->addItem($description); } else { // author as hidden field $hi = new ilHiddenInputGUI("author"); $author = ilUtil::prepareFormOutput($this->object->getAuthor()); if (trim($author) == "") { $author = "-"; } $hi->setValue($author); $form->addItem($hi); } // questiontext $question = new ilTextAreaInputGUI($this->lng->txt("question"), "question"); $question->setValue($this->object->prepareTextareaOutput($this->object->getQuestion())); $question->setRequired(TRUE); $question->setRows(10); $question->setCols(80); if (!$this->object->getSelfAssessmentEditingMode()) { if ($this->object->getAdditionalContentEditingMode() != assQuestion::ADDITIONAL_CONTENT_EDITING_MODE_PAGE_OBJECT) { $question->setUseRte(TRUE); include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php"; $question->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment")); $question->addPlugin("latex"); $question->addButton("latex"); $question->addButton("pastelatex"); $question->setRTESupport($this->object->getId(), "qpl", "assessment"); } } else { $question->setRteTags(self::getSelfAssessmentTags()); $question->setUseTagsForRteOnly(false); } $form->addItem($question); if (!$this->object->getSelfAssessmentEditingMode()) { // duration $duration = new ilDurationInputGUI($this->lng->txt("working_time"), "Estimated"); $duration->setShowHours(TRUE); $duration->setShowMinutes(TRUE); $duration->setShowSeconds(TRUE); $ewt = $this->object->getEstimatedWorkingTime(); $duration->setHours($ewt["h"]); $duration->setMinutes($ewt["m"]); $duration->setSeconds($ewt["s"]); $duration->setRequired(FALSE); $form->addItem($duration); } else { // number of tries if (strlen($this->object->getNrOfTries())) { $nr_tries = $this->object->getNrOfTries(); } else { $nr_tries = $this->object->getDefaultNrOfTries(); } if ($nr_tries < 1) { $nr_tries = ""; } $ni = new ilNumberInputGUI($this->lng->txt("qst_nr_of_tries"), "nr_of_tries"); $ni->setValue($nr_tries); $ni->setMinValue(0); $ni->setSize(5); $ni->setMaxLength(5); $form->addItem($ni); } }
function addBasicQuestionFormProperties($form) { // title $title = new ilTextInputGUI($this->lng->txt("title"), "title"); $title->setValue($this->object->getTitle()); $title->setRequired(TRUE); $form->addItem($title); if (!$this->object->getSelfAssessmentEditingMode()) { // author $author = new ilTextInputGUI($this->lng->txt("author"), "author"); $author->setValue($this->object->getAuthor()); $author->setRequired(TRUE); $form->addItem($author); // description $description = new ilTextInputGUI($this->lng->txt("description"), "comment"); $description->setValue($this->object->getComment()); $description->setRequired(FALSE); $form->addItem($description); } else { // author as hidden field $hi = new ilHiddenInputGUI("author"); $author = ilUtil::prepareFormOutput($this->object->getAuthor()); if (trim($author) == "") { $author = "-"; } $hi->setValue($author); $form->addItem($hi); } // questiontext $question = new ilTextAreaInputGUI($this->lng->txt("question"), "question"); $question->setValue($this->object->prepareTextareaOutput($this->object->getQuestion())); $question->setRequired(TRUE); $question->setRows(10); $question->setCols(80); if (!$this->object->getSelfAssessmentEditingMode()) { if ($this->object->getAdditionalContentEditingMode() == assQuestion::ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT) { $question->setUseRte(TRUE); include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php"; $question->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment")); $question->addPlugin("latex"); $question->addButton("latex"); $question->addButton("pastelatex"); $question->setRTESupport($this->object->getId(), "qpl", "assessment"); } } else { $question->setRteTags(self::getSelfAssessmentTags()); $question->setUseTagsForRteOnly(false); } $form->addItem($question); $tpl = new ilTemplate("tpl.il_as_qpl_cloze_gap_button_code.html", TRUE, TRUE, "Modules/TestQuestionPool"); $tpl->setVariable('INSERT_GAP', $this->lng->txt('insert_gap')); $tpl->setVariable('CREATE_GAPS', $this->lng->txt('create_gaps')); $tpl->parseCurrentBlock(); $button = new ilCustomInputGUI(' ', ''); $button->setHtml($tpl->get()); $form->addItem($button); if (!$this->object->getSelfAssessmentEditingMode()) { // duration $duration = new ilDurationInputGUI($this->lng->txt("working_time"), "Estimated"); $duration->setShowHours(TRUE); $duration->setShowMinutes(TRUE); $duration->setShowSeconds(TRUE); $ewt = $this->object->getEstimatedWorkingTime(); $duration->setHours($ewt["h"]); $duration->setMinutes($ewt["m"]); $duration->setSeconds($ewt["s"]); $duration->setRequired(FALSE); $form->addItem($duration); } else { // number of tries if (strlen($this->object->getNrOfTries())) { $nr_tries = $this->object->getNrOfTries(); } else { $nr_tries = $this->object->getDefaultNrOfTries(); } /*if ($nr_tries <= 0) { $nr_tries = 1; }*/ if ($nr_tries < 0) { $nr_tries = 0; } $ni = new ilNumberInputGUI($this->lng->txt("qst_nr_of_tries"), "nr_of_tries"); $ni->setValue($nr_tries); //$ni->setMinValue(1); $ni->setMinValue(0); $ni->setSize(5); $ni->setMaxLength(5); $ni->setRequired(true); $form->addItem($ni); } }
/** * init settings form * * @access protected */ protected function initSettingsForm($a_mode = 'update') { if (is_object($this->form)) { return true; } include_once 'Services/Form/classes/class.ilPropertyFormGUI.php'; $this->form = new ilPropertyFormGUI(); $this->form->setFormAction($this->ctrl->getFormAction($this, 'settings')); $this->form->setTitle($this->lng->txt('ecs_connection_settings')); $ena = new ilCheckboxInputGUI($this->lng->txt('ecs_active'), 'active'); $ena->setChecked($this->settings->isEnabled()); $ena->setValue(1); $this->form->addItem($ena); $ser = new ilTextInputGUI($this->lng->txt('ecs_server_url'), 'server'); $ser->setValue((string) $this->settings->getServer()); $ser->setRequired(true); $this->form->addItem($ser); $pro = new ilSelectInputGUI($this->lng->txt('ecs_protocol'), 'protocol'); // fixed to https #$pro->setOptions(array(ilECSSetting::PROTOCOL_HTTP => $this->lng->txt('http'), # ilECSSetting::PROTOCOL_HTTPS => $this->lng->txt('https'))); $pro->setOptions(array(ilECSSetting::PROTOCOL_HTTPS => 'HTTPS')); $pro->setValue($this->settings->getProtocol()); $pro->setRequired(true); $this->form->addItem($pro); $por = new ilTextInputGUI($this->lng->txt('ecs_port'), 'port'); $por->setSize(5); $por->setMaxLength(5); $por->setValue((string) $this->settings->getPort()); $por->setRequired(true); $this->form->addItem($por); $tcer = new ilRadioGroupInputGUI($this->lng->txt('ecs_auth_type'), 'auth_type'); $tcer->setValue($this->settings->getAuthType()); $this->form->addItem($tcer); // Certificate based authentication $cert_based = new ilRadioOption($this->lng->txt('ecs_auth_type_cert'), ilECSSetting::AUTH_CERTIFICATE); $tcer->addOption($cert_based); $cli = new ilTextInputGUI($this->lng->txt('ecs_client_cert'), 'client_cert'); $cli->setSize(60); $cli->setValue((string) $this->settings->getClientCertPath()); $cli->setRequired(true); $cert_based->addSubItem($cli); $key = new ilTextInputGUI($this->lng->txt('ecs_cert_key'), 'key_path'); $key->setSize(60); $key->setValue((string) $this->settings->getKeyPath()); $key->setRequired(true); $cert_based->addSubItem($key); $cerp = new ilTextInputGUI($this->lng->txt('ecs_key_password'), 'key_password'); $cerp->setSize(12); $cerp->setValue((string) $this->settings->getKeyPassword()); $cerp->setInputType('password'); $cerp->setRequired(true); $cert_based->addSubItem($cerp); $cer = new ilTextInputGUI($this->lng->txt('ecs_ca_cert'), 'ca_cert'); $cer->setSize(60); $cer->setValue((string) $this->settings->getCACertPath()); $cer->setRequired(true); $cert_based->addSubItem($cer); // Apache auth $apa_based = new ilRadioOption($this->lng->txt('ecs_auth_type_apache'), ilECSSetting::AUTH_APACHE); $tcer->addOption($apa_based); $user = new ilTextInputGUI($this->lng->txt('ecs_apache_user'), 'auth_user'); $user->setSize(32); $user->setValue((string) $this->settings->getAuthUser()); $user->setRequired(true); $apa_based->addSubItem($user); $pass = new ilPasswordInputGUI($this->lng->txt('ecs_apache_pass'), 'auth_pass'); $pass->setRetype(false); $pass->setSize(16); $pass->setMaxLength(32); $pass->setValue((string) $this->settings->getAuthPass()); $pass->setRequired(true); $apa_based->addSubItem($pass); $ser = new ilNonEditableValueGUI($this->lng->txt('cert_serial')); $ser->setValue($this->settings->getCertSerialNumber() ? $this->settings->getCertSerialNumber() : $this->lng->txt('ecs_no_value')); $cert_based->addSubItem($ser); $loc = new ilFormSectionHeaderGUI(); $loc->setTitle($this->lng->txt('ecs_local_settings')); $this->form->addItem($loc); $pol = new ilDurationInputGUI($this->lng->txt('ecs_polling'), 'polling'); $pol->setShowDays(false); $pol->setShowHours(false); $pol->setShowMinutes(true); $pol->setShowSeconds(true); $pol->setSeconds($this->settings->getPollingTimeSeconds()); $pol->setMinutes($this->settings->getPollingTimeMinutes()); $pol->setRequired(true); $pol->setInfo($this->lng->txt('ecs_polling_info')); $this->form->addItem($pol); $imp = new ilCustomInputGUI($this->lng->txt('ecs_import_id')); $imp->setRequired(true); $tpl = new ilTemplate('tpl.ecs_import_id_form.html', true, true, 'Services/WebServices/ECS'); $tpl->setVariable('SIZE', 5); $tpl->setVariable('MAXLENGTH', 11); $tpl->setVariable('POST_VAR', 'import_id'); $tpl->setVariable('PROPERTY_VALUE', $this->settings->getImportId()); if ($this->settings->getImportId()) { $tpl->setVariable('COMPLETE_PATH', $this->buildPath($this->settings->getImportId())); } $imp->setHTML($tpl->get()); $imp->setInfo($this->lng->txt('ecs_import_id_info')); $this->form->addItem($imp); $loc = new ilFormSectionHeaderGUI(); $loc->setTitle($this->lng->txt('ecs_remote_user_settings')); $this->form->addItem($loc); $role = new ilSelectInputGUI($this->lng->txt('ecs_role'), 'global_role'); $role->setOptions($this->prepareRoleSelect()); $role->setValue($this->settings->getGlobalRole()); $role->setInfo($this->lng->txt('ecs_global_role_info')); $role->setRequired(true); $this->form->addItem($role); $duration = new ilDurationInputGUI($this->lng->txt('ecs_account_duration'), 'duration'); $duration->setInfo($this->lng->txt('ecs_account_duration_info')); $duration->setMonths($this->settings->getDuration()); $duration->setShowSeconds(false); $duration->setShowMinutes(false); $duration->setShowHours(false); $duration->setShowDays(false); $duration->setShowMonths(true); $duration->setRequired(true); $this->form->addItem($duration); // Email recipients $loc = new ilFormSectionHeaderGUI(); $loc->setTitle($this->lng->txt('ecs_notifications')); $this->form->addItem($loc); $rcp_user = new ilTextInputGUI($this->lng->txt('ecs_user_rcp'), 'user_recipients'); $rcp_user->setValue((string) $this->settings->getUserRecipientsAsString()); $rcp_user->setInfo($this->lng->txt('ecs_user_rcp_info')); $this->form->addItem($rcp_user); $rcp_econ = new ilTextInputGUI($this->lng->txt('ecs_econ_rcp'), 'econtent_recipients'); $rcp_econ->setValue((string) $this->settings->getEContentRecipientsAsString()); $rcp_econ->setInfo($this->lng->txt('ecs_econ_rcp_info')); $this->form->addItem($rcp_econ); $rcp_app = new ilTextInputGUI($this->lng->txt('ecs_approval_rcp'), 'approval_recipients'); $rcp_app->setValue((string) $this->settings->getApprovalRecipientsAsString()); $rcp_app->setInfo($this->lng->txt('ecs_approval_rcp_info')); $this->form->addItem($rcp_app); if ($a_mode == 'update') { $this->form->addCommandButton('update', $this->lng->txt('save')); } else { $this->form->addCommandButton('save', $this->lng->txt('save')); } $this->form->addCommandButton('overview', $this->lng->txt('cancel')); }
public function initCreateForm($item) { global $ilUser; $settings = ilAdobeConnectServer::_getInstance(); //Login User - this creates a user if he not exists. if ($settings->getAuthMode() == ilAdobeConnectServer::AUTH_MODE_SWITCHAAI) { $this->pluginObj->includeClass('class.ilAdobeConnectUserUtil.php'); $ilAdobeConnectUser = new ilAdobeConnectUserUtil($this->user->getId()); $ilAdobeConnectUser->loginUser(); } $this->pluginObj->includeClass('class.ilObjAdobeConnect.php'); if (isset($_POST['tpl_id']) && (int) $_POST['tpl_id'] > 0) { $item['id'] = $_POST['tpl_id']; } $template_settings = array(); if ($item['id']) { include_once "Services/Administration/classes/class.ilSettingsTemplate.php"; $template = new ilSettingsTemplate($item['id']); $template_settings = $template->getSettings(); } $form = new ilPropertyFormGUI(); $form->setTitle($this->pluginObj->txt($item['title'])); // login to ac-server $this->pluginObj->includeClass('class.ilAdobeConnectServer.php'); // title $title = new ilTextInputGUI($this->pluginObj->txt("title"), "title"); $title->setRequired(true); // description $description = new ilTextAreaInputGUI($this->pluginObj->txt("description"), "desc"); // contact_info_val $civ = array(); if ($ilUser->getPref('public_profile') == "y") { if ($ilUser->getPref('public_title')) { $civ_title = $ilUser->getUTitle() . ' '; } $civ[] = $civ_title . $ilUser->getFirstname() . ' ' . $ilUser->getLastname(); if ($ilUser->getPref('public_email')) { $civ[] = $ilUser->getEmail(); } if ($ilUser->getPref('public_phone_office') && strlen($ilUser->getPhoneOffice()) > 1) { $civ[] = $this->pluginObj->txt('office') . ': ' . $ilUser->getPhoneOffice(); } if ($ilUser->getPref('public_phone_mobile') && strlen($ilUser->getPhoneMobile()) > 1) { $civ[] = $this->pluginObj->txt('mobile') . ': ' . $ilUser->getPhoneMobile(); } } $contact_info_value = implode(', ', $civ); // owner $owner = new ilTextInputGUI($this->lng->txt("owner"), "owner"); $owner->setInfo($this->pluginObj->txt('owner_info')); $owner->setValue(ilObjUser::_lookupLogin($ilUser->getId())); $radio_time_type = new ilRadioGroupInputGUI($this->pluginObj->txt('time_type_selection'), 'time_type_selection'); // option: permanent room if (ilAdobeConnectServer::getSetting('enable_perm_room', '1')) { $permanent_room = new ilRadioOption($this->pluginObj->txt('permanent_room'), 'permanent_room'); $permanent_room->setInfo($this->pluginObj->txt('permanent_room_info')); $radio_time_type->addOption($permanent_room); $radio_time_type->setValue('permanent_room'); } // option: date selection $opt_date = new ilRadioOption($this->pluginObj->txt('start_date'), 'date_selection'); if ($template_settings['start_date']['hide'] == '0') { // start date $sd = new ilDateTimeInputGUI($this->pluginObj->txt("start_date"), "start_date"); $serverConfig = ilAdobeConnectServer::_getInstance(); $now = strtotime('+3 minutes'); $minTime = new ilDateTime($now + $serverConfig->getScheduleLeadTime() * 60 * 60, IL_CAL_UNIX); $sd->setDate($minTime); $sd->setShowTime(true); $sd->setRequired(true); $opt_date->addSubItem($sd); } if ($template_settings['duration']['hide'] == '0') { $duration = new ilDurationInputGUI($this->pluginObj->txt("duration"), "duration"); $duration->setRequired(true); $duration->setHours('2'); $opt_date->addSubItem($duration); } $radio_time_type->addOption($opt_date); $radio_time_type->setRequired(true); if (!ilAdobeConnectServer::getSetting('enable_perm_room', '1')) { $radio_time_type->setValue('date_selection'); } // access-level of the meeting room $radio_access_level = new ilRadioGroupInputGUI($this->pluginObj->txt('access'), 'access_level'); $opt_private = new ilRadioOption($this->pluginObj->txt('private_room'), ilObjAdobeConnect::ACCESS_LEVEL_PRIVATE); $opt_protected = new ilRadioOption($this->pluginObj->txt('protected_room'), ilObjAdobeConnect::ACCESS_LEVEL_PROTECTED); $opt_public = new ilRadioOption($this->pluginObj->txt('public_room'), ilObjAdobeConnect::ACCESS_LEVEL_PUBLIC); $radio_access_level->addOption($opt_private); $radio_access_level->addOption($opt_protected); $radio_access_level->addOption($opt_public); $radio_access_level->setValue(ilObjAdobeConnect::ACCESS_LEVEL_PROTECTED); $this->pluginObj->includeClass('class.ilAdobeConnectUserUtil.php'); $ilAdobeConnectUser = new ilAdobeConnectUserUtil($this->user->getId()); $ilAdobeConnectUser->ensureAccountExistance(); $xavc_login = $ilAdobeConnectUser->getXAVCLogin(); $folder_id = $ilAdobeConnectUser->ensureUserFolderExistance($xavc_login); if ($template_settings['reuse_existing_rooms']['hide'] == '0') { $all_scos = (array) ilObjAdobeConnect::getScosByFolderId($folder_id); $local_scos = (array) ilObjAdobeConnect::getLocalScos(); $free_scos = array(); if ($all_scos) { foreach ($all_scos as $sco) { $sco_ids[] = $sco['sco_id']; } $free_scos = array_diff($sco_ids, $local_scos); } if (!$free_scos) { $hidden_creation_type = new ilHiddenInputGUI('creation_type'); $hidden_creation_type->setValue('new_vc'); $form->addItem($hidden_creation_type); $advanced_form_item = $form; $afi_add_method = 'addItem'; } else { $radio_grp = new ilRadioGroupInputGUI($this->pluginObj->txt('choose_creation_type'), 'creation_type'); $radio_grp->setRequired(true); $radio_new = new ilRadioOption($this->pluginObj->txt('create_new'), 'new_vc'); $radio_existing = new ilRadioOption($this->pluginObj->txt('select_existing'), 'existing_vc'); $radio_grp->setValue('new_vc'); $radio_grp->addOption($radio_new); $advanced_form_item = $radio_new; $afi_add_method = 'addSubItem'; } $advanced_form_item->{$afi_add_method}($title); $advanced_form_item->{$afi_add_method}($description); $contact_info = new ilTextAreaInputGUI($this->pluginObj->txt("contact_information"), "contact_info"); $contact_info->setRows(self::CREATION_FORM_TA_ROWS); $contact_info->setValue($contact_info_value); $advanced_form_item->{$afi_add_method}($contact_info); $instructions = new ilTextAreaInputGUI($this->lng->txt('exc_instruction'), 'instructions'); $instructions->setRows(self::CREATION_FORM_TA_ROWS); $advanced_form_item->{$afi_add_method}($instructions); if ($template_settings['access_level']['hide'] == 0) { $advanced_form_item->{$afi_add_method}($radio_access_level); } $advanced_form_item->{$afi_add_method}($radio_time_type); $advanced_form_item->{$afi_add_method}($owner); if ($free_scos && $radio_existing) { $radio_existing = new ilRadioOption($this->pluginObj->txt('select_existing'), 'existing_vc'); $radio_grp->addOption($radio_existing); $form->addItem($radio_grp); foreach ($free_scos as $fs) { $options[$fs] = $all_scos[$fs]['sco_name']; } $available_rooms = new ilSelectInputGUI($this->pluginObj->txt('available_rooms'), 'available_rooms'); $available_rooms->setOptions($options); $available_rooms->setInfo($this->pluginObj->txt('choose_existing_room')); $radio_existing->addSubItem($available_rooms); $instructions_3 = new ilTextAreaInputGUI($this->lng->txt('exc_instruction'), 'instructions_3'); $instructions_3->setRows(self::CREATION_FORM_TA_ROWS); $radio_existing->addSubItem($instructions_3); $contact_info_3 = new ilTextAreaInputGUI($this->pluginObj->txt("contact_information"), "contact_info_3"); $contact_info_3->setValue($contact_info_value); $contact_info_3->setRows(self::CREATION_FORM_TA_ROWS); $radio_existing->addSubItem($contact_info_3); } else { //$info = new ilNonEditableValueGUI($this->pluginObj->txt('no_available_rooms')); //$radio_existing->addSubItem($info); } } else { $form->addItem($title); $form->addItem($description); $contact_info_2 = new ilTextAreaInputGUI($this->pluginObj->txt("contact_information"), "contact_info_2"); $contact_info_2->setRows(self::CREATION_FORM_TA_ROWS); $contact_info_2->setValue($contact_info_value); $form->addItem($contact_info_2); if ($template_settings['access_level']['hide'] == 0) { $form->addItem($radio_access_level); } $instructions_2 = new ilTextAreaInputGUI($this->lng->txt('exc_instruction'), 'instructions_2'); $instructions_2->setRows(self::CREATION_FORM_TA_ROWS); $form->addItem($instructions_2); if (ilAdobeConnectServer::getSetting('default_perm_room') && ilAdobeConnectServer::getSetting('enable_perm_room', '1')) { $info_text = $this->pluginObj->txt('smpl_permanent_room_enabled'); } else { $time = date('H:i', strtotime('+2 hours')); $info_text = sprintf($this->pluginObj->txt('smpl_permanent_room_disabled'), $time); } $info = new ilNonEditableValueGUI($this->lng->txt('info'), 'info_text'); $info->setValue($info_text); $form->addItem($info); } $tpl_id = new ilHiddenInputGUI('tpl_id'); $tpl_id->setValue($item['id']); $form->addItem($tpl_id); $form->addCommandButton("save", $this->pluginObj->txt($this->getType() . "_add")); $form->addCommandButton("cancelCreation", $this->lng->txt("cancel")); $form->setFormAction($this->ctrl->getFormAction($this)); return $form; }