private function __handlePreferences($prefs, $row) { include_once "Services/Mail/classes/class.ilMailOptions.php"; $mailOptions = new ilMailOptions($row["usr_id"]); $prefs["mail_incoming_type"] = $mailOptions->getIncomingType(); $prefs["mail_signature"] = $mailOptions->getSignature(); $prefs["mail_linebreak"] = $mailOptions->getLinebreak(); if (count($prefs)) { $this->xmlStartTag("Prefs"); foreach ($prefs as $key => $value) { if (ilUserXMLWriter::isPrefExportable($key)) { $this->xmlElement("Pref", array("key" => $key), $value); } } $this->xmlEndTag("Prefs"); } }
private function verifyPref($key, $value) { switch ($key) { case 'mail_linebreak': case 'hits_per_page': if (!is_numeric($value) || $value < 0) { $this->logFailure("---", "Wrong value '{$value}': Positiv numeric value expected for preference {$key}."); } break; case 'language': case 'skin': case 'style': case 'ilPageEditor_HTMLMode': case 'ilPageEditor_JavaScript': case 'ilPageEditor_MediaMode': case 'tst_javascript': case 'tst_lastquestiontype': case 'tst_multiline_answers': case 'tst_use_previous_answers': case 'graphicalAnswerSetting': case 'priv_feed_pass': $this->logFailure("---", "Preference {$key} is not supported."); break; case 'public_city': case 'public_country': case 'public_department': case 'public_email': case 'public_fax': case 'public_hobby': case 'public_institution': case 'public_matriculation': case 'public_phone': case 'public_phone_home': case 'public_phone_mobile': case 'public_phone_office': case 'public_street': case 'public_upload': case 'public_zip': case 'send_info_mails': case 'hide_own_online_status': if (!in_array($value, array('y', 'n'))) { $this->logFailure("---", "Wrong value '{$value}': Value 'y' or 'n' expected for preference {$key}."); } break; case 'public_profile': if (!in_array($value, array('y', 'n', 'g'))) { $this->logFailure("---", "Wrong value '{$value}': Value 'y', 'g' or 'n' expected for preference {$key}."); } break; case 'show_users_online': if (!in_array($value, array('y', 'n', 'associated'))) { $this->logFailure("---", "Wrong value '{$value}': Value 'y' or 'n' or 'associated' expected for preference {$key}."); } break; case 'mail_incoming_type': if (!in_array((int) $value, array("0", "1", "2"))) { $this->logFailure("---", "Wrong value '{$value}': Value \"0\" (LOCAL),\"1\" (EMAIL) or \"2\" (BOTH) expected for preference {$key}."); } break; case 'weekstart': if (!in_array($value, array("0", "1"))) { $this->logFailure("---", "Wrong value '{$value}': Value \"0\" (Sunday) or \"1\" (Monday) expected for preference {$key}."); } break; case 'mail_signature': break; case 'user_tz': include_once 'Services/Calendar/classes/class.ilTimeZone.php'; try { $tz = ilTimeZone::_getInstance($value); return true; } catch (ilTimeZoneException $tze) { $this->logFailure("---", "Wrong value '{$value}': Invalid timezone {$value} detected for preference {$key}."); } break; default: if (!ilUserXMLWriter::isPrefExportable($key)) { $this->logFailure("---", "Preference {$key} is not supported."); } break; } }