本文整理汇总了PHP中ilPropertyFormGUI::setId方法的典型用法代码示例。如果您正苦于以下问题:PHP ilPropertyFormGUI::setId方法的具体用法?PHP ilPropertyFormGUI::setId怎么用?PHP ilPropertyFormGUI::setId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilPropertyFormGUI
的用法示例。
在下文中一共展示了ilPropertyFormGUI::setId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: editQuestion
/**
* Creates an output of the edit form for the question
*
* @access public
*/
public function editQuestion($checkonly = FALSE)
{
$save = $this->isSaveCommand();
$this->getQuestionTemplate();
include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
$form = new ilPropertyFormGUI();
$form->setFormAction($this->ctrl->getFormAction($this));
$form->setTitle($this->outQuestionType());
$form->setMultipart(false);
$form->setTableWidth("100%");
$form->setId("assfileupload");
$this->addBasicQuestionFormProperties($form);
$this->populateQuestionSpecificFormPart($form);
$this->populateTaxonomyFormSection($form);
$this->addQuestionFormCommandButtons($form);
$errors = false;
if ($save) {
$form->setValuesByPost();
$errors = !$form->checkInput();
$form->setValuesByPost();
// again, because checkInput now performs the whole stripSlashes handling and
// we need this if we don't want to have duplication of backslashes
if ($errors) {
$checkonly = false;
}
}
if (!$checkonly) {
$this->tpl->setVariable("QUESTION_DATA", $form->getHTML());
}
return $errors;
}
示例2: initUploadForm
public function initUploadForm()
{
global $ilCtrl, $lng;
include_once "./Services/Form/classes/class.ilDragDropFileInputGUI.php";
include_once "./Services/jQuery/classes/class.iljQueryUtil.php";
$this->form = new ilPropertyFormGUI();
$this->form->setId("upload");
$this->form->setMultipart(true);
$this->form->setHideLabels();
$file = new ilDragDropFileInputGUI($lng->txt("cld_upload_flies"), "upload_files");
$file->setRequired(true);
$this->form->addItem($file);
$this->form->addCommandButton("uploadFiles", $lng->txt("upload"));
$this->form->addCommandButton("cancelAll", $lng->txt("cancel"));
$this->form->setTableWidth("100%");
$this->form->setTitle($lng->txt("upload_files_title"));
$this->form->setTitleIcon(ilUtil::getImagePath('icon_file.gif'), $lng->txt('obj_file'));
$this->form->setTitle($lng->txt("upload_files"));
$this->form->setFormAction($ilCtrl->getFormAction($this, "uploadFiles"));
$this->form->setTarget("cld_blank_target");
}
示例3: editQuestion
/**
* Creates an output of the edit form for the question
*
* @param bool $checkonly
*
* @return bool
*/
public function editQuestion($checkonly = FALSE)
{
$save = $this->isSaveCommand();
$this->getQuestionTemplate();
include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
$form = new ilPropertyFormGUI();
$form->setFormAction($this->ctrl->getFormAction($this));
$form->setTitle($this->outQuestionType());
$isSingleline = $this->object->lastChange == 0 && !array_key_exists('types', $_POST) ? $this->object->getMultilineAnswerSetting() ? false : true : $this->object->isSingleline;
if ($checkonly) {
$isSingleline = $_POST['types'] == 0 ? true : false;
}
if ($isSingleline) {
$form->setMultipart(TRUE);
} else {
$form->setMultipart(FALSE);
}
$form->setTableWidth("100%");
$form->setId("assmultiplechoice");
// title, author, description, question, working time (assessment mode)
$this->addBasicQuestionFormProperties($form);
$this->populateQuestionSpecificFormPart($form);
$this->populateAnswerSpecificFormPart($form);
$this->populateTaxonomyFormSection($form);
$this->addQuestionFormCommandButtons($form);
$errors = false;
if ($save) {
$form->setValuesByPost();
$errors = !$form->checkInput();
$form->setValuesByPost();
// again, because checkInput now performs the whole stripSlashes handling and we need this if we don't want to have duplication of backslashes
if ($errors) {
$checkonly = false;
}
}
if (!$checkonly) {
$this->tpl->setVariable("QUESTION_DATA", $form->getHTML());
}
return $errors;
}
示例4: editQuestion
/**
* Creates an output of the edit form for the question
*
* @access public
*/
public function editQuestion($checkonly = FALSE)
{
$save = $this->isSaveCommand();
$this->getQuestionTemplate();
include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
$form = new ilPropertyFormGUI();
$form->setFormAction($this->ctrl->getFormAction($this));
$form->setTitle($this->outQuestionType());
$form->setMultipart(FALSE);
$form->setTableWidth("100%");
$form->setId("assclozetest");
// title, author, description, question, working time (assessment mode)
$this->addBasicQuestionFormProperties($form);
// Modify "instructive" question textbox... get rid of this crap asap.
$q_item = $form->getItemByPostVar("question");
$q_item->setInfo($this->lng->txt("close_text_hint"));
$q_item->setTitle($this->lng->txt("cloze_text"));
$this->populateQuestionSpecificFormPart($form);
$this->populateAnswerSpecificFormPart($form);
$this->populateTaxonomyFormSection($form);
$this->addQuestionFormCommandButtons($form);
$errors = false;
if ($save) {
$form->setValuesByPost();
$errors = !$form->checkInput();
$form->setValuesByPost();
// again, because checkInput now performs the whole stripSlashes handling and we
// need this if we don't want to have duplication of backslashes
if ($errors) {
$checkonly = false;
}
}
if (!$checkonly) {
$this->tpl->setVariable("QUESTION_DATA", $form->getHTML());
}
return $errors;
}
示例5: initSearchForm
protected function initSearchForm()
{
global $ilCtrl;
if ($_GET["ref"] != "wsp") {
$this->saveMailData();
$title = $this->lng->txt('search_recipients');
} else {
$this->lng->loadLanguageModule("wsp");
$title = $this->lng->txt("wsp_share_search_users");
}
// searchform
include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
$form = new ilPropertyFormGUI();
$form->setTitle($title);
$form->setId('search_rcp');
$form->setFormAction($ilCtrl->getFormAction($this, 'search'));
$inp = new ilTextInputGUI($this->lng->txt("search_for"), 'search');
$inp->setSize(30);
$dsDataLink = $ilCtrl->getLinkTarget($this, 'lookupRecipientAsync', '', true, false);
$inp->setDataSource($dsDataLink);
if (strlen(trim($_SESSION["mail_search_search"])) > 0) {
$inp->setValue(ilUtil::prepareFormOutput(trim($_SESSION["mail_search_search"]), true));
}
$form->addItem($inp);
$form->addCommandButton('search', $this->lng->txt("search"));
$form->addCommandButton('cancel', $this->lng->txt("cancel"));
return $form;
}
示例6: buildBasicEditFormObject
/**
* @return ilPropertyFormGUI
*/
protected function buildBasicEditFormObject()
{
require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
$form = new ilPropertyFormGUI();
$form->setFormAction($this->ctrl->getFormAction($this));
$form->setId($this->getType());
$form->setTitle($this->outQuestionType());
$form->setTableWidth('100%');
$form->setMultipart(true);
return $form;
}
示例7: buildAdjustQuestionForm
/**
* @param $question_id
* @param $question_pool_id
*
* @return ilPropertyFormGUI
*/
protected function buildAdjustQuestionForm($question_id, $question_pool_id)
{
require_once './Services/Form/classes/class.ilPropertyFormGUI.php';
require_once './Modules/TestQuestionPool/classes/class.assQuestion.php';
$form = new ilPropertyFormGUI();
$form->setFormAction($this->ctrl->getFormAction($this));
$form->setMultipart(FALSE);
$form->setTableWidth("100%");
$form->setId("adjustment");
/** @var $question assQuestionGUI|ilGuiQuestionScoringAdjustable|ilGuiAnswerScoringAdjustable */
$question = assQuestion::instantiateQuestionGUI($question_id);
$form->setTitle($question->object->getTitle() . '<br /><small>(' . $question->outQuestionType() . ')</small>');
$hidden_question_id = new ilHiddenInputGUI('q_id');
$hidden_question_id->setValue($question_id);
$form->addItem($hidden_question_id);
$hidden_qpl_id = new ilHiddenInputGUI('qpl_id');
$hidden_qpl_id->setValue($question_pool_id);
$form->addItem($hidden_qpl_id);
$this->populateScoringAdjustments($question, $form);
$manscoring_section = new ilFormSectionHeaderGUI();
$manscoring_section->setTitle($this->lng->txt('manscoring'));
$form->addItem($manscoring_section);
$manscoring_preservation = new ilCheckboxInputGUI($this->lng->txt('preserve_manscoring'), 'preserve_manscoring');
$manscoring_preservation->setChecked(true);
$manscoring_preservation->setInfo($this->lng->txt('preserve_manscoring_info'));
$form->addItem($manscoring_preservation);
$form->addCommandButton("savescoringfortest", $this->lng->txt("save"));
$participants = $this->object->getParticipants();
$active_ids = array_keys($participants);
$results = array();
foreach ($active_ids as $active_id) {
$passes[] = $this->object->_getPass($active_id);
foreach ($passes as $key => $pass) {
for ($i = 0; $i <= $pass; $i++) {
$results[] = $question->object->getSolutionValues($active_id, $i);
}
}
}
$relevant_answers = array();
foreach ($results as $result) {
foreach ($result as $answer) {
if ($answer['question_fi'] == $question->object->getId()) {
$relevant_answers[] = $answer;
}
}
}
$answers_view = $question->getAggregatedAnswersView($relevant_answers);
include_once 'Services/jQuery/classes/class.iljQueryUtil.php';
iljQueryUtil::initjQuery();
include_once 'Services/YUI/classes/class.ilYuiUtil.php';
ilYuiUtil::initPanel();
ilYuiUtil::initOverlay();
$this->tpl->addJavascript('./Services/UIComponent/Overlay/js/ilOverlay.js');
$this->tpl->addJavaScript("./Services/JavaScript/js/Basic.js");
$container = new ilTemplate('tpl.il_as_tst_adjust_answer_aggregation_container.html', true, true, 'Modules/Test');
$container->setVariable('FORM_ELEMENT_NAME', 'aggr_usr_answ');
$container->setVariable('CLOSE_HTML', json_encode(ilGlyphGUI::get(ilGlyphGUI::CLOSE, $this->lng->txt('close'))));
$container->setVariable('TXT_SHOW_ANSWER_OVERVIEW', $this->lng->txt('show_answer_overview'));
$container->setVariable('TXT_CLOSE', $this->lng->txt('close'));
$container->setVariable('ANSWER_OVERVIEW', $answers_view);
$custom_input = new ilCustomInputGUI('', 'aggr_usr_answ');
$custom_input->setHtml($container->get());
$form->addItem($custom_input);
return $form;
}
示例8: buildForm
private function buildForm()
{
require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
$form = new ilPropertyFormGUI();
$form->setFormAction($this->ctrl->getFormAction($this));
$form->addCommandButton(self::CMD_SAVE_FORM, $this->lng->txt("save"));
$form->setTableWidth("100%");
$form->setId("test_properties");
if (!$this->settingsTemplate || $this->formShowGeneralSection($this->settingsTemplate->getSettings())) {
// general properties
$header = new ilFormSectionHeaderGUI();
$header->setTitle($this->lng->txt("tst_general_properties"));
$form->addItem($header);
}
// title & description (meta data)
include_once 'Services/MetaData/classes/class.ilMD.php';
$md_obj = new ilMD($this->testOBJ->getId(), 0, "tst");
$md_section = $md_obj->getGeneral();
$title = new ilTextInputGUI($this->lng->txt("title"), "title");
$title->setRequired(true);
$title->setValue($md_section->getTitle());
$form->addItem($title);
$ids = $md_section->getDescriptionIds();
if ($ids) {
$desc_obj = $md_section->getDescription(array_pop($ids));
$desc = new ilTextAreaInputGUI($this->lng->txt("description"), "description");
$desc->setCols(50);
$desc->setRows(4);
$desc->setValue($desc_obj->getDescription());
$form->addItem($desc);
}
// anonymity
$anonymity = new ilRadioGroupInputGUI($this->lng->txt('tst_anonymity'), 'anonymity');
if ($this->testOBJ->participantDataExist()) {
$anonymity->setDisabled(true);
}
$rb = new ilRadioOption($this->lng->txt('tst_anonymity_no_anonymization'), 0);
$anonymity->addOption($rb);
$rb = new ilRadioOption($this->lng->txt('tst_anonymity_anonymous_test'), 1);
$anonymity->addOption($rb);
$anonymity->setValue((int) $this->testOBJ->getAnonymity());
$form->addItem($anonymity);
// test mode (question set type)
$questSetType = new ilRadioGroupInputGUI($this->lng->txt("tst_question_set_type"), 'question_set_type');
$questSetTypeFixed = new ilRadioOption($this->lng->txt("tst_question_set_type_fixed"), ilObjTest::QUESTION_SET_TYPE_FIXED, $this->lng->txt("tst_question_set_type_fixed_desc"));
$questSetType->addOption($questSetTypeFixed);
$questSetTypeRandom = new ilRadioOption($this->lng->txt("tst_question_set_type_random"), ilObjTest::QUESTION_SET_TYPE_RANDOM, $this->lng->txt("tst_question_set_type_random_desc"));
$questSetType->addOption($questSetTypeRandom);
$questSetTypeContinues = new ilRadioOption($this->lng->txt("tst_question_set_type_dynamic"), ilObjTest::QUESTION_SET_TYPE_DYNAMIC, $this->lng->txt("tst_question_set_type_dynamic_desc"));
$questSetType->addOption($questSetTypeContinues);
$questSetType->setValue($this->testOBJ->getQuestionSetType());
if ($this->testOBJ->participantDataExist()) {
$questSetType->setDisabled(true);
}
$form->addItem($questSetType);
// pool usage
$pool_usage = new ilCheckboxInputGUI($this->lng->txt("test_question_pool_usage"), "use_pool");
$pool_usage->setValue(1);
$pool_usage->setChecked($this->testOBJ->getPoolUsage());
$form->addItem($pool_usage);
// enable_archiving
$enable_archiving = new ilCheckboxInputGUI($this->lng->txt('test_enable_archiving'), 'enable_archiving');
$enable_archiving->setValue(1);
$enable_archiving->setChecked($this->testOBJ->getEnableArchiving());
$form->addItem($enable_archiving);
// activation/availability (no template support yet)
include_once "Services/Object/classes/class.ilObjectActivation.php";
$this->lng->loadLanguageModule('rep');
$section = new ilFormSectionHeaderGUI();
$section->setTitle($this->lng->txt('rep_activation_availability'));
$form->addItem($section);
// additional info only with multiple references
$act_obj_info = $act_ref_info = "";
if (sizeof(ilObject::_getAllReferences($this->testOBJ->getId())) > 1) {
$act_obj_info = ' ' . $this->lng->txt('rep_activation_online_object_info');
$act_ref_info = $this->lng->txt('rep_activation_access_ref_info');
}
$online = new ilCheckboxInputGUI($this->lng->txt('rep_activation_online'), 'online');
$online->setChecked($this->testOBJ->isOnline());
$online->setInfo($this->lng->txt('tst_activation_online_info') . $act_obj_info);
$form->addItem($online);
$act_type = new ilRadioGroupInputGUI($this->lng->txt('rep_activation_access'), 'activation_type');
$act_type->setInfo($act_ref_info);
$act_type->setValue($this->testOBJ->isActivationLimited() ? ilObjectActivation::TIMINGS_ACTIVATION : ilObjectActivation::TIMINGS_DEACTIVATED);
$opt = new ilRadioOption($this->lng->txt('rep_visibility_limitless'), ilObjectActivation::TIMINGS_DEACTIVATED);
$opt->setInfo($this->lng->txt('tst_availability_limitless_info'));
$act_type->addOption($opt);
$opt = new ilRadioOption($this->lng->txt('rep_visibility_until'), ilObjectActivation::TIMINGS_ACTIVATION);
$opt->setInfo($this->lng->txt('tst_availability_until_info'));
$this->tpl->addJavaScript('./Services/Form/js/date_duration.js');
include_once "Services/Form/classes/class.ilDateDurationInputGUI.php";
$dur = new ilDateDurationInputGUI("", "access_period");
$dur->setShowTime(true);
$date = $this->testOBJ->getActivationStartingTime();
$dur->setStart(new ilDateTime($date ? $date : time(), IL_CAL_UNIX));
$dur->setStartText($this->lng->txt('rep_activation_limited_start'));
$date = $this->testOBJ->getActivationEndingTime();
$dur->setEnd(new ilDateTime($date ? $date : time(), IL_CAL_UNIX));
$dur->setEndText($this->lng->txt('rep_activation_limited_end'));
$opt->addSubItem($dur);
//.........这里部分代码省略.........
示例9: initForm
/**
* init Form
*/
public function initForm()
{
$this->form = new ilPropertyFormGUI();
$prefix = $this->ctrl->isAsynch() ? 'dclajax' : 'dcl';
// Used by datacolleciton.js to select input elements
$this->form->setId($prefix . $this->table_id . $this->record_id);
$hidden_prop = new ilHiddenInputGUI("table_id");
$hidden_prop->setValue($this->table_id);
$this->form->addItem($hidden_prop);
if ($this->record_id) {
$hidden_prop = new ilHiddenInputGUI("record_id");
$hidden_prop->setValue($this->record_id);
$this->form->addItem($hidden_prop);
}
$this->ctrl->setParameter($this, "record_id", $this->record_id);
$this->form->setFormAction($this->ctrl->getFormAction($this));
$allFields = $this->table->getRecordFields();
$inline_css = '';
foreach ($allFields as $field) {
$item = ilDataCollectionDatatype::getInputField($field);
if ($item === NULL) {
continue;
// Fields calculating values at runtime, e.g. ilDataCollectionFormulaField do not have input
}
if ($field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_REFERENCE) {
$fieldref = $field->getFieldRef();
$reffield = ilDataCollectionCache::getFieldCache($fieldref);
$options = array();
if (!$field->isNRef()) {
$options[""] = $this->lng->txt('dcl_please_select');
}
$reftable = ilDataCollectionCache::getTableCache($reffield->getTableId());
foreach ($reftable->getRecords() as $record) {
// If the referenced field is MOB or FILE, we display the filename in the dropdown
switch ($reffield->getDatatypeId()) {
case ilDataCollectionDatatype::INPUTFORMAT_FILE:
$file_obj = new ilObjFile($record->getRecordFieldValue($fieldref), false);
$options[$record->getId()] = $file_obj->getFileName();
break;
case ilDataCollectionDatatype::INPUTFORMAT_MOB:
$media_obj = new ilObjMediaObject($record->getRecordFieldValue($fieldref), false);
$options[$record->getId()] = $media_obj->getTitle();
break;
case ilDataCollectionDatatype::INPUTFORMAT_DATETIME:
$options[$record->getId()] = $record->getRecordFieldSingleHTML($fieldref);
break;
default:
$options[$record->getId()] = $record->getRecordFieldValue($fieldref);
break;
}
}
asort($options);
$item->setOptions($options);
if ($field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_REFERENCE) {
// FSX use this to apply to MultiSelectInputGUI
// if (!$field->isNRef()) { // addCustomAttribute only defined for single selects
if ($reftable->hasPermissionToAddRecord($_GET['ref_id'])) {
$item->addCustomAttribute('data-ref="1"');
$item->addCustomAttribute('data-ref-table-id="' . $reftable->getId() . '"');
$item->addCustomAttribute('data-ref-field-id="' . $reffield->getId() . '"');
}
// }
}
if ($item instanceof ilMultiSelectInputGUI) {
$item->setWidth(400);
$item->setHeight(100);
$inline_css .= 'div#' . $item->getFieldId() . '{resize:both;} ';
}
}
if ($this->record_id) {
$record = ilDataCollectionCache::getRecordCache($this->record_id);
}
$item->setRequired($field->getRequired());
//WORKAROUND. If field is from type file: if it's required but already has a value it is no longer required as the old value is taken as default without the form knowing about it.
if ($field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_FILE || $field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_MOB) {
if ($this->record_id and $record->getId()) {
$field_value = $record->getRecordFieldValue($field->getId());
if ($field_value) {
$item->setRequired(false);
}
}
// If this is an ajax request to return the form, input files are currently not supported
if ($this->ctrl->isAsynch()) {
$item->setDisabled(true);
}
}
if (!ilObjDataCollection::_hasWriteAccess($this->parent_obj->ref_id) && $field->getLocked()) {
$item->setDisabled(true);
}
$this->form->addItem($item);
}
$this->tpl->addInlineCss($inline_css);
// Add possibility to change the owner in edit mode
if ($this->record_id) {
$ownerField = $this->table->getField('owner');
$inputfield = ilDataCollectionDatatype::getInputField($ownerField);
$this->form->addItem($inputfield);
//.........这里部分代码省略.........
示例10: editQuestion
/**
* Creates an output of the edit form for the question
*
* @access public
*/
public function editQuestion($checkonly = FALSE)
{
include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
$form = new ilPropertyFormGUI();
$form->setFormAction($this->ctrl->getFormAction($this));
$form->setTitle($this->lng->txt($this->getQuestionType()));
$form->setMultipart(FALSE);
$form->setTableWidth("100%");
$form->setId("multiplechoice");
// title
$title = new ilTextInputGUI($this->lng->txt("title"), "title");
$title->setValue($this->object->getTitle());
$title->setRequired(TRUE);
$form->addItem($title);
// label
$label = new ilTextInputGUI($this->lng->txt("label"), "label");
$label->setValue($this->object->label);
$label->setInfo($this->lng->txt("label_info"));
$label->setRequired(false);
$form->addItem($label);
// author
$author = new ilTextInputGUI($this->lng->txt("author"), "author");
$author->setValue($this->object->getAuthor());
$author->setRequired(TRUE);
$form->addItem($author);
// description
$description = new ilTextInputGUI($this->lng->txt("description"), "description");
$description->setValue($this->object->getDescription());
$description->setRequired(FALSE);
$form->addItem($description);
// questiontext
$question = new ilTextAreaInputGUI($this->lng->txt("question"), "question");
$question->setValue($this->object->prepareTextareaOutput($this->object->getQuestiontext()));
$question->setRequired(TRUE);
$question->setRows(10);
$question->setCols(80);
$question->setUseRte(TRUE);
include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
$question->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey"));
$question->addPlugin("latex");
$question->addButton("latex");
$question->addButton("pastelatex");
$question->setRTESupport($this->object->getId(), "spl", "survey", null, false, "3.4.7");
$form->addItem($question);
// obligatory
$shuffle = new ilCheckboxInputGUI($this->lng->txt("obligatory"), "obligatory");
$shuffle->setValue(1);
$shuffle->setChecked($this->object->getObligatory());
$shuffle->setRequired(FALSE);
$form->addItem($shuffle);
// orientation
$orientation = new ilRadioGroupInputGUI($this->lng->txt("orientation"), "orientation");
$orientation->setRequired(false);
$orientation->setValue($this->object->getOrientation());
$orientation->addOption(new ilRadioOption($this->lng->txt('vertical'), 0));
$orientation->addOption(new ilRadioOption($this->lng->txt('horizontal'), 1));
$form->addItem($orientation);
// minimum answers
$minanswers = new ilCheckboxInputGUI($this->lng->txt("use_min_answers"), "use_min_answers");
$minanswers->setValue(1);
$minanswers->setOptionTitle($this->lng->txt("use_min_answers_option"));
$minanswers->setChecked($this->object->use_min_answers);
$minanswers->setRequired(FALSE);
$nranswers = new ilNumberInputGUI($this->lng->txt("nr_min_answers"), "nr_min_answers");
$nranswers->setSize(5);
$nranswers->setDecimals(0);
$nranswers->setRequired(false);
$nranswers->setMinValue(1);
$nranswers->setValue($this->object->nr_min_answers);
$minanswers->addSubItem($nranswers);
$nrmaxanswers = new ilNumberInputGUI($this->lng->txt("nr_max_answers"), "nr_max_answers");
$nrmaxanswers->setSize(5);
$nrmaxanswers->setDecimals(0);
$nrmaxanswers->setRequired(false);
$nrmaxanswers->setMinValue(1);
$nrmaxanswers->setValue($this->object->nr_max_answers);
$minanswers->addSubItem($nrmaxanswers);
$form->addItem($minanswers);
// Answers
include_once "./Modules/SurveyQuestionPool/classes/class.ilCategoryWizardInputGUI.php";
$answers = new ilCategoryWizardInputGUI($this->lng->txt("answers"), "answers");
$answers->setRequired(false);
$answers->setAllowMove(true);
$answers->setShowWizard(false);
$answers->setShowSavePhrase(false);
$answers->setUseOtherAnswer(true);
$answers->setShowNeutralCategory(true);
$answers->setNeutralCategoryTitle($this->lng->txt('svy_neutral_answer'));
if (!$this->object->getCategories()->getCategoryCount()) {
$this->object->getCategories()->addCategory("");
}
$answers->setValues($this->object->getCategories());
$answers->setDisabledScale(false);
$form->addItem($answers);
$this->addCommandButtons($form);
//.........这里部分代码省略.........
示例11: editQuestion
/**
* Creates an output of the edit form for the question
*
* @access public
*/
public function editQuestion($checkonly = FALSE)
{
$save = $this->isSaveCommand();
$this->getQuestionTemplate();
include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
$form = new ilPropertyFormGUI();
$form->setFormAction($this->ctrl->getFormAction($this));
$form->setTitle($this->outQuestionType());
$form->setMultipart(false);
$form->setTableWidth("100%");
$form->setId("assfileupload");
$this->addBasicQuestionFormProperties($form);
// maxsize
$maxsize = new ilNumberInputGUI($this->lng->txt("maxsize"), "maxsize");
$maxsize->setValue($this->object->getMaxSize());
$maxsize->setInfo($this->lng->txt("maxsize_info"));
$maxsize->setSize(10);
$maxsize->setMinValue(0);
//mbecker: Quick fix for mantis bug 8595: Change size file
$umf = get_cfg_var("upload_max_filesize");
// get the value for the maximal post data from the php.ini (if available)
$pms = get_cfg_var("post_max_size");
//convert from short-string representation to "real" bytes
$multiplier_a = array("K" => 1024, "M" => 1024 * 1024, "G" => 1024 * 1024 * 1024);
$umf_parts = preg_split("/(\\d+)([K|G|M])/", $umf, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
$pms_parts = preg_split("/(\\d+)([K|G|M])/", $pms, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
if (count($umf_parts) == 2) {
$umf = $umf_parts[0] * $multiplier_a[$umf_parts[1]];
}
if (count($pms_parts) == 2) {
$pms = $pms_parts[0] * $multiplier_a[$pms_parts[1]];
}
// use the smaller one as limit
$max_filesize = min($umf, $pms);
if (!$max_filesize) {
$max_filesize = max($umf, $pms);
}
$maxsize->setMaxValue($max_filesize);
// end quick fix
$maxsize->setRequired(FALSE);
$form->addItem($maxsize);
// allowedextensions
$allowedextensions = new ilTextInputGUI($this->lng->txt("allowedextensions"), "allowedextensions");
$allowedextensions->setInfo($this->lng->txt("allowedextensions_info"));
$allowedextensions->setValue($this->object->getAllowedExtensions());
$allowedextensions->setRequired(FALSE);
$form->addItem($allowedextensions);
// points
$points = new ilNumberInputGUI($this->lng->txt("points"), "points");
$points->setValue(is_numeric($this->object->getPoints()) && $this->object->getPoints() >= 0 ? $this->object->getPoints() : '');
$points->setRequired(TRUE);
$points->setSize(3);
$points->setMinValue(0.0);
$points->setMinvalueShouldBeGreater(false);
$form->addItem($points);
$subcompl = new ilCheckboxInputGUI($this->lng->txt('ass_completion_by_submission'), 'completion_by_submission');
$subcompl->setInfo($this->lng->txt('ass_completion_by_submission_info'));
$subcompl->setValue(1);
$subcompl->setChecked($this->object->isCompletionBySubmissionEnabled());
$form->addItem($subcompl);
$this->addQuestionFormCommandButtons($form);
$errors = false;
if ($save) {
$form->setValuesByPost();
$errors = !$form->checkInput();
$form->setValuesByPost();
// again, because checkInput now performs the whole stripSlashes handling and we need this if we don't want to have duplication of backslashes
if ($errors) {
$checkonly = false;
}
}
if (!$checkonly) {
$this->tpl->setVariable("QUESTION_DATA", $form->getHTML());
}
return $errors;
}
示例12: searchUsers
public function searchUsers($save = true)
{
global $ilUser, $ilCtrl;
$this->tpl->setTitle($this->lng->txt("mail"));
if ($save) {
// decode post values
$files = array();
if (is_array($_POST['attachments'])) {
foreach ($_POST['attachments'] as $value) {
$files[] = urldecode($value);
}
}
// Note: For security reasons, ILIAS only allows Plain text strings in E-Mails.
$this->umail->savePostData($ilUser->getId(), $files, ilUtil::securePlainString($_POST["rcp_to"]), ilUtil::securePlainString($_POST["rcp_cc"]), ilUtil::securePlainString($_POST["rcp_bcc"]), $_POST["m_type"], ilUtil::securePlainString($_POST["m_email"]), ilUtil::securePlainString($_POST["m_subject"]), ilUtil::securePlainString($_POST["m_message"]), ilUtil::securePlainString($_POST['use_placeholders']));
}
include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
$form = new ilPropertyFormGUI();
$form->setId('search_rcp');
$form->setTitle($this->lng->txt('search_recipients'));
$form->setFormAction($ilCtrl->getFormAction($this, 'search'));
$inp = new ilTextInputGUI($this->lng->txt("search_for"), 'search');
$inp->setSize(30);
$dsDataLink = $ilCtrl->getLinkTarget($this, 'lookupRecipientAsync', '', true, false);
$inp->setDataSource($dsDataLink);
if (strlen(trim($_SESSION["mail_search_search"])) > 0) {
$inp->setValue(ilUtil::prepareFormOutput(trim($_SESSION["mail_search_search"]), true));
}
$form->addItem($inp);
$form->addCommandButton('search', $this->lng->txt("search"));
$form->addCommandButton('cancelSearch', $this->lng->txt("cancel"));
$this->tpl->setContent($form->getHtml());
$this->tpl->show();
}
示例13: editQuestion
/**
* Creates an output of the edit form for the question
*
* @access public
*/
public function editQuestion($checkonly = FALSE)
{
include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
$form = new ilPropertyFormGUI();
$form->setFormAction($this->ctrl->getFormAction($this));
$form->setTitle($this->lng->txt($this->getQuestionType()));
$form->setMultipart(FALSE);
$form->setTableWidth("100%");
$form->setId("multiplechoice");
// title
$title = new ilTextInputGUI($this->lng->txt("title"), "title");
$title->setValue($this->object->getTitle());
$title->setRequired(TRUE);
$form->addItem($title);
// label
$label = new ilTextInputGUI($this->lng->txt("label"), "label");
$label->setValue($this->object->label);
$label->setInfo($this->lng->txt("label_info"));
$label->setRequired(false);
$form->addItem($label);
// author
$author = new ilTextInputGUI($this->lng->txt("author"), "author");
$author->setValue($this->object->getAuthor());
$author->setRequired(TRUE);
$form->addItem($author);
// description
$description = new ilTextInputGUI($this->lng->txt("description"), "description");
$description->setValue($this->object->getDescription());
$description->setRequired(FALSE);
$form->addItem($description);
// questiontext
$question = new ilTextAreaInputGUI($this->lng->txt("question"), "question");
$question->setValue($this->object->prepareTextareaOutput($this->object->getQuestiontext()));
$question->setRequired(TRUE);
$question->setRows(10);
$question->setCols(80);
$question->setUseRte(TRUE);
include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
$question->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey"));
$question->addPlugin("latex");
$question->addButton("latex");
$question->addButton("pastelatex");
$question->setRTESupport($this->object->getId(), "spl", "survey", null, false, "3.4.7");
$form->addItem($question);
// subtype
$subtype = new ilRadioGroupInputGUI($this->lng->txt("subtype"), "type");
$subtype->setRequired(false);
$subtype->setValue($this->object->getSubtype());
$subtypes = array("0" => "matrix_subtype_sr", "1" => "matrix_subtype_mr");
foreach ($subtypes as $idx => $st) {
$subtype->addOption(new ilRadioOption($this->lng->txt($st), $idx));
}
$form->addItem($subtype);
// obligatory
$shuffle = new ilCheckboxInputGUI($this->lng->txt("obligatory"), "obligatory");
$shuffle->setValue(1);
$shuffle->setChecked($this->object->getObligatory());
$shuffle->setRequired(FALSE);
$form->addItem($shuffle);
$header = new ilFormSectionHeaderGUI();
$header->setTitle($this->lng->txt("matrix_appearance"));
$form->addItem($header);
// column separators
$column_separators = new ilCheckboxInputGUI($this->lng->txt("matrix_column_separators"), "column_separators");
$column_separators->setValue(1);
$column_separators->setInfo($this->lng->txt("matrix_column_separators_description"));
$column_separators->setChecked($this->object->getColumnSeparators());
$column_separators->setRequired(false);
$form->addItem($column_separators);
// row separators
$row_separators = new ilCheckboxInputGUI($this->lng->txt("matrix_row_separators"), "row_separators");
$row_separators->setValue(1);
$row_separators->setInfo($this->lng->txt("matrix_row_separators_description"));
$row_separators->setChecked($this->object->getRowSeparators());
$row_separators->setRequired(false);
$form->addItem($row_separators);
// neutral column separators
$neutral_column_separator = new ilCheckboxInputGUI($this->lng->txt("matrix_neutral_column_separator"), "neutral_column_separator");
$neutral_column_separator->setValue(1);
$neutral_column_separator->setInfo($this->lng->txt("matrix_neutral_column_separator_description"));
$neutral_column_separator->setChecked($this->object->getNeutralColumnSeparator());
$neutral_column_separator->setRequired(false);
$form->addItem($neutral_column_separator);
$header = new ilFormSectionHeaderGUI();
$header->setTitle($this->lng->txt("matrix_columns"));
$form->addItem($header);
// Answers
include_once "./Modules/SurveyQuestionPool/classes/class.ilCategoryWizardInputGUI.php";
$columns = new ilCategoryWizardInputGUI("", "columns");
$columns->setRequired(false);
$columns->setAllowMove(true);
$columns->setShowWizard(true);
$columns->setShowNeutralCategory(true);
$columns->setDisabledScale(false);
$columns->setNeutralCategoryTitle($this->lng->txt('matrix_neutral_answer'));
//.........这里部分代码省略.........
示例14: ilPropertyFormGUI
function importExternalMailRecipientsFromTextFormObject()
{
global $ilAccess;
$this->parent_gui->handleWriteAccess();
$this->setCodesSubtabs();
include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
$form_import_text = new ilPropertyFormGUI();
$form_import_text->setFormAction($this->ctrl->getFormAction($this));
$form_import_text->setTableWidth("100%");
$form_import_text->setId("codes_import_text");
$headertext = new ilFormSectionHeaderGUI();
$headertext->setTitle($this->lng->txt("import_from_text"));
$form_import_text->addItem($headertext);
$inp = new ilTextAreaInputGUI($this->lng->txt('externaltext'), 'externaltext');
if (array_key_exists('externaltext', $_SESSION) && strlen($_SESSION['externaltext'])) {
$inp->setValue($_SESSION['externaltext']);
} else {
// $this->lng->txt('mail_import_example1') #14897
$inp->setValue("email;firstname;lastname\n" . $this->lng->txt('mail_import_example2') . "\n" . $this->lng->txt('mail_import_example3') . "\n");
}
$inp->setRequired(true);
$inp->setCols(80);
$inp->setRows(10);
$inp->setInfo($this->lng->txt('externaltext_info'));
$form_import_text->addItem($inp);
unset($_SESSION['externaltext']);
if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
$form_import_text->addCommandButton("importExternalRecipientsFromText", $this->lng->txt("import"));
}
if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
$form_import_text->addCommandButton("codes", $this->lng->txt("cancel"));
}
$this->tpl->setContent($form_import_text->getHTML());
}
示例15: editQuestion
public function editQuestion($checkonly = FALSE)
{
$save = $this->isSaveCommand();
$this->getQuestionTemplate();
include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
$form = new ilPropertyFormGUI();
$form->setFormAction($this->ctrl->getFormAction($this));
$form->setTitle($this->outQuestionType());
$form->setMultipart(true);
$form->setTableWidth("100%");
$form->setId("matching");
// title, author, description, question, working time (assessment mode)
$this->addBasicQuestionFormProperties($form);
$this->populateQuestionSpecificFormPart($form);
$this->populateAnswerSpecificFormPart($form);
$this->populateTaxonomyFormSection($form);
$this->addQuestionFormCommandButtons($form);
$errors = false;
if ($save) {
$form->setValuesByPost();
$errors = !$form->checkInput();
$form->setValuesByPost();
// again, because checkInput now performs the whole stripSlashes handling and we need this if we don't want to have duplication of backslashes
if (!$errors && count($this->object->getTerms()) < count($this->object->getDefinitions()) && !$this->object->getSelfAssessmentEditingMode()) {
$errors = true;
$terms = $form->getItemByPostVar('terms');
$terms->setAlert($this->lng->txt("msg_number_of_terms_too_low"));
ilUtil::sendFailure($this->lng->txt('form_input_not_valid'));
}
if ($errors) {
$checkonly = false;
}
}
if (!$checkonly) {
$this->tpl->setVariable("QUESTION_DATA", $form->getHTML());
}
return $errors;
}