summaryrefslogtreecommitdiff
path: root/includes/model
diff options
context:
space:
mode:
Diffstat (limited to 'includes/model')
-rw-r--r--includes/model/AngelType_model.php17
-rw-r--r--includes/model/UserAngelTypes_model.php6
-rw-r--r--includes/model/User_model.php4
3 files changed, 19 insertions, 8 deletions
diff --git a/includes/model/AngelType_model.php b/includes/model/AngelType_model.php
index 5e7f4fb6..e4aef450 100644
--- a/includes/model/AngelType_model.php
+++ b/includes/model/AngelType_model.php
@@ -17,15 +17,17 @@ function AngelType_delete($angeltype) {
*
* @param int $angeltype_id
* @param string $name
- * @param boolean $restricted
+ * @param bool $restricted
* @param string $description
+ * @param bool $requires_driver_license
*/
-function AngelType_update($angeltype_id, $name, $restricted, $description) {
+function AngelType_update($angeltype_id, $name, $restricted, $description, $requires_driver_license) {
return sql_query("
UPDATE `AngelTypes` SET
`name`='" . sql_escape($name) . "',
- `restricted`='" . sql_escape($restricted ? 1 : 0) . "',
- `description`='" . sql_escape($description) . "'
+ `restricted`=" . sql_bool($restricted) . ",
+ `description`='" . sql_escape($description) . "',
+ `requires_driver_license`=" . sql_bool($requires_driver_license) . "
WHERE `id`='" . sql_escape($angeltype_id) . "'
LIMIT 1");
}
@@ -38,12 +40,13 @@ function AngelType_update($angeltype_id, $name, $restricted, $description) {
* @param string $description
* @return New Angeltype id
*/
-function AngelType_create($name, $restricted, $description) {
+function AngelType_create($name, $restricted, $description, $requires_driver_license) {
$result = sql_query("
INSERT INTO `AngelTypes` SET
`name`='" . sql_escape($name) . "',
- `restricted`='" . sql_escape($restricted ? 1 : 0) . "',
- `description`='" . sql_escape($description) . "'");
+ `restricted`=" . sql_bool($restricted) . ",
+ `description`='" . sql_escape($description) . "',
+ `requires_driver_license`=" . sql_bool($requires_driver_license));
if ($result === false)
return false;
return sql_id();
diff --git a/includes/model/UserAngelTypes_model.php b/includes/model/UserAngelTypes_model.php
index b2ebd9fe..f942483e 100644
--- a/includes/model/UserAngelTypes_model.php
+++ b/includes/model/UserAngelTypes_model.php
@@ -1,8 +1,14 @@
<?php
+
/**
* User angeltypes model
*/
+/**
+ * List users angeltypes.
+ *
+ * @param User $user
+ */
function User_angeltypes($user) {
return sql_select("
SELECT `AngelTypes`.*, `UserAngelTypes`.`confirm_user_id`, `UserAngelTypes`.`coordinator`
diff --git a/includes/model/User_model.php b/includes/model/User_model.php
index bd3ec31f..d051b3e9 100644
--- a/includes/model/User_model.php
+++ b/includes/model/User_model.php
@@ -123,9 +123,11 @@ function Users_by_angeltype($angeltype) {
`User`.*,
`UserAngelTypes`.`id` as `user_angeltype_id`,
`UserAngelTypes`.`confirm_user_id`,
- `UserAngelTypes`.`coordinator`
+ `UserAngelTypes`.`coordinator`,
+ `UserDriverLicenses`.*
FROM `User`
JOIN `UserAngelTypes` ON `User`.`UID`=`UserAngelTypes`.`user_id`
+ LEFT JOIN `UserDriverLicenses` ON `User`.`UID`=`UserDriverLicenses`.`user_id`
WHERE `UserAngelTypes`.`angeltype_id`='" . sql_escape($angeltype['id']) . "'
ORDER BY `Nick`");
}