32 ?
int $a_user_id = null
39 $this->user_id = (
int) $a_user_id;
43 if (!$this->user_id) {
44 $this->user_id =
$ilUser->getId();
61 public function set(array $a_data):
void 74 public function enabled(
string $a_option): bool
76 return (
bool) $this->
getValue($a_option);
94 public function setValue(
string $a_option, $a_value): void
96 $this->
settings[$a_option] = $a_value;
114 return array_key_exists($a_option, $this->
settings);
119 $this->
delete(
false);
121 $query =
"INSERT INTO usr_form_settings (user_id,id,settings) " .
123 $this->db->quote($this->user_id,
'integer') .
", " .
124 $this->db->quote($this->
id,
'text') .
", " .
125 $this->db->quote(serialize($this->
settings),
'text') .
" " .
127 $this->db->manipulate(
$query);
130 protected function read(): void
132 $query =
"SELECT * FROM usr_form_settings" .
133 " WHERE user_id = " . $this->db->quote($this->user_id,
'integer') .
134 " AND id = " . $this->db->quote($this->
id,
'text');
137 if (
$res->numRows()) {
138 $this->has_stored_entry =
true;
143 $this->
settings = unserialize($row->settings, [
'allowed_classes' =>
false]);
150 public function delete(
bool $a_reset =
true):
void 152 $query =
"DELETE FROM usr_form_settings" .
153 " WHERE user_id = " . $this->db->quote($this->user_id,
'integer') .
154 " AND id = " . $this->db->quote($this->
id,
'text');
155 $this->db->manipulate(
$query);
169 $ilDB = $DIC[
'ilDB'];
170 $query =
"DELETE FROM usr_form_settings" .
171 " WHERE user_id = " .
$ilDB->quote($a_user_id,
'integer');
180 $query =
"DELETE FROM usr_form_settings" .
181 " WHERE id = " .
$GLOBALS[
'DIC'][
'ilDB']->quote($a_id,
'text');
190 $query =
"DELETE FROM usr_form_settings " .
191 'WHERE ' .
$GLOBALS[
'DIC'][
'ilDB']->like(
'id',
'text', $a_prefix .
'%');
204 foreach ($a_form->
getItems() as $item) {
205 if (method_exists($item,
"getPostVar")) {
206 $field = $item->getPostVar();
208 if (method_exists($item,
"getDate")) {
209 $value = $item->getDate();
210 if ($value && !$value->isNull()) {
213 } elseif (method_exists($item,
"getChecked")) {
214 $value = $item->getChecked();
215 } elseif (method_exists($item,
"getMulti") && $item->getMulti()) {
216 $value = $item->getMultiValues();
217 } elseif (method_exists($item,
"getValue")) {
218 $value = $item->getValue();
231 bool $a_set_post =
false 233 foreach ($a_form->
getItems() as $item) {
234 if (method_exists($item,
"getPostVar")) {
235 $field = $item->getPostVar();
240 if (method_exists($item,
"setDate")) {
242 $item->setDate($date);
243 } elseif (method_exists($item,
"setChecked")) {
244 $item->setChecked((
bool) $value);
245 } elseif (method_exists($item,
"setValue")) {
246 $item->setValue($value);
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']