$user->setLanguages($this->suid, $m, $survey->getAllowedLanguages($m)); } $user->saveChanges(); } } } } function convertSurveySettings($row) { $query = "replace into " . Config::dbSurvey() . "_surveys (suid, name, description) values ("; $query .= prepareDatabaseString($this->suid) . ","; $query .= "'" . prepareDatabaseString($row["header"]) . "',"; $query .= "'')"; $this->db->executeQuery($query); $query = "replace into " . Config::dbSurvey() . "_versions (suid, vnid, name, description) values ("; $query .= prepareDatabaseString($this->suid) . ","; $query .= prepareDatabaseString(1) . ","; $query .= "'Current',"; $query .= "'Current version')"; $this->db->executeQuery($query); /* add default survey */ $setting = new Setting(); $setting->setSuid($this->suid); $setting->setObject(USCIC_SURVEY); $setting->setObjectType(OBJECT_SURVEY); $setting->setName(SETTING_DEFAULT_SURVEY); $setting->setValue($this->suid); $setting->setMode(MODE_CASI); // dummy $setting->setLanguage(1); // dummy $setting->save(); /* add default mode */ $setting = new Setting(); $setting->setSuid($this->suid); $setting->setObject(USCIC_SURVEY); $setting->setObjectType(OBJECT_SURVEY); $setting->setName(SETTING_DEFAULT_MODE); $setting->setMode(MODE_CASI); $setting->setLanguage(1); // dummy $setting->setValue(MODE_CASI); $setting->save(); /* add default language */ $setting = new Setting(); $setting->setSuid($this->suid); $setting->setObject(USCIC_SURVEY); $setting->setObjectType(OBJECT_SURVEY); $setting->setName(SETTING_DEFAULT_LANGUAGE);
function setSettingDirectly($object, $objecttype, $name, $value, $mode = "", $language = "") { $setting = new Setting(); $setting->setSuid($this->getSuid()); $setting->setLanguage($language); $setting->setMode($mode); $setting->setName($name); $setting->setObject($object); $setting->setObjectType($objecttype); $setting->setValue($value); $setting->save(); }
require_once "../model/Query/Setting.php"; /** * Validate data */ $set = new Setting(); $set->setClinicName($_POST["clinic_name"]); $_POST["clinic_name"] = $set->getClinicName(); $set->setClinicHours($_POST["clinic_hours"]); $_POST["clinic_hours"] = $set->getClinicHours(); $set->setClinicAddress($_POST["clinic_address"]); $_POST["clinic_address"] = $set->getClinicAddress(); $set->setClinicPhone($_POST["clinic_phone"]); $_POST["clinic_phone"] = $set->getClinicPhone(); $set->setClinicUrl($_POST["clinic_url"]); $_POST["clinic_url"] = $set->getClinicUrl(); $set->setLanguage($_POST["language"]); $_POST["language"] = $set->getLanguage(); $set->setSessionTimeout($_POST["session_timeout"]); $_POST["session_timeout"] = $set->getSessionTimeout(); $set->setItemsPerPage($_POST["items_per_page"]); $_POST["items_per_page"] = $set->getItemsPerPage(); if (!$set->validateData()) { $formError["session_timeout"] = $set->getSessionTimeoutError(); $formError["items_per_page"] = $set->getItemsPerPageError(); Form::setSession($_POST, $formError); header("Location: ../admin/setting_edit_form.php"); exit; } /** * Destroy form values and errors */
} return ""; } function getSettingValue($name, $default = true) { return $this->getSetting($name, $default)->getValue(); } function setSettingValue($name, $value) { /* determine index */ $index = strtoupper($name . getSurveyMode() . getSurveyLanguage() . $this->getObjectType()); /* don't store if follow generic/follow type (these are implicitly derived, * so no need to store them explicitly). Also don't store if empty (if something should be empty * like a text, then enter for example as value). * If we had a value stored before, then we remove it now. */ if (inArray($value, array("", SETTING_FOLLOW_GENERIC, SETTING_FOLLOW_TYPE))) { if (isset($this->settings[$index])) { $s = $this->settings[$index]; if ($s != null) { $s->remove(); } unset($this->settings[$index]); } return; } /* update */ if (isset($this->settings[$index])) { $this->settings[$index]->setValue($value); } else { /* create new */