本文整理汇总了PHP中ilFileInputGUI类的典型用法代码示例。如果您正苦于以下问题:PHP ilFileInputGUI类的具体用法?PHP ilFileInputGUI怎么用?PHP ilFileInputGUI使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ilFileInputGUI类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: editSettings
/**
* Edit news settings.
*/
public function editSettings()
{
global $ilCtrl, $lng, $ilSetting, $ilTabs, $ilToolbar;
$ilTabs->activateTab("settings");
if (OH_REF_ID > 0) {
ilUtil::sendInfo("This installation is used for online help authoring. Help modules cannot be imported.");
return;
}
if ($this->checkPermissionBool("write")) {
// help file
include_once "./Services/Form/classes/class.ilFileInputGUI.php";
$fi = new ilFileInputGUI($lng->txt("help_help_file"), "help_file");
$fi->setSuffixes(array("zip"));
$ilToolbar->addInputItem($fi, true);
$ilToolbar->addFormButton($lng->txt("upload"), "uploadHelpFile");
$ilToolbar->addSeparator();
// help mode
include_once "./Services/Form/classes/class.ilSelectInputGUI.php";
$options = array("" => $lng->txt("help_tooltips_and_help"), "1" => $lng->txt("help_help_only"), "2" => $lng->txt("help_tooltips_only"));
$si = new ilSelectInputGUI($this->lng->txt("help_mode"), "help_mode");
$si->setOptions($options);
$si->setValue($ilSetting->get("help_mode"));
$ilToolbar->addInputItem($si);
$ilToolbar->addFormButton($lng->txt("help_set_mode"), "setMode");
}
$ilToolbar->setFormAction($ilCtrl->getFormAction($this), true);
include_once "./Services/Help/classes/class.ilHelpModuleTableGUI.php";
$tab = new ilHelpModuleTableGUI($this, "editSettings");
$this->tpl->setContent($tab->getHTML());
}
示例2: initForm
protected function initForm($submit_action)
{
$form = new ilPropertyFormGUI();
$input = new ilFileInputGUI($this->lng->txt("import_xml_file"), "import_file");
$input->setRequired(true);
$form->addItem($input);
$form->setFormAction($this->ctrl->getFormAction($this));
$form->addCommandButton($submit_action, $this->lng->txt("import"));
return $form;
}
示例3: _initForm
/**
* Init Social Bookmark edit/create Form
*
* @param ilObjectGUI $formhandlerObject taken as form target
* @param int $mode "create" / "edit"
*/
public static function _initForm($formhandlerObject, $mode = "create", $id = 0)
{
global $lng, $ilCtrl;
include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
$form = new ilPropertyFormGUI();
$form->setMultipart(true);
// File Title
$in_title = new ilTextInputGUI($lng->txt("title"), "title");
$in_title->setMaxLength(128);
$in_title->setSize(40);
$in_title->setRequired(true);
$form->addItem($in_title);
// Link
$in_link = new ilTextInputGUI($lng->txt("link"), "link");
$in_link->setMaxLength(300);
$in_link->setSize(40);
$in_link->setRequired(true);
$in_link->setInfo($lng->txt('socialbm_link_description'));
$form->addItem($in_link);
// File
$in_file = new ilFileInputGUI($lng->txt("file"), "image_file");
$in_file->setSuffixes(array('bmp', 'gif', 'jpg', 'jpeg', 'png'));
$form->addItem($in_file);
// Activate on submit
$in_activate = new ilCheckboxInputGUI($lng->txt("activate"), "activate");
$in_activate->setValue('1');
$form->addItem($in_activate);
// save and cancel commands
if ($mode == "create") {
$form->addCommandButton("createSocialBookmark", $lng->txt("create"));
$form->addCommandButton("editSocialBookmarks", $lng->txt("cancel"));
$form->setTitle($lng->txt("adm_social_bm_create"));
$in_file->setRequired(true);
} else {
if ($mode == "update") {
$in_hidden = new ilHiddenInputGUI("sbm_id", $id);
$form->addItem($in_hidden);
$form->addCommandButton("updateSocialBookmark", $lng->txt("update"));
$form->addCommandButton("cancel", $lng->txt("cancel"));
$form->setTitle($lng->txt("adm_social_bm_edit"));
$in_file->setRequired(false);
}
}
$form->setTableWidth("60%");
$form->setFormAction($ilCtrl->getFormAction($formhandlerObject));
return $form;
}
示例4: initNewAccountMailForm
protected function initNewAccountMailForm()
{
global $lng, $ilCtrl;
$lng->loadLanguageModule("meta");
$lng->loadLanguageModule("mail");
include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
$form = new ilPropertyFormGUI();
$form->setFormAction($ilCtrl->getFormAction($this));
$form->setTitleIcon(ilUtil::getImagePath("icon_mail.png"));
$form->setTitle($lng->txt("user_new_account_mail"));
$form->setDescription($lng->txt("user_new_account_mail_desc"));
$langs = $lng->getInstalledLanguages();
foreach ($langs as $lang_key) {
$amail = $this->object->_lookupNewAccountMail($lang_key);
$title = $lng->txt("meta_l_" . $lang_key);
if ($lang_key == $lng->getDefaultLanguage()) {
$title .= " (" . $lng->txt("default") . ")";
}
$header = new ilFormSectionHeaderGUI();
$header->setTitle($title);
$form->addItem($header);
$subj = new ilTextInputGUI($lng->txt("subject"), "subject_" . $lang_key);
// $subj->setRequired(true);
$subj->setValue($amail["subject"]);
$form->addItem($subj);
$salg = new ilTextInputGUI($lng->txt("mail_salutation_general"), "sal_g_" . $lang_key);
// $salg->setRequired(true);
$salg->setValue($amail["sal_g"]);
$form->addItem($salg);
$salf = new ilTextInputGUI($lng->txt("mail_salutation_female"), "sal_f_" . $lang_key);
// $salf->setRequired(true);
$salf->setValue($amail["sal_f"]);
$form->addItem($salf);
$salm = new ilTextInputGUI($lng->txt("mail_salutation_male"), "sal_m_" . $lang_key);
// $salm->setRequired(true);
$salm->setValue($amail["sal_m"]);
$form->addItem($salm);
$body = new ilTextAreaInputGUI($lng->txt("message_content"), "body_" . $lang_key);
// $body->setRequired(true);
$body->setValue($amail["body"]);
$body->setRows(10);
$body->setCols(100);
$form->addItem($body);
$att = new ilFileInputGUI($lng->txt("attachment"), "att_" . $lang_key);
$att->setAllowDeletion(true);
if ($amail["att_file"]) {
$att->setValue($amail["att_file"]);
}
$form->addItem($att);
}
$form->addCommandButton("saveNewAccountMail", $lng->txt("save"));
$form->addCommandButton("cancelNewAccountMail", $lng->txt("cancel"));
return $form;
}
示例5: initImportForm
/**
* Init import form.
*/
public function initImportForm()
{
global $lng, $ilCtrl;
include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
$form = new ilPropertyFormGUI();
$new_type = $_POST["new_type"] ? $_POST["new_type"] : $_GET["new_type"];
$this->ctrl->setParameter($this, "new_type", $new_type);
$form->setTarget(ilFrameTargetInfo::_getFrame("MainContent"));
$form->setTableWidth("600px");
// import file
$fi = new ilFileInputGUI($this->lng->txt("file"), "xmldoc");
$fi->setSuffixes(array("zip"));
$fi->setRequired(true);
$fi->setSize(30);
$form->addItem($fi);
// validation
$cb = new ilCheckboxInputGUI($this->lng->txt("cont_validate_file"), "validate");
$cb->setInfo($this->lng->txt(""));
$form->addItem($cb);
$form->addCommandButton("importFile", $lng->txt("import"));
$form->addCommandButton("cancel", $lng->txt("cancel"));
$form->setTitle($this->lng->txt("import_" . $new_type));
$form->setFormAction($ilCtrl->getFormAction($this));
return $form;
}
示例6: initImportForm
function initImportForm($a_new_type)
{
include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
$form = new ilPropertyFormGUI();
$form->setTarget("_top");
$new_type = $_POST["new_type"] ? $_POST["new_type"] : $_GET["new_type"];
$this->ctrl->setParameter($this, "new_type", $new_type);
$form->setFormAction($this->ctrl->getFormAction($this));
$form->setTitle($this->lng->txt("import_tst"));
// file
include_once "./Services/Form/classes/class.ilFileInputGUI.php";
$fi = new ilFileInputGUI($this->lng->txt("import_file"), "xmldoc");
$fi->setSuffixes(array("zip"));
$fi->setRequired(true);
$form->addItem($fi);
// question pool
include_once "./Modules/Test/classes/class.ilObjTest.php";
$tst = new ilObjTest();
$questionpools = $tst->getAvailableQuestionpools(TRUE, FALSE, TRUE, TRUE);
if (count($questionpools)) {
$options = array("-1" => $this->lng->txt("dont_use_questionpool"));
foreach ($questionpools as $key => $value) {
$options[$key] = $value["title"];
}
$pool = new ilSelectInputGUI($this->lng->txt("select_questionpool"), "qpl");
$pool->setOptions($options);
$form->addItem($pool);
}
$form->addCommandButton("importFile", $this->lng->txt("import"));
$form->addCommandButton("cancel", $this->lng->txt("cancel"));
return $form;
}
示例7: listFiles
/**
* list files
*/
function listFiles()
{
global $ilToolbar, $lng, $ilCtrl;
// determine directory
// FIXME: I have to call stripSlashes here twice, because I could not
// determine where the second layer of slashes is added to the
// URL Parameter
$cur_subdir = ilUtil::stripSlashes(ilUtil::stripSlashes($_GET["cdir"]));
$new_subdir = ilUtil::stripSlashes(ilUtil::stripSlashes($_GET["newdir"]));
if ($new_subdir == "..") {
$cur_subdir = substr($cur_subdir, 0, strrpos($cur_subdir, "/"));
} else {
if (!empty($new_subdir)) {
if (!empty($cur_subdir)) {
$cur_subdir = $cur_subdir . "/" . $new_subdir;
} else {
$cur_subdir = $new_subdir;
}
}
}
$cur_subdir = str_replace("..", "", $cur_subdir);
$cur_dir = !empty($cur_subdir) ? $this->main_dir . "/" . $cur_subdir : $this->main_dir;
$this->ctrl->setParameter($this, "cdir", $cur_subdir);
// toolbar for adding files/directories
$ilToolbar->setFormAction($ilCtrl->getFormAction($this), true);
include_once "./Services/Form/classes/class.ilTextInputGUI.php";
if ($this->getAllowDirectories() && $this->getAllowDirectoryCreation()) {
$ti = new ilTextInputGUI($this->lng->txt("cont_new_dir"), "new_dir");
$ti->setMaxLength(80);
$ti->setSize(10);
$ilToolbar->addInputItem($ti, true);
$ilToolbar->addFormButton($lng->txt("create"), "createDirectory");
$ilToolbar->addSeparator();
}
include_once "./Services/Form/classes/class.ilFileInputGUI.php";
if ($this->getAllowFileCreation()) {
$fi = new ilFileInputGUI($this->lng->txt("cont_new_file"), "new_file");
$fi->setSize(10);
$ilToolbar->addInputItem($fi, true);
$ilToolbar->addFormButton($lng->txt("upload"), "uploadFile");
}
include_once 'Services/FileSystem/classes/class.ilUploadFiles.php';
if (ilUploadFiles::_getUploadDirectory()) {
$ilToolbar->addSeparator();
$files = ilUploadFiles::_getUploadFiles();
$options[""] = $lng->txt("cont_select_from_upload_dir");
foreach ($files as $file) {
$file = htmlspecialchars($file, ENT_QUOTES, "utf-8");
$options[$file] = $file;
}
include_once "./Services/Form/classes/class.ilSelectInputGUI.php";
$si = new ilSelectInputGUI($this->lng->txt("cont_uploaded_file"), "uploaded_file");
$si->setOptions($options);
$ilToolbar->addInputItem($si, true);
$ilToolbar->addFormButton($lng->txt("copy"), "uploadFile");
}
// load files templates
include_once "./Services/FileSystem/classes/class.ilFileSystemTableGUI.php";
$fs_table = new ilFileSystemTableGUI($this, "listFiles", $cur_dir, $cur_subdir, $this->label_enable, $this->file_labels, $this->label_header, $this->commands, $this->getPostDirPath());
$fs_table->setId($this->getTableId());
if ($this->getTitle() != "") {
$fs_table->setTitle($this->getTitle());
}
if ($_GET["resetoffset"] == 1) {
$fs_table->resetOffset();
}
$this->tpl->setContent($fs_table->getHTML());
}
示例8: initAddCastItemForm
/**
* 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"));
}
示例9: initUploadForm
/**
* Init upload form.
*/
public function initUploadForm()
{
global $lng, $ilCtrl;
include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
$this->form = new ilPropertyFormGUI();
// type selection
$options = array("scorm2004" => $lng->txt("lm_type_scorm2004"), "scorm" => $lng->txt("lm_type_scorm"), "aicc" => $lng->txt("lm_type_aicc"), "hacp" => $lng->txt("lm_type_hacp"));
$si = new ilSelectInputGUI($this->lng->txt("type"), "sub_type");
$si->setOptions($options);
$this->form->addItem($si);
// input file
$fi = new ilFileInputGUI($this->lng->txt("select_file"), "scormfile");
$fi->setRequired(true);
$this->form->addItem($fi);
// todo "uploaded file"
// todo wysiwyg editor removement
include_once 'Services/FileSystem/classes/class.ilUploadFiles.php';
if (ilUploadFiles::_getUploadDirectory()) {
$options = array();
$fi->setRequired(false);
$files = ilUploadFiles::_getUploadFiles();
$options[""] = $this->lng->txt("cont_select_from_upload_dir");
foreach ($files as $file) {
$file = htmlspecialchars($file, ENT_QUOTES, "utf-8");
$options[$file] = $file;
}
//
$si = new ilSelectInputGUI($this->lng->txt("cont_uploaded_file"), "uploaded_file");
$si->setOptions($options);
$this->form->addItem($si);
}
// validate file
$cb = new ilCheckboxInputGUI($this->lng->txt("cont_validate_file"), "validate");
$cb->setValue("y");
//$cb->setChecked(true);
$this->form->addItem($cb);
// import for editing
$cb = new ilCheckboxInputGUI($this->lng->txt("sahs_authoring_mode"), "editable");
$cb->setValue("y");
$cb->setInfo($this->lng->txt("sahs_authoring_mode_info"));
$this->form->addItem($cb);
//
$radg = new ilRadioGroupInputGUI($lng->txt("sahs_sequencing"), "import_sequencing");
$radg->setValue(0);
$op1 = new ilRadioOption($lng->txt("sahs_std_sequencing"), 0, $lng->txt("sahs_std_sequencing_info"));
$radg->addOption($op1);
$op1 = new ilRadioOption($lng->txt("sahs_import_sequencing"), 1, $lng->txt("sahs_import_sequencing_info"));
$radg->addOption($op1);
$cb->addSubItem($radg);
$this->form->addCommandButton("upload", $lng->txt("import"));
$this->form->addCommandButton("cancel", $lng->txt("cancel"));
$this->form->setTitle($lng->txt("import_sahs"));
$this->form->setFormAction($ilCtrl->getFormAction($this, "upload"));
$this->form->setTarget(ilFrameTargetInfo::_getFrame("MainContent"));
}
示例10: populateQuestionSpecificFormPart
public function populateQuestionSpecificFormPart(\ilPropertyFormGUI $form)
{
// points
$points = new ilNumberInputGUI($this->lng->txt("points"), "points");
$points->setValue($this->object->getPoints());
$points->setRequired(TRUE);
$points->setSize(3);
$points->setMinValue(0.0);
$form->addItem($points);
$header = new ilFormSectionHeaderGUI();
$header->setTitle($this->lng->txt("applet_attributes"));
$form->addItem($header);
// java applet
$javaapplet = $this->object->getJavaAppletFilename();
$applet = new ilFileInputGUI($this->lng->txt('javaapplet'), 'javaappletName');
$applet->setSuffixes(array('jar', 'class'));
$applet->setRequired(false);
if (strlen($javaapplet)) {
$filename = new ilNonEditableValueGUI($this->lng->txt('filename'), 'uploaded_javaapplet');
$filename->setValue($javaapplet);
$applet->addSubItem($filename);
$delete = new ilCheckboxInputGUI('', 'delete_applet');
$delete->setOptionTitle($this->lng->txt('delete'));
$delete->setValue(1);
$applet->addSubItem($delete);
}
$form->addItem($applet);
// Code
$code = new ilTextInputGUI($this->lng->txt("code"), "java_code");
$code->setValue($this->object->getJavaCode());
$code->setRequired(TRUE);
$form->addItem($code);
if (!strlen($javaapplet)) {
// Archive
$archive = new ilTextInputGUI($this->lng->txt("archive"), "java_archive");
$archive->setValue($this->object->getJavaArchive());
$archive->setRequired(false);
$form->addItem($archive);
// Codebase
$codebase = new ilTextInputGUI($this->lng->txt("codebase"), "java_codebase");
$codebase->setValue($this->object->getJavaCodebase());
$codebase->setRequired(false);
$form->addItem($codebase);
}
// Width
$width = new ilNumberInputGUI($this->lng->txt("width"), "java_width");
$width->setDecimals(0);
$width->setSize(6);
$width->setMinValue(50);
$width->setMaxLength(6);
$width->setValue($this->object->getJavaWidth());
$width->setRequired(TRUE);
$form->addItem($width);
// Height
$height = new ilNumberInputGUI($this->lng->txt("height"), "java_height");
$height->setDecimals(0);
$height->setSize(6);
$height->setMinValue(50);
$height->setMaxLength(6);
$height->setValue($this->object->getJavaHeight());
$height->setRequired(TRUE);
$form->addItem($height);
$header = new ilFormSectionHeaderGUI();
$header->setTitle($this->lng->txt("applet_parameters"));
$form->addItem($header);
include_once "./Modules/TestQuestionPool/classes/class.ilKVPWizardInputGUI.php";
$kvp = new ilKVPWizardInputGUI($this->lng->txt("applet_parameters"), "kvp");
$values = array();
for ($i = 0; $i < $this->object->getParameterCount(); $i++) {
$param = $this->object->getParameter($i);
array_push($values, array($param['name'], $param['value']));
}
if (count($values) == 0) {
array_push($values, array("", ""));
}
$kvp->setKeyName($this->lng->txt('name'));
$kvp->setValueName($this->lng->txt('value'));
$kvp->setValues($values);
$form->addItem($kvp);
}
示例11: initZipUploadForm
/**
* Init upload form form.
*/
public function initZipUploadForm()
{
global $lng, $ilCtrl;
include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
$this->form = new ilPropertyFormGUI();
// desc
include_once "./Services/Form/classes/class.ilFileInputGUI.php";
$fi = new ilFileInputGUI($lng->txt("file"), "deliver");
$fi->setSuffixes(array("zip"));
$this->form->addItem($fi);
$this->form->addCommandButton("deliverUnzip", $lng->txt("upload"));
$this->form->setTitle($lng->txt("header_zip"));
$this->form->setFormAction($ilCtrl->getFormAction($this));
}
示例12: certificateEditor
/**
* 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");
//.........这里部分代码省略.........
示例13: createObject
/**
* create
*/
function createObject()
{
global $rbacsystem, $lng, $tpl, $ilHelp;
$forms = array();
$ilHelp->setScreenIdComponent("sty");
$ilHelp->setDefaultScreenId(ilHelpGUI::ID_PART_SCREEN, "create");
// --- create
include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
$form = new ilPropertyFormGUI();
$form->setFormAction($this->ctrl->getFormAction($this));
$form->setTitle($this->lng->txt("sty_create_new_stylesheet"));
// title
$ti = new ilTextInputGUI($this->lng->txt("title"), "style_title");
$ti->setMaxLength(128);
$ti->setSize(40);
$ti->setRequired(true);
$form->addItem($ti);
// description
$ta = new ilTextAreaInputGUI($this->lng->txt("description"), "style_description");
$ta->setCols(40);
$ta->setRows(2);
$form->addItem($ta);
$form->addCommandButton("save", $this->lng->txt("save"));
$form->addCommandButton("cancel", $this->lng->txt("cancel"));
$forms[] = $form;
// --- import
include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
$form = new ilPropertyFormGUI();
$form->setFormAction($this->ctrl->getFormAction($this));
$form->setTitle($this->lng->txt("sty_import_stylesheet"));
// title
$ti = new ilFileInputGUI($this->lng->txt("import_file"), "stylefile");
$ti->setRequired(true);
$form->addItem($ti);
$form->addCommandButton("importStyle", $this->lng->txt("import"));
$form->addCommandButton("cancel", $this->lng->txt("cancel"));
$forms[] = $form;
// --- clone
include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
$form = new ilPropertyFormGUI();
$form->setFormAction($this->ctrl->getFormAction($this));
$form->setTitle($this->lng->txt("sty_copy_other_stylesheet"));
// source
$ti = new ilSelectInputGUI($this->lng->txt("sty_source"), "source_style");
$ti->setRequired(true);
$ti->setOptions(ilObjStyleSheet::_getClonableContentStyles());
$form->addItem($ti);
$form->addCommandButton("copyStyle", $this->lng->txt("copy"));
$form->addCommandButton("cancel", $this->lng->txt("cancel"));
$forms[] = $form;
$this->tpl->setContent($this->getCreationFormsHTML($forms));
}
示例14: initEditForm
/**
* Init edit form
*
* @param int $a_mode Edit Mode
*/
public function initEditForm($a_mode = "edit")
{
global $lng, $ilCtrl, $ilUser;
include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
$form = new ilPropertyFormGUI();
if ($a_mode != "add_file") {
// title
$ti = new ilTextInputGUI($lng->txt("title"), "flst_title");
$ti->setMaxLength(80);
$ti->setSize(40);
$form->addItem($ti);
// language
require_once "Services/MetaData/classes/class.ilMDLanguageItem.php";
$lang = ilMDLanguageItem::_getLanguages();
$si = new ilSelectInputGUI($lng->txt("language"), "flst_language");
$si->setOptions($lang);
$form->addItem($si);
}
if (in_array($a_mode, array("create", "add_file"))) {
// file
$fi = new ilFileInputGUI($lng->txt("file"), "file");
$fi->setRequired(true);
$form->addItem($fi);
} else {
if (in_array($a_mode, array("select_file"))) {
// file
$ne = new ilNonEditableValueGUI($lng->txt("file"), "");
if (isset($_GET["file_ref_id"])) {
include_once "./Modules/File/classes/class.ilObjFile.php";
$file_obj = new ilObjFile((int) $_GET["file_ref_id"]);
if (is_object($file_obj)) {
// ref id as hidden input
$hi = new ilHiddenInputGUI("file_ref_id");
$hi->setValue((int) $_GET["file_ref_id"]);
$form->addItem($hi);
$ne->setValue($file_obj->getTitle());
}
} else {
if (isset($_GET["fl_wsp_id"])) {
// we need the object id for the instance
include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
$tree = new ilWorkspaceTree($ilUser->getId());
$node = $tree->getNodeData((int) $_GET["fl_wsp_id"]);
include_once "./Modules/File/classes/class.ilObjFile.php";
$file_obj = new ilObjFile($node["obj_id"], false);
if (is_object($file_obj)) {
// ref id as hidden input
$hi = new ilHiddenInputGUI("file_ref_id");
$hi->setValue("wsp_" . (int) $node["obj_id"]);
$form->addItem($hi);
$ne->setValue($file_obj->getTitle());
}
$this->tpl->parseCurrentBlock();
}
}
$form->addItem($ne);
}
}
switch ($a_mode) {
case "edit":
$ti->setValue($this->content_obj->getListTitle());
$si->setValue($this->content_obj->getLanguage());
$form->addCommandButton("saveProperties", $lng->txt("save"));
$form->addCommandButton("cancelUpdate", $lng->txt("cancel"));
$form->setTitle($lng->txt("cont_edit_file_list_properties"));
break;
case "create":
case "select_file":
if ($_SESSION["il_text_lang_" . $_GET["ref_id"]] != "") {
$s_lang = $_SESSION["il_text_lang_" . $_GET["ref_id"]];
} else {
$s_lang = $ilUser->getLanguage();
}
$si->setValue($s_lang);
$form->addCommandButton("create_flst", $lng->txt("save"));
$form->addCommandButton("cancelCreate", $lng->txt("cancel"));
$form->setTitle($lng->txt("cont_insert_file_list"));
break;
case "add_file":
$form->addCommandButton("insertNewFileItem", $lng->txt("save"));
$form->addCommandButton("editFiles", $lng->txt("cancel"));
$form->setTitle($lng->txt("cont_insert_file_item"));
break;
}
$form->setFormAction($ilCtrl->getFormAction($this));
return $form;
}
示例15: createFileInputFormItem
/**
* Creates an input field for the davinci text file upload
*
* @return \ilFileInputGUI file input form item
*/
protected function createFileInputFormItem()
{
$file = new ilFileInputGUI($this->lng->txt("rep_robj_xrs_daVinci_import_file"), "upload_file");
$file->setSize(50);
$file->setRequired(true);
$file->setALlowDeletion(true);
$file->setSuffixes(array('txt'));
return $file;
}