function checkInput()
 {
     global $lng;
     include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
     if (is_array($_POST[$this->getPostVar()])) {
         $_POST[$this->getPostVar()] = ilUtil::stripSlashesRecursive($_POST[$this->getPostVar()], false, ilObjAdvancedEditing::_getUsedHTMLTagsAsString("assessment"));
     }
     $foundvalues = $_POST[$this->getPostVar()];
     #vd($foundvalues);
     if (is_array($foundvalues)) {
         // check answers
         if (is_array($foundvalues['answer'])) {
             foreach ($foundvalues['answer'] as $aidx => $answervalue) {
                 if (strlen($answervalue) == 0 && strlen($foundvalues['imagename'][$aidx]) == 0) {
                     $this->setAlert($lng->txt("msg_input_is_required"));
                     return FALSE;
                 }
             }
         }
         // check correctness
         if (!isset($foundvalues['correctness']) || count($foundvalues['correctness']) < count($foundvalues['answer'])) {
             $this->setAlert($lng->txt("msg_input_is_required"));
             return false;
         }
         if (!$this->checkUploads($foundvalues)) {
             return false;
         }
     } else {
         $this->setAlert($lng->txt("msg_input_is_required"));
         return FALSE;
     }
     return $this->checkSubItemsInput();
 }
 /** 
  * Concrete function which builds a html purifier config instance
  * 
  * @access	protected
  * @return	HTMLPurifier_Config Instance of HTMLPurifier_Config
  * 
  */
 protected function getPurifierConfigInstance()
 {
     include_once 'Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php';
     $config = HTMLPurifier_Config::createDefault();
     $config->set('HTML.DefinitionID', 'ilias forum post');
     $config->set('HTML.DefinitionRev', 1);
     $config->set('Cache.SerializerPath', ilHtmlPurifierAbstractLibWrapper::_getCacheDirectory());
     $config->set('HTML.Doctype', 'XHTML 1.0 Strict');
     $tags = ilObjAdvancedEditing::_getUsedHTMLTags(self::$_type);
     $tags = $this->makeElementListTinyMceCompliant($tags);
     $config->set('HTML.AllowedElements', $this->removeUnsupportedElements($tags));
     $config->set('HTML.ForbiddenAttributes', 'div@style');
     if ($def = $config->maybeGetRawHTMLDefinition()) {
         $def->addAttribute('a', 'target', 'Enum#_blank,_self,_target,_top');
     }
     return $config;
 }
 /** 
  * Concrete function which builds a html purifier config instance
  * 
  * @access	protected
  * @return	HTMLPurifier_Config Instance of HTMLPurifier_Config
  * 
  */
 protected function getPurifierConfigInstance()
 {
     include_once 'Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php';
     $config = HTMLPurifier_Config::createDefault();
     $config->set('HTML.DefinitionID', 'ilias forum post');
     $config->set('HTML.DefinitionRev', 1);
     $config->set('Cache.SerializerPath', ilHtmlPurifierAbstractLibWrapper::_getCacheDirectory());
     $config->set('HTML.Doctype', 'XHTML 1.0 Strict');
     // Bugfix #5945: Necessary because TinyMCE does not use the "u"
     // html element but <span style="text-decoration: underline">E</span>
     $tags = ilObjAdvancedEditing::_getUsedHTMLTags(self::$_type);
     if (in_array('u', $tags) && !in_array('span', $tags)) {
         $tags[] = 'span';
     }
     $config->set('HTML.AllowedElements', $this->removeUnsupportedElements($tags));
     $config->set('HTML.ForbiddenAttributes', 'div@style');
     if ($def = $config->maybeGetRawHTMLDefinition()) {
         $def->addAttribute('a', 'target', 'Enum#_blank,_self,_target,_top');
     }
     return $config;
 }
 protected function initEditForm()
 {
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this, "save"));
     $form->setTitle($this->lng->txt($this->getQuestionType()));
     $form->setMultipart(FALSE);
     $form->setTableWidth("100%");
     // $form->setId("essay");
     // title
     $title = new ilTextInputGUI($this->lng->txt("title"), "title");
     $title->setRequired(TRUE);
     $form->addItem($title);
     // label
     $label = new ilTextInputGUI($this->lng->txt("label"), "label");
     $label->setInfo($this->lng->txt("label_info"));
     $label->setRequired(false);
     $form->addItem($label);
     // author
     $author = new ilTextInputGUI($this->lng->txt("author"), "author");
     $author->setRequired(TRUE);
     $form->addItem($author);
     // description
     $description = new ilTextInputGUI($this->lng->txt("description"), "description");
     $description->setRequired(FALSE);
     $form->addItem($description);
     // questiontext
     $question = new ilTextAreaInputGUI($this->lng->txt("question"), "question");
     $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");
     $form->addItem($question);
     // obligatory
     $shuffle = new ilCheckboxInputGUI($this->lng->txt("obligatory"), "obligatory");
     $shuffle->setValue(1);
     $shuffle->setRequired(FALSE);
     $form->addItem($shuffle);
     $this->addFieldsToEditForm($form);
     $this->addCommandButtons($form);
     // values
     $title->setValue($this->object->getTitle());
     $label->setValue($this->object->label);
     $author->setValue($this->object->getAuthor());
     $description->setValue($this->object->getDescription());
     $question->setValue($this->object->prepareTextareaOutput($this->object->getQuestiontext()));
     $shuffle->setChecked($this->object->getObligatory());
     return $form;
 }
 /**
  * Clones the textblocks of survey questions
  *
  * @access public
  */
 function cloneTextblocks($mapping)
 {
     foreach ($mapping as $original_id => $new_id) {
         $textblock = $this->getTextblock($original_id);
         include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
         $this->saveHeading(ilUtil::stripSlashes($textblock, TRUE, ilObjAdvancedEditing::_getUsedHTMLTagsAsString("survey")), $new_id);
     }
 }
 function updateAssignmentTextObject($a_return = false)
 {
     global $ilCtrl, $ilUser;
     $times_up = $this->ass->getDeadline() && $this->ass->getDeadline() - time() < 0;
     if (!$this->ass || $this->ass->getType() != ilExAssignment::TYPE_TEXT || $times_up) {
         if ($times_up) {
             ilUtil::sendFailure($this->lng->txt("exercise_time_over"), true);
         }
         $ilCtrl->redirect($this, "showOverview");
     }
     $this->checkPermission("read");
     $form = $this->initAssignmentTextForm($this->ass);
     // we are not using a purifier, so we have to set the valid RTE tags
     // :TODO:
     include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
     $rte = $form->getItemByPostVar("atxt");
     $rte->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("exc_ass"));
     if ($form->checkInput()) {
         $text = trim($form->getInput("atxt"));
         $existing = (bool) ilExAssignment::getDeliveredFiles($this->ass->getExerciseId(), $this->ass->getId(), $ilUser->getId());
         $returned_id = $this->object->updateTextSubmission($this->ass->getExerciseId(), $this->ass->getId(), $ilUser->getId(), ilRTE::_replaceMediaObjectImageSrc($text, 0));
         // no empty text
         if ($returned_id) {
             if (!$existing) {
                 // #14332 - new text
                 $this->sendNotifications($this->ass->getId());
                 $this->object->handleSubmission($this->ass->getId());
             }
             // mob usage
             include_once "Services/MediaObjects/classes/class.ilObjMediaObject.php";
             $mobs = ilRTE::_getMediaObjects($text, 0);
             foreach ($mobs as $mob) {
                 if (ilObjMediaObject::_exists($mob)) {
                     ilObjMediaObject::_removeUsage($mob, 'exca~:html', $ilUser->getId());
                     ilObjMediaObject::_saveUsage($mob, 'exca:html', $returned_id);
                 }
             }
         }
         ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
         if ($a_return) {
             $ilCtrl->redirect($this, "showOverview");
         } else {
             $ilCtrl->redirect($this, "editAssignmentText");
         }
     }
     $form->setValuesByPost();
     $this->editAssignmentTextObject($form);
 }
 /**
  * @param ilPropertyFormGUI $form
  */
 private function saveTestFinishProperties(ilPropertyFormGUI $form)
 {
     if ($this->formPropertyExists($form, 'enable_examview')) {
         $this->testOBJ->setEnableExamview($form->getItemByPostVar('enable_examview')->getChecked());
         $this->testOBJ->setShowExamviewHtml($form->getItemByPostVar('show_examview_html')->getChecked());
         $this->testOBJ->setShowExamviewPdf($form->getItemByPostVar('show_examview_pdf')->getChecked());
     }
     $this->testOBJ->setShowFinalStatement($form->getItemByPostVar('showfinalstatement')->getChecked());
     $this->testOBJ->setFinalStatement($form->getItemByPostVar('finalstatement')->getValue(), false, ilObjAdvancedEditing::_getUsedHTMLTagsAsString("assessment"));
     if ($form->getItemByPostVar('redirection_enabled')->getChecked()) {
         $this->testOBJ->setRedirectionMode($form->getItemByPostVar('redirection_mode')->getValue());
     } else {
         $this->testOBJ->setRedirectionMode(REDIRECT_NONE);
     }
     if (strlen($form->getItemByPostVar('redirection_url')->getValue())) {
         $this->testOBJ->setRedirectionUrl($form->getItemByPostVar('redirection_url')->getValue());
     } else {
         $this->testOBJ->setRedirectionUrl(null);
     }
     if ($this->formPropertyExists($form, 'sign_submission')) {
         $this->testOBJ->setSignSubmission($form->getItemByPostVar('sign_submission')->getChecked());
     }
     if ($this->formPropertyExists($form, 'mailnotification') && $form->getItemByPostVar('mailnotification')->getChecked()) {
         $this->testOBJ->setMailNotification($form->getItemByPostVar('mailnotification_content')->getValue());
         $this->testOBJ->setMailNotificationType($form->getItemByPostVar('mailnottype')->getChecked());
     } else {
         $this->testOBJ->setMailNotification(0);
         $this->testOBJ->setMailNotificationType(false);
     }
 }
Example #8
0
 /**
  * Add basic question form properties:
  * assessment: title, author, description, question, working time
  *
  * @return	int	Default Nr of Tries
  */
 function addBasicQuestionFormProperties($form)
 {
     // title
     $title = new ilTextInputGUI($this->lng->txt("title"), "title");
     $title->setValue($this->object->getTitle());
     $title->setRequired(TRUE);
     $form->addItem($title);
     if (!$this->object->getSelfAssessmentEditingMode()) {
         // author
         $author = new ilTextInputGUI($this->lng->txt("author"), "author");
         $author->setValue($this->object->getAuthor());
         $author->setRequired(TRUE);
         $form->addItem($author);
         // description
         $description = new ilTextInputGUI($this->lng->txt("description"), "comment");
         $description->setValue($this->object->getComment());
         $description->setRequired(FALSE);
         $form->addItem($description);
     } else {
         // author as hidden field
         $hi = new ilHiddenInputGUI("author");
         $author = ilUtil::prepareFormOutput($this->object->getAuthor());
         if (trim($author) == "") {
             $author = "-";
         }
         $hi->setValue($author);
         $form->addItem($hi);
     }
     // questiontext
     $question = new ilTextAreaInputGUI($this->lng->txt("question"), "question");
     $question->setValue($this->object->prepareTextareaOutput($this->object->getQuestion()));
     $question->setRequired(TRUE);
     $question->setRows(10);
     $question->setCols(80);
     if (!$this->object->getSelfAssessmentEditingMode()) {
         if ($this->object->getAdditionalContentEditingMode() != assQuestion::ADDITIONAL_CONTENT_EDITING_MODE_PAGE_OBJECT) {
             $question->setUseRte(TRUE);
             include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
             $question->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment"));
             $question->addPlugin("latex");
             $question->addButton("latex");
             $question->addButton("pastelatex");
             $question->setRTESupport($this->object->getId(), "qpl", "assessment");
         }
     } else {
         $question->setRteTags(self::getSelfAssessmentTags());
         $question->setUseTagsForRteOnly(false);
     }
     $form->addItem($question);
     if (!$this->object->getSelfAssessmentEditingMode()) {
         // duration
         $duration = new ilDurationInputGUI($this->lng->txt("working_time"), "Estimated");
         $duration->setShowHours(TRUE);
         $duration->setShowMinutes(TRUE);
         $duration->setShowSeconds(TRUE);
         $ewt = $this->object->getEstimatedWorkingTime();
         $duration->setHours($ewt["h"]);
         $duration->setMinutes($ewt["m"]);
         $duration->setSeconds($ewt["s"]);
         $duration->setRequired(FALSE);
         $form->addItem($duration);
     } else {
         // number of tries
         if (strlen($this->object->getNrOfTries())) {
             $nr_tries = $this->object->getNrOfTries();
         } else {
             $nr_tries = $this->object->getDefaultNrOfTries();
         }
         if ($nr_tries < 1) {
             $nr_tries = "";
         }
         $ni = new ilNumberInputGUI($this->lng->txt("qst_nr_of_tries"), "nr_of_tries");
         $ni->setValue($nr_tries);
         $ni->setMinValue(0);
         $ni->setSize(5);
         $ni->setMaxLength(5);
         $form->addItem($ni);
     }
 }
 /**
  * Check input, strip slashes etc. set alert, if input is not ok.
  *
  * @return	boolean		Input ok, true/false
  */
 function checkInput()
 {
     global $lng;
     include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
     if (is_array($_POST[$this->getPostVar()])) {
         $_POST[$this->getPostVar()] = ilUtil::stripSlashesRecursive($_POST[$this->getPostVar()], true, ilObjAdvancedEditing::_getUsedHTMLTagsAsString("assessment"));
     }
     $foundvalues = $_POST[$this->getPostVar()];
     if (is_array($foundvalues)) {
         // check answers
         if (is_array($foundvalues['answer'])) {
             foreach ($foundvalues['answer'] as $aidx => $answervalue) {
                 if (strlen($answervalue) == 0 && strlen($foundvalues['imagename'][$aidx]) == 0) {
                     $this->setAlert($lng->txt("msg_input_is_required"));
                     return FALSE;
                 }
             }
         }
         if (!$this->hideImages) {
             if (is_array($_FILES[$this->getPostVar()]['error']['image'])) {
                 foreach ($_FILES[$this->getPostVar()]['error']['image'] as $index => $error) {
                     // error handling
                     if ($error > 0) {
                         switch ($error) {
                             case UPLOAD_ERR_INI_SIZE:
                                 $this->setAlert($lng->txt("form_msg_file_size_exceeds"));
                                 return false;
                                 break;
                             case UPLOAD_ERR_FORM_SIZE:
                                 $this->setAlert($lng->txt("form_msg_file_size_exceeds"));
                                 return false;
                                 break;
                             case UPLOAD_ERR_PARTIAL:
                                 $this->setAlert($lng->txt("form_msg_file_partially_uploaded"));
                                 return false;
                                 break;
                             case UPLOAD_ERR_NO_FILE:
                                 if ($this->getRequired()) {
                                     if (!strlen($foundvalues['imagename'][$index]) && !strlen($foundvalues['answer'][$index])) {
                                         $this->setAlert($lng->txt("form_msg_file_no_upload"));
                                         return false;
                                     }
                                 }
                                 break;
                             case UPLOAD_ERR_NO_TMP_DIR:
                                 $this->setAlert($lng->txt("form_msg_file_missing_tmp_dir"));
                                 return false;
                                 break;
                             case UPLOAD_ERR_CANT_WRITE:
                                 $this->setAlert($lng->txt("form_msg_file_cannot_write_to_disk"));
                                 return false;
                                 break;
                             case UPLOAD_ERR_EXTENSION:
                                 $this->setAlert($lng->txt("form_msg_file_upload_stopped_ext"));
                                 return false;
                                 break;
                         }
                     }
                 }
             }
             if (is_array($_FILES[$this->getPostVar()]['tmp_name']['image'])) {
                 foreach ($_FILES[$this->getPostVar()]['tmp_name']['image'] as $index => $tmpname) {
                     $filename = $_FILES[$this->getPostVar()]['name']['image'][$index];
                     $filename_arr = pathinfo($filename);
                     $suffix = $filename_arr["extension"];
                     // check suffixes
                     if (strlen($tmpname) && is_array($this->getSuffixes())) {
                         $vir = ilUtil::virusHandling($tmpname, $filename);
                         if ($vir[0] == false) {
                             $this->setAlert($lng->txt("form_msg_file_virus_found") . "<br />" . $vir[1]);
                             return false;
                         }
                         if (!in_array(strtolower($suffix), $this->getSuffixes())) {
                             $this->setAlert($lng->txt("form_msg_file_wrong_file_type"));
                             return false;
                         }
                     }
                 }
             }
         }
     }
     return $this->checkSubItemsInput();
 }
 private function performSaveForm(ilPropertyFormGUI $form)
 {
     include_once 'Services/MetaData/classes/class.ilMD.php';
     $md_obj =& new ilMD($this->testOBJ->getId(), 0, "tst");
     $md_section = $md_obj->getGeneral();
     // title
     $md_section->setTitle(ilUtil::stripSlashes($form->getItemByPostVar('title')->getValue()));
     $md_section->update();
     // Description
     $md_desc_ids = $md_section->getDescriptionIds();
     if ($md_desc_ids) {
         $md_desc = $md_section->getDescription(array_pop($md_desc_ids));
         $md_desc->setDescription(ilUtil::stripSlashes($form->getItemByPostVar('description')->getValue()));
         $md_desc->update();
     } else {
         $md_desc = $md_section->addDescription();
         $md_desc->setDescription(ilUtil::stripSlashes($form->getItemByPostVar('description')->getValue()));
         $md_desc->save();
     }
     $this->testOBJ->setTitle(ilUtil::stripSlashes($form->getItemByPostVar('title')->getValue()));
     $this->testOBJ->setDescription(ilUtil::stripSlashes($form->getItemByPostVar('description')->getValue()));
     $this->testOBJ->update();
     // pool usage setting
     if ($form->getItemByPostVar('use_pool') instanceof ilFormPropertyGUI) {
         $this->testOBJ->setPoolUsage($form->getItemByPostVar('use_pool')->getChecked());
     }
     // Archiving
     $this->testOBJ->setEnableArchiving($form->getItemByPostVar('enable_archiving')->getChecked());
     // Examview
     $this->testOBJ->setEnableExamview($form->getItemByPostVar('enable_examview')->getChecked());
     $this->testOBJ->setShowExamviewHtml($form->getItemByPostVar('show_examview_html')->getChecked());
     $this->testOBJ->setShowExamviewPdf($form->getItemByPostVar('show_examview_pdf')->getChecked());
     // online status
     $this->testOBJ->setOnline($form->getItemByPostVar('online')->getChecked());
     // activation
     if ($form->getItemByPostVar('activation_type')->getValue() == ilObjectActivation::TIMINGS_ACTIVATION) {
         $this->testOBJ->setActivationLimited(true);
         $this->testOBJ->setActivationVisibility($form->getItemByPostVar('activation_visibility')->getChecked());
         $period = $form->getItemByPostVar("access_period");
         $this->testOBJ->setActivationStartingTime($period->getStart()->get(IL_CAL_UNIX));
         $this->testOBJ->setActivationEndingTime($period->getEnd()->get(IL_CAL_UNIX));
     } else {
         $this->testOBJ->setActivationLimited(false);
     }
     include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
     $this->testOBJ->setIntroduction($form->getItemByPostVar('introduction')->getValue(), false, ilObjAdvancedEditing::_getUsedHTMLTagsAsString("assessment"));
     $this->testOBJ->setShowInfo($form->getItemByPostVar('showinfo')->getChecked());
     $this->testOBJ->setFinalStatement($form->getItemByPostVar('finalstatement')->getValue(), false, ilObjAdvancedEditing::_getUsedHTMLTagsAsString("assessment"));
     $this->testOBJ->setShowFinalStatement($form->getItemByPostVar('showfinalstatement')->getChecked());
     if ($form->getItemByPostVar('chb_postpone') instanceof ilFormPropertyGUI) {
         $this->testOBJ->setSequenceSettings($form->getItemByPostVar('chb_postpone')->getChecked());
     }
     $this->testOBJ->setShuffleQuestions($form->getItemByPostVar('chb_shuffle_questions')->getChecked());
     $this->testOBJ->setListOfQuestions($form->getItemByPostVar('list_of_questions')->getChecked());
     $listOfQuestionsOptions = $form->getItemByPostVar('list_of_questions_options')->getValue();
     if (is_array($listOfQuestionsOptions)) {
         $this->testOBJ->setListOfQuestionsStart(in_array('chb_list_of_questions_start', $listOfQuestionsOptions));
         $this->testOBJ->setListOfQuestionsEnd(in_array('chb_list_of_questions_end', $listOfQuestionsOptions));
         $this->testOBJ->setListOfQuestionsDescription(in_array('chb_list_of_questions_with_description', $listOfQuestionsOptions));
     } else {
         $this->testOBJ->setListOfQuestionsStart(0);
         $this->testOBJ->setListOfQuestionsEnd(0);
         $this->testOBJ->setListOfQuestionsDescription(0);
     }
     if ($form->getItemByPostVar('mailnotification') instanceof ilFormPropertyGUI) {
         $this->testOBJ->setMailNotification($form->getItemByPostVar('mailnotification')->getValue());
     }
     if ($form->getItemByPostVar('mailnottype') instanceof ilFormPropertyGUI) {
         $this->testOBJ->setMailNotificationType($form->getItemByPostVar('mailnottype')->getChecked());
     }
     if ($form->getItemByPostVar('chb_show_marker') instanceof ilFormPropertyGUI) {
         $this->testOBJ->setShowMarker($form->getItemByPostVar('chb_show_marker')->getChecked());
     }
     if ($form->getItemByPostVar('chb_show_cancel') instanceof ilFormPropertyGUI) {
         $this->testOBJ->setShowCancel($form->getItemByPostVar('chb_show_cancel')->getChecked());
     }
     if ($form->getItemByPostVar('kiosk') instanceof ilFormPropertyGUI) {
         $this->testOBJ->setKioskMode($form->getItemByPostVar('kiosk')->getChecked());
         $kioskOptions = $form->getItemByPostVar('kiosk_options')->getValue();
         if (is_array($kioskOptions)) {
             $this->testOBJ->setShowKioskModeTitle(in_array('kiosk_title', $kioskOptions));
             $this->testOBJ->setShowKioskModeParticipant(in_array('kiosk_participant', $kioskOptions));
             $this->testOBJ->setExamidInKiosk(in_array('examid_in_kiosk', $_POST["kiosk_options"]));
         }
     }
     // redirect after test
     if ($form->getItemByPostVar('redirection_enabled')->getChecked()) {
         $this->testOBJ->setRedirectionMode($form->getItemByPostVar('redirection_mode')->getValue());
     } else {
         $this->testOBJ->setRedirectionMode(REDIRECT_NONE);
     }
     if (strlen($form->getItemByPostVar('redirection_url')->getValue())) {
         $this->testOBJ->setRedirectionUrl($form->getItemByPostVar('redirection_url')->getValue());
     } else {
         $this->testOBJ->setRedirectionUrl(null);
     }
     if ($form->getItemByPostVar('sign_submission')->getChecked()) {
         $this->testOBJ->setSignSubmission(true);
     } else {
         $this->testOBJ->setSignSubmission(false);
     }
     $this->testOBJ->setEnableProcessingTime($form->getItemByPostVar('chb_processing_time')->getChecked());
     if ($this->testOBJ->getEnableProcessingTime()) {
         $processingTime = $form->getItemByPostVar('processing_time');
         $this->testOBJ->setProcessingTime(sprintf("%02d:%02d:%02d", $processingTime->getHours(), $processingTime->getMinutes(), $processingTime->getSeconds()));
     } else {
         $this->testOBJ->setProcessingTime('');
     }
     $this->testOBJ->setResetProcessingTime($form->getItemByPostVar('chb_reset_processing_time')->getChecked());
     if ($form->getItemByPostVar('chb_starting_time')->getChecked()) {
         $startingTimeSetting = $form->getItemByPostVar('starting_time');
         $this->testOBJ->setStartingTime(ilFormat::dateDB2timestamp($startingTimeSetting->getDate()->get(IL_CAL_DATETIME)));
     } else {
         $this->testOBJ->setStartingTime('');
     }
     if ($form->getItemByPostVar('chb_ending_time')->getChecked()) {
         $endingTimeSetting = $form->getItemByPostVar('ending_time');
         $this->testOBJ->setEndingTime(ilFormat::dateDB2timestamp($endingTimeSetting->getDate()->get(IL_CAL_DATETIME)));
     } else {
         $this->testOBJ->setEndingTime('');
     }
     if ($form->getItemByPostVar('forcejs') instanceof ilFormPropertyGUI) {
         $this->testOBJ->setForceJS($form->getItemByPostVar('forcejs')->getChecked());
     }
     if ($form->getItemByPostVar('title_output') instanceof ilFormPropertyGUI) {
         $this->testOBJ->setTitleOutput($form->getItemByPostVar('title_output')->getValue());
     }
     if ($form->getItemByPostVar('password') instanceof ilFormPropertyGUI) {
         $this->testOBJ->setPassword($form->getItemByPostVar('password')->getValue());
     }
     if ($form->getItemByPostVar('allowedUsers') instanceof ilFormPropertyGUI) {
         $this->testOBJ->setAllowedUsers($form->getItemByPostVar('allowedUsers')->getValue());
     }
     if ($form->getItemByPostVar('allowedUsersTimeGap') instanceof ilFormPropertyGUI) {
         $this->testOBJ->setAllowedUsersTimeGap($form->getItemByPostVar('allowedUsersTimeGap')->getValue());
     }
     // Selector for uicode characters
     global $ilSetting;
     if ($ilSetting->get('char_selector_availability') > 0) {
         require_once 'Services/UIComponent/CharSelector/classes/class.ilCharSelectorGUI.php';
         $char_selector = new ilCharSelectorGUI(ilCharSelectorConfig::CONTEXT_TEST);
         $char_selector->addFormProperties($form);
         $char_selector->getFormValues($form);
         $this->testOBJ->setCharSelectorAvailability($char_selector->getConfig()->getAvailability());
         $this->testOBJ->setCharSelectorDefinition($char_selector->getConfig()->getDefinition());
     }
     $this->testOBJ->setAutosave($form->getItemByPostVar('autosave')->getChecked());
     $this->testOBJ->setAutosaveIval($form->getItemByPostVar('autosave_ival')->getValue() * 1000);
     $this->testOBJ->setUsePreviousAnswers($form->getItemByPostVar('chb_use_previous_answers')->getChecked());
     // highscore settings
     $this->testOBJ->setHighscoreEnabled((bool) $form->getItemByPostVar('highscore_enabled')->getChecked());
     $this->testOBJ->setHighscoreAnon((bool) $form->getItemByPostVar('highscore_anon')->getChecked());
     $this->testOBJ->setHighscoreAchievedTS((bool) $form->getItemByPostVar('highscore_achieved_ts')->getChecked());
     $this->testOBJ->setHighscoreScore((bool) $form->getItemByPostVar('highscore_score')->getChecked());
     $this->testOBJ->setHighscorePercentage((bool) $form->getItemByPostVar('highscore_percentage')->getChecked());
     $this->testOBJ->setHighscoreHints((bool) $form->getItemByPostVar('highscore_hints')->getChecked());
     $this->testOBJ->setHighscoreWTime((bool) $form->getItemByPostVar('highscore_wtime')->getChecked());
     $this->testOBJ->setHighscoreOwnTable((bool) $form->getItemByPostVar('highscore_own_table')->getChecked());
     $this->testOBJ->setHighscoreTopTable((bool) $form->getItemByPostVar('highscore_top_table')->getChecked());
     $this->testOBJ->setHighscoreTopNum((int) $form->getItemByPostVar('highscore_top_num')->getValue());
     if (!$this->testOBJ->participantDataExist()) {
         // question set type
         if ($form->getItemByPostVar('question_set_type') instanceof ilFormPropertyGUI) {
             $this->testOBJ->setQuestionSetType($form->getItemByPostVar('question_set_type')->getValue());
         }
         // anonymity setting
         $this->testOBJ->setAnonymity($form->getItemByPostVar('anonymity')->getValue());
         // nr of tries (max passes)
         $this->testOBJ->setNrOfTries($form->getItemByPostVar('nr_of_tries')->getValue());
         // fixed participants setting
         if ($form->getItemByPostVar('fixedparticipants') instanceof ilFormPropertyGUI) {
             $this->testOBJ->setFixedParticipants($form->getItemByPostVar('fixedparticipants')->getChecked());
         }
     }
     // store settings to db
     $this->testOBJ->saveToDb(true);
     // Update ecs export settings
     include_once 'Modules/Test/classes/class.ilECSTestSettings.php';
     $ecs = new ilECSTestSettings($this->testOBJ);
     $ecs->handleSettingsUpdate();
 }
Example #11
0
 public function populateQuestionSpecificFormPart(ilPropertyFormGUI $form)
 {
     // cloze text
     $cloze_text = new ilTextAreaInputGUI($this->lng->txt("cloze_text"), 'cloze_text');
     $cloze_text->setRequired(true);
     $cloze_text->setValue($this->applyIndizesToGapText($this->object->getClozeText()));
     $cloze_text->setInfo($this->lng->txt("close_text_hint"));
     $cloze_text->setRows(10);
     $cloze_text->setCols(80);
     if (!$this->object->getSelfAssessmentEditingMode()) {
         if ($this->object->getAdditionalContentEditingMode() == assQuestion::ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT) {
             $cloze_text->setUseRte(TRUE);
             include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
             $cloze_text->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment"));
             $cloze_text->addPlugin("latex");
             $cloze_text->addButton("latex");
             $cloze_text->addButton("pastelatex");
         }
     } else {
         $cloze_text->setUseRte(TRUE);
         $cloze_text->setRteTags(self::getSelfAssessmentTags());
         $cloze_text->setUseTagsForRteOnly(false);
     }
     $cloze_text->setRTESupport($this->object->getId(), "qpl", "assessment");
     $form->addItem($cloze_text);
     $tpl = new ilTemplate("tpl.il_as_qpl_cloze_gap_button_code.html", TRUE, TRUE, "Modules/TestQuestionPool");
     $tpl->setVariable('INSERT_GAP', $this->lng->txt('insert_gap'));
     $tpl->setVariable('CREATE_GAPS', $this->lng->txt('create_gaps'));
     $tpl->parseCurrentBlock();
     $button = new ilCustomInputGUI('&nbsp;', '');
     $button->setHtml($tpl->get());
     $form->addItem($button);
     // text rating
     if (!$this->object->getSelfAssessmentEditingMode()) {
         $textrating = new ilSelectInputGUI($this->lng->txt("text_rating"), "textgap_rating");
         $text_options = array("ci" => $this->lng->txt("cloze_textgap_case_insensitive"), "cs" => $this->lng->txt("cloze_textgap_case_sensitive"), "l1" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "1"), "l2" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "2"), "l3" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "3"), "l4" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "4"), "l5" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "5"));
         $textrating->setOptions($text_options);
         $textrating->setValue($this->object->getTextgapRating());
         $form->addItem($textrating);
         // text field length
         $fixedTextLength = new ilNumberInputGUI($this->lng->txt("cloze_fixed_textlength"), "fixedTextLength");
         $ftl = $this->object->getFixedTextLength();
         $fixedTextLength->setValue($ftl > 0 ? $ftl : '');
         $fixedTextLength->setMinValue(0);
         $fixedTextLength->setSize(3);
         $fixedTextLength->setMaxLength(6);
         $fixedTextLength->setInfo($this->lng->txt('cloze_fixed_textlength_description'));
         $fixedTextLength->setRequired(false);
         $form->addItem($fixedTextLength);
         // identical scoring
         $identical_scoring = new ilCheckboxInputGUI($this->lng->txt("identical_scoring"), "identical_scoring");
         $identical_scoring->setValue(1);
         $identical_scoring->setChecked($this->object->getIdenticalScoring());
         $identical_scoring->setInfo($this->lng->txt('identical_scoring_desc'));
         $identical_scoring->setRequired(FALSE);
         $form->addItem($identical_scoring);
     }
     return $form;
 }
Example #12
0
 function savePageContentObject()
 {
     include_once "Services/XHTMLPage/classes/class.ilXHTMLPage.php";
     include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
     $xpage_id = ilContainer::_lookupContainerSetting($this->object->getId(), "xhtml_page");
     /*include_once("./Services/Form/classes/class.ilFormPropertyGUI.php");
     		include_once("./Services/Form/classes/class.ilTextAreaInputGUI.php");
     		$ta = new ilTextAreaInputGUI();
     		$ta->setRteTagSet("extended_table_img");
     		$tags = $ta->getRteTagString();*/
     //$text = ilUtil::stripSlashes($_POST["page_content"],
     //		true,
     //		$tags);
     $text = ilUtil::stripSlashes($_POST["page_content"], true, ilObjAdvancedEditing::_getUsedHTMLTagsAsString());
     if ($xpage_id > 0) {
         $xpage = new ilXHTMLPage($xpage_id);
         $xpage->setContent($text);
         $xpage->save();
     } else {
         $xpage = new ilXHTMLPage();
         $xpage->setContent($text);
         $xpage->save();
         ilContainer::_writeContainerSetting($this->object->getId(), "xhtml_page", $xpage->getId());
     }
     include_once "Services/RTE/classes/class.ilRTE.php";
     ilRTE::_cleanupMediaObjectUsage($text, $this->object->getType() . ":html", $this->object->getId());
     ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
     $this->ctrl->redirect($this, "");
 }
 function addBasicQuestionFormProperties($form)
 {
     // title
     $title = new ilTextInputGUI($this->lng->txt("title"), "title");
     $title->setValue($this->object->getTitle());
     $title->setRequired(TRUE);
     $form->addItem($title);
     if (!$this->object->getSelfAssessmentEditingMode()) {
         // author
         $author = new ilTextInputGUI($this->lng->txt("author"), "author");
         $author->setValue($this->object->getAuthor());
         $author->setRequired(TRUE);
         $form->addItem($author);
         // description
         $description = new ilTextInputGUI($this->lng->txt("description"), "comment");
         $description->setValue($this->object->getComment());
         $description->setRequired(FALSE);
         $form->addItem($description);
     } else {
         // author as hidden field
         $hi = new ilHiddenInputGUI("author");
         $author = ilUtil::prepareFormOutput($this->object->getAuthor());
         if (trim($author) == "") {
             $author = "-";
         }
         $hi->setValue($author);
         $form->addItem($hi);
     }
     // questiontext
     $question = new ilTextAreaInputGUI($this->lng->txt("question"), "question");
     $question->setValue($this->object->prepareTextareaOutput($this->object->getQuestion()));
     $question->setRequired(TRUE);
     $question->setRows(10);
     $question->setCols(80);
     if (!$this->object->getSelfAssessmentEditingMode()) {
         if ($this->object->getAdditionalContentEditingMode() == assQuestion::ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT) {
             $question->setUseRte(TRUE);
             include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
             $question->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment"));
             $question->addPlugin("latex");
             $question->addButton("latex");
             $question->addButton("pastelatex");
             $question->setRTESupport($this->object->getId(), "qpl", "assessment");
         }
     } else {
         $question->setRteTags(self::getSelfAssessmentTags());
         $question->setUseTagsForRteOnly(false);
     }
     $form->addItem($question);
     $tpl = new ilTemplate("tpl.il_as_qpl_cloze_gap_button_code.html", TRUE, TRUE, "Modules/TestQuestionPool");
     $tpl->setVariable('INSERT_GAP', $this->lng->txt('insert_gap'));
     $tpl->setVariable('CREATE_GAPS', $this->lng->txt('create_gaps'));
     $tpl->parseCurrentBlock();
     $button = new ilCustomInputGUI('&nbsp;', '');
     $button->setHtml($tpl->get());
     $form->addItem($button);
     if (!$this->object->getSelfAssessmentEditingMode()) {
         // duration
         $duration = new ilDurationInputGUI($this->lng->txt("working_time"), "Estimated");
         $duration->setShowHours(TRUE);
         $duration->setShowMinutes(TRUE);
         $duration->setShowSeconds(TRUE);
         $ewt = $this->object->getEstimatedWorkingTime();
         $duration->setHours($ewt["h"]);
         $duration->setMinutes($ewt["m"]);
         $duration->setSeconds($ewt["s"]);
         $duration->setRequired(FALSE);
         $form->addItem($duration);
     } else {
         // number of tries
         if (strlen($this->object->getNrOfTries())) {
             $nr_tries = $this->object->getNrOfTries();
         } else {
             $nr_tries = $this->object->getDefaultNrOfTries();
         }
         /*if ($nr_tries <= 0)
         		{
         			$nr_tries = 1;
         		}*/
         if ($nr_tries < 0) {
             $nr_tries = 0;
         }
         $ni = new ilNumberInputGUI($this->lng->txt("qst_nr_of_tries"), "nr_of_tries");
         $ni->setValue($nr_tries);
         //$ni->setMinValue(1);
         $ni->setMinValue(0);
         $ni->setSize(5);
         $ni->setMaxLength(5);
         $ni->setRequired(true);
         $form->addItem($ni);
     }
 }
 private function saveManScoringParticipantScreen($redirect = true)
 {
     global $tpl, $ilCtrl, $lng;
     $activeId = $this->fetchActiveIdParameter();
     $pass = $this->fetchPassParameter($activeId);
     $questionGuiList = $this->service->getManScoringQuestionGuiList($activeId, $pass);
     $form = $this->buildManScoringParticipantForm($questionGuiList, $activeId, $pass, false);
     $form->setValuesByPost();
     if (!$form->checkInput()) {
         ilUtil::sendFailure(sprintf($lng->txt('tst_save_manscoring_failed'), $pass + 1));
         return $this->showManScoringParticipantScreen($form);
     }
     include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
     $maxPointsByQuestionId = array();
     $maxPointsExceeded = false;
     foreach ($questionGuiList as $questionId => $questionGui) {
         $reachedPoints = $form->getItemByPostVar("question__{$questionId}__points")->getValue();
         $maxPoints = assQuestion::_getMaximumPoints($questionId);
         if ($reachedPoints > $maxPoints) {
             $maxPointsExceeded = true;
             $form->getItemByPostVar("question__{$questionId}__points")->setAlert(sprintf($lng->txt('tst_manscoring_maxpoints_exceeded_input_alert'), $maxPoints));
         }
         $maxPointsByQuestionId[$questionId] = $maxPoints;
     }
     if ($maxPointsExceeded) {
         ilUtil::sendFailure(sprintf($lng->txt('tst_save_manscoring_failed'), $pass + 1));
         return $this->showManScoringParticipantScreen($form);
     }
     include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
     foreach ($questionGuiList as $questionId => $questionGui) {
         $reachedPoints = $form->getItemByPostVar("question__{$questionId}__points")->getValue();
         assQuestion::_setReachedPoints($activeId, $questionId, $reachedPoints, $maxPointsByQuestionId[$questionId], $pass, 1, $this->object->areObligationsEnabled());
         $feedback = ilUtil::stripSlashes($form->getItemByPostVar("question__{$questionId}__feedback")->getValue(), false, ilObjAdvancedEditing::_getUsedHTMLTagsAsString("assessment"));
         $this->object->saveManualFeedback($activeId, $questionId, $pass, $feedback);
         $notificationData[$questionId] = array('points' => $reachedPoints, 'feedback' => $feedback);
     }
     include_once "./Modules/Test/classes/class.ilObjTestAccess.php";
     include_once "./Services/Tracking/classes/class.ilLPStatusWrapper.php";
     ilLPStatusWrapper::_updateStatus($this->object->getId(), ilObjTestAccess::_getParticipantId($activeId));
     $manScoringDone = $form->getItemByPostVar("manscoring_done")->getChecked();
     ilTestService::setManScoringDone($activeId, $manScoringDone);
     $manScoringNotify = $form->getItemByPostVar("manscoring_notify")->getChecked();
     if ($manScoringNotify) {
         require_once 'Modules/Test/classes/notifications/class.ilTestManScoringParticipantNotification.php';
         $notification = new ilTestManScoringParticipantNotification($this->object->_getUserIdFromActiveId($activeId), $this->object->getRefId());
         $notification->setAdditionalInformation(array('test_title' => $this->object->getTitle(), 'test_pass' => $pass + 1, 'questions_gui_list' => $questionGuiList, 'questions_scoring_data' => $notificationData));
         $notification->send();
     }
     require_once './Modules/Test/classes/class.ilTestScoring.php';
     $scorer = new ilTestScoring($this->object);
     $scorer->setPreserveManualScores(true);
     $scorer->recalculateSolutions();
     if ($this->object->getAnonymity() == 0) {
         $user_name = ilObjUser::_lookupName(ilObjTestAccess::_getParticipantId($activeId));
         $name_real_or_anon = $user_name['firstname'] . ' ' . $user_name['lastname'];
     } else {
         $name_real_or_anon = $lng->txt('anonymous');
     }
     ilUtil::sendSuccess(sprintf($lng->txt('tst_saved_manscoring_successfully'), $pass + 1, $name_real_or_anon), true);
     if ($redirect == true) {
         $ilCtrl->redirect($this, 'showManScoringParticipantScreen');
     } else {
         return;
     }
 }
Example #15
0
 private function initReplyEditForm()
 {
     /**
      * @var $ilUser ilObjUser
      * @var $rbacsystem ilRbacSystem
      * @var $ilSetting ilSetting
      */
     global $ilUser, $rbacsystem, $ilSetting;
     // init objects
     $oForumObjects = $this->getForumObjects();
     /**
      * @var $frm ilForum
      */
     $frm = $oForumObjects['frm'];
     /**
      * @var $oFDForum ilFileDataForum
      */
     $oFDForum = $oForumObjects['file_obj'];
     require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
     $this->replyEditForm = new ilPropertyFormGUI();
     $this->replyEditForm->setTableWidth('100%');
     // titel
     if ($_GET['action'] == 'showreply' || $_GET['action'] == 'ready_showreply') {
         $this->ctrl->setParameter($this, 'action', 'ready_showreply');
     } else {
         $this->ctrl->setParameter($this, 'action', 'ready_showedit');
     }
     // form action
     $this->ctrl->setParameter($this, 'pos_pk', $this->objCurrentPost->getId());
     $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentPost->getThreadId());
     $this->ctrl->setParameter($this, 'offset', (int) $_GET['offset']);
     $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']);
     $this->replyEditForm->setFormAction($this->ctrl->getFormAction($this, 'savePost', $this->objCurrentPost->getId()));
     $this->ctrl->clearParameters($this);
     if ($_GET['action'] == 'showreply' || $_GET['action'] == 'ready_showreply') {
         $this->replyEditForm->setTitle($this->lng->txt('forums_your_reply'));
     } else {
         $this->replyEditForm->setTitle($this->lng->txt('forums_edit_post'));
     }
     // alias
     if ($this->objProperties->isAnonymized() && in_array($_GET['action'], array('showreply', 'ready_showreply'))) {
         $oAnonymousNameGUI = new ilTextInputGUI($this->lng->txt('forums_your_name'), 'alias');
         $oAnonymousNameGUI->setMaxLength(64);
         $oAnonymousNameGUI->setInfo($this->lng->txt('forums_use_alias'));
         $this->replyEditForm->addItem($oAnonymousNameGUI);
     }
     // subject
     $oSubjectGUI = new ilTextInputGUI($this->lng->txt('forums_subject'), 'subject');
     $oSubjectGUI->setMaxLength(64);
     $oSubjectGUI->setRequired(true);
     if ($this->objProperties->getSubjectSetting() == 'empty_subject') {
         $oSubjectGUI->setInfo($this->lng->txt('enter_new_subject'));
     }
     $this->replyEditForm->addItem($oSubjectGUI);
     // post
     $oPostGUI = new ilTextAreaInputGUI($_GET['action'] == 'showreply' || $_GET['action'] == 'ready_showreply' ? $this->lng->txt('forums_your_reply') : $this->lng->txt('forums_edit_post'), 'message');
     $oPostGUI->setRequired(true);
     $oPostGUI->setCols(50);
     $oPostGUI->setRows(15);
     $oPostGUI->setUseRte(true);
     $oPostGUI->addPlugin('latex');
     $oPostGUI->addButton('latex');
     $oPostGUI->addButton('pastelatex');
     $oPostGUI->addPlugin('ilfrmquote');
     //$oPostGUI->addPlugin('code');
     if ($_GET['action'] == 'showreply' || $_GET['action'] == 'ready_showreply') {
         $oPostGUI->addButton('ilFrmQuoteAjaxCall');
     }
     $oPostGUI->removePlugin('advlink');
     $oPostGUI->setRTERootBlockElement('');
     $oPostGUI->usePurifier(true);
     $oPostGUI->disableButtons(array('charmap', 'undo', 'redo', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', 'anchor', 'fullscreen', 'cut', 'copy', 'paste', 'pastetext', 'formatselect'));
     if ($_GET['action'] == 'showreply' || $_GET['action'] == 'ready_showreply') {
         $oPostGUI->setRTESupport($ilUser->getId(), 'frm~', 'frm_post', 'tpl.tinymce_frm_post.html', false, '3.4.7');
     } else {
         $oPostGUI->setRTESupport($this->objCurrentPost->getId(), 'frm', 'frm_post', 'tpl.tinymce_frm_post.html', false, '3.4.7');
     }
     // purifier
     require_once 'Services/Html/classes/class.ilHtmlPurifierFactory.php';
     $oPostGUI->setPurifier(ilHtmlPurifierFactory::_getInstanceByType('frm_post'));
     $this->replyEditForm->addItem($oPostGUI);
     // notification only if gen. notification is disabled and forum isn't anonymous
     include_once 'Services/Mail/classes/class.ilMail.php';
     $umail = new ilMail($ilUser->getId());
     if ($rbacsystem->checkAccess('internal_mail', $umail->getMailObjectReferenceId()) && !$frm->isThreadNotificationEnabled($ilUser->getId(), $this->objCurrentPost->getThreadId()) && !$this->objProperties->isAnonymized()) {
         $oNotificationGUI = new ilCheckboxInputGUI('', 'notify');
         $oNotificationGUI->setInfo($this->lng->txt('forum_notify_me'));
         $this->replyEditForm->addItem($oNotificationGUI);
     }
     // attachments
     $oFileUploadGUI = new ilFileWizardInputGUI($this->lng->txt('forums_attachments_add'), 'userfile');
     $oFileUploadGUI->setFilenames(array(0 => ''));
     $this->replyEditForm->addItem($oFileUploadGUI);
     require_once 'Services/Captcha/classes/class.ilCaptchaUtil.php';
     if ($ilUser->isAnonymous() && !$ilUser->isCaptchaVerified() && ilCaptchaUtil::isActiveForForum()) {
         require_once 'Services/Captcha/classes/class.ilCaptchaInputGUI.php';
         $captcha = new ilCaptchaInputGUI($this->lng->txt('cont_captcha_code'), 'captcha_code');
         $captcha->setRequired(true);
         $this->replyEditForm->addItem($captcha);
     }
     // edit attachments
     if (count($oFDForum->getFilesOfPost()) && ($_GET['action'] == 'showedit' || $_GET['action'] == 'ready_showedit')) {
         $oExistingAttachmentsGUI = new ilCheckboxGroupInputGUI($this->lng->txt('forums_delete_file'), 'del_file');
         foreach ($oFDForum->getFilesOfPost() as $file) {
             $oAttachmentGUI = new ilCheckboxInputGUI($file['name'], 'del_file');
             $oAttachmentGUI->setValue($file['md5']);
             $oExistingAttachmentsGUI->addOption($oAttachmentGUI);
         }
         $this->replyEditForm->addItem($oExistingAttachmentsGUI);
     }
     // buttons
     $this->replyEditForm->addCommandButton('savePost', $this->lng->txt('create'));
     if ($_GET['action'] == 'showreply' || $_GET['action'] == 'ready_showreply') {
         include_once 'Services/RTE/classes/class.ilRTE.php';
         $rtestring = ilRTE::_getRTEClassname();
         if (array_key_exists('show_rte', $_POST)) {
             ilObjAdvancedEditing::_setRichTextEditorUserState($_POST['show_rte']);
         }
         if (strtolower($rtestring) != 'iltinymce' || !ilObjAdvancedEditing::_getRichTextEditorUserState()) {
             $this->replyEditForm->addCommandButton('quotePost', $this->lng->txt('forum_add_quote'));
         }
     }
     $this->replyEditForm->addCommandButton('cancelPost', $this->lng->txt('cancel'));
 }
 /**
  * add the properties of a question part to the form
  *
  * @param object    form object to extend
  * @param object    question part object
  * @param integer    counter of the question part
  */
 private function initPartProperties($form, $part_obj = null, $counter = "1")
 {
     // Use a dummy part object for a new booking definition
     if (!isset($part_obj)) {
         $part_obj = new assAccountingQuestionPart($this->object);
     }
     // Part identifier (is 0 for a new part)
     $item = new ilHiddenInputGUI("parts[]");
     $item->setValue($part_obj->getPartId());
     $form->addItem($item);
     // Title
     $item = new ilFormSectionHeaderGUI();
     $item->setTitle($this->plugin->txt('accounting_table') . ' ' . $counter);
     $form->addItem($item);
     // Position
     $item = new ilNumberInputGUI($this->plugin->txt('position'), 'position_' . $part_obj->getPartId());
     $item->setSize(2);
     $item->setDecimals(1);
     $item->SetInfo($this->plugin->txt('position_info'));
     if ($part_obj->getPartId()) {
         $item->setValue(sprintf("%01.1f", $part_obj->getPosition()));
     }
     $form->addItem($item);
     // Text
     $item = new ilTextAreaInputGUI($this->plugin->txt("question_part"), 'text_' . $part_obj->getPartId());
     $item->setValue($this->object->prepareTextareaOutput($part_obj->getText()));
     $item->setRows(10);
     $item->setCols(80);
     if (!$this->object->getSelfAssessmentEditingMode()) {
         $item->setUseRte(TRUE);
         include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
         $item->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment"));
         $item->addPlugin("latex");
         $item->addButton("latex");
         $item->addButton("pastelatex");
         $item->setRTESupport($this->object->getId(), "qpl", "assessment");
     } else {
         $item->setRteTags(self::getSelfAssessmentTags());
         $item->setUseTagsForRteOnly(false);
     }
     $form->addItem($item);
     // Booking XML definition
     $item = new ilCustomInputGUI($this->plugin->txt('booking_xml'));
     $item->setInfo($this->plugin->txt('booking_xml_info'));
     $tpl = $this->plugin->getTemplate('tpl.il_as_qpl_accqst_edit_xml.html');
     $tpl->setVariable("CONTENT", ilUtil::prepareFormOutput($part_obj->getBookingXML()));
     $tpl->setVariable("NAME", 'booking_xml_' . $part_obj->getPartId());
     $item->setHTML($tpl->get());
     // Booking file
     $subitem = new ilFileInputGUI($this->plugin->txt('booking_file'), "booking_file_" . $part_obj->getPartId());
     $subitem->setSuffixes(array('xml'));
     $item->addSubItem($subitem);
     // Download button
     if (strlen($part_obj->getBookingXML())) {
         $tpl = $this->plugin->getTemplate('tpl.il_as_qpl_accqst_form_custom.html');
         $this->ctrl->setParameter($this, 'xmltype', 'booking');
         $this->ctrl->setParameter($this, 'part_id', $part_obj->getPartId());
         $tpl->setCurrentBlock('button');
         $tpl->setVariable('BUTTON_HREF', $this->ctrl->getLinkTarget($this, 'downloadXml'));
         $tpl->setVariable('BUTTON_TEXT', $this->plugin->txt('download_booking_xml'));
         $tpl->ParseCurrentBlock();
         $subitem = new ilcustomInputGUI('');
         $subitem->setHTML($tpl->get());
         $item->addSubItem($subitem);
     }
     $form->addItem($item);
     // Delete Button
     if ($part_obj->getPartId()) {
         $tpl = $this->plugin->getTemplate('tpl.il_as_qpl_accqst_form_custom.html');
         $tpl->setCurrentBlock('button');
         $this->ctrl->setParameter($this, 'part_id', $part_obj->getPartId());
         $tpl->setVariable('BUTTON_HREF', $this->ctrl->getLinkTarget($this, 'deletePart'));
         $tpl->setVariable('BUTTON_TEXT', $this->plugin->txt('delete_accounting_table'));
         $tpl->ParseCurrentBlock();
         $item = new ilcustomInputGUI();
         $item->setHTML($tpl->get());
         $form->addItem($item);
     }
 }
 /**
  * builds and returns a form property gui object with the given label and postvar
  * that is addable to property forms
  * depending on the given flag "asNonEditable" it returns a ...
  * - non editable gui
  * - textarea input gui
  * 
  * @final
  * @access protected
  * @param string $label
  * @param string $postVar
  * @param boolean $asNonEditable
  * @return ilTextAreaInputGUI|ilNonEditableValueGUI $formProperty
  */
 protected final function buildFeedbackContentFormProperty($label, $postVar, $asNonEditable)
 {
     if ($asNonEditable) {
         require_once 'Services/Form/classes/class.ilNonEditableValueGUI.php';
         $property = new ilNonEditableValueGUI($label, $postVar, true);
     } else {
         require_once 'Services/Form/classes/class.ilTextAreaInputGUI.php';
         require_once 'Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php';
         $property = new ilTextAreaInputGUI($label, $postVar);
         $property->setRequired(false);
         $property->setRows(10);
         $property->setCols(80);
         if (!$this->questionOBJ->getPreventRteUsage()) {
             $property->setUseRte(true);
             $property->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment"));
             $property->addPlugin("latex");
             $property->addButton("latex");
             $property->addButton("pastelatex");
         }
         $property->setRTESupport($this->questionOBJ->getId(), "qpl", "assessment");
     }
     return $property;
 }
Example #18
0
 /**
  * Init survey settings form
  * 
  * @return ilPropertyFormGUI
  */
 function initPropertiesForm()
 {
     $template_settings = $hide_rte_switch = null;
     $template = $this->object->getTemplate();
     if ($template) {
         include_once "Services/Administration/classes/class.ilSettingsTemplate.php";
         $template = new ilSettingsTemplate($template);
         $template_settings = $template->getSettings();
         $hide_rte_switch = $template_settings["rte_switch"]["hide"];
     }
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTableWidth("100%");
     $form->setId("survey_properties");
     // general properties
     $header = new ilFormSectionHeaderGUI();
     $header->setTitle($this->lng->txt("settings"));
     $form->addItem($header);
     // title & description (meta data)
     include_once 'Services/MetaData/classes/class.ilMD.php';
     $md_obj = new ilMD($this->object->getId(), 0, "svy");
     $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);
     }
     // pool usage
     $pool_usage = new ilRadioGroupInputGUI($this->lng->txt("survey_question_pool_usage"), "use_pool");
     $opt = new ilRadioOption($this->lng->txt("survey_question_pool_usage_active"), 1);
     $opt->setInfo($this->lng->txt("survey_question_pool_usage_active_info"));
     $pool_usage->addOption($opt);
     $opt = new ilRadioOption($this->lng->txt("survey_question_pool_usage_inactive"), 0);
     $opt->setInfo($this->lng->txt("survey_question_pool_usage_inactive_info"));
     $pool_usage->addOption($opt);
     $pool_usage->setValue($this->object->getPoolUsage());
     $form->addItem($pool_usage);
     // 360°: appraisees
     if ($this->object->get360Mode()) {
         $self_eval = new ilCheckboxInputGUI($this->lng->txt("survey_360_self_evaluation"), "self_eval");
         $self_eval->setInfo($this->lng->txt("survey_360_self_evaluation_info"));
         $self_eval->setChecked($this->object->get360SelfEvaluation());
         $form->addItem($self_eval);
         $self_rate = new ilCheckboxInputGUI($this->lng->txt("survey_360_self_raters"), "self_rate");
         $self_rate->setInfo($this->lng->txt("survey_360_self_raters_info"));
         $self_rate->setChecked($this->object->get360SelfRaters());
         $form->addItem($self_rate);
         $self_appr = new ilCheckboxInputGUI($this->lng->txt("survey_360_self_appraisee"), "self_appr");
         $self_appr->setInfo($this->lng->txt("survey_360_self_appraisee_info"));
         $self_appr->setChecked($this->object->get360SelfAppraisee());
         $form->addItem($self_appr);
     }
     // activation
     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->object->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->setInfo($this->lng->txt('svy_activation_online_info') . $act_obj_info);
     $online->setChecked($this->object->isOnline());
     $form->addItem($online);
     $act_type = new ilCheckboxInputGUI($this->lng->txt('rep_visibility_until'), 'access_type');
     // $act_type->setInfo($this->lng->txt('svy_availability_until_info'));
     $act_type->setChecked($this->object->isActivationLimited());
     $this->tpl->addJavaScript('./Services/Form/js/date_duration.js');
     include_once "Services/Form/classes/class.ilDateDurationInputGUI.php";
     $dur = new ilDateDurationInputGUI($this->lng->txt('rep_time_period'), "access_period");
     $dur->setShowTime(true);
     $date = $this->object->getActivationStartDate();
     $dur->setStart(new ilDateTime($date ? $date : time(), IL_CAL_UNIX));
     $dur->setStartText($this->lng->txt('rep_activation_limited_start'));
     $date = $this->object->getActivationEndDate();
     $dur->setEnd(new ilDateTime($date ? $date : time(), IL_CAL_UNIX));
     $dur->setEndText($this->lng->txt('rep_activation_limited_end'));
     $act_type->addSubItem($dur);
     $visible = new ilCheckboxInputGUI($this->lng->txt('rep_activation_limited_visibility'), 'access_visiblity');
     $visible->setInfo($this->lng->txt('svy_activation_limited_visibility_info'));
     $visible->setChecked($this->object->getActivationVisibility());
     $act_type->addSubItem($visible);
     $form->addItem($act_type);
     // before start
     $section = new ilFormSectionHeaderGUI();
     $section->setTitle($this->lng->txt('svy_settings_section_before_start'));
     $form->addItem($section);
     // introduction
     $intro = new ilTextAreaInputGUI($this->lng->txt("introduction"), "introduction");
     $intro->setValue($this->object->prepareTextareaOutput($this->object->getIntroduction()));
     $intro->setRows(10);
     $intro->setCols(80);
     $intro->setUseRte(TRUE);
     $intro->setInfo($this->lng->txt("survey_introduction_info"));
     include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
     $intro->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey"));
     $intro->addPlugin("latex");
     $intro->addButton("latex");
     $intro->addButton("pastelatex");
     $intro->setRTESupport($this->object->getId(), "svy", "survey", null, $hide_rte_switch);
     $form->addItem($intro);
     // access
     $section = new ilFormSectionHeaderGUI();
     $section->setTitle($this->lng->txt('svy_settings_section_access'));
     $form->addItem($section);
     // enable start date
     $start = $this->object->getStartDate();
     $enablestartingtime = new ilCheckboxInputGUI($this->lng->txt("start_date"), "enabled_start_date");
     $enablestartingtime->setValue(1);
     // $enablestartingtime->setOptionTitle($this->lng->txt("enabled"));
     $enablestartingtime->setChecked($start);
     // start date
     $startingtime = new ilDateTimeInputGUI('', 'start_date');
     $startingtime->setShowTime(true);
     if ($start) {
         $startingtime->setDate(new ilDate($start, IL_CAL_TIMESTAMP));
     }
     $enablestartingtime->addSubItem($startingtime);
     $form->addItem($enablestartingtime);
     // enable end date
     $end = $this->object->getEndDate();
     $enableendingtime = new ilCheckboxInputGUI($this->lng->txt("end_date"), "enabled_end_date");
     $enableendingtime->setValue(1);
     // $enableendingtime->setOptionTitle($this->lng->txt("enabled"));
     $enableendingtime->setChecked($end);
     // end date
     $endingtime = new ilDateTimeInputGUI('', 'end_date');
     $endingtime->setShowTime(true);
     if ($end) {
         $endingtime->setDate(new ilDate($end, IL_CAL_TIMESTAMP));
     }
     $enableendingtime->addSubItem($endingtime);
     $form->addItem($enableendingtime);
     // anonymization
     if (!$this->object->get360Mode()) {
         $codes = new ilCheckboxInputGUI($this->lng->txt("survey_access_codes"), "acc_codes");
         $codes->setInfo($this->lng->txt("survey_access_codes_info"));
         $codes->setChecked(!$this->object->isAccessibleWithoutCode());
         $form->addItem($codes);
         if ($this->object->_hasDatasets($this->object->getSurveyId())) {
             $codes->setDisabled(true);
         }
     }
     // question behaviour
     $section = new ilFormSectionHeaderGUI();
     $section->setTitle($this->lng->txt('svy_settings_section_question_behaviour'));
     $form->addItem($section);
     // show question titles
     $show_question_titles = new ilCheckboxInputGUI($this->lng->txt("svy_show_questiontitles"), "show_question_titles");
     $show_question_titles->setValue(1);
     $show_question_titles->setChecked($this->object->getShowQuestionTitles());
     $form->addItem($show_question_titles);
     // finishing
     $info = new ilFormSectionHeaderGUI();
     $info->setTitle($this->lng->txt("svy_settings_section_finishing"));
     $form->addItem($info);
     $view_own = new ilCheckboxInputGUI($this->lng->txt("svy_results_view_own"), "view_own");
     $view_own->setInfo($this->lng->txt("svy_results_view_own_info"));
     $view_own->setChecked($this->object->hasViewOwnResults());
     $form->addItem($view_own);
     $mail_own = new ilCheckboxInputGUI($this->lng->txt("svy_results_mail_own"), "mail_own");
     $mail_own->setInfo($this->lng->txt("svy_results_mail_own_info"));
     $mail_own->setChecked($this->object->hasMailOwnResults());
     $form->addItem($mail_own);
     // final statement
     $finalstatement = new ilTextAreaInputGUI($this->lng->txt("outro"), "outro");
     $finalstatement->setValue($this->object->prepareTextareaOutput($this->object->getOutro()));
     $finalstatement->setRows(10);
     $finalstatement->setCols(80);
     $finalstatement->setUseRte(TRUE);
     $finalstatement->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey"));
     $finalstatement->addPlugin("latex");
     $finalstatement->addButton("latex");
     $finalstatement->addButton("pastelatex");
     $finalstatement->setRTESupport($this->object->getId(), "svy", "survey", null, $hide_rte_switch);
     $form->addItem($finalstatement);
     // mail notification
     $mailnotification = new ilCheckboxInputGUI($this->lng->txt("mailnotification"), "mailnotification");
     // $mailnotification->setOptionTitle($this->lng->txt("activate"));
     $mailnotification->setInfo($this->lng->txt("svy_result_mail_notification_info"));
     // #11762
     $mailnotification->setValue(1);
     $mailnotification->setChecked($this->object->getMailNotification());
     // addresses
     $mailaddresses = new ilTextInputGUI($this->lng->txt("mailaddresses"), "mailaddresses");
     $mailaddresses->setValue($this->object->getMailAddresses());
     $mailaddresses->setSize(80);
     $mailaddresses->setInfo($this->lng->txt('mailaddresses_info'));
     $mailaddresses->setRequired(true);
     // participant data
     $participantdata = new ilTextAreaInputGUI($this->lng->txt("mailparticipantdata"), "mailparticipantdata");
     $participantdata->setValue($this->object->getMailParticipantData());
     $participantdata->setRows(6);
     $participantdata->setCols(80);
     $participantdata->setUseRte(false);
     $participantdata->setInfo($this->lng->txt("mailparticipantdata_info"));
     // #12755 - because of privacy concerns we restrict user data to a minimum
     $placeholders = array("FIRST_NAME" => "firstname", "LAST_NAME" => "lastname", "LOGIN" => "login");
     $txt = array();
     foreach ($placeholders as $placeholder => $caption) {
         $txt[] = "[" . strtoupper($placeholder) . "]: " . $this->lng->txt($caption);
     }
     $txt = implode("<br />", $txt);
     $participantdatainfo = new ilNonEditableValueGUI($this->lng->txt("mailparticipantdata_placeholder"), "", true);
     $participantdatainfo->setValue($txt);
     $mailnotification->addSubItem($mailaddresses);
     $mailnotification->addSubItem($participantdata);
     $mailnotification->addSubItem($participantdatainfo);
     $form->addItem($mailnotification);
     // tutor notification - currently not available for 360°
     if (!$this->object->get360Mode()) {
         // parent course?
         global $tree;
         $has_parent = $tree->checkForParentType($this->object->getRefId(), "grp");
         if (!$has_parent) {
             $has_parent = $tree->checkForParentType($this->object->getRefId(), "crs");
         }
         $num_inv = sizeof($this->object->getInvitedUsers());
         // notification
         $tut = new ilCheckboxInputGUI($this->lng->txt("survey_notification_tutor_setting"), "tut");
         $tut->setChecked($this->object->getTutorNotificationStatus());
         $form->addItem($tut);
         $tut_logins = array();
         $tuts = $this->object->getTutorNotificationRecipients();
         if ($tuts) {
             foreach ($tuts as $tut_id) {
                 $tmp = ilObjUser::_lookupName($tut_id);
                 if ($tmp["login"]) {
                     $tut_logins[] = $tmp["login"];
                 }
             }
         }
         $tut_ids = new ilTextInputGUI($this->lng->txt("survey_notification_tutor_recipients"), "tut_ids");
         $tut_ids->setDataSource($this->ctrl->getLinkTarget($this, "doAutoComplete", "", true));
         $tut_ids->setRequired(true);
         $tut_ids->setMulti(true);
         $tut_ids->setMultiValues($tut_logins);
         $tut_ids->setValue(array_shift($tut_logins));
         $tut->addSubItem($tut_ids);
         $tut_grp = new ilRadioGroupInputGUI($this->lng->txt("survey_notification_target_group"), "tut_grp");
         $tut_grp->setRequired(true);
         $tut_grp->setValue($this->object->getTutorNotificationTarget());
         $tut->addSubItem($tut_grp);
         $tut_grp_crs = new ilRadioOption($this->lng->txt("survey_notification_target_group_parent_course"), ilObjSurvey::NOTIFICATION_PARENT_COURSE);
         if (!$has_parent) {
             $tut_grp_crs->setInfo($this->lng->txt("survey_notification_target_group_parent_course_inactive"));
         }
         $tut_grp->addOption($tut_grp_crs);
         $tut_grp_inv = new ilRadioOption($this->lng->txt("survey_notification_target_group_invited"), ilObjSurvey::NOTIFICATION_INVITED_USERS);
         $tut_grp_inv->setInfo(sprintf($this->lng->txt("survey_notification_target_group_invited_info"), $num_inv));
         $tut_grp->addOption($tut_grp_inv);
     }
     // reminders
     // reminder - currently not available for 360°
     if (!$this->object->get360Mode()) {
         $info = new ilFormSectionHeaderGUI();
         $info->setTitle($this->lng->txt("svy_settings_section_reminders"));
         $form->addItem($info);
         $rmd = new ilCheckboxInputGUI($this->lng->txt("survey_reminder_setting"), "rmd");
         $rmd->setChecked($this->object->getReminderStatus());
         $form->addItem($rmd);
         $rmd_start = new ilDateTimeInputGUI($this->lng->txt("survey_reminder_start"), "rmd_start");
         $rmd_start->setRequired(true);
         $start = $this->object->getReminderStart();
         if ($start) {
             $rmd_start->setDate($start);
         }
         $rmd->addSubItem($rmd_start);
         $end = $this->object->getReminderEnd();
         $rmd_end = new ilDateTimeInputGUI($this->lng->txt("survey_reminder_end"), "rmd_end");
         $rmd_end->enableDateActivation("", "rmd_end_tgl", (bool) $end);
         if ($end) {
             $rmd_end->setDate($end);
         }
         $rmd->addSubItem($rmd_end);
         $rmd_freq = new ilNumberInputGUI($this->lng->txt("survey_reminder_frequency"), "rmd_freq");
         $rmd_freq->setRequired(true);
         $rmd_freq->setSize(3);
         $rmd_freq->setSuffix($this->lng->txt("survey_reminder_frequency_days"));
         $rmd_freq->setValue($this->object->getReminderFrequency());
         $rmd_freq->setMinValue(1);
         $rmd->addSubItem($rmd_freq);
         $rmd_grp = new ilRadioGroupInputGUI($this->lng->txt("survey_notification_target_group"), "rmd_grp");
         $rmd_grp->setRequired(true);
         $rmd_grp->setValue($this->object->getReminderTarget());
         $rmd->addSubItem($rmd_grp);
         $rmd_grp_crs = new ilRadioOption($this->lng->txt("survey_notification_target_group_parent_course"), ilObjSurvey::NOTIFICATION_PARENT_COURSE);
         if (!$has_parent) {
             $rmd_grp_crs->setInfo($this->lng->txt("survey_notification_target_group_parent_course_inactive"));
         }
         $rmd_grp->addOption($rmd_grp_crs);
         $rmd_grp_inv = new ilRadioOption($this->lng->txt("survey_notification_target_group_invited"), ilObjSurvey::NOTIFICATION_INVITED_USERS);
         $rmd_grp_inv->setInfo(sprintf($this->lng->txt("survey_notification_target_group_invited_info"), $num_inv));
         $rmd_grp->addOption($rmd_grp_inv);
     }
     // results
     $results = new ilFormSectionHeaderGUI();
     $results->setTitle($this->lng->txt("results"));
     $form->addItem($results);
     // evaluation access
     if (!$this->object->get360Mode()) {
         $evaluation_access = new ilRadioGroupInputGUI($this->lng->txt('evaluation_access'), "evaluation_access");
         $option = new ilCheckboxOption($this->lng->txt("evaluation_access_off"), ilObjSurvey::EVALUATION_ACCESS_OFF, '');
         $option->setInfo($this->lng->txt("svy_evaluation_access_off_info"));
         $evaluation_access->addOption($option);
         $option = new ilCheckboxOption($this->lng->txt("evaluation_access_all"), ilObjSurvey::EVALUATION_ACCESS_ALL, '');
         $option->setInfo($this->lng->txt("svy_evaluation_access_all_info"));
         $evaluation_access->addOption($option);
         $option = new ilCheckboxOption($this->lng->txt("evaluation_access_participants"), ilObjSurvey::EVALUATION_ACCESS_PARTICIPANTS, '');
         $option->setInfo($this->lng->txt("svy_evaluation_access_participants_info"));
         $evaluation_access->addOption($option);
         $evaluation_access->setValue($this->object->getEvaluationAccess());
         $form->addItem($evaluation_access);
         $anonymization_options = new ilRadioGroupInputGUI($this->lng->txt("survey_results_anonymization"), "anonymization_options");
         $option = new ilCheckboxOption($this->lng->txt("survey_results_personalized"), "statpers");
         $option->setInfo($this->lng->txt("survey_results_personalized_info"));
         $anonymization_options->addOption($option);
         $option = new ilCheckboxOption($this->lng->txt("survey_results_anonymized"), "statanon");
         $option->setInfo($this->lng->txt("survey_results_anonymized_info"));
         $anonymization_options->addOption($option);
         $anonymization_options->setValue($this->object->hasAnonymizedResults() ? "statanon" : "statpers");
         $form->addItem($anonymization_options);
         if ($this->object->_hasDatasets($this->object->getSurveyId())) {
             $anonymization_options->setDisabled(true);
         }
     } else {
         $ts_results = new ilRadioGroupInputGUI($this->lng->txt("survey_360_results"), "ts_res");
         $ts_results->setValue($this->object->get360Results());
         $option = new ilRadioOption($this->lng->txt("survey_360_results_none"), ilObjSurvey::RESULTS_360_NONE);
         $option->setInfo($this->lng->txt("survey_360_results_none_info"));
         $ts_results->addOption($option);
         $option = new ilRadioOption($this->lng->txt("survey_360_results_own"), ilObjSurvey::RESULTS_360_OWN);
         $option->setInfo($this->lng->txt("survey_360_results_own_info"));
         $ts_results->addOption($option);
         $option = new ilRadioOption($this->lng->txt("survey_360_results_all"), ilObjSurvey::RESULTS_360_ALL);
         $option->setInfo($this->lng->txt("survey_360_results_all_info"));
         $ts_results->addOption($option);
         $form->addItem($ts_results);
     }
     // competence service activation for 360 mode
     include_once "./Services/Skill/classes/class.ilSkillManagementSettings.php";
     $skmg_set = new ilSkillManagementSettings();
     if ($this->object->get360Mode() && $skmg_set->isActivated()) {
         $other = new ilFormSectionHeaderGUI();
         $other->setTitle($this->lng->txt("other"));
         $form->addItem($other);
         $skill_service = new ilCheckboxInputGUI($this->lng->txt("survey_activate_skill_service"), "skill_service");
         $skill_service->setInfo($this->lng->txt("survey_activate_skill_service_info"));
         $skill_service->setChecked($this->object->get360SkillService());
         $form->addItem($skill_service);
     }
     $form->addCommandButton("saveProperties", $this->lng->txt("save"));
     // remove items when using template
     if ($template_settings) {
         foreach ($template_settings as $id => $item) {
             if ($item["hide"]) {
                 $form->removeItemByPostVar($id);
             }
         }
     }
     return $form;
 }
 private function getElementsUsedForAdvancedEditing()
 {
     include_once 'Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php';
     return ilObjAdvancedEditing::_getUsedHTMLTags(self::TYPE);
 }
 /**
  * Creates the output of the feedback page for a single choice question
  *
  * @access public
  */
 function feedback($checkonly = false)
 {
     $save = strcmp($this->ctrl->getCmd(), "saveFeedback") == 0 ? TRUE : FALSE;
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTitle($this->lng->txt('feedback_answers'));
     $form->setTableWidth("100%");
     $form->setId("feedback");
     $complete = new ilTextAreaInputGUI($this->lng->txt("feedback_complete_solution"), "feedback_complete");
     $complete->setValue($this->object->prepareTextareaOutput($this->object->getFeedbackGeneric(1)));
     $complete->setRequired(falsse);
     $complete->setRows(10);
     $complete->setCols(80);
     $complete->setUseRte(true);
     include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
     $complete->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment"));
     $complete->addPlugin("latex");
     $complete->addButton("latex");
     $complete->addButton("pastelatex");
     $complete->setRTESupport($this->object->getId(), "qpl", "assessment");
     $form->addItem($complete);
     $incomplete = new ilTextAreaInputGUI($this->lng->txt("feedback_incomplete_solution"), "feedback_incomplete");
     $incomplete->setValue($this->object->prepareTextareaOutput($this->object->getFeedbackGeneric(0)));
     $incomplete->setRequired(false);
     $incomplete->setRows(10);
     $incomplete->setCols(80);
     $incomplete->setUseRte(true);
     include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
     $incomplete->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment"));
     $incomplete->addPlugin("latex");
     $incomplete->addButton("latex");
     $incomplete->addButton("pastelatex");
     $incomplete->setRTESupport($this->object->getId(), "qpl", "assessment");
     $form->addItem($incomplete);
     if (!$this->getSelfAssessmentEditingMode()) {
         foreach ($this->object->answers as $index => $answer) {
             $answerobj = new ilTextAreaInputGUI($this->object->prepareTextareaOutput($answer->getAnswertext(), true), "feedback_answer_{$index}");
             $answerobj->setValue($this->object->prepareTextareaOutput($this->object->getFeedbackSyntaxTree($index)));
             $answerobj->setRequired(false);
             $answerobj->setRows(10);
             $answerobj->setCols(80);
             $answerobj->setUseRte(true);
             include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
             $answerobj->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment"));
             $answerobj->addPlugin("latex");
             $answerobj->addButton("latex");
             $answerobj->addButton("pastelatex");
             $answerobj->setRTESupport($this->object->getId(), "qpl", "assessment");
             $form->addItem($answerobj);
         }
     }
     $form->addCommandButton("saveFeedback", $this->lng->txt("save"));
     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 (!$checkonly) {
         $this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
     }
     return $errors;
 }
 /**
  * Creates the output of the feedback page for a single choice question
  *
  * @access public
  */
 function feedback($checkonly = false)
 {
     $save = strcmp($this->ctrl->getCmd(), "saveFeedback") == 0 ? TRUE : FALSE;
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTitle($this->lng->txt('feedback_answers'));
     $form->setTableWidth("98%");
     $form->setId("feedback");
     $complete = new ilTextAreaInputGUI($this->lng->txt("feedback_complete_solution"), "feedback_complete");
     $complete->setValue($this->object->prepareTextareaOutput($this->object->getFeedbackGeneric(1)));
     $complete->setRequired(false);
     $complete->setRows(10);
     $complete->setCols(80);
     if (!$this->getPreventRteUsage()) {
         $complete->setUseRte(true);
     }
     include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
     $complete->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment"));
     $complete->addPlugin("latex");
     $complete->addButton("latex");
     $complete->addButton("pastelatex");
     $complete->setRTESupport($this->object->getId(), "qpl", "assessment", null, false, '3.4.7');
     $form->addItem($complete);
     $incomplete = new ilTextAreaInputGUI($this->lng->txt("feedback_incomplete_solution"), "feedback_incomplete");
     $incomplete->setValue($this->object->prepareTextareaOutput($this->object->getFeedbackGeneric(0)));
     $incomplete->setRequired(false);
     $incomplete->setRows(10);
     $incomplete->setCols(80);
     if (!$this->getPreventRteUsage()) {
         $incomplete->setUseRte(true);
     }
     include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
     $incomplete->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment"));
     $incomplete->addPlugin("latex");
     $incomplete->addButton("latex");
     $incomplete->addButton("pastelatex");
     $incomplete->setRTESupport($this->object->getId(), "qpl", "assessment", null, false, '3.4.7');
     $form->addItem($incomplete);
     if (!$this->getSelfAssessmentEditingMode()) {
         foreach ($this->object->getErrorData() as $index => $answer) {
             $caption = $ordinal = $index + 1;
             $caption .= '. <br />"' . $answer->text_wrong . '" =&gt; ';
             $caption .= '"' . $answer->text_correct . '"';
             $caption .= '</i>';
             $answerobj = new ilTextAreaInputGUI($this->object->prepareTextareaOutput($caption, true), "feedback_answer_{$index}");
             $answerobj->setValue($this->object->prepareTextareaOutput($this->object->getFeedbackSingleAnswer($index)));
             $answerobj->setRequired(false);
             $answerobj->setRows(10);
             $answerobj->setCols(80);
             $answerobj->setUseRte(true);
             include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
             $answerobj->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment"));
             $answerobj->addPlugin("latex");
             $answerobj->addButton("latex");
             $answerobj->addButton("pastelatex");
             $answerobj->setRTESupport($this->object->getId(), "qpl", "assessment", null, false, '3.4.7');
             $form->addItem($answerobj);
         }
     }
     global $ilAccess;
     if ($ilAccess->checkAccess("write", "", $_GET['ref_id']) || $this->getSelfAssessmentEditingMode()) {
         $form->addCommandButton("saveFeedback", $this->lng->txt("save"));
     }
     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 (!$checkonly) {
         $this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
     }
     return $errors;
 }
 /**
  * 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'));
     $columns->setCategoryText($this->lng->txt('matrix_standard_answers'));
     $columns->setShowSavePhrase(true);
     if (!$this->object->getColumnCount()) {
         $this->object->columns->addCategory("");
     }
     $columns->setValues($this->object->getColumns());
     $form->addItem($columns);
     $header = new ilFormSectionHeaderGUI();
     $header->setTitle($this->lng->txt("matrix_column_settings"));
     $form->addItem($header);
     // bipolar adjectives
     $bipolar = new ilCustomInputGUI($this->lng->txt("matrix_bipolar_adjectives"));
     $bipolar->setInfo($this->lng->txt("matrix_bipolar_adjectives_description"));
     // left pole
     $bipolar1 = new ilTextInputGUI($this->lng->txt("matrix_left_pole"), "bipolar1");
     $bipolar1->setValue($this->object->getBipolarAdjective(0));
     $bipolar1->setRequired(false);
     $bipolar->addSubItem($bipolar1);
     // right pole
     $bipolar2 = new ilTextInputGUI($this->lng->txt("matrix_right_pole"), "bipolar2");
     $bipolar2->setValue($this->object->getBipolarAdjective(1));
     $bipolar2->setRequired(false);
     $bipolar->addSubItem($bipolar2);
     $form->addItem($bipolar);
     $header = new ilFormSectionHeaderGUI();
     $header->setTitle($this->lng->txt("matrix_rows"));
     $form->addItem($header);
     // matrix rows
     include_once "./Modules/SurveyQuestionPool/classes/class.ilMatrixRowWizardInputGUI.php";
     $rows = new ilMatrixRowWizardInputGUI("", "rows");
     $rows->setRequired(false);
     $rows->setAllowMove(true);
     $rows->setLabelText($this->lng->txt('label'));
     $rows->setUseOtherAnswer(true);
     if ($this->object->getRowCount() == 0) {
         $this->object->getRows()->addCategory("");
     }
     $rows->setValues($this->object->getRows());
     $form->addItem($rows);
     $this->addCommandButtons($form);
     $errors = false;
     if ($this->isSaveCommand(array("wizardcolumns", "savePhrasecolumns"))) {
         $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("ADM_CONTENT", $form->getHTML());
     }
     return $errors;
 }
 /**
  * FORM HtmlBlock: Get current values for HtmlBlock form.
  *
  */
 public function getValuesHtmlBlock()
 {
     $values = array();
     switch ($this->getFormEditMode()) {
         case IL_FORM_CREATE:
             $values["Title"] = "";
             $values["Content"] = "";
             break;
         case IL_FORM_EDIT:
             $values["Title"] = $this->html_block->getTitle();
             $values["Content"] = $this->html_block->getContent();
             break;
         case IL_FORM_RE_EDIT:
         case IL_FORM_RE_CREATE:
             $values["Title"] = ilUtil::stripSlashes($_POST["block_title"]);
             $values["Content"] = ilUtil::stripSlashes($_POST["block_content"], true, ilObjAdvancedEditing::_getUsedHTMLTagsAsString());
             break;
     }
     return $values;
 }
Example #24
0
 /**
  * Adds support for an RTE in an ILIAS form
  *
  * Adds support for an RTE in an ILIAS form
  *
  * @param string $a_module Module or object which should use the HTML tags
  * @access public
  */
 function addRTESupport($obj_id, $obj_type, $a_module = "", $allowFormElements = FALSE, $cfg_template = null, $hide_switch = false)
 {
     global $ilBrowser;
     include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
     /*
     if (array_key_exists("show_rte", $_POST))
     {
     	ilObjAdvancedEditing::_setRichTextEditorUserState($_POST["show_rte"]);
     }
     */
     if ($ilBrowser->isMobile()) {
         ilObjAdvancedEditing::_setRichTextEditorUserState(0);
     } else {
         ilObjAdvancedEditing::_setRichTextEditorUserState(1);
     }
     include_once "./Services/UICore/classes/class.ilTemplate.php";
     if (ilObjAdvancedEditing::_getRichTextEditorUserState() != 0 && strcmp(ilObjAdvancedEditing::_getRichTextEditor(), "0") != 0) {
         $tpl = new ilTemplate($cfg_template === null ? "tpl.tinymce.html" : $cfg_template, true, true, "Services/RTE");
         $this->handleImgContextMenuItem($tpl);
         $tags =& ilObjAdvancedEditing::_getUsedHTMLTags($a_module);
         if ($allowFormElements) {
             $tpl->touchBlock("formelements");
         }
         $tpl->setCurrentBlock("tinymce");
         $tpl->setVariable("JAVASCRIPT_LOCATION", "./Services/RTE/tiny_mce" . $this->vd . "/tiny_mce.js");
         include_once "./Services/Object/classes/class.ilObject.php";
         $tpl->setVariable("OBJ_ID", $obj_id);
         $tpl->setVariable("OBJ_TYPE", $obj_type);
         $tpl->setVariable("CLIENT_ID", CLIENT_ID);
         $tpl->setVariable("SESSION_ID", $_COOKIE["PHPSESSID"]);
         $tpl->setVariable("BLOCKFORMATS", $this->_buildAdvancedBlockformatsFromHTMLTags($tags));
         $tpl->setVariable("VALID_ELEMENTS", $this->_getValidElementsFromHTMLTags($tags));
         $buttons_1 = $this->_buildAdvancedButtonsFromHTMLTags(1, $tags);
         $buttons_2 = $this->_buildAdvancedButtonsFromHTMLTags(2, $tags) . ',' . $this->_buildAdvancedTableButtonsFromHTMLTags($tags) . ($this->getStyleSelect() ? ',styleselect' : '');
         $buttons_3 = $this->_buildAdvancedButtonsFromHTMLTags(3, $tags);
         $tpl->setVariable('BUTTONS_1', self::_removeRedundantSeparators($buttons_1));
         $tpl->setVariable('BUTTONS_2', self::_removeRedundantSeparators($buttons_2));
         $tpl->setVariable('BUTTONS_3', self::_removeRedundantSeparators($buttons_3));
         $tpl->setVariable("ADDITIONAL_PLUGINS", join(",", $this->plugins));
         include_once "./Services/Utilities/classes/class.ilUtil.php";
         //$tpl->setVariable("STYLESHEET_LOCATION", $this->getContentCSS());
         $tpl->setVariable("STYLESHEET_LOCATION", ilUtil::getNewContentStyleSheetLocation() . "," . ilUtil::getStyleSheetLocation("output", "delos.css"));
         $tpl->setVariable("LANG", $this->_getEditorLanguage());
         if ($this->getRTERootBlockElement() !== null) {
             $tpl->setVariable('FORCED_ROOT_BLOCK', $this->getRTERootBlockElement());
         }
         $tpl->parseCurrentBlock();
         $this->tpl->setVariable("CONTENT_BLOCK", $tpl->get());
     }
     /*
     if (!$hide_switch && strcmp(ilObjAdvancedEditing::_getRichTextEditor(), "0") != 0)
     {
     	$tpl = new ilTemplate("tpl.rte.switch.html", true, true, "Services/RTE");
     	$tpl->setVariable("FORMACTION", $this->ctrl->getFormActionByClass($this->ctrl->getCmdClass()), $this->ctrl->getCmd());
     	$tpl->setVariable("TEXT_SET_MODE", $this->lng->txt("set_edit_mode"));
     	$tpl->setVariable("TEXT_ENABLED", $this->lng->txt("rte_editor_enabled"));
     	$tpl->setVariable("TEXT_DISABLED", $this->lng->txt("rte_editor_disabled"));
     	if (ilObjAdvancedEditing::_getRichTextEditorUserState() != 0)
     	{
     		$tpl->setVariable("SELECTED_ENABLED", " selected=\"selected\"");
     	}
     	$tpl->setVariable("BTN_COMMAND", $this->ctrl->getCmd());
     	
     	$this->tpl->setVariable("RTE_SWITCH", $tpl->get());
     }
     */
 }
 /**
  * builds the questions hints form
  * 
  * @access	private
  * @global	ilCtrl				$ilCtrl
  * @global	ilLanguage			$lng
  * @return	ilPropertyFormGUI	$form
  */
 private function buildForm(ilAssQuestionHint $questionHint = null)
 {
     global $ilCtrl, $lng;
     require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
     require_once 'Services/Form/classes/class.ilTextAreaInputGUI.php';
     require_once 'Services/Form/classes/class.ilNumberInputGUI.php';
     require_once 'Services/Form/classes/class.ilHiddenInputGUI.php';
     $form = new ilPropertyFormGUI();
     $form->setTableWidth('100%');
     if (!$this->questionOBJ->isAdditionalContentEditingModePageObject()) {
         // form input: hint text
         $areaInp = new ilTextAreaInputGUI($lng->txt('tst_question_hints_form_label_hint_text'), 'hint_text');
         $areaInp->setRequired(true);
         $areaInp->setRows(10);
         $areaInp->setCols(80);
         if (!$this->questionOBJ->getPreventRteUsage()) {
             $areaInp->setUseRte(true);
         }
         include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
         $areaInp->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment"));
         $areaInp->setRTESupport($this->questionOBJ->getId(), 'qpl', 'assessment');
         $areaInp->addPlugin("latex");
         $areaInp->addButton("latex");
         $areaInp->addButton("pastelatex");
         $form->addItem($areaInp);
     }
     // form input: hint points
     $numInp = new ilNumberInputGUI($lng->txt('tst_question_hints_form_label_hint_points'), 'hint_points');
     $numInp->allowDecimals(true);
     $numInp->setRequired(true);
     $numInp->setSize(3);
     $form->addItem($numInp);
     if ($questionHint instanceof ilAssQuestionHint) {
         // build form title for an existing hint
         $form->setTitle(sprintf($lng->txt('tst_question_hints_form_header_edit'), $questionHint->getIndex(), $this->questionOBJ->getTitle()));
         // hidden input: hint id
         $hiddenInp = new ilHiddenInputGUI('hint_id');
         $form->addItem($hiddenInp);
         // init values
         require_once 'Services/Utilities/classes/class.ilUtil.php';
         if (!$this->questionOBJ->isAdditionalContentEditingModePageObject()) {
             $areaInp->setValue(ilUtil::prepareTextareaOutput($questionHint->getText(), true));
         }
         $numInp->setValue($questionHint->getPoints());
         $hiddenInp->setValue($questionHint->getId());
     } else {
         // build form title for a new hint
         $form->setTitle(sprintf($lng->txt('tst_question_hints_form_header_create'), $this->questionOBJ->getTitle()));
     }
     if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
         if ($questionHint instanceof ilAssQuestionHint) {
             $saveCmdLabel = $lng->txt('tst_question_hints_form_cmd_save_points');
         } else {
             $saveCmdLabel = $lng->txt('tst_question_hints_form_cmd_save_points_and_edit_page');
         }
     } else {
         $saveCmdLabel = $lng->txt('tst_question_hints_form_cmd_save');
     }
     $form->setFormAction($ilCtrl->getFormAction($this));
     $form->addCommandButton(self::CMD_CANCEL_FORM, $lng->txt('cancel'));
     $form->addCommandButton(self::CMD_SAVE_FORM, $saveCmdLabel);
     return $form;
 }
Example #26
0
 public static function _getRTEClassname()
 {
     include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
     $editor = ilObjAdvancedEditing::_getRichTextEditor();
     switch ($editor) {
         case "tinymce":
             return "ilTinyMCE";
             break;
         default:
             return "ilRTE";
             break;
     }
 }
 /**
  * render questions per page
  */
 protected function renderPage()
 {
     global $ilCtrl, $lng, $tpl, $rbacsystem;
     $pages = $this->object->getSurveyPages();
     $this->has_next_page = $this->current_page < sizeof($pages);
     $this->has_previous_page = $this->current_page > 1;
     $this->has_datasets = $this->object->_hasDatasets($this->object->getSurveyId());
     if ($this->has_datasets) {
         $link = $ilCtrl->getLinkTargetByClass(array("ilobjsurveygui", "ilsurveyparticipantsgui"), "maintenance");
         $link = "<a href=\"" . $link . "\">" . $lng->txt("survey_has_datasets_warning_page_view_link") . "</a>";
         ilUtil::sendInfo($lng->txt("survey_has_datasets_warning_page_view") . " " . $link);
     }
     $ilCtrl->setParameter($this, "pg", $this->current_page);
     $ilCtrl->setParameter($this, "pgov", "");
     $this->renderToolbar($pages);
     if ($pages) {
         $ttpl = new ilTemplate("tpl.il_svy_svy_page_view.html", true, true, "Modules/Survey");
         $ttpl->setVariable("FORM_ACTION", $ilCtrl->getFormAction($this));
         $ttpl->setVariable("WYSIWYG_ACTION", $ilCtrl->getFormAction($this));
         $lng->loadLanguageModule("form");
         $read_only = $this->has_datasets || !$rbacsystem->checkAccess("write", $this->ref_id);
         $commands = $multi_commands = array();
         if (!$read_only) {
             // clipboard is empty
             if (!$_SESSION["survey_page_view"][$this->ref_id]["clipboard"]) {
                 $multi_commands[] = array("cmd" => "multiDelete", "text" => $lng->txt("delete"));
                 $multi_commands[] = array("cmd" => "multiCut", "text" => $lng->txt("cut"));
                 $multi_commands[] = array("cmd" => "multiCopy", "text" => $lng->txt("copy"));
             } else {
                 if (!$this->suppress_clipboard_msg) {
                     ilUtil::sendInfo($lng->txt("survey_clipboard_notice"));
                 }
                 $multi_commands[] = array("cmd" => "clearClipboard", "text" => $lng->txt("survey_dnd_clear_clipboard"));
             }
             // help
             $ttpl->setCurrentBlock("help_img");
             $ttpl->setVariable("IMG_HELP", ilUtil::getImagePath("streaked_area.png"));
             $ttpl->parseCurrentBlock();
             $ttpl->setCurrentBlock("help_section");
             $ttpl->setVariable("TXT_HELP", $lng->txt("form_hierarchy_add_elements"));
             $ttpl->parseCurrentBlock();
             $ttpl->setCurrentBlock("help_img");
             $ttpl->setVariable("IMG_HELP", ilUtil::getImagePath("icon_cont_el_s.png"));
             $ttpl->parseCurrentBlock();
             $ttpl->setVariable("IMG_HELP", ilUtil::getImagePath("drop_streaked_area.png"));
             $ttpl->parseCurrentBlock();
             $ttpl->setCurrentBlock("help_section");
             $ttpl->setVariable("TXT_HELP", $lng->txt("form_hierarchy_drag_drop_help"));
             $ttpl->parseCurrentBlock();
             $ttpl->setCurrentBlock("help_img");
             $ttpl->setVariable("IMG_HELP", ilUtil::getImagePath("icon_cont_el_s.png"));
             $ttpl->parseCurrentBlock();
             $ttpl->setCurrentBlock("help_section");
             $ttpl->setVariable("TXT_HELP", $lng->txt("survey_dnd_double_click_to_delete"));
             $ttpl->parseCurrentBlock();
             $ttpl->setVariable("DND_INIT_JS", "initDragElements();");
             // tiny mce
             include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
             $tags = ilObjAdvancedEditing::_getUsedHTMLTags("survey");
             include_once "./Services/RTE/classes/class.ilTinyMCE.php";
             $tiny = new ilTinyMCE("3.3.9.2");
             $ttpl->setVariable("WYSIWYG_BLOCKFORMATS", $tiny->_buildAdvancedBlockformatsFromHTMLTags($tags));
             $ttpl->setVariable("WYSIWYG_VALID_ELEMENTS", $tiny->_getValidElementsFromHTMLTags($tags));
             $buttons_1 = $tiny->_buildAdvancedButtonsFromHTMLTags(1, $tags);
             $buttons_2 = $tiny->_buildAdvancedButtonsFromHTMLTags(2, $tags) . ',' . $tiny->_buildAdvancedTableButtonsFromHTMLTags($tags) . ($tiny->getStyleSelect() ? ',styleselect' : '');
             $buttons_3 = $tiny->_buildAdvancedButtonsFromHTMLTags(3, $tags);
             $ttpl->setVariable('WYSIWYG_BUTTONS_1', $tiny->_removeRedundantSeparators($buttons_1));
             $ttpl->setVariable('WYSIWYG_BUTTONS_2', $tiny->_removeRedundantSeparators($buttons_2));
             $ttpl->setVariable('WYSIWYG_BUTTONS_3', $tiny->_removeRedundantSeparators($buttons_3));
         }
         // commands
         if (count($multi_commands) > 0 || count($commands) > 0) {
             $single = false;
             foreach ($commands as $cmd) {
                 $ttpl->setCurrentBlock("cmd");
                 $ttpl->setVariable("ORG_CMD", "renderPage");
                 $ttpl->setVariable("CMD", $cmd["cmd"]);
                 $ttpl->setVariable("CMD_TXT", $cmd["text"]);
                 $ttpl->parseCurrentBlock();
                 $single = true;
             }
             $multi = false;
             foreach ($multi_commands as $cmd) {
                 $ttpl->setCurrentBlock("multi_cmd");
                 $ttpl->setVariable("ORG_CMD_MULTI", "renderPage");
                 $ttpl->setVariable("MULTI_CMD", $cmd["cmd"]);
                 $ttpl->setVariable("MULTI_CMD_TXT", $cmd["text"]);
                 $ttpl->parseCurrentBlock();
                 $multi = true;
             }
             if ($multi) {
                 $ttpl->setCurrentBlock("multi_cmds");
                 $ttpl->setVariable("MCMD_ALT", $lng->txt("commands"));
                 $ttpl->setVariable("MCMD_IMG", ilUtil::getImagePath("arrow_downright.png"));
                 $ttpl->parseCurrentBlock();
             }
             if ($single || $multi) {
                 $ttpl->setCurrentBlock("commands");
                 $ttpl->parseCurrentBlock();
             }
         }
         // nodes
         $ttpl->setVariable("NODES", $this->getPageNodes($pages[$this->current_page - 1], $this->has_previous_page, $this->has_next_page, $read_only));
         $tpl->setContent($ttpl->get());
         // add js to template
         include_once "./Services/YUI/classes/class.ilYuiUtil.php";
         ilYuiUtil::initDragDrop();
         $tpl->addJavascript("./Modules/Survey/js/SurveyPageView.js");
         $tpl->addJavascript("./Services/RTE/tiny_mce_3_3_9_2/tiny_mce_src.js");
     }
 }
 public function saveHeadingObject()
 {
     $form = $this->initHeadingForm((int) $_REQUEST["q_id"]);
     if ($form->checkInput()) {
         include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
         $this->object->saveHeading(ilUtil::stripSlashes($form->getInput("heading"), true, ilObjAdvancedEditing::_getUsedHTMLTagsAsString("survey")), $form->getInput("insertbefore"));
         $this->ctrl->redirect($this, "questions");
     }
     $form->setValuesByPost();
     $this->addHeadingObject($form);
 }
 /**
  * Returns a string of all HTML tags
  *
  * Returns a string of all HTML tags
  *
  * @return string Used HTML tags
  */
 function _getAllHTMLTagsAsString()
 {
     $result = "";
     $tags =& ilObjAdvancedEditing::_getAllHTMLTags();
     foreach ($tags as $tag) {
         $result .= "<{$tag}>";
     }
     return $result;
 }
 /**
  * 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);
     $errors = false;
     if ($this->isSaveCommand()) {
         $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 ($nranswers->getValue() > $answers->getCategoryCount()) {
             $nrmaxanswers->setAlert($this->lng->txt('err_minvalueganswers'));
             if (!$errors) {
                 ilUtil::sendFailure($this->lng->txt('form_input_not_valid'));
             }
             $errors = true;
         }
         if ($nrmaxanswers->getValue() > 0 && ($nrmaxanswers->getValue() > $answers->getCategoryCount() || $nrmaxanswers->getValue() < $nranswers->getValue())) {
             $nrmaxanswers->setAlert($this->lng->txt('err_maxvaluegeminvalue'));
             if (!$errors) {
                 ilUtil::sendFailure($this->lng->txt('form_input_not_valid'));
             }
             $errors = true;
         }
         if ($errors) {
             $checkonly = false;
         }
     }
     if (!$checkonly) {
         $this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
     }
     return $errors;
 }