/** * Add all fields to the form */ protected function initForm() { $this->setFormAction($this->ctrl->getFormAction($this->parent_gui)); $this->setTitle($this->lng->txt('orgu_type_custom_icon')); $item = new ilImageFileInputGUI($this->lng->txt('icon') . ' 32x32 px', 'icon'); $item->setSuffixes(array('svg')); $item->setInfo($this->lng->txt('orgu_type_custom_icon_info')); if (is_file($this->type->getIconPath(true))) { $item->setImage($this->type->getIconPath(true)); } $this->addItem($item); $this->addCommandButton('updateCustomIcons', $this->lng->txt('save')); }
/** * Shows the certificate editor for ILIAS tests */ public function certificateEditor() { global $ilAccess; $form_fields = array(); if (strcmp($this->ctrl->getCmd(), "certificateSave") == 0) { $form_fields = $this->getFormFieldsFromPOST(); } else { $form_fields = $this->getFormFieldsFromFO(); } include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setPreventDoubleSubmission(false); $form->setFormAction($this->ctrl->getFormAction($this)); $form->setTitle($this->lng->txt("certificate_edit")); $form->setMultipart(TRUE); $form->setTableWidth("100%"); $form->setId("certificate"); $active = new ilCheckboxInputGUI($this->lng->txt("active"), "active"); $active->setChecked($form_fields["active"]); $form->addItem($active); $import = new ilFileInputGUI($this->lng->txt("import"), "certificate_import"); $import->setRequired(FALSE); $import->setSuffixes(array("zip")); // handle the certificate import if (strlen($_FILES["certificate_import"]["tmp_name"])) { if ($import->checkInput()) { $result = $this->object->importCertificate($_FILES["certificate_import"]["tmp_name"], $_FILES["certificate_import"]["name"]); if ($result == FALSE) { $import->setAlert($this->lng->txt("certificate_error_import")); } else { $this->ctrl->redirect($this, "certificateEditor"); } } } $form->addItem($import); $pageformat = new ilRadioGroupInputGUI($this->lng->txt("certificate_page_format"), "pageformat"); $pageformats = $this->object->getPageFormats(); $pageformat->setValue($form_fields["pageformat"]); foreach ($pageformats as $format) { $option = new ilRadioOption($format["name"], $format["value"]); if (strcmp($format["value"], "custom") == 0) { $pageheight = new ilTextInputGUI($this->lng->txt("certificate_pageheight"), "pageheight"); $pageheight->setValue($form_fields["pageheight"]); $pageheight->setSize(6); $pageheight->setValidationRegexp("/[0123456789\\.](cm|mm|in|pt|pc|px|em)/is"); $pageheight->setInfo($this->lng->txt("certificate_unit_description")); $pageheight->setRequired(true); $option->addSubitem($pageheight); $pagewidth = new ilTextInputGUI($this->lng->txt("certificate_pagewidth"), "pagewidth"); $pagewidth->setValue($form_fields["pagewidth"]); $pagewidth->setSize(6); $pagewidth->setValidationRegexp("/[0123456789\\.](cm|mm|in|pt|pc|px|em)/is"); $pagewidth->setInfo($this->lng->txt("certificate_unit_description")); $pagewidth->setRequired(true); $option->addSubitem($pagewidth); } $pageformat->addOption($option); } $pageformat->setRequired(true); if (strcmp($this->ctrl->getCmd(), "certificateSave") == 0) { $pageformat->checkInput(); } $form->addItem($pageformat); $bgimage = new ilImageFileInputGUI($this->lng->txt("certificate_background_image"), "background"); $bgimage->setRequired(FALSE); $bgimage->setUseCache(false); if (count($_POST)) { // handle the background upload if (strlen($_FILES["background"]["tmp_name"])) { if ($bgimage->checkInput()) { $result = $this->object->uploadBackgroundImage($_FILES["background"]["tmp_name"]); if ($result == FALSE) { $bgimage->setAlert($this->lng->txt("certificate_error_upload_bgimage")); } } } } if (!$this->object->hasBackgroundImage()) { include_once "./Services/Certificate/classes/class.ilObjCertificateSettingsAccess.php"; if (ilObjCertificateSettingsAccess::hasBackgroundImage()) { $bgimage->setImage(ilObjCertificateSettingsAccess::getBackgroundImageThumbPathWeb()); } } else { $bgimage->setImage($this->object->getBackgroundImageThumbPathWeb()); } $form->addItem($bgimage); $padding_top = new ilTextInputGUI($this->lng->txt("certificate_padding_top"), "padding_top"); $padding_top->setRequired(TRUE); $padding_top->setValue($form_fields["padding_top"]); $padding_top->setSize(6); $padding_top->setValidationRegexp("/[0123456789\\.](cm|mm|in|pt|pc|px|em)/is"); $padding_top->setInfo($this->lng->txt("certificate_unit_description")); if (strcmp($this->ctrl->getCmd(), "certificateSave") == 0) { $padding_top->checkInput(); } $form->addItem($padding_top); $rect = new ilCSSRectInputGUI($this->lng->txt("certificate_margin_body"), "margin_body"); $rect->setRequired(TRUE); $rect->setUseUnits(TRUE); $rect->setTop($form_fields["margin_body_top"]); $rect->setBottom($form_fields["margin_body_bottom"]); $rect->setLeft($form_fields["margin_body_left"]); $rect->setRight($form_fields["margin_body_right"]); $rect->setInfo($this->lng->txt("certificate_unit_description")); if (strcmp($this->ctrl->getCmd(), "certificateSave") == 0) { $rect->checkInput(); } $form->addItem($rect); $certificate = new ilTextAreaInputGUI($this->lng->txt("certificate_text"), "certificate_text"); $certificate->removePlugin('ilimgupload'); $certificate->setValue($form_fields["certificate_text"]); $certificate->setRequired(TRUE); $certificate->setRows(20); $certificate->setCols(80); // fraunhpatch start $common_desc_tpl = new ilTemplate("tpl.common_desc.html", true, true, "Services/Certificate"); foreach (ilCertificate::getCustomCertificateFields() as $f) { $common_desc_tpl->setCurrentBlock("cert_field"); $common_desc_tpl->setVariable("PH", $f["ph"]); $common_desc_tpl->setVariable("PH_TXT", $f["name"]); $common_desc_tpl->parseCurrentBlock(); } $common_desc = $common_desc_tpl->get(); // fraunhpatch start $certificate->setInfo($this->object->getAdapter()->getCertificateVariablesDescription() . $common_desc); $certificate->setUseRte(TRUE, '3.4.7'); $tags = array("br", "em", "font", "li", "ol", "p", "span", "strong", "u", "ul"); $certificate->setRteTags($tags); if (strcmp($this->ctrl->getCmd(), "certificateSave") == 0) { $certificate->checkInput(); } $form->addItem($certificate); $this->object->getAdapter()->addAdditionalFormElements($form, $form_fields); if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) { if ($this->object->isComplete() || $this->object->hasBackgroundImage()) { $form->addCommandButton("certificatePreview", $this->lng->txt("certificate_preview")); $form->addCommandButton("certificateExportFO", $this->lng->txt("certificate_export")); $form->addCommandButton("certificateDelete", $this->lng->txt("delete")); } $form->addCommandButton("certificateSave", $this->lng->txt("save")); } $this->tpl->setVariable("ADM_CONTENT", $form->getHTML()); if (strcmp($this->ctrl->getCmd(), "certificateSave") == 0) { if ($_POST["background_delete"]) { $this->object->deleteBackgroundImage(); } if ($form->checkInput()) { try { $xslfo = $this->object->processXHTML2FO($form_fields); $this->object->getAdapter()->saveFormFields($form_fields); $this->object->saveCertificate($xslfo); $this->object->writeActive($form_fields["active"]); ilUtil::sendSuccess($this->lng->txt("saved_successfully"), TRUE); $this->ctrl->redirect($this, "certificateEditor"); } catch (Exception $e) { ilUtil::sendFailure($e->getMessage()); } } } }
/** * Add standard fields to form */ function addStandardFieldsToForm($a_form, $a_user = NULL, array $custom_fields = NULL) { global $ilSetting, $lng, $rbacreview, $ilias; // custom registration settings if (self::$mode == self::MODE_REGISTRATION) { include_once 'Services/Registration/classes/class.ilRegistrationSettings.php'; $registration_settings = new ilRegistrationSettings(); self::$user_field["username"]["group"] = "login_data"; self::$user_field["password"]["group"] = "login_data"; self::$user_field["language"]["default"] = $lng->lang_key; // different position for role $roles = self::$user_field["roles"]; unset(self::$user_field["roles"]); self::$user_field["roles"] = $roles; self::$user_field["roles"]["group"] = "settings"; } $fields = $this->getStandardFields(); $current_group = ""; $custom_fields_done = false; foreach ($fields as $f => $p) { // next group? -> diplay subheader if ($p["group"] != $current_group && ilUserProfile::userSettingVisible($f)) { if (is_array($custom_fields) && !$custom_fields_done) { // should be appended to "other" or at least before "settings" if ($current_group == "other" || $p["group"] == "settings") { // add "other" subheader if ($current_group != "other") { $sh = new ilFormSectionHeaderGUI(); $sh->setTitle($lng->txt("other")); $a_form->addItem($sh); } foreach ($custom_fields as $custom_field) { $a_form->addItem($custom_field); } $custom_fields_done = true; } } $sh = new ilFormSectionHeaderGUI(); $sh->setTitle($lng->txt($p["group"])); $a_form->addItem($sh); $current_group = $p["group"]; } $m = ""; if (isset($p["method"])) { $m = $p["method"]; } $lv = isset($p["lang_var"]) && $p["lang_var"] != "" ? $p["lang_var"] : $f; switch ($p["input"]) { case "login": if ((int) $ilSetting->get('allow_change_loginname') || self::$mode == self::MODE_REGISTRATION) { $val = new ilTextInputGUI($lng->txt('username'), 'username'); if ($a_user) { $val->setValue($a_user->getLogin()); } $val->setMaxLength(32); $val->setSize(40); $val->setRequired(true); } else { // user account name $val = new ilNonEditableValueGUI($lng->txt("username"), 'ne_un'); if ($a_user) { $val->setValue($a_user->getLogin()); } } $a_form->addItem($val); break; case "text": if (ilUserProfile::userSettingVisible($f)) { $ti = new ilTextInputGUI($lng->txt($lv), "usr_" . $f); if ($a_user) { $ti->setValue($a_user->{$m}()); } $ti->setMaxLength($p["maxlength"]); $ti->setSize($p["size"]); $ti->setRequired($ilSetting->get("require_" . $f)); if (!$ti->getRequired() || $ti->getValue()) { $ti->setDisabled($ilSetting->get("usr_settings_disable_" . $f)); } $a_form->addItem($ti); } break; case "sel_country": if (ilUserProfile::userSettingVisible($f)) { include_once "./Services/Form/classes/class.ilCountrySelectInputGUI.php"; $ci = new ilCountrySelectInputGUI($lng->txt($lv), "usr_" . $f); if ($a_user) { $ci->setValue($a_user->{$m}()); } $ci->setRequired($ilSetting->get("require_" . $f)); if (!$ci->getRequired() || $ci->getValue()) { $ci->setDisabled($ilSetting->get("usr_settings_disable_" . $f)); } $a_form->addItem($ci); } break; case "birthday": if (ilUserProfile::userSettingVisible($f)) { $bi = new ilBirthdayInputGUI($lng->txt($lv), "usr_" . $f); include_once "./Services/Calendar/classes/class.ilDateTime.php"; $date = null; if ($a_user && strlen($a_user->{$m}())) { $date = new ilDateTime($a_user->{$m}(), IL_CAL_DATE); $bi->setDate($date); } $bi->setShowEmpty(true); $bi->setStartYear(1900); $bi->setRequired($ilSetting->get("require_" . $f)); if (!$bi->getRequired() || $date) { $bi->setDisabled($ilSetting->get("usr_settings_disable_" . $f)); } $a_form->addItem($bi); } break; case "radio": if (ilUserProfile::userSettingVisible($f)) { $rg = new ilRadioGroupInputGUI($lng->txt($lv), "usr_" . $f); if ($a_user) { $rg->setValue($a_user->{$m}()); } foreach ($p["values"] as $k => $v) { $op = new ilRadioOption($lng->txt($v), $k); $rg->addOption($op); } $rg->setRequired($ilSetting->get("require_" . $f)); if (!$rg->getRequired() || $rg->getValue()) { $rg->setDisabled($ilSetting->get("usr_settings_disable_" . $f)); } $a_form->addItem($rg); } break; case "picture": if (ilUserProfile::userSettingVisible("upload") && $a_user) { $ii = new ilImageFileInputGUI($lng->txt("personal_picture"), "userfile"); $ii->setDisabled($ilSetting->get("usr_settings_disable_upload")); $upload = $a_form->getFileUpload("userfile"); if ($upload["name"]) { $ii->setPending($upload["name"]); } else { $im = ilObjUser::_getPersonalPicturePath($a_user->getId(), "small", true, true); if ($im != "") { $ii->setImage($im); $ii->setAlt($lng->txt("personal_picture")); } } // ilinc link as info if (ilUserProfile::userSettingVisible("upload") and $ilSetting->get("ilinc_active")) { include_once './Modules/ILinc/classes/class.ilObjiLincUser.php'; $ilinc_user = new ilObjiLincUser($a_user); if ($ilinc_user->id) { include_once './Modules/ILinc/classes/class.ilnetucateXMLAPI.php'; $ilincAPI = new ilnetucateXMLAPI(); $ilincAPI->uploadPicture($ilinc_user); $response = $ilincAPI->sendRequest("uploadPicture"); // return URL to user's personal page $url = trim($response->data['url']['cdata']); $desc = $lng->txt("ilinc_upload_pic_text") . " " . '<a href="' . $url . '">' . $lng->txt("ilinc_upload_pic_linktext") . '</a>'; $ii->setInfo($desc); } } $a_form->addItem($ii); } break; case "roles": if (self::$mode == self::MODE_DESKTOP) { if (ilUserProfile::userSettingVisible("roles")) { $global_roles = $rbacreview->getGlobalRoles(); foreach ($global_roles as $role_id) { if (in_array($role_id, $rbacreview->assignedRoles($a_user->getId()))) { $roleObj = $ilias->obj_factory->getInstanceByObjId($role_id); $role_names .= $roleObj->getTitle() . ", "; unset($roleObj); } } $dr = new ilNonEditableValueGUI($lng->txt("default_roles"), "ne_dr"); $dr->setValue(substr($role_names, 0, -2)); $a_form->addItem($dr); } } else { if (self::$mode == self::MODE_REGISTRATION) { if ($registration_settings->roleSelectionEnabled()) { include_once "./Services/AccessControl/classes/class.ilObjRole.php"; $options = array(); foreach (ilObjRole::_lookupRegisterAllowed() as $role) { $options[$role["id"]] = $role["title"]; } // registration form validation will take care of missing field / value if ($options) { if (sizeof($options) > 1) { $ta = new ilSelectInputGUI($lng->txt('default_role'), "usr_" . $f); $ta->setOptions($options); $ta->setRequired($ilSetting->get("require_" . $f)); if (!$ta->getRequired()) { $ta->setDisabled($ilSetting->get("usr_settings_disable_" . $f)); } } else { $ta = new ilHiddenInputGUI("usr_" . $f); $ta->setValue(array_shift(array_keys($options))); } $a_form->addItem($ta); } } } } break; case "email": if (ilUserProfile::userSettingVisible($f)) { $em = new ilEMailInputGUI($lng->txt($lv), "usr_" . $f); if ($a_user) { $em->setValue($a_user->{$m}()); } $em->setRequired($ilSetting->get("require_" . $f)); if (!$em->getRequired() || $em->getValue()) { $em->setDisabled($ilSetting->get("usr_settings_disable_" . $f)); } if (self::MODE_REGISTRATION == self::$mode) { $em->setRetype(true); } $a_form->addItem($em); } break; case "textarea": if (ilUserProfile::userSettingVisible($f)) { $ta = new ilTextAreaInputGUI($lng->txt($lv), "usr_" . $f); if ($a_user) { $ta->setValue($a_user->{$m}()); } $ta->setRows($p["rows"]); $ta->setCols($p["cols"]); $ta->setRequired($ilSetting->get("require_" . $f)); if (!$ta->getRequired() || $ta->getValue()) { $ta->setDisabled($ilSetting->get("usr_settings_disable_" . $f)); } $a_form->addItem($ta); } break; case "messenger": if (ilUserProfile::userSettingVisible("instant_messengers")) { $im_arr = $p["types"]; foreach ($im_arr as $im_name) { $im = new ilTextInputGUI($lng->txt("im_" . $im_name), "usr_im_" . $im_name); if ($a_user) { $im->setValue($a_user->getInstantMessengerId($im_name)); } $im->setMaxLength($p["maxlength"]); $im->setSize($p["size"]); $im->setRequired($ilSetting->get("require_" . "instant_messengers")); if (!$im->getRequired() || $im->getValue()) { $im->setDisabled($ilSetting->get("usr_settings_disable_" . "instant_messengers")); } $a_form->addItem($im); } } break; case "password": if (self::$mode == self::MODE_REGISTRATION) { if (!$registration_settings->passwordGenerationEnabled()) { $ta = new ilPasswordInputGUI($lng->txt($lv), "usr_" . $f); $ta->setRequired(true); // $ta->setDisabled($ilSetting->get("usr_settings_disable_".$f)); } else { $ta = new ilNonEditableValueGUI($lng->txt($lv)); $ta->setValue($lng->txt("reg_passwd_via_mail")); } $a_form->addItem($ta); } break; case "language": if (ilUserProfile::userSettingVisible($f)) { $ta = new ilSelectInputGUI($lng->txt($lv), "usr_" . $f); if ($a_user) { $ta->setValue($a_user->{$m}()); } $options = array(); $lng->loadLanguageModule("meta"); foreach ($lng->getInstalledLanguages() as $lang_key) { $options[$lang_key] = $lng->txt("meta_l_" . $lang_key); } asort($options); // #9728 $ta->setOptions($options); $ta->setRequired($ilSetting->get("require_" . $f)); if (!$ta->getRequired() || $ta->getValue()) { $ta->setDisabled($ilSetting->get("usr_settings_disable_" . $f)); } $a_form->addItem($ta); } break; case "multitext": if (ilUserProfile::userSettingVisible($f)) { $ti = new ilTextInputGUI($lng->txt($lv), "usr_" . $f); $ti->setMulti(true); if ($a_user) { $ti->setValue($a_user->{$m}()); } $ti->setMaxLength($p["maxlength"]); $ti->setSize($p["size"]); $ti->setRequired($ilSetting->get("require_" . $f)); if (!$ti->getRequired() || $ti->getValue()) { $ti->setDisabled($ilSetting->get("usr_settings_disable_" . $f)); } if ($this->ajax_href) { // add field to ajax call $ti->setDataSource($this->ajax_href . "&f=" . $f); } $a_form->addItem($ti); } break; } } // append custom fields as "other" if (is_array($custom_fields) && !$custom_fields_done) { // add "other" subheader if ($current_group != "other") { $sh = new ilFormSectionHeaderGUI(); $sh->setTitle($lng->txt("other")); $a_form->addItem($sh); } foreach ($custom_fields as $custom_field) { $a_form->addItem($custom_field); } } }
/** * Init image form */ function initImageForm() { global $lng, $ilCtrl; include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $this->form_gui = new ilPropertyFormGUI(); $this->form_gui->setTitle($lng->txt("sty_add_image")); $file_input = new ilImageFileInputGUI($lng->txt("sty_image_file"), "image_file"); $file_input->setRequired(true); $this->form_gui->addItem($file_input); $this->form_gui->addCommandButton("uploadImage", $lng->txt("upload")); $this->form_gui->addCommandButton("cancelUpload", $lng->txt("cancel")); $this->form_gui->setFormAction($ilCtrl->getFormAction($this)); }
/** * @param $type_id * @param ilDataCollectionField $field * @return ilCheckboxInputGUI|ilDateTimeInputGUI|ilFileInputGUI|ilTextInputGUI|NULL */ static function getInputField(ilDataCollectionField $field) { global $lng; $type_id = $field->getDatatypeId(); $title = $field->getTitle(); switch ($type_id) { case ilDataCollectionDatatype::INPUTFORMAT_TEXT: $input = new ilTextInputGUI($title, 'field_' . $field->getId()); if ($field->getTextArea()) { $input = new ilTextAreaInputGUI($title, 'field_' . $field->getId()); } if ($field->getLength()) { $input->setInfo($lng->txt("dcl_max_text_length") . ": " . $field->getLength()); if (!$field->getTextArea()) { $input->setMaxLength($field->getLength()); } } break; case ilDataCollectionDatatype::INPUTFORMAT_NUMBER: $input = new ilTextInputGUI($title, 'field_' . $field->getId()); break; case ilDataCollectionDatatype::INPUTFORMAT_BOOLEAN: $input = new ilCheckboxInputGUI($title, 'field_' . $field->getId()); break; case ilDataCollectionDatatype::INPUTFORMAT_DATETIME: $input = new ilDateTimeInputGUI($title, 'field_' . $field->getId()); $input->setStartYear(date("Y") - 100); break; case ilDataCollectionDatatype::INPUTFORMAT_FILE: $input = new ilFileInputGUI($title, 'field_' . $field->getId()); break; case ilDataCollectionDatatype::INPUTFORMAT_REFERENCE: if (!$field->isNRef()) { $input = new ilSelectInputGUI($title, 'field_' . $field->getId()); } else { $input = new ilMultiSelectInputGUI($title, 'field_' . $field->getId()); } break; case ilDataCollectionDatatype::INPUTFORMAT_RATING: $input = new ilTextInputGUI($title, 'field_' . $field->getId()); $input->setValue($lng->txt("dcl_editable_in_table_gui")); $input->setDisabled(true); break; case ilDataCollectionDatatype::INPUTFORMAT_ILIAS_REF: $input = new ilDataCollectionTreePickInputGUI($title, 'field_' . $field->getId()); break; case ilDataCollectionDatatype::INPUTFORMAT_MOB: $input = new ilImageFileInputGUI($title, 'field_' . $field->getId()); $input->setAllowDeletion(true); break; } if ($field->getDescription()) { $input->setInfo($field->getDescription() . ($input->getInfo() ? "<br>" . $input->getInfo() : "")); } return $input; }
/** * Init add cast item form. */ function initAddCastItemForm($a_mode = "create") { global $lng, $ilCtrl, $ilTabs; $this->checkPermission("write"); $ilTabs->activateTab("edit_content"); $lng->loadLanguageModule("mcst"); $news_set = new ilSetting("news"); $enable_internal_rss = $news_set->get("enable_rss_for_internal"); include "Services/Form/classes/class.ilPropertyFormGUI.php"; $this->form_gui = new ilPropertyFormGUI(); $this->form_gui->setMultipart(true); // Property Title $text_input = new ilTextInputGUI($lng->txt("title"), "title"); $text_input->setMaxLength(200); $this->form_gui->addItem($text_input); // Property Content $text_area = new ilTextAreaInputGUI($lng->txt("description"), "description"); $text_area->setRequired(false); $this->form_gui->addItem($text_area); // Property Visibility if ($enable_internal_rss) { $radio_group = new ilRadioGroupInputGUI($lng->txt("access_scope"), "visibility"); $radio_option = new ilRadioOption($lng->txt("access_users"), "users"); $radio_group->addOption($radio_option); $radio_option = new ilRadioOption($lng->txt("access_public"), "public"); $radio_group->addOption($radio_option); $radio_group->setInfo($lng->txt("mcst_visibility_info")); $radio_group->setRequired(true); $radio_group->setValue($this->object->getDefaultAccess() == 0 ? "users" : "public"); $this->form_gui->addItem($radio_group); } // Duration $dur = new ilDurationInputGUI($lng->txt("mcst_duration"), "duration"); $dur->setInfo($lng->txt("mcst_duration_info")); $dur->setShowDays(false); $dur->setShowHours(true); $dur->setShowSeconds(true); $this->form_gui->addItem($dur); foreach (ilObjMediaCast::$purposes as $purpose) { if ($purpose == "VideoAlternative" && $a_mode == "create") { continue; } $section = new ilFormSectionHeaderGUI(); $section->setTitle($lng->txt("mcst_" . strtolower($purpose) . "_title")); $this->form_gui->addItem($section); if ($a_mode != "create") { $value = new ilHiddenInputGUI("value_" . $purpose); $label = new ilNonEditableValueGUI($lng->txt("value")); $label->setPostVar("label_value_" . $purpose); $label->setInfo($lng->txt("mcst_current_value_info")); $this->form_gui->addItem($label); $this->form_gui->addItem($value); } $file = new ilFileInputGUI($lng->txt("file"), "file_" . $purpose); $file->setSuffixes($this->purposeSuffixes[$purpose]); $this->form_gui->addItem($file); $text_input = new ilRegExpInputGUI($lng->txt("url"), "url_" . $purpose); $text_input->setPattern("/https?\\:\\/\\/.+/i"); $text_input->setInfo($lng->txt("mcst_reference_info")); $this->form_gui->addItem($text_input); if ($purpose != "Standard") { $clearCheckBox = new ilCheckboxInputGUI(); $clearCheckBox->setPostVar("delete_" . $purpose); $clearCheckBox->setTitle($lng->txt("mcst_clear_purpose_title")); $this->form_gui->addItem($clearCheckBox); } else { // mime type selection $mimeTypeSelection = new ilSelectInputGUI(); $mimeTypeSelection->setPostVar("mimetype_" . $purpose); $mimeTypeSelection->setTitle($lng->txt("mcst_mimetype")); $mimeTypeSelection->setInfo($lng->txt("mcst_mimetype_info")); $options = array("" => $lng->txt("mcst_automatic_detection")); $options = array_merge($options, $this->mimeTypes); $mimeTypeSelection->setOptions($options); $this->form_gui->addItem($mimeTypeSelection); // preview picure $pp = new ilImageFileInputGUI($lng->txt("mcst_preview_picture"), "preview_pic"); $pp->setSuffixes(array("png", "jpeg", "jpg")); $pp->setInfo($lng->txt("mcst_preview_picture_info") . " mp4, mp3, png, jp(e)g, gif"); $this->form_gui->addItem($pp); } } // save/cancel button if ($a_mode == "create") { $this->form_gui->setTitle($lng->txt("mcst_add_new_item")); $this->form_gui->addCommandButton("saveCastItem", $lng->txt("save")); } else { $this->form_gui->setTitle($lng->txt("mcst_edit_item")); $this->form_gui->addCommandButton("updateCastItem", $lng->txt("save")); } $this->form_gui->addCommandButton("listItems", $lng->txt("cancel")); $this->form_gui->setFormAction($ilCtrl->getFormAction($this, "saveCastItem")); }
/** * Edit settings. */ public function settings() { global $lng, $ilAccess; $this->tabs_gui->setTabActive('settings'); $form_settings = new ilSetting("certificate"); include_once 'Services/Form/classes/class.ilPropertyFormGUI.php'; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $form->setTitle($this->lng->txt('certificate_settings')); $active = new ilCheckboxInputGUI($this->lng->txt("active"), "active"); $active->setChecked($form_settings->get("active")); $form->addItem($active); $info = new ilNonEditableValueGUI($this->lng->txt("info"), "info"); $info->setValue($this->lng->txt("certificate_usage")); $form->addItem($info); $bgimage = new ilImageFileInputGUI($this->lng->txt("certificate_background_image"), "background"); $bgimage->setRequired(FALSE); if (count($_POST)) { // handle the background upload if (strlen($_FILES["background"]["tmp_name"])) { if ($bgimage->checkInput()) { $result = $this->object->uploadBackgroundImage($_FILES["background"]["tmp_name"]); if ($result == FALSE) { $bgimage->setAlert($this->lng->txt("certificate_error_upload_bgimage")); } } } } if (strlen($this->object->hasBackgroundImage())) { $bgimage->setImage($this->object->getBackgroundImageThumbPathWeb()); } $bgimage->setInfo($this->lng->txt("default_background_info")); $form->addItem($bgimage); $format = new ilSelectInputGUI($this->lng->txt("certificate_page_format"), "pageformat"); $defaultformats = array("a4" => $this->lng->txt("certificate_a4"), "a4landscape" => $this->lng->txt("certificate_a4_landscape"), "a5" => $this->lng->txt("certificate_a5"), "a5landscape" => $this->lng->txt("certificate_a5_landscape"), "letter" => $this->lng->txt("certificate_letter"), "letterlandscape" => $this->lng->txt("certificate_letter_landscape")); $format->setOptions($defaultformats); $format->setValue($form_settings->get("pageformat")); $format->setInfo($this->lng->txt("certificate_page_format_info")); $form->addItem($format); if ($ilAccess->checkAccess('write', '', $this->object->getRefId())) { $form->addCommandButton('save', $this->lng->txt('save')); } $this->tpl->setContent($form->getHTML()); if (strcmp($this->ctrl->getCmd(), "save") == 0) { if ($_POST["background_delete"]) { $this->object->deleteBackgroundImage(); } } }
/** * Init user form */ function initForm($a_mode) { global $lng, $ilCtrl, $styleDefinition, $ilSetting, $ilClientIniFile, $ilUser; $settings = $ilSetting->getAll(); include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $this->form_gui = new ilPropertyFormGUI(); $this->form_gui->setFormAction($ilCtrl->getFormAction($this)); if ($a_mode == "create") { $this->form_gui->setTitle($lng->txt("usr_new")); } else { $this->form_gui->setTitle($lng->txt("usr_edit")); } // login data $sec_l = new ilFormSectionHeaderGUI(); $sec_l->setTitle($lng->txt("login_data")); $this->form_gui->addItem($sec_l); // authentication mode include_once './Services/Authentication/classes/class.ilAuthUtils.php'; $active_auth_modes = ilAuthUtils::_getActiveAuthModes(); $am = new ilSelectInputGUI($lng->txt("auth_mode"), "auth_mode"); $option = array(); foreach ($active_auth_modes as $auth_name => $auth_key) { if ($auth_name == 'default') { $name = $this->lng->txt('auth_' . $auth_name) . " (" . $this->lng->txt('auth_' . ilAuthUtils::_getAuthModeName($auth_key)) . ")"; } else { $name = $this->lng->txt('auth_' . $auth_name); } $option[$auth_name] = $name; } $am->setOptions($option); $this->form_gui->addItem($am); if ($a_mode == "edit") { $id = new ilNonEditableValueGUI($lng->txt("usr_id"), "id"); $id->setValue($this->object->getId()); $this->form_gui->addItem($id); } // login $lo = new ilUserLoginInputGUI($lng->txt("login"), "login"); $lo->setRequired(true); if ($a_mode == "edit") { $lo->setCurrentUserId($this->object->getId()); try { include_once 'Services/Calendar/classes/class.ilDate.php'; $last_history_entry = ilObjUser::_getLastHistoryDataByUserId($this->object->getId()); $lo->setInfo(sprintf($this->lng->txt('usr_loginname_history_info'), ilDatePresentation::formatDate(new ilDateTime($last_history_entry[1], IL_CAL_UNIX)), $last_history_entry[0])); } catch (ilUserException $e) { } } $this->form_gui->addItem($lo); $pw = new ilPasswordInputGUI($lng->txt("passwd"), "passwd"); $pw->setSize(32); $pw->setMaxLength(32); $pw->setValidateAuthPost("auth_mode"); if ($a_mode == "create") { $pw->setRequiredOnAuth(true); } $pw->setInfo(ilUtil::getPasswordRequirementsInfo()); $this->form_gui->addItem($pw); // @todo: invisible/hidden passwords // external account include_once './Services/Authentication/classes/class.ilAuthUtils.php'; if (ilAuthUtils::_isExternalAccountEnabled()) { $ext = new ilTextInputGUI($lng->txt("user_ext_account"), "ext_account"); $ext->setSize(40); $ext->setMaxLength(250); $ext->setInfo($lng->txt("user_ext_account_desc")); $this->form_gui->addItem($ext); } // login data $sec_si = new ilFormSectionHeaderGUI(); $sec_si->setTitle($this->lng->txt("system_information")); $this->form_gui->addItem($sec_si); // create date, approve date, agreement date, last login if ($a_mode == "edit") { $sia = array("create_date", "approve_date", "agree_date", "last_login", "owner"); foreach ($sia as $a) { $siai = new ilNonEditableValueGUI($lng->txt($a), $a); $this->form_gui->addItem($siai); } } // active $ac = new ilCheckboxInputGUI($lng->txt("active"), "active"); $ac->setChecked(true); $this->form_gui->addItem($ac); // access @todo: get fields right (names change) $lng->loadLanguageModule('crs'); // access $radg = new ilRadioGroupInputGUI($lng->txt("time_limit"), "time_limit_unlimited"); $radg->setValue(1); $op1 = new ilRadioOption($lng->txt("user_access_unlimited"), 1); $radg->addOption($op1); $op2 = new ilRadioOption($lng->txt("user_access_limited"), 0); $radg->addOption($op2); // $ac = new ilCheckboxInputGUI($lng->txt("time_limit"), "time_limit_unlimited"); // $ac->setChecked(true); // $ac->setOptionTitle($lng->txt("crs_unlimited")); // access.from $acfrom = new ilDateTimeInputGUI($this->lng->txt("crs_from"), "time_limit_from"); $acfrom->setShowTime(true); // $ac->addSubItem($acfrom); $op2->addSubItem($acfrom); // access.to $acto = new ilDateTimeInputGUI($this->lng->txt("crs_to"), "time_limit_until"); $acto->setShowTime(true); // $ac->addSubItem($acto); $op2->addSubItem($acto); // $this->form_gui->addItem($ac); $this->form_gui->addItem($radg); require_once 'Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php'; if (ilDiskQuotaActivationChecker::_isActive()) { $lng->loadLanguageModule("file"); $quota_head = new ilFormSectionHeaderGUI(); $quota_head->setTitle($lng->txt("repository_disk_quota")); $this->form_gui->addItem($quota_head); // disk quota $disk_quota = new ilTextInputGUI($lng->txt("disk_quota"), "disk_quota"); $disk_quota->setSize(10); $disk_quota->setMaxLength(11); $disk_quota->setInfo($this->lng->txt("enter_in_mb_desc")); $this->form_gui->addItem($disk_quota); if ($a_mode == "edit") { // show which disk quota is in effect, and explain why require_once 'Services/WebDAV/classes/class.ilDiskQuotaChecker.php'; $dq_info = ilDiskQuotaChecker::_lookupDiskQuota($this->object->getId()); if ($dq_info['user_disk_quota'] > $dq_info['role_disk_quota']) { $info_text = sprintf($lng->txt('disk_quota_is_1_instead_of_2_by_3'), ilFormat::formatSize($dq_info['user_disk_quota'], 'short'), ilFormat::formatSize($dq_info['role_disk_quota'], 'short'), $dq_info['role_title']); } else { if (is_infinite($dq_info['role_disk_quota'])) { $info_text = sprintf($lng->txt('disk_quota_is_unlimited_by_1'), $dq_info['role_title']); } else { $info_text = sprintf($lng->txt('disk_quota_is_1_by_2'), ilFormat::formatSize($dq_info['role_disk_quota'], 'short'), $dq_info['role_title']); } } $disk_quota->setInfo($this->lng->txt("enter_in_mb_desc") . '<br>' . $info_text); // disk usage $du_info = ilDiskQuotaChecker::_lookupDiskUsage($this->object->getId()); $disk_usage = new ilNonEditableValueGUI($lng->txt("disk_usage"), "disk_usage"); if ($du_info['last_update'] === null) { $disk_usage->setValue($lng->txt('unknown')); } else { require_once './Services/Utilities/classes/class.ilFormat.php'; $disk_usage->setValue(ilFormat::formatSize($du_info['disk_usage'], 'short')); $info = '<table class="il_user_quota_disk_usage_overview">'; // write the count and size of each object type foreach ($du_info['details'] as $detail_data) { $info .= '<tr>' . '<td class="std">' . $detail_data['count'] . '</td>' . '<td class="std">' . $lng->txt($detail_data['type']) . '</td>' . '<td class="std">' . ilFormat::formatSize($detail_data['size'], 'short') . '</td>' . '</tr>'; } $info .= '</table>'; $info .= '<br>' . $this->lng->txt('last_update') . ': ' . ilDatePresentation::formatDate(new ilDateTime($du_info['last_update'], IL_CAL_DATETIME)); $disk_usage->setInfo($info); } $this->form_gui->addItem($disk_usage); // date when the last disk quota reminder was sent to the user if (true || $dq_info['last_reminder']) { $reminder = new ilNonEditableValueGUI($lng->txt("disk_quota_last_reminder_sent"), "last_reminder"); $reminder->setValue(ilDatePresentation::formatDate(new ilDateTime($dq_info['last_reminder'], IL_CAL_DATETIME))); $reminder->setInfo($this->lng->txt("disk_quota_last_reminder_sent_desc")); $this->form_gui->addItem($reminder); } } } if (ilDiskQuotaActivationChecker::_isPersonalWorkspaceActive()) { $lng->loadLanguageModule("file"); $quota_head = new ilFormSectionHeaderGUI(); $quota_head->setTitle($lng->txt("personal_workspace_disk_quota")); $this->form_gui->addItem($quota_head); // personal workspace disk quota $wsp_disk_quota = new ilTextInputGUI($lng->txt("disk_quota"), "wsp_disk_quota"); $wsp_disk_quota->setSize(10); $wsp_disk_quota->setMaxLength(11); $wsp_disk_quota->setInfo($this->lng->txt("enter_in_mb_desc")); $this->form_gui->addItem($wsp_disk_quota); if ($a_mode == "edit") { // show which disk quota is in effect, and explain why require_once 'Services/WebDAV/classes/class.ilDiskQuotaChecker.php'; $dq_info = ilDiskQuotaChecker::_lookupPersonalWorkspaceDiskQuota($this->object->getId()); if ($dq_info['user_wsp_disk_quota'] > $dq_info['role_wsp_disk_quota']) { $info_text = sprintf($lng->txt('disk_quota_is_1_instead_of_2_by_3'), ilFormat::formatSize($dq_info['user_wsp_disk_quota'], 'short'), ilFormat::formatSize($dq_info['role_wsp_disk_quota'], 'short'), $dq_info['role_title']); } else { if (is_infinite($dq_info['role_wsp_disk_quota'])) { $info_text = sprintf($lng->txt('disk_quota_is_unlimited_by_1'), $dq_info['role_title']); } else { $info_text = sprintf($lng->txt('disk_quota_is_1_by_2'), ilFormat::formatSize($dq_info['role_wsp_disk_quota'], 'short'), $dq_info['role_title']); } } $wsp_disk_quota->setInfo($this->lng->txt("enter_in_mb_desc") . '<br>' . $info_text); } // disk usage include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php"; $du_info = ilDiskQuotaHandler::getFilesizeByTypeAndOwner($this->object->getId()); $disk_usage = new ilNonEditableValueGUI($lng->txt("disk_usage"), "disk_usage"); if (!sizeof($du_info)) { $disk_usage->setValue($lng->txt('unknown')); } else { require_once './Services/Utilities/classes/class.ilFormat.php'; $disk_usage->setValue(ilFormat::formatSize(ilDiskQuotaHandler::getFilesizeByOwner($this->object->getId()))); $info = '<table class="il_user_quota_disk_usage_overview">'; // write the count and size of each object type foreach ($du_info as $detail_data) { $info .= '<tr>' . '<td class="std">' . $detail_data['count'] . '</td>' . '<td class="std">' . $lng->txt("obj_" . $detail_data["src_type"]) . '</td>' . '<td class="std">' . ilFormat::formatSize($detail_data['filesize'], 'short') . '</td>' . '</tr>'; } $info .= '</table>'; $disk_usage->setInfo($info); } $this->form_gui->addItem($disk_usage); } // personal data if ($this->isSettingChangeable('gender') or $this->isSettingChangeable('firstname') or $this->isSettingChangeable('lastname') or $this->isSettingChangeable('title') or $this->isSettingChangeable('personal_image') or $this->isSettingChangeable('birhtday')) { $sec_pd = new ilFormSectionHeaderGUI(); $sec_pd->setTitle($this->lng->txt("personal_data")); $this->form_gui->addItem($sec_pd); } // gender if ($this->isSettingChangeable('gender')) { $gndr = new ilRadioGroupInputGUI($lng->txt("gender"), "gender"); $gndr->setRequired(isset($settings["require_gender"]) && $settings["require_gender"]); $female = new ilRadioOption($lng->txt("gender_f"), "f"); $gndr->addOption($female); $male = new ilRadioOption($lng->txt("gender_m"), "m"); $gndr->addOption($male); $this->form_gui->addItem($gndr); } // firstname, lastname, title $fields = array("firstname" => true, "lastname" => true, "title" => isset($settings["require_title"]) && $settings["require_title"]); foreach ($fields as $field => $req) { if ($this->isSettingChangeable($field)) { $inp = new ilTextInputGUI($lng->txt($field), $field); $inp->setSize(32); $inp->setMaxLength(32); $inp->setRequired($req); $this->form_gui->addItem($inp); } } // personal image if ($this->isSettingChangeable('upload')) { $pi = new ilImageFileInputGUI($lng->txt("personal_picture"), "userfile"); if ($a_mode == "edit" || $a_mode == "upload") { $pi->setImage(ilObjUser::_getPersonalPicturePath($this->object->getId(), "small", true, true)); } $this->form_gui->addItem($pi); } if ($this->isSettingChangeable('birthday')) { $birthday = new ilBirthdayInputGUI($lng->txt('birthday'), 'birthday'); $birthday->setRequired(isset($settings["require_birthday"]) && $settings["require_birthday"]); $birthday->setShowEmpty(true); $birthday->setStartYear(1900); $this->form_gui->addItem($birthday); } // institution, department, street, city, zip code, country, phone office // phone home, phone mobile, fax, e-mail $fields = array(array("institution", 40, 80), array("department", 40, 80), array("street", 40, 40), array("city", 40, 40), array("zipcode", 10, 10), array("country", 40, 40), array("sel_country"), array("phone_office", 30, 30), array("phone_home", 30, 30), array("phone_mobile", 30, 30), array("fax", 30, 30)); $counter = 0; foreach ($fields as $field) { if (!$counter++ and $this->isSettingChangeable($field[0])) { // contact data $sec_cd = new ilFormSectionHeaderGUI(); $sec_cd->setTitle($this->lng->txt("contact_data")); $this->form_gui->addItem($sec_cd); } if ($this->isSettingChangeable($field[0])) { if ($field[0] != "sel_country") { $inp = new ilTextInputGUI($lng->txt($field[0]), $field[0]); $inp->setSize($field[1]); $inp->setMaxLength($field[2]); $inp->setRequired(isset($settings["require_" . $field[0]]) && $settings["require_" . $field[0]]); $this->form_gui->addItem($inp); } else { // country selection include_once "./Services/Form/classes/class.ilCountrySelectInputGUI.php"; $cs = new ilCountrySelectInputGUI($lng->txt($field[0]), $field[0]); $cs->setRequired(isset($settings["require_" . $field[0]]) && $settings["require_" . $field[0]]); $this->form_gui->addItem($cs); } } } // email if ($this->isSettingChangeable('email')) { $em = new ilEMailInputGUI($lng->txt("email"), "email"); $em->setRequired(isset($settings["require_email"]) && $settings["require_email"]); $this->form_gui->addItem($em); } // interests/hobbies if ($this->isSettingChangeable('hobby')) { $hob = new ilTextAreaInputGUI($lng->txt("hobby"), "hobby"); $hob->setRows(3); $hob->setCols(40); $hob->setRequired(isset($settings["require_hobby"]) && $settings["require_hobby"]); $this->form_gui->addItem($hob); } // referral comment if ($this->isSettingChangeable('referral_comment')) { $rc = new ilTextAreaInputGUI($lng->txt("referral_comment"), "referral_comment"); $rc->setRows(3); $rc->setCols(40); $rc->setRequired(isset($settings["require_referral_comment"]) && $settings["require_referral_comment"]); $this->form_gui->addItem($rc); } // interests $sh = new ilFormSectionHeaderGUI(); $sh->setTitle($lng->txt("interests")); $this->form_gui->addItem($sh); $multi_fields = array("interests_general", "interests_help_offered", "interests_help_looking"); foreach ($multi_fields as $multi_field) { if ($this->isSettingChangeable($multi_field)) { // see ilUserProfile $ti = new ilTextInputGUI($lng->txt($multi_field), $multi_field); $ti->setMulti(true); $ti->setMaxLength(40); $ti->setSize(40); $ti->setRequired(isset($settings["require_" . $multi_field]) && $settings["require_" . $multi_field]); $this->form_gui->addItem($ti); } } // instant messengers if ($this->isSettingChangeable('instant_messengers')) { $sec_im = new ilFormSectionHeaderGUI(); $sec_im->setTitle($this->lng->txt("instant_messengers")); $this->form_gui->addItem($sec_im); } // icq, yahoo, msn, aim, skype $fields = array("icq", "yahoo", "msn", "aim", "skype", "jabber", "voip"); foreach ($fields as $field) { if ($this->isSettingChangeable('instant_messengers')) { $im = new ilTextInputGUI($lng->txt("im_" . $field), "im_" . $field); $im->setSize(40); $im->setMaxLength(40); $this->form_gui->addItem($im); } } // other information if ($this->isSettingChangeable('user_profile_other')) { $sec_oi = new ilFormSectionHeaderGUI(); $sec_oi->setTitle($this->lng->txt("user_profile_other")); $this->form_gui->addItem($sec_oi); } // matriculation number if ($this->isSettingChangeable('matriculation')) { $mr = new ilTextInputGUI($lng->txt("matriculation"), "matriculation"); $mr->setSize(40); $mr->setMaxLength(40); $mr->setRequired(isset($settings["require_matriculation"]) && $settings["require_matriculation"]); $this->form_gui->addItem($mr); } // delicious if ($this->isSettingChangeable('delicious')) { $mr = new ilTextInputGUI($lng->txt("delicious"), "delicious"); $mr->setSize(40); $mr->setMaxLength(40); $mr->setRequired(isset($settings["require_delicious"]) && $settings["require_delicious"]); $this->form_gui->addItem($mr); } // client IP $ip = new ilTextInputGUI($lng->txt("client_ip"), "client_ip"); $ip->setSize(40); $ip->setMaxLength(255); $ip->setInfo($this->lng->txt("current_ip") . " " . $_SERVER["REMOTE_ADDR"] . " <br />" . '<span class="warning">' . $this->lng->txt("current_ip_alert") . "</span>"); $this->form_gui->addItem($ip); // additional user defined fields include_once './Services/User/classes/class.ilUserDefinedFields.php'; $user_defined_fields = ilUserDefinedFields::_getInstance(); if ($this->usrf_ref_id == USER_FOLDER_ID) { $all_defs = $user_defined_fields->getDefinitions(); } else { $all_defs = $user_defined_fields->getChangeableLocalUserAdministrationDefinitions(); } foreach ($all_defs as $field_id => $definition) { if ($definition['field_type'] == UDF_TYPE_TEXT) { $udf = new ilTextInputGUI($definition['field_name'], "udf_" . $definition['field_id']); $udf->setSize(40); $udf->setMaxLength(255); } else { if ($definition['field_type'] == UDF_TYPE_WYSIWYG) { $udf = new ilTextAreaInputGUI($definition['field_name'], "udf_" . $definition['field_id']); $udf->setUseRte(true); } else { $udf = new ilSelectInputGUI($definition['field_name'], "udf_" . $definition['field_id']); $udf->setOptions($user_defined_fields->fieldValuesToSelectArray($definition['field_values'])); } } $udf->setRequired($definition['required']); $this->form_gui->addItem($udf); } // settings if ($a_mode == 'create' or $this->isSettingChangeable('language') or $this->isSettingChangeable('skin_style') or $this->isSettingChangeable('hits_per_page') or $this->isSettingChangeable('hide_own_online_status')) { $sec_st = new ilFormSectionHeaderGUI(); $sec_st->setTitle($this->lng->txt("settings")); $this->form_gui->addItem($sec_st); } // role if ($a_mode == "create") { $role = new ilSelectInputGUI($lng->txt("default_role"), 'default_role'); $role->setRequired(true); $role->setValue($this->default_role); $role->setOptions($this->selectable_roles); $this->form_gui->addItem($role); } // language if ($this->isSettingChangeable('language')) { $lang = new ilSelectInputGUI($lng->txt("language"), 'language'); $languages = $lng->getInstalledLanguages(); $lng->loadLanguageModule("meta"); $options = array(); foreach ($languages as $l) { $options[$l] = $lng->txt("meta_l_" . $l); } $lang->setOptions($options); $lang->setValue($ilSetting->get("language")); $this->form_gui->addItem($lang); } // skin/style if ($this->isSettingChangeable('skin_style')) { $sk = new ilSelectInputGUI($lng->txt("skin_style"), 'skin_style'); $templates = $styleDefinition->getAllTemplates(); include_once "./Services/Style/classes/class.ilObjStyleSettings.php"; $options = array(); if (count($templates) > 0 && is_array($templates)) { foreach ($templates as $template) { $styleDef =& new ilStyleDefinition($template["id"]); $styleDef->startParsing(); $styles = $styleDef->getStyles(); foreach ($styles as $style) { if (!ilObjStyleSettings::_lookupActivatedStyle($template["id"], $style["id"])) { continue; } $options[$template["id"] . ":" . $style["id"]] = $styleDef->getTemplateName() . " / " . $style["name"]; } } } $sk->setOptions($options); $sk->setValue($ilClientIniFile->readVariable("layout", "skin") . ":" . $ilClientIniFile->readVariable("layout", "style")); $this->form_gui->addItem($sk); } // hits per page if ($this->isSettingChangeable('hits_per_page')) { $hpp = new ilSelectInputGUI($lng->txt("hits_per_page"), 'hits_per_page'); $options = array(10 => 10, 15 => 15, 20 => 20, 30 => 30, 40 => 40, 50 => 50, 100 => 100, 9999 => $this->lng->txt("no_limit")); $hpp->setOptions($options); $hpp->setValue($ilSetting->get("hits_per_page")); $this->form_gui->addItem($hpp); // users online $uo = new ilSelectInputGUI($lng->txt("users_online"), 'show_users_online'); $options = array("y" => $lng->txt("users_online_show_y"), "associated" => $lng->txt("users_online_show_associated"), "n" => $lng->txt("users_online_show_n")); $uo->setOptions($options); $uo->setValue($ilSetting->get("show_users_online")); $this->form_gui->addItem($uo); } // hide online status if ($this->isSettingChangeable('hide_own_online_status')) { $os = new ilCheckboxInputGUI($lng->txt("hide_own_online_status"), "hide_own_online_status"); $this->form_gui->addItem($os); } if ((int) $ilSetting->get('session_reminder_enabled')) { $cb = new ilCheckboxInputGUI($this->lng->txt('session_reminder'), 'session_reminder_enabled'); $cb->setValue(1); $this->form_gui->addItem($cb); } // Options if ($this->isSettingChangeable('send_mail')) { $sec_op = new ilFormSectionHeaderGUI(); $sec_op->setTitle($this->lng->txt("options")); $this->form_gui->addItem($sec_op); } // send email $se = new ilCheckboxInputGUI($lng->txt('inform_user_mail'), 'send_mail'); $se->setInfo($lng->txt('inform_user_mail_info')); $se->setValue('y'); $se->setChecked($ilUser->getPref('send_info_mails') == 'y'); $this->form_gui->addItem($se); // ignore required fields $irf = new ilCheckboxInputGUI($lng->txt('ignore_required_fields'), 'ignore_rf'); $irf->setInfo($lng->txt('ignore_required_fields_info')); $irf->setValue(1); $this->form_gui->addItem($irf); // @todo: handle all required fields // command buttons if ($a_mode == "create" || $a_mode == "save") { $this->form_gui->addCommandButton("save", $lng->txt("save")); } if ($a_mode == "edit" || $a_mode == "update") { $this->form_gui->addCommandButton("update", $lng->txt("save")); } $this->form_gui->addCommandButton("cancel", $lng->txt("cancel")); }
/** * Init the form to set the type icons * * @param integer type id */ private function initFormIcons() { global $ilSetting, $lng, $ilCtrl; $type_id = $this->type->getTypeId(); $svg = ilExternalContentPlugin::_getIcon("xxco", "svg", 0, $type_id, "type"); include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($ilCtrl->getFormAction($this)); $form->setTitle($this->txt('icons')); $caption = $this->txt("svg_icon"); $item = new ilImageFileInputGUI($caption, "svg_icon"); $item->setSuffixes(array("svg")); $item->setImage($svg); $form->addItem($item); if (empty($svg)) { $caption = $lng->txt("big_icon") . " (" . ilExternalContentPlugin::BIG_ICON_SIZE . ")"; $item = new ilImageFileInputGUI($caption, "big_icon"); $item->setImage(ilExternalContentPlugin::_getIcon("xxco", "big", 0, $type_id, "type")); $form->addItem($item); $caption = $lng->txt("standard_icon") . " (" . ilExternalContentPlugin::SMALL_ICON_SIZE . ")"; $item = new ilImageFileInputGUI($caption, "small_icon"); $item->setImage(ilExternalContentPlugin::_getIcon("xxco", "small", 0, $type_id, "type")); $form->addItem($item); $caption = $lng->txt("tiny_icon") . " (" . ilExternalContentPlugin::TINY_ICON_SIZE . ")"; $item = new ilImageFileInputGUI($caption, "tiny_icon"); $item->setImage(ilExternalContentPlugin::_getIcon("xxco", "tiny", 0, $type_id, "type")); $form->addItem($item); } $form->addCommandButton('submitFormIcons', $lng->txt('save')); $this->form = $form; }
/** * show edit section of custom icons for container * */ function showCustomIconsEditing($a_input_colspan = 1, ilPropertyFormGUI $a_form = null, $a_as_section = true) { if ($this->ilias->getSetting("custom_icons")) { if (!$a_form) { /* $this->tpl->addBlockFile("CONTAINER_ICONS", "container_icon_settings", "tpl.container_icon_settings.html", "Services/Container"); if (($big_icon = $this->object->getBigIconPath()) != "") { $this->tpl->setCurrentBlock("big_icon"); $this->tpl->setVariable("SRC_BIG_ICON", $big_icon); $this->tpl->parseCurrentBlock(); } if ($this->object->getType() != "root") { if (($small_icon = $this->object->getSmallIconPath()) != "") { $this->tpl->setCurrentBlock("small_icon"); $this->tpl->setVariable("SRC_SMALL_ICON", $small_icon); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("small_icon_row"); $this->tpl->setVariable("SMALL_ICON", $this->lng->txt("standard_icon")); $this->tpl->setVariable("SMALL_SIZE", "(". $this->ilias->getSetting("custom_icon_small_width")."x". $this->ilias->getSetting("custom_icon_small_height").")"); $this->tpl->setVariable("TXT_REMOVE_S", $this->lng->txt("remove")); $this->tpl->parseCurrentBlock(); } if (($tiny_icon = $this->object->getTinyIconPath()) != "") { $this->tpl->setCurrentBlock("tiny_icon"); $this->tpl->setVariable("SRC_TINY_ICON", $tiny_icon); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("container_icon_settings"); $this->tpl->setVariable("SPAN_TITLE", $a_input_colspan + 1); $this->tpl->setVariable("SPAN_INPUT", $a_input_colspan); $this->tpl->setVariable("ICON_SETTINGS", $this->lng->txt("icon_settings")); $this->tpl->setVariable("BIG_ICON", $this->lng->txt("big_icon")); $this->tpl->setVariable("TINY_ICON", $this->lng->txt("tiny_icon")); $this->tpl->setVariable("BIG_SIZE", "(". $this->ilias->getSetting("custom_icon_big_width")."x". $this->ilias->getSetting("custom_icon_big_height").")"); $this->tpl->setVariable("TINY_SIZE", "(". $this->ilias->getSetting("custom_icon_tiny_width")."x". $this->ilias->getSetting("custom_icon_tiny_height").")"); $this->tpl->setVariable("TXT_REMOVE", $this->lng->txt("remove")); $this->tpl->parseCurrentBlock(); */ } else { //$big_icon = $this->object->getBigIconPath(); $custom_icon = $this->object->getCustomIconPath(); //$tiny_icon = $this->object->getTinyIconPath(); if ($a_as_section) { $title = new ilFormSectionHeaderGUI(); $title->setTitle($this->lng->txt("icon_settings")); } else { $title = new ilCustomInputGUI($this->lng->txt("icon_settings"), ""); } $a_form->addItem($title); // big /* $caption = $this->lng->txt("big_icon")." (". $this->ilias->getSetting("custom_icon_big_width")."x". $this->ilias->getSetting("custom_icon_big_height").")"; $icon = new ilImageFileInputGUI($caption, "cont_big_icon"); $icon->setImage($big_icon); if($a_as_section) { $a_form->addItem($icon); } else { $title->addSubItem($icon); }*/ // small/standard //if ($this->object->getType() != "root") //{ /*$caption = $this->lng->txt("standard_icon")." (". $this->ilias->getSetting("custom_icon_small_width")."x". $this->ilias->getSetting("custom_icon_small_height").")";*/ $caption = $this->lng->txt("cont_custom_icon"); $icon = new ilImageFileInputGUI($caption, "cont_icon"); $icon->setSuffixes(array("svg")); $icon->setImage($custom_icon); if ($a_as_section) { $a_form->addItem($icon); } else { $title->addSubItem($icon); } //} // tiny /* $caption = $this->lng->txt("tiny_icon")." (". $this->ilias->getSetting("custom_icon_tiny_width")."x". $this->ilias->getSetting("custom_icon_tiny_height").")"; $icon = new ilImageFileInputGUI($caption, "cont_tiny_icon"); $icon->setImage($tiny_icon); if($a_as_section) { $a_form->addItem($icon); } else { $title->addSubItem($icon); } */ } } }
/** * Init creation/base image form. * * @param int $a_mode Edit Mode */ public function initForm($a_mode = "edit") { global $lng, $ilCtrl; include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); // image file $fi = new ilImageFileInputGUI($lng->txt("cont_file"), "image_file"); $fi->setAllowDeletion(false); if ($a_mode == "edit") { $fi->setImage($this->content_obj->getBaseThumbnailTarget()); } $form->addItem($fi); if ($a_mode == "edit") { // caption $ti = new ilTextInputGUI($this->lng->txt("cont_caption"), "caption"); $ti->setMaxLength(200); $ti->setSize(50); $form->addItem($ti); } // save and cancel commands if ($a_mode == "create") { $form->setTitle($lng->txt("cont_ed_insert_iim")); $form->addCommandButton("create_iim", $lng->txt("save")); $form->addCommandButton("cancelCreate", $lng->txt("cancel")); } else { // get caption $std_alias_item = new ilMediaAliasItem($this->dom, $this->getHierId(), "Standard", $this->content_obj->getPcId(), "InteractiveImage"); $ti->setValue($std_alias_item->getCaption()); $form->setTitle($lng->txt("cont_edit_base_image")); $form->addCommandButton("update", $lng->txt("save")); } $form->setFormAction($ilCtrl->getFormAction($this)); return $form; }
public function updateDetails() { if (!$_GET['pobject_id']) { ilUtil::sendInfo($this->lng->txt('paya_no_object_selected')); $this->showObjects(); return true; } $this->__initPaymentObject((int) $_GET['pobject_id']); $this->ctrl->setParameter($this, 'pobject_id', (int) $_GET['pobject_id']); // read old settings $old_status = $this->pobject->getStatus(); // check status changed from not_buyable if ($old_status == $this->pobject->STATUS_NOT_BUYABLE and (int) $_POST['status'] != $old_status) { // check pay_method edited switch ((int) $_POST['pay_method']) { case $this->pobject->PAY_METHOD_NOT_SPECIFIED: ilUtil::sendInfo($this->lng->txt('paya_select_pay_method_first')); $this->editDetails(); return false; default: } // check minimum one price include_once './Services/Payment/classes/class.ilPaymentPrices.php'; $prices_obj = new ilPaymentPrices((int) $_GET['pobject_id']); if (!count($prices_obj->getPrices())) { ilUtil::sendInfo($this->lng->txt('paya_edit_prices_first')); $this->editDetails(); return false; } } if ((int) $_POST['status'] == 0) { // Status: not buyable -> delete depending shoppingcart entries include_once './Services/Payment/classes/class.ilPaymentShoppingCart.php'; ilPaymentShoppingCart::_deleteShoppingCartEntries($this->pobject->getPobjectId()); } $this->pobject->setStatus((int) $_POST['status']); $this->pobject->setVendorId((int) $_POST['vendor']); $this->pobject->setPayMethod((int) $_POST['pay_method']); $this->pobject->setTopicId((int) $_POST['topic_id']); $this->pobject->setVatId((int) $_POST['vat_id']); $this->pobject->setSubtype((string) $_POST['exc_subtype']); $this->pobject->setSpecial((int) $_POST['is_special']); if ((int) $_POST['thumbnail_delete']) { $oFile = new ilFileDataShop($this->pobject->getPobjectId()); $oFile->deassignFileFromPaymentObject(); } else { if ($_FILES['thumbnail']['tmp_name'] != '') { $this->lng->loadLanguageModule('form'); include_once 'Services/Form/classes/class.ilPropertyFormGUI.php'; $oThumbnail = new ilImageFileInputGUI($this->lng->txt('pay_thumbnail'), 'thumbnail'); if ($oThumbnail->checkInput()) { $oFile = new ilFileDataShop($this->pobject->getPobjectId()); if ($oFile->storeUploadedFile($_FILES['thumbnail']) !== false) { $oFile->assignFileToPaymentObject(); } } else { ilUtil::sendInfo($oThumbnail->getAlert()); return $this->editDetails(); } } } $this->pobject->update(); ilUtil::sendInfo($this->lng->txt('paya_details_updated')); $this->showObjects(); return true; }
public function setValue($a_value) { parent::setValue($a_value); }
protected function initQuestionForm($a_read_only = false) { global $lng, $ilCtrl; include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($ilCtrl->getFormAction($this, "saveQuestion")); $form->setTitle($lng->txt("obj_poll")); $question = new ilTextAreaInputGUI($lng->txt("poll_question"), "question"); $question->setRequired(true); $question->setCols(40); $question->setRows(2); $question->setValue($this->object->getQuestion()); $question->setDisabled($a_read_only); $form->addItem($question); $dimensions = " (" . ilObjPoll::getImageSize() . "px)"; $img = new ilImageFileInputGUI($lng->txt("poll_image") . $dimensions, "image"); $img->setDisabled($a_read_only); $form->addItem($img); // show existing file $file = $this->object->getImageFullPath(true); if ($file) { $img->setImage($file); } $anonymous = new ilRadioGroupInputGUI($lng->txt("poll_mode"), "mode"); $anonymous->setRequired(true); $option = new ilRadioOption($lng->txt("poll_mode_anonymous"), 0); $option->setInfo($lng->txt("poll_mode_anonymous_info")); $anonymous->addOption($option); $option = new ilRadioOption($lng->txt("poll_mode_personal"), 1); $option->setInfo($lng->txt("poll_mode_personal_info")); $anonymous->addOption($option); $anonymous->setValue($this->object->getNonAnonymous()); $anonymous->setDisabled($a_read_only); $form->addItem($anonymous); $nanswers = new ilNumberInputGUI($lng->txt("poll_max_number_of_answers"), "nanswers"); $nanswers->setRequired(true); $nanswers->setMinValue(1); $nanswers->setSize(3); $nanswers->setValue($this->object->getMaxNumberOfAnswers()); $nanswers->setDisabled($a_read_only); $form->addItem($nanswers); $answers = new ilTextInputGUI($lng->txt("poll_answers"), "answers"); $answers->setRequired(true); $answers->setMulti(true, true); $answers->setDisabled($a_read_only); $form->addItem($answers); $multi_answers = array(); foreach ($this->object->getAnswers() as $idx => $item) { if (!$idx) { $answers->setValue($item["answer"]); } $multi_answers[] = $item["answer"]; } $answers->setMultiValues($multi_answers); if (!$a_read_only) { $form->addCommandButton("saveQuestion", $lng->txt("save")); } return $form; }
/** * Initializes SmiliesEditForm and returns it. * * @global ilCtrl2 $ilCtrl * @global ilLanguage $lng * @return ilPropertyFormGUI */ public function initSmiliesEditForm($form_data) { global $ilCtrl, $lng; include_once './Services/Form/classes/class.ilPropertyFormGUI.php'; $this->form_gui = new ilPropertyFormGUI(); $this->form_gui->setValuesByArray($form_data); $table_nav = $_REQUEST["_table_nav"] ? "&_table_nav=" . $_REQUEST["_table_nav"] : ""; $ilCtrl->saveParameter($this->gui, 'smiley_id'); $this->form_gui->setFormAction($ilCtrl->getFormAction($this->gui, 'smiley-updateSmiliesObject') . $table_nav); $sec_l = new ilFormSectionHeaderGUI(); $sec_l->setTitle($lng->txt('chatroom_edit_smiley')); $this->form_gui->addItem($sec_l); include_once "Modules/Chatroom/classes/class.ilChatroomSmiliesCurrentSmileyFormElement.php"; $inp = new ilChatroomSmiliesCurrentSmileyFormElement($lng->txt('chatroom_current_smiley_image_path'), 'chatroom_current_smiley_image_path'); $inp->setValue($form_data['chatroom_current_smiley_image_path']); $this->form_gui->addItem($inp); $inp = new ilImageFileInputGUI($lng->txt('chatroom_image_path'), 'chatroom_image_path'); $inp->setRequired(false); $inp->setInfo($lng->txt('chatroom_smiley_image_only_if_changed')); $this->form_gui->addItem($inp); $inp = new ilTextAreaInputGUI($lng->txt('chatroom_smiley_keywords'), 'chatroom_smiley_keywords'); $inp->setValue($form_data['chatroom_smiley_keywords']); $inp->setUseRte(false); $inp->setRequired(true); $inp->setInfo($lng->txt('chatroom_smiley_keywords_one_per_line_note')); $this->form_gui->addItem($inp); $inp = new ilHiddenInputGUI('chatroom_smiley_id'); $this->form_gui->addItem($inp); $this->form_gui->addCommandButton('smiley-updateSmiliesObject', $lng->txt('submit')); $this->form_gui->addCommandButton('smiley', $lng->txt('cancel')); return $this->form_gui; }
public function editDetailsObject($a_show_confirm = false) { global $ilToolbar; if (!(int) $_GET['pobject_id']) { ilUtil::sendInfo($this->lng->txt('paya_no_object_selected')); return $this->objectsObject(); } $this->__initPaymentObject((int) $_GET['pobject_id']); $this->ctrl->setParameter($this, 'pobject_id', (int) $_GET['pobject_id']); $ilToolbar->addButton($this->lng->txt('paya_edit_details'), $this->ctrl->getLinkTarget($this, 'editDetails')); $ilToolbar->addButton($this->lng->txt('paya_edit_prices'), $this->ctrl->getLinkTarget($this, 'editPrices')); $ilToolbar->addButton($this->lng->txt('pay_edit_abstract'), $this->ctrl->getLinkTargetByClass(array('ilshoppagegui'), 'edit')); $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.main_view.html', 'Services/Payment'); $tmp_obj = ilObjectFactory::getInstanceByRefId($this->pobject->getRefId(), false); if ($tmp_obj) { $tmp_object['title'] = $tmp_obj->getTitle(); $tmp_object['type'] = $tmp_obj->getType(); } else { $tmp_object['title'] = $this->lng->txt('object_not_found'); $tmp_object['type'] = ''; } if ($a_show_confirm) { include_once './Services/Utilities/classes/class.ilConfirmationGUI.php'; $oConfirmationGUI = new ilConfirmationGUI(); // set confirm/cancel commands $oConfirmationGUI->setFormAction($this->ctrl->getFormAction($this, "performObjectDelete")); $oConfirmationGUI->setHeaderText($this->lng->txt("paya_sure_delete_object")); $oConfirmationGUI->setCancel($this->lng->txt("cancel"), "objects"); $oConfirmationGUI->setConfirm($this->lng->txt("confirm"), "performObjectDelete"); $oConfirmationGUI->addItem('', $tmp_object['title'], $tmp_object['title']); $this->tpl->setVariable('CONFIRMATION', $oConfirmationGUI->getHTML()); return true; } $oForm = new ilPropertyFormGUI(); $oForm->setFormAction($this->ctrl->getFormAction($this, 'updateDetails')); $oForm->setTitle($tmp_object['title']); // repository path $oPathGUI = new ilNonEditableValueGUI($this->lng->txt('path')); $oPathGUI->setValue($this->__getHTMLPath($this->pobject->getRefId())); $oForm->addItem($oPathGUI); // number of purchasers $oPurchasersGUI = new ilNonEditableValueGUI($this->lng->txt('paya_count_purchaser')); $oPurchasersGUI->setValue(ilPaymentBookings::_getCountBookingsByObject((int) $_GET['pobject_id'])); $oForm->addItem($oPurchasersGUI); // vendors $oVendorsGUI = new ilSelectInputGUI($this->lng->txt('paya_vendor'), 'vendor'); $oVendorsGUI->setOptions($this->__getVendors()); $oVendorsGUI->setValue($this->pobject->getVendorId()); $oForm->addItem($oVendorsGUI); // status $oStatusGUI = new ilSelectInputGUI($this->lng->txt('status'), 'status'); $oStatusGUI->setOptions($this->__getStatus()); $oStatusGUI->setValue($this->pobject->getStatus()); $oForm->addItem($oStatusGUI); // pay methods $oPayMethodsGUI = new ilSelectInputGUI($this->lng->txt('paya_pay_method'), 'pay_method'); $oPayMethodsGUI->setOptions(ilPayMethods::getPayMethodsOptions('not_specified')); $oPayMethodsGUI->setValue($this->pobject->getPayMethod()); $oForm->addItem($oPayMethodsGUI); // topics include_once './Services/Payment/classes/class.ilShopTopics.php'; ilShopTopics::_getInstance()->read(); if (is_array($topics = ilShopTopics::_getInstance()->getTopics()) && count($topics)) { $oTopicsGUI = new ilSelectInputGUI($this->lng->txt('topic'), 'topic_id'); ilShopTopics::_getInstance()->read(); $topic_options = array(); $topic_options[''] = $this->lng->txt('please_choose'); foreach ($topics as $oTopic) { $topic_options[$oTopic->getId()] = $oTopic->getTitle(); } $oTopicsGUI->setOptions($topic_options); $oTopicsGUI->setValue($this->pobject->getTopicId()); $oForm->addItem($oTopicsGUI); } // vats $oShopVatsList = new ilShopVatsList(); $oShopVatsList->read(); if ($oShopVatsList->hasItems()) { $oVatsGUI = new ilSelectInputGUI($this->lng->txt('vat_rate'), 'vat_id'); $vats_options = array(); foreach ($oShopVatsList as $oVAT) { $vats_options[$oVAT->getId()] = ilShopUtils::_formatVAT($oVAT->getRate()) . ' -> ' . $oVAT->getTitle(); } $oVatsGUI->setOptions($vats_options); $oVatsGUI->setValue($this->pobject->getVatId()); $oForm->addItem($oVatsGUI); } else { $oVatsGUI = new ilNonEditableValueGUI($this->lng->txt('vat_rate')); $oVatsGUI->setValue($this->lng->txt('paya_no_vats_assigned')); $oForm->addItem($oVatsGUI); } $oThumbnail = new ilImageFileInputGUI($this->lng->txt('pay_thumbnail'), 'thumbnail'); $oFile = new ilFileDataShop($this->pobject->getPobjectId()); if (($webpath_file = $oFile->getCurrentImageWebPath()) !== false) { $oThumbnail->setImage($webpath_file); } $oForm->addItem($oThumbnail); // buttons $oForm->addCommandButton('updateDetails', $this->lng->txt('save')); $oForm->addCommandButton('deleteObject', $this->lng->txt('delete')); $this->tpl->setVariable('FORM', $oForm->getHTML()); return true; }
/** * Init form */ protected function initForm() { $title = $this->signature->getId() ? $this->pl->txt('edit_signature') : $this->pl->txt('add_new_signature'); $this->setTitle($title); $this->setFormAction($this->ctrl->getFormAction($this->parent_gui)); $item = new ilTextInputGUI($this->pl->txt('first_name'), 'first_name'); $item->setValue($this->signature->getFirstName()); $item->setRequired(true); $this->addItem($item); $item = new ilTextInputGUI($this->pl->txt('last_name'), 'last_name'); $item->setValue($this->signature->getLastName()); $item->setRequired(true); $this->addItem($item); // If the signature is a rasterized image, we display it base64 encoded $is_vector = in_array(strtolower($this->signature->getSuffix()), array('svg')); if ($is_vector) { $item = new ilFileInputGUI($this->pl->txt('signature_file'), 'signature_file'); } else { $item = new ilImageFileInputGUI($this->pl->txt('signature_file'), 'signature_file'); } $item->setSuffixes(array('jpeg', 'jpg', 'gif', 'bmp', 'png', 'svg')); $signature_file = $this->signature->getFilePath(true); if (is_file($signature_file) && !$is_vector) { $item->setValue($signature_file); $base64 = base64_encode(file_get_contents($signature_file)); $suffix = $this->signature->getSuffix(); $item->setImage("data:image/{$suffix};base64,{$base64}"); } $item->setFilename($signature_file); $item->setInfo($this->pl->txt('signature_file_info')); $item->setRequired(!is_file($signature_file)); $item->setValue($this->signature->getFilePath(true)); $this->addItem($item); $command = $this->signature->getId() ? 'updateSignature' : 'createSignature'; $this->addCommandButton($command, $this->lng->txt('save')); }