diff options
author | Philip Häusler <msquare@notrademark.de> | 2014-09-28 15:01:02 +0200 |
---|---|---|
committer | Philip Häusler <msquare@notrademark.de> | 2014-09-28 15:01:02 +0200 |
commit | bd2a8b441f16c6a1beb0b38e787be3d75a1b8da2 (patch) | |
tree | e483ae40f60c416ef7443210e016ff0684a3f56c /includes/model | |
parent | 1d9e1c467cf4d3920f9bcf0157481c7ca8ea6d5d (diff) |
clear up mvc for user list
Diffstat (limited to 'includes/model')
-rw-r--r-- | includes/model/ShiftEntry_model.php | 7 | ||||
-rw-r--r-- | includes/model/User_model.php | 41 |
2 files changed, 47 insertions, 1 deletions
diff --git a/includes/model/ShiftEntry_model.php b/includes/model/ShiftEntry_model.php index 332620f6..c7895f17 100644 --- a/includes/model/ShiftEntry_model.php +++ b/includes/model/ShiftEntry_model.php @@ -1,6 +1,13 @@ <?php /** + * Counts all freeloaded shifts. + */ +function ShiftEntries_freeleaded_count() { + return sql_select_single_cell("SELECT COUNT(*) FROM `ShiftEntry` WHERE `freeloaded` = 1"); +} + +/** * Returns next (or current) shifts of given user. * @param User $user */ diff --git a/includes/model/User_model.php b/includes/model/User_model.php index af4c4a97..45ed2700 100644 --- a/includes/model/User_model.php +++ b/includes/model/User_model.php @@ -5,8 +5,47 @@ */ /** + * Counts all forced active users. + */ +function User_force_active_count() { + return sql_select_single_cell("SELECT COUNT(*) FROM `User` WHERE `force_active` = 1"); +} + +function User_active_count() { + return sql_select_single_cell("SELECT COUNT(*) FROM `User` WHERE `Aktiv` = 1"); +} + +function User_arrived_count() { + return sql_select_single_cell("SELECT COUNT(*) FROM `User` WHERE `Gekommen` = 1"); +} + +function User_tshirts_count() { + return sql_select_single_cell("SELECT COUNT(*) FROM `User` WHERE `Tshirt` = 1"); +} + +/** + * Returns all column names for sorting in an array. + */ +function User_sortable_columns() { + return array( + 'Nick', + 'Name', + 'Vorname', + 'Alter', + 'DECT', + 'email', + 'Size', + 'Gekommen', + 'Aktiv', + 'force_active', + 'Tshirt', + 'lastLogIn' + ); +} + +/** * Get all users, ordered by Nick by default or by given param. - * + * * @param string $order_by */ function Users($order_by = 'Nick') { |