protected function importEditFormValues(ilPropertyFormGUI $a_form) { $max = $a_form->getInput("maxchars"); $this->object->setMaxChars(strlen($max) ? $max : null); $this->object->setTextWidth($a_form->getInput("textwidth")); $this->object->setTextHeight($a_form->getInput("textheight")); }
/** * saves a given form object's specific form properties * relating to this question type * * (overwrites the method from ilAssMultiOptionQuestionFeedback, because of individual setting) * * @access public * @param ilPropertyFormGUI $form */ public function saveSpecificFormProperties(ilPropertyFormGUI $form) { if (!$this->questionOBJ->isAdditionalContentEditingModePageObject()) { $this->saveSpecificFeedbackSetting($this->questionOBJ->getId(), $form->getInput('feedback_setting')); foreach ($this->getAnswerOptionsByAnswerIndex() as $index => $answer) { $this->saveSpecificAnswerFeedbackContent($this->questionOBJ->getId(), $index, $form->getInput("feedback_answer_{$index}")); } } }
/** * @param ilPropertyFormGUI $form * @param ilObjCloud $obj */ public function afterSavePluginCreation(ilObjCloud &$obj, ilPropertyFormGUI $form) { if ($form->getInput(self::F_BASE_FOLDER) == self::F_DEFAULT_BASE_FOLDER) { $root_folder = $obj->getTitle(); } else { $root_folder = $form->getInput(self::F_CUSTOM_BASE_FOLDER_INPUT); } $root_folder = '/ILIASCloud/' . ltrim($root_folder, "/"); $obj->setRootFolder($root_folder); }
/** * @param ilPropertyFormGUI $form * @param ilObjCloud $obj */ function afterSavePluginCreation(ilObjCloud &$obj, ilPropertyFormGUI $form) { if ($form->getInput(self::F_BASE_FOLDER) == self::F_DROPBOX_DEFAULT_BASE_FOLDER) { $obj->setRootFolder($obj->getTitle()); } else { $obj->setRootFolder($form->getInput(self::F_DROPBOX_CUSTOM_BASE_FOLDER_INPUT)); } if ($form->getInput(self::F_ONLINE) == "1") { $obj->setOnline(true); } $obj->doUpdate(); }
/** * Check input of form * * @param $a_mode 'create' | 'update' * * @return bool */ protected function checkInput($a_mode) { global $lng; $return = $this->form->checkInput(); // Additional check for text fields: The length property should be max 200 if the textarea option is not set if ($this->form->getInput('datatype') == ilDataCollectionDatatype::INPUTFORMAT_TEXT && (int) $this->form->getInput('prop_' . ilDataCollectionField::PROPERTYID_LENGTH) > 200 && !$this->form->getInput('prop_' . ilDataCollectionField::PROPERTYID_TEXTAREA)) { $inputObj = $this->form->getItemByPostVar('prop_' . ilDataCollectionField::PROPERTYID_LENGTH); $inputObj->setAlert($lng->txt("form_msg_value_too_high")); $return = false; } // Don't allow multiple fields with the same title in this table if ($a_mode == 'create') { if ($title = $this->form->getInput('title')) { if (ilDataCollectionTable::_hasFieldByTitle($title, $this->table_id)) { $inputObj = $this->form->getItemByPostVar('title'); $inputObj->setAlert($lng->txt("dcl_field_title_unique")); $return = false; } } } if (!$return) { ilUtil::sendFailure($lng->txt("form_input_not_valid")); } return $return; }
/** * */ protected function saveSettings() { /** * @var $rbacsystem ilRbacSystem * @var $ilErr ilErrorHandling */ global $rbacsystem, $ilErr; if (!$rbacsystem->checkAccess('write', $this->object->getRefId())) { $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->MESSAGE); } $provider = $this->factory->getByContext(ilTermsOfServiceTableDataProviderFactory::CONTEXT_AGRREMENT_BY_LANGUAGE); $list = $provider->getList(array(), array()); $has_documents = false; foreach ($list['items'] as $item) { if ($item['agreement_document']) { $has_documents = true; break; } } $this->initSettingsForm(); if ($this->form->checkInput()) { if ($has_documents || !(int) $this->form->getInput('tos_status')) { $this->object->saveStatus((int) $this->form->getInput('tos_status')); ilUtil::sendSuccess($this->lng->txt('saved_successfully')); } } if (!$has_documents && (int) $this->form->getInput('tos_status') && !$this->object->getStatus()) { $_POST['tos_status'] = 0; ilUtil::sendFailure($this->lng->txt('tos_no_documents_exist_cant_save')); } $this->settings(false); }
/** * Update properties */ public function uploadFiles() { $response = new stdClass(); $response->error = null; $response->debug = null; $this->initUploadForm(); if ($this->form->checkInput()) { try { $fileresult = $this->handleFileUpload($this->form->getInput("upload_files")); if ($fileresult) { $response = (object) array_merge((array) $response, (array) $fileresult); } } catch (ilException $e) { $response->error = $e->getMessage(); } } else { $error = new ilCloudException(ilCloudException::UPLOAD_FAILED); $response->error = $error->getMessage(); } // send response object (don't use 'application/json' as IE wants to download it!) header('Vary: Accept'); header('Content-type: text/plain'); echo ilJsonUtil::encode($response); exit; }
public function updateProperties() { $this->initPropertiesForm(); if ($this->form->checkInput()) { $this->object->setTitle($this->form->getInput('title')); $this->object->setDescription($this->form->getInput('desc')); $this->object->update(); ilUtil::sendSuccess($this->lng->txt('msg_obj_modified'), true); $this->ctrl->redirect($this, 'editProperties'); } $this->form->setValuesByPost(); $this->tpl->setContent($this->form->getHtml()); }
protected function importEditFormValues(ilPropertyFormGUI $a_form) { $this->object->setOrientation($a_form->getInput("orientation")); $this->object->categories->flushCategories(); foreach ($_POST['answers']['answer'] as $key => $value) { if (strlen($value)) { $this->object->getCategories()->addCategory($value, $_POST['answers']['other'][$key], 0, null, $_POST['answers']['scale'][$key]); } } if (strlen($_POST['answers']['neutral'])) { $this->object->getCategories()->addCategory($_POST['answers']['neutral'], 0, 1, null, $_POST['answers_neutral_scale']); } }
/** * */ protected function saveSettings() { /** * @var $rbacsystem ilRbacSystem * @var $ilErr ilErrorHandling */ global $rbacsystem, $ilErr; if (!$rbacsystem->checkAccess('write', $this->object->getRefId())) { $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->MESSAGE); } $this->initSettingsForm(); if ($this->form->checkInput()) { $this->object->saveStatus((int) $this->form->getInput('tos_status')); ilUtil::sendSuccess($this->lng->txt('saved_successfully')); } $this->settings(false); }
public function updateNotificationSettingsObject() { /** * @var $ilAccess ilAccessHandler * @var $ilErr ilErr */ global $ilAccess, $ilErr; if (!$ilAccess->checkAccess('write', '', $this->ref_id)) { $ilErr->raiseError($this->lng->txt('msg_no_perm_read'), $ilErr->MESSAGE); } // instantiate the property form $this->initNotificationSettingsForm(); // check input if ($this->notificationSettingsForm->checkInput()) { if (isset($_POST['notification_type']) && $_POST['notification_type'] == 'all_users') { // set values and call update $this->objProperties->setAdminForceNoti(1); $this->objProperties->setUserToggleNoti((int) $this->notificationSettingsForm->getInput('usr_toggle')); $this->objProperties->setNotificationType('all_users'); $this->updateUserNotifications(true); } else { if ($_POST['notification_type'] == 'per_user') { $this->objProperties->setNotificationType('per_user'); $this->objProperties->setAdminForceNoti(1); $this->objProperties->setUserToggleNoti(0); $this->updateUserNotifications(); } else { $this->objProperties->setNotificationType('default'); $this->objProperties->setAdminForceNoti(0); $this->objProperties->setUserToggleNoti(0); include_once 'Modules/Forum/classes/class.ilForumNotification.php'; $frm_noti = new ilForumNotification($this->object->getRefId()); $frm_noti->deleteNotificationAllUsers(); } } $this->objProperties->update(); // print success message ilUtil::sendSuccess($this->lng->txt('saved_successfully')); } $this->notificationSettingsForm->setValuesByPost(); return $this->showMembersObject(); }
public function importCustomDefinitionFormPostValues(ilPropertyFormGUI $a_form) { $old = $this->getOptions(); $new = $a_form->getInput("opts"); $missing = array_diff($old, $new); if (sizeof($missing)) { $this->confirmed_objects = $this->buildConfirmedObjects($a_form); if (!is_array($this->confirmed_objects)) { $search = ilADTFactory::getInstance()->getSearchBridgeForDefinitionInstance($this->getADTDefinition(), false, false); ilADTFactory::initActiveRecordByType(); foreach ($missing as $missing_value) { $in_use = $this->findBySingleValue($search, $missing_value); if (sizeof($in_use)) { foreach ($in_use as $item) { $this->confirm_objects[$missing_value][] = $item; } } } } } $this->old_options = $old; $this->setOptions($new); }
/** * Save form input */ public function save() { /** @var ilCtrl $ilCtrl */ global $tpl, $ilCtrl; $this->initConfigurationForm(); if ($this->form->checkInput()) { // Save Checkbox Values foreach ($this->checkboxes as $key => $cb) { if (!is_array($cb)) { $this->setValue($cb, $this->form->getInput($cb)); } else { $this->setValue($key, $this->form->getInput($key)); foreach ($cb as $field => $gui) { $this->setValue($key . '_' . $field, $this->form->getInput($key . '_' . $field)); } } } $ilCtrl->redirect($this, 'configure'); } else { $this->form->setValuesByPost(); $tpl->setContent($this->form->getHtml()); } }
/** * */ protected function saveCategory() { if (!$this->isCRUDContext()) { $this->{$this->getDefaultCommand()}(); return; } $category = $this->getCategoryById((int) $_GET['category_id']); $this->initUnitCategoryForm($category); if ($this->unit_cat_form->checkInput()) { try { $category->setCategory($this->unit_cat_form->getInput('category_name')); $this->repository->saveCategory($category); ilUtil::sendSuccess($this->lng->txt('saved_successfully')); $this->{$this->getUnitCategoryOverviewCommand()}(); return; } catch (ilException $e) { $this->unit_cat_form->getItemByPostVar('category_name')->setAlert($this->lng->txt($e->getMessage())); ilUtil::sendFailure($this->lng->txt('form_input_not_valid')); } } $this->unit_cat_form->setValuesByPost(); $this->tpl->setContent($this->unit_cat_form->getHtml()); }
/** * Command for saving the updated Test Overview settings. * * This command saves the HTML form input into the Test Overview * currently selected. */ protected function updateSettings() { /** * @var $tpl ilTemplate * @var $lng ilLanguage * @var $ilCtrl ilCtrl */ global $tpl, $lng, $ilCtrl; $this->initSettingsForm(); if ($this->form->checkInput()) { /* Form is sent and input validated, now save settings. */ $this->object->setTitle($this->form->getInput('title')); $this->object->setDescription($this->form->getInput('desc')); $this->object->update(); ilUtil::sendSuccess($lng->txt('msg_obj_modified'), true); /* Back to editSettings */ $ilCtrl->redirect($this, 'editSettings'); } /* Form is sent but there is an input error. Fill back the form and render again. */ $this->form->setValuesByPost(); $tpl->setContent($this->renderSettings()); }
protected function updateCustom(ilPropertyFormGUI $a_form) { if ($this->id_type == self::REPOSITORY_NODE_ID) { $this->object->setApproval($a_form->getInput("approval")); } $this->object->setNotesStatus($a_form->getInput("notes")); $this->object->setProfilePicture($a_form->getInput("ppic")); $this->object->setBackgroundColor($a_form->getInput("bg_color")); $this->object->setFontColor($a_form->getInput("font_color")); $this->object->setRSS($a_form->getInput("rss")); // banner field is optional $banner = $a_form->getItemByPostVar("banner"); if ($banner) { if ($_FILES["banner"]["tmp_name"]) { $this->object->uploadImage($_FILES["banner"]); } else { if ($banner->getDeletionFlag()) { $this->object->deleteImage(); } } } }
/** * updateSettings */ public function updateCustom(ilPropertyFormGUI $a_form) { global $ilUser; $this->object->setOnline($a_form->getInput("is_online")); $this->object->setRating($a_form->getInput("rating")); $this->object->setPublicNotes($a_form->getInput("public_notes")); $this->object->setApproval($a_form->getInput("approval")); $this->object->setNotification($a_form->getInput("notification")); $this->emptyInfo(); }
protected function updateCustom(ilPropertyFormGUI $a_form) { $this->object->setViewResults($a_form->getInput("results")); $this->object->setOnline($a_form->getInput("online")); $this->object->setSortResultByVotes($a_form->getInput("sort")); $this->object->setShowComments($a_form->getInput("comment")); $this->object->setShowResultsAs($a_form->getInput("show_results_as")); include_once "Services/Object/classes/class.ilObjectActivation.php"; if ($a_form->getInput("access_type")) { $this->object->setAccessType(ilObjectActivation::TIMINGS_ACTIVATION); $period = $a_form->getItemByPostVar("access_period"); $this->object->setAccessBegin($period->getStart()->get(IL_CAL_UNIX)); $this->object->setAccessEnd($period->getEnd()->get(IL_CAL_UNIX)); } else { $this->object->setAccessType(ilObjectActivation::TIMINGS_DEACTIVATED); } if ($a_form->getInput("period")) { $this->object->setVotingPeriod(1); $period = $a_form->getItemByPostVar("voting_period"); $this->object->setVotingPeriodBegin($period->getStart()->get(IL_CAL_UNIX)); $this->object->setVotingPeriodEnd($period->getEnd()->get(IL_CAL_UNIX)); } else { $this->object->setVotingPeriod(0); } }
/** * saves a given form object's GENERIC form properties * relating to all question types * * @final * @access public * @param ilPropertyFormGUI $form */ public final function saveGenericFormProperties(ilPropertyFormGUI $form) { if (!$this->questionOBJ->isAdditionalContentEditingModePageObject()) { $this->saveGenericFeedbackContent($this->questionOBJ->getId(), false, $form->getInput('feedback_incomplete')); $this->saveGenericFeedbackContent($this->questionOBJ->getId(), true, $form->getInput('feedback_complete')); } }
/** * Save record */ public function save() { $this->initForm(); if ($this->form->checkInput()) { $record_obj = ilDataCollectionCache::getRecordCache($this->record_id); $date_obj = new ilDateTime(time(), IL_CAL_UNIX); $record_obj->setTableId($this->table_id); $record_obj->setLastUpdate($date_obj->get(IL_CAL_DATETIME)); $record_obj->setLastEditBy($this->user->getId()); $create_mode = false; if (ilObjDataCollection::_hasWriteAccess($this->parent_obj->ref_id)) { $all_fields = $this->table->getRecordFields(); } else { $all_fields = $this->table->getEditableFields(); } $fail = ""; //Check if we can create this record. foreach ($all_fields as $field) { try { $value = $this->form->getInput("field_" . $field->getId()); $field->checkValidity($value, $this->record_id); } catch (ilDataCollectionInputException $e) { $fail .= $field->getTitle() . ": " . $e . "<br>"; } } if ($fail) { $this->sendFailure($fail); return; } if (!isset($this->record_id)) { if (!$this->table->hasPermissionToAddRecord($this->parent_obj->ref_id)) { $this->accessDenied(); return; } $record_obj->setOwner($this->user->getId()); $record_obj->setCreateDate($date_obj->get(IL_CAL_DATETIME)); $record_obj->setTableId($this->table_id); $record_obj->doCreate(); $this->record_id = $record_obj->getId(); $create_mode = true; } else { if (!$record_obj->hasPermissionToEdit($this->parent_obj->ref_id)) { $this->accessDenied(); return; } } //edit values, they are valid we already checked them above foreach ($all_fields as $field) { $value = $this->form->getInput("field_" . $field->getId()); //deletion flag on MOB inputs. if ($field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_MOB && $this->form->getItemByPostVar("field_" . $field->getId())->getDeletionFlag()) { $value = -1; } $record_obj->setRecordFieldValue($field->getId(), $value); } // Do we need to set a new owner for this record? if (!$create_mode) { $owner_id = ilObjUser::_lookupId($_POST['field_owner']); if (!$owner_id) { $this->sendFailure($this->lng->txt('user_not_known')); return; } $record_obj->setOwner($owner_id); } if ($create_mode) { ilObjDataCollection::sendNotification("new_record", $this->table_id, $record_obj->getId()); } $record_obj->doUpdate(); $this->ctrl->setParameter($this, "table_id", $this->table_id); $this->ctrl->setParameter($this, "record_id", $this->record_id); if (!$this->ctrl->isAsynch()) { ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true); } $this->checkAndPerformRedirect(); if ($this->ctrl->isAsynch()) { // If ajax request, return the form in edit mode again $this->record_id = $record_obj->getId(); $this->initForm(); $this->setFormValues(); echo $this->tpl->getMessageHTML($this->lng->txt('msg_obj_modified'), 'success') . $this->form->getHTML(); exit; } else { $this->ctrl->redirectByClass("ildatacollectionrecordlistgui", "listRecords"); } } else { // Form not valid... $this->form->setValuesByPost(); if ($this->ctrl->isAsynch()) { echo $this->form->getHTML(); exit; } else { $this->tpl->setContent($this->form->getHTML()); } } }
public function updateCustom(ilPropertyFormGUI $a_form) { $this->object->setOnline($a_form->getInput("online")); // activation if ($a_form->getInput("access_type") == ilObjectActivation::TIMINGS_ACTIVATION) { $this->object->setActivationLimited(true); $this->object->setActivationVisibility($a_form->getInput("access_visiblity")); $period = $a_form->getItemByPostVar("access_period"); $this->object->setActivationStartDate($period->getStart()->get(IL_CAL_UNIX)); $this->object->setActivationEndDate($period->getEnd()->get(IL_CAL_UNIX)); } else { $this->object->setActivationLimited(false); } parent::updateCustom($a_form); }
/** * Import custom post values from definition form * * @param ilPropertyFormGUI $a_form */ public function importCustomDefinitionFormPostValues(ilPropertyFormGUI $a_form) { $min = $a_form->getInput("min"); $this->setMin($min !== "" ? $min : null); $max = $a_form->getInput("max"); $this->setMax($max !== "" ? $max : null); $suffix = $a_form->getInput("suffix"); $this->setSuffix($suffix !== "" ? $suffix : null); }
protected function updateCustom(ilPropertyFormGUI $a_form) { // Save sorting include_once './Services/Container/classes/class.ilContainerSortingSettings.php'; $sort = new ilContainerSortingSettings($this->object->getId()); $sort->setSortMode($a_form->getInput('sor')); $sort->update(); }
/** * Import custom post values from definition form * * @param ilPropertyFormGUI $a_form */ public function importCustomDefinitionFormPostValues(ilPropertyFormGUI $a_form) { $max = $a_form->getInput("max"); $this->setMaxLength($max !== "" ? $max : null); $this->setMulti($a_form->getInput("multi")); }
private function getGradeUserId() { include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); return $form->getInput('user_id', false); }
protected function importEditFormValues(ilPropertyFormGUI $a_form) { $this->object->setOrientation($a_form->getInput("orientation")); $this->object->use_other_answer = $a_form->getInput('use_other_answer') ? 1 : 0; $this->object->other_answer_label = $this->object->use_other_answer ? $a_form->getInput('other_answer_label') : null; $this->object->use_min_answers = $a_form->getInput('use_min_answers') ? true : false; $this->object->nr_min_answers = $a_form->getInput('nr_min_answers') > 0 ? $a_form->getInput('nr_min_answers') : null; $this->object->nr_max_answers = $a_form->getInput('nr_max_answers') > 0 ? $a_form->getInput('nr_max_answers') : null; $this->object->label = $a_form->getInput('label'); $this->object->categories->flushCategories(); foreach ($_POST['answers']['answer'] as $key => $value) { if (strlen($value)) { $this->object->getCategories()->addCategory($value, $_POST['answers']['other'][$key], 0, null, $_POST['answers']['scale'][$key]); } } if (strlen($_POST['answers']['neutral'])) { $this->object->getCategories()->addCategory($_POST['answers']['neutral'], 0, 1, null, $_POST['answers_neutral_scale']); } }
protected function updateCustom(ilPropertyFormGUI $a_form) { $this->object->setViewResults($a_form->getInput("results")); $this->object->setOnline($a_form->getInput("online")); include_once "Services/Object/classes/class.ilObjectActivation.php"; $this->object->setAccessType($a_form->getInput("access_type")); if ($this->object->getAccessType() == ilObjectActivation::TIMINGS_ACTIVATION) { $date = new ilDateTime($_POST['access_begin']['date'] . ' ' . $_POST['access_begin']['time'], IL_CAL_DATETIME); $this->object->setAccessBegin($date->get(IL_CAL_UNIX)); $date = new ilDateTime($_POST['access_end']['date'] . ' ' . $_POST['access_end']['time'], IL_CAL_DATETIME); $this->object->setAccessEnd($date->get(IL_CAL_UNIX)); // $this->object->setAccessVisibility($a_form->getInput("access_visiblity")); } $this->object->setVotingPeriod($a_form->getInput("period")); if ($this->object->getVotingPeriod()) { $date = new ilDateTime($_POST['period_begin']['date'] . ' ' . $_POST['period_begin']['time'], IL_CAL_DATETIME); $this->object->setVotingPeriodBegin($date->get(IL_CAL_UNIX)); $date = new ilDateTime($_POST['period_end']['date'] . ' ' . $_POST['period_end']['time'], IL_CAL_DATETIME); $this->object->setVotingPeriodEnd($date->get(IL_CAL_UNIX)); } }
/** * Reload definition values from post data * * @param ilPropertyFormGUI $form */ protected function setDefinitionFromPost(ilPropertyFormGUI $form) { $days = $form->getInput("days"); if ($days) { $days_group = $form->getItemByPostVar("days"); foreach ($days_group->getOptions() as $option) { $days_fields[$option->getValue()] = $option; } foreach ($days as $day) { $slot = $form->getInput($day . "_slot"); $subs = $days_fields[$day]->getSubItems(); if ($slot[0]) { $subs[0]->setValue($slot[0]); } if ($slot[1]) { $subs[1]->setValue($slot[1]); } } } }
protected function updateCustom(ilPropertyFormGUI $a_form) { global $ilUser; $this->object->setShowSubmissions($a_form->getInput("show_submissions")); $this->object->setPassMode($a_form->getInput("pass_mode")); if ($this->object->getPassMode() == "nr") { $this->object->setPassNr($a_form->getInput("pass_nr")); } $this->object->setCompletionBySubmission($a_form->getInput('completion_by_submission') == 1 ? true : false); include_once "./Services/Notification/classes/class.ilNotification.php"; ilNotification::setNotification(ilNotification::TYPE_EXERCISE_SUBMISSION, $ilUser->getId(), $this->object->getId(), (bool) $a_form->getInput("notification")); }
protected function importEditFormValues(ilPropertyFormGUI $a_form) { $this->object->setSubtype($a_form->getInput("type")); $this->object->setRowSeparators($a_form->getInput("row_separators") ? 1 : 0); $this->object->setColumnSeparators($a_form->getInput("column_separators") ? 1 : 0); $this->object->setNeutralColumnSeparator($a_form->getInput("neutral_column_separator") ? 1 : 0); // Set bipolar adjectives $this->object->setBipolarAdjective(0, $a_form->getInput("bipolar1")); $this->object->setBipolarAdjective(1, $a_form->getInput("bipolar2")); // set columns $this->object->flushColumns(); foreach ($_POST['columns']['answer'] as $key => $value) { if (strlen($value)) { $this->object->getColumns()->addCategory($value, $_POST['columns']['other'][$key], 0, null, $_POST['columns']['scale'][$key]); } } if (strlen($_POST["columns"]["neutral"])) { $this->object->getColumns()->addCategory($_POST['columns']['neutral'], 0, 1, null, $_POST['columns_neutral_scale']); } // set rows $this->object->flushRows(); foreach ($_POST['rows']['answer'] as $key => $value) { if (strlen($value)) { $this->object->getRows()->addCategory($value, $_POST['rows']['other'][$key], 0, $_POST['rows']['label'][$key]); } } }