本文整理汇总了PHP中ilTextInputGUI::checkInput方法的典型用法代码示例。如果您正苦于以下问题:PHP ilTextInputGUI::checkInput方法的具体用法?PHP ilTextInputGUI::checkInput怎么用?PHP ilTextInputGUI::checkInput使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilTextInputGUI
的用法示例。
在下文中一共展示了ilTextInputGUI::checkInput方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkInput
/**
* @return bool
*/
public function checkInput()
{
global $lng;
$ok = parent::checkInput();
$query = ilUtil::stripSlashes($_POST[$this->getPostVar()]);
if (!$ok) {
return false;
}
include_once 'Services/Mail/classes/class.ilMailLuceneQueryParser.php';
try {
ilMailLuceneQueryParser::validateQuery($query);
return true;
} catch (Exception $e) {
$this->setAlert($lng->txt($e->getMessage()));
return false;
}
}
示例2: 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");
//.........这里部分代码省略.........
示例3: addAdditionalFormElements
/**
* Allows to add additional form fields to the certificate editor form
* This method will be called when the certificate editor form will built
* using the ilPropertyFormGUI class. Additional fields will be added at the
* bottom of the form.
*
* @param object $form An ilPropertyFormGUI instance
* @param array $form_fields An array containing the form values. The array keys are the names of the form fields
*/
public function addAdditionalFormElements(&$form, $form_fields)
{
global $lng;
$short_name = new ilTextInputGUI($lng->txt("certificate_short_name"), "short_name");
$short_name->setRequired(TRUE);
require_once "./Services/Utilities/classes/class.ilStr.php";
$short_name->setValue(strlen($form_fields["short_name"]) ? $form_fields["short_name"] : ilStr::subStr($this->object->getTitle(), 0, 30));
$short_name->setSize(30);
if (strlen($form_fields["short_name"])) {
$short_name->setInfo(str_replace("[SHORT_TITLE]", $form_fields["short_name"], $lng->txt("certificate_short_name_description")));
} else {
$short_name->setInfo($lng->txt("certificate_short_name_description"));
}
if (count($_POST)) {
$short_name->checkInput();
}
$form->addItem($short_name);
$visibility = new ilCheckboxInputGUI($lng->txt("certificate_enabled_scorm"), "certificate_enabled_scorm");
$visibility->setInfo($lng->txt("certificate_enabled_scorm_introduction"));
$visibility->setValue(1);
if ($form_fields["certificate_enabled_scorm"]) {
$visibility->setChecked(TRUE);
}
if (count($_POST)) {
$visibility->checkInput();
}
$form->addItem($visibility);
}