Add adress and phone number attributes
Change-Id: I7e69468ac6e5a05f42120a42bf02b92f18773ca7
diff --git a/utils.php b/utils.php
index 41996fb..2c2d29b 100644
--- a/utils.php
+++ b/utils.php
@@ -60,18 +60,23 @@
function replace_all_user_variables(string $string, User $user, string $url)
{
+ foreach ($user as $key => $value) {
+ $to_replace = "{{" . $key . "}}";
+ $string = str_replace($to_replace, $value, $string);
+ }
+
$string = str_replace("{{url}}", $url, $string);
$string = str_replace("{{full_name}}", $user->first_name . " " . $user->last_name, $string);
$string = str_replace("{{fullname}}", $user->first_name . " " . $user->last_name, $string);
- $string = str_replace("{{first_name}}", $user->first_name, $string);
- $string = str_replace("{{last_name}}", $user->last_name, $string);
- $string = str_replace("{{email}}", $user->email, $string);
- $string = str_replace("{{organization}}", $user->organization, $string);
- $string = str_replace("{{username}}", $user->username, $string);
+ $string = str_replace("{{usertable}}", $user->to_table(), $string);
return $string;
}
-function user_to_string(User $user)
+function array_to_string(array $array)
{
- return $user->first_name . " " . $user->last_name . " <" . $user->email . "> " . $user->organization . " " . $user->username;
-}
\ No newline at end of file
+ $string = "";
+ foreach ($array as $key => $value) {
+ $string .= $key . ": " . $value . "\n";
+ }
+ return $string;
+}