summaryrefslogtreecommitdiff
path: root/includes/model/UserDriverLicenses_model.php
diff options
context:
space:
mode:
authorBot <bot@myigel.name>2017-01-02 03:57:23 +0100
committerIgor Scheller <igor.scheller@igorshp.de>2017-01-02 03:57:23 +0100
commit7313e15ce8236e19331fb6639a3a5b97c8f06ecd (patch)
tree399e5eaa403d6dd5993ca8fb6f2162319d2ed2e1 /includes/model/UserDriverLicenses_model.php
parentb839e401062b294292fdcbd7e30b79bc149fab6f (diff)
PSR-2 formatting
Diffstat (limited to 'includes/model/UserDriverLicenses_model.php')
-rw-r--r--includes/model/UserDriverLicenses_model.php77
1 files changed, 41 insertions, 36 deletions
diff --git a/includes/model/UserDriverLicenses_model.php b/includes/model/UserDriverLicenses_model.php
index 6caa3589..7d1be528 100644
--- a/includes/model/UserDriverLicenses_model.php
+++ b/includes/model/UserDriverLicenses_model.php
@@ -4,15 +4,16 @@
* Returns a new empty UserDriverLicense
* FIXME entity object needed
*/
-function UserDriverLicense_new() {
- return [
+function UserDriverLicense_new()
+{
+ return [
'user_id' => null,
'has_car' => false,
'has_license_car' => false,
'has_license_3_5t_transporter' => false,
'has_license_7_5t_truck' => false,
'has_license_12_5t_truck' => false,
- 'has_license_forklift' => false
+ 'has_license_forklift' => false
];
}
@@ -23,8 +24,9 @@ function UserDriverLicense_new() {
* The UserDriverLicense to check
* @return boolean
*/
-function UserDriverLicense_valid($user_driver_license) {
- return $user_driver_license['has_car'] || $user_driver_license['has_license_car'] || $user_driver_license['has_license_3_5t_transporter'] || $user_driver_license['has_license_7_5t_truck'] || $user_driver_license['has_license_12_5t_truck'] || $user_driver_license['has_license_forklift'];
+function UserDriverLicense_valid($user_driver_license)
+{
+ return $user_driver_license['has_car'] || $user_driver_license['has_license_car'] || $user_driver_license['has_license_3_5t_transporter'] || $user_driver_license['has_license_7_5t_truck'] || $user_driver_license['has_license_12_5t_truck'] || $user_driver_license['has_license_forklift'];
}
/**
@@ -33,16 +35,17 @@ function UserDriverLicense_valid($user_driver_license) {
* @param int $user_id
* The users id
*/
-function UserDriverLicense($user_id) {
- $user_driver_license = sql_select("SELECT * FROM `UserDriverLicenses` WHERE `user_id`='" . sql_escape($user_id) . "'");
- if ($user_driver_license === false) {
- engelsystem_error('Unable to load user driver license.');
- return false;
- }
- if (count($user_driver_license) > 0) {
- return $user_driver_license[0];
- }
- return null;
+function UserDriverLicense($user_id)
+{
+ $user_driver_license = sql_select("SELECT * FROM `UserDriverLicenses` WHERE `user_id`='" . sql_escape($user_id) . "'");
+ if ($user_driver_license === false) {
+ engelsystem_error('Unable to load user driver license.');
+ return false;
+ }
+ if (count($user_driver_license) > 0) {
+ return $user_driver_license[0];
+ }
+ return null;
}
/**
@@ -51,9 +54,10 @@ function UserDriverLicense($user_id) {
* @param UserDriverLicense $user_driver_license
* The UserDriverLicense to create
*/
-function UserDriverLicenses_create($user_driver_license, $user) {
- $user_driver_license['user_id'] = $user['UID'];
- $result = sql_query("
+function UserDriverLicenses_create($user_driver_license, $user)
+{
+ $user_driver_license['user_id'] = $user['UID'];
+ $result = sql_query("
INSERT INTO `UserDriverLicenses` SET
`user_id`=" . sql_escape($user_driver_license['user_id']) . ",
`has_car`=" . sql_bool($user_driver_license['has_car']) . ",
@@ -62,10 +66,10 @@ function UserDriverLicenses_create($user_driver_license, $user) {
`has_license_7_5t_truck`=" . sql_bool($user_driver_license['has_license_7_5t_truck']) . ",
`has_license_12_5t_truck`=" . sql_bool($user_driver_license['has_license_12_5t_truck']) . ",
`has_license_forklift`=" . sql_bool($user_driver_license['has_license_forklift']));
- if ($result === false) {
- engelsystem_error('Unable to create user driver license');
- }
- return $user_driver_license;
+ if ($result === false) {
+ engelsystem_error('Unable to create user driver license');
+ }
+ return $user_driver_license;
}
/**
@@ -74,8 +78,9 @@ function UserDriverLicenses_create($user_driver_license, $user) {
* @param UserDriverLicense $user_driver_license
* The UserDriverLicense to update
*/
-function UserDriverLicenses_update($user_driver_license) {
- $result = sql_query("UPDATE `UserDriverLicenses` SET
+function UserDriverLicenses_update($user_driver_license)
+{
+ $result = sql_query("UPDATE `UserDriverLicenses` SET
`has_car`=" . sql_bool($user_driver_license['has_car']) . ",
`has_license_car`=" . sql_bool($user_driver_license['has_license_car']) . ",
`has_license_3_5t_transporter`=" . sql_bool($user_driver_license['has_license_3_5t_transporter']) . ",
@@ -83,22 +88,22 @@ function UserDriverLicenses_update($user_driver_license) {
`has_license_12_5t_truck`=" . sql_bool($user_driver_license['has_license_12_5t_truck']) . ",
`has_license_forklift`=" . sql_bool($user_driver_license['has_license_forklift']) . "
WHERE `user_id`='" . sql_escape($user_driver_license['user_id']) . "'");
- if ($result === false) {
- engelsystem_error("Unable to update user driver license information");
- }
- return $result;
+ if ($result === false) {
+ engelsystem_error("Unable to update user driver license information");
+ }
+ return $result;
}
/**
* Delete a user's driver license entry
*
- * @param int $user_id
+ * @param int $user_id
*/
-function UserDriverLicenses_delete($user_id) {
- $result = sql_query("DELETE FROM `UserDriverLicenses` WHERE `user_id`=" . sql_escape($user_id));
- if ($result === false) {
- engelsystem_error("Unable to remove user driver license information");
- }
- return $result;
+function UserDriverLicenses_delete($user_id)
+{
+ $result = sql_query("DELETE FROM `UserDriverLicenses` WHERE `user_id`=" . sql_escape($user_id));
+ if ($result === false) {
+ engelsystem_error("Unable to remove user driver license information");
+ }
+ return $result;
}
-?> \ No newline at end of file