diff --git a/inc/functions.php b/inc/functions.php
index a464681..b7ca44b 100644
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -79,3 +79,24 @@
return $return;
}
+
+ function formatUsersIn($users_in, $all_users) {
+ // TODO : Move this function to somewhere else ?
+ $return = '';
+ $users_in = $users_in->get();
+
+ $i = false;
+ foreach($users_in as $user_in=>$guests) {
+ if($i) { $return .= '
'; } else { $i = true; }
+
+ $return .= $all_users[$user_in]->getDisplayName();
+ if($guests != 0) {
+ if($guest > 1)
+ $return .= ' ('.$guests.' '.$localized['guest'].'s)';
+ else
+ $return .= ' ('.$guests.' '.$localized['guest'].')';
+ }
+ }
+
+ return $return;
+ }
diff --git a/index.php b/index.php
index 0aaceb6..e3759f6 100644
--- a/index.php
+++ b/index.php
@@ -11,6 +11,10 @@
'template_error'=>array('fr'=>'Template non disponible.', 'en'=>'Template not available.')
);
+ $localized = array(
+ 'guest'=>array('fr'=>'invité', 'en'=>'guest')
+ );
+
// Include necessary files
if(!file_exists('data/config.php')) { header('location: install.php'); exit(); }
require_once('data/config.php');
@@ -444,6 +448,7 @@
break;
case 'delete_invoice':
+ // TODO : Check user has right to do it
if(!empty($_GET['id'])) {
$invoice = new Invoice();
$invoice->setId($_GET['id']);
diff --git a/tpl/default_en/index.html b/tpl/default_en/index.html
index bd8f77a..f5b45cb 100755
--- a/tpl/default_en/index.html
+++ b/tpl/default_en/index.html
@@ -27,7 +27,7 @@
Date | @@ -42,7 +42,7 @@||||||
---|---|---|---|---|---|---|
{$value->getDate()} | {$users[$value->getBuyer()]->getDisplayName()} | -{$value->getUsersIn()} | +{function="formatUsersIn($value->getUsersIn(), $users)"} | {$value->getAmount()} | {$value->getWhat()} | Edit |