47 $this->user_id = (int)$a_user_id;
48 $this->
id = (string)$a_id;
53 $this->user_id = $ilUser->getId();
64 public function set($a_data)
66 $this->settings = $a_data;
74 $this->settings = array();
85 return (
bool)$this->
getValue($a_option);
98 return $this->settings[$a_option];
110 $this->settings[$a_option] = $a_value;
122 unset($this->settings[$a_option]);
134 return array_key_exists($a_option,(array)$this->settings);
142 $this->
delete(
false);
144 $query =
"INSERT INTO usr_form_settings (user_id,id,settings) ".
146 $this->db->quote($this->user_id,
'integer').
", ".
147 $this->db->quote($this->
id,
'text').
", ".
148 $this->db->quote(serialize($this->settings),
'text').
" ".
150 $this->db->manipulate(
$query);
162 $query =
"SELECT * FROM usr_form_settings".
163 " WHERE user_id = ".$this->db->quote($this->user_id,
'integer').
164 " AND id = ".$this->db->quote($this->
id,
'text');
170 $this->settings = unserialize(
$row->settings);
180 public function delete($a_reset =
true)
182 $query =
"DELETE FROM usr_form_settings".
183 " WHERE user_id = ".$this->db->quote($this->user_id,
'integer').
184 " AND id = ".$this->db->quote($this->
id,
'text');
185 $this->db->manipulate(
$query);
198 $query =
"DELETE FROM usr_form_settings".
199 " WHERE user_id = ".$this->db->quote($a_user_id,
'integer');
200 $this->db->manipulate(
$query);
212 foreach($a_form->
getItems() as $item)
214 if(method_exists($item,
"getPostVar"))
216 $field = $item->getPostVar();
218 if(method_exists($item,
"getDate"))
220 $value = $item->getDate();
221 if($value && !$value->isNull())
226 else if(method_exists($item,
"getMulti") && $item->getMulti())
228 $value = $item->getMultiValues();
230 else if(method_exists($item,
"getValue"))
232 $value = $item->getValue();
247 foreach($a_form->
getItems() as $item)
249 if(method_exists($item,
"getPostVar"))
251 $field = $item->getPostVar();
257 if(method_exists($item,
"setDate"))
260 $item->setDate($date);
262 else if(method_exists($item,
"setValue"))
264 $item->setValue($value);
266 if(method_exists($item,
"setChecked"))
268 $item->setChecked(
true);