summaryrefslogtreecommitdiff
path: root/includes/model/AngelType_model.php
diff options
context:
space:
mode:
authormsquare <msquare@notrademark.de>2016-11-09 17:43:56 +0100
committerGitHub <noreply@github.com>2016-11-09 17:43:56 +0100
commitd43eb41d25d0d5c0509417247030dd6c21118cf6 (patch)
tree2c3f78bf8fbd4215e70af7dbc2ce30cfef674816 /includes/model/AngelType_model.php
parentd5d2acc7d80920eef5f0ed779a3738a12d5db348 (diff)
parent22520532c78b3a032aec6ececb7623ba094da8de (diff)
Merge pull request #274 from engelsystem/task-164-shift-view
Task 164 shift view
Diffstat (limited to 'includes/model/AngelType_model.php')
-rw-r--r--includes/model/AngelType_model.php25
1 files changed, 15 insertions, 10 deletions
diff --git a/includes/model/AngelType_model.php b/includes/model/AngelType_model.php
index 73b746f0..be15dc59 100644
--- a/includes/model/AngelType_model.php
+++ b/includes/model/AngelType_model.php
@@ -91,7 +91,7 @@ function AngelType_validate_name($name, $angeltype) {
* @param User $user
*/
function AngelTypes_with_user($user) {
- return sql_select("
+ $result = sql_select("
SELECT `AngelTypes`.*,
`UserAngelTypes`.`id` as `user_angeltype_id`,
`UserAngelTypes`.`confirm_user_id`,
@@ -100,30 +100,35 @@ function AngelTypes_with_user($user) {
LEFT JOIN `UserAngelTypes` ON `AngelTypes`.`id`=`UserAngelTypes`.`angeltype_id`
AND `UserAngelTypes`.`user_id`=" . $user['UID'] . "
ORDER BY `name`");
+ if ($result === false) {
+ engelsystem_error("Unable to load angeltypes.");
+ }
+ return $result;
}
/**
* Returns all angeltypes.
*/
function AngelTypes() {
- return sql_select("
+ $result = sql_select("
SELECT *
FROM `AngelTypes`
ORDER BY `name`");
+ if ($result === false) {
+ engelsystem_error("Unable to load angeltypes.");
+ }
+ return $result;
}
/**
* Returns AngelType id array
*/
function AngelType_ids() {
- $angelType_source = sql_select("SELECT `id` FROM `AngelTypes`");
- if ($angelType_source === false) {
- return false;
- }
- if (count($angelType_source) > 0) {
- return $angelType_source;
+ $result = sql_select("SELECT `id` FROM `AngelTypes`");
+ if ($result === false) {
+ engelsystem_error("Unable to load angeltypes.");
}
- return null;
+ return select_array($result, 'id', 'id');
}
/**
@@ -135,7 +140,7 @@ function AngelType_ids() {
function AngelType($angeltype_id) {
$angelType_source = sql_select("SELECT * FROM `AngelTypes` WHERE `id`='" . sql_escape($angeltype_id) . "' LIMIT 1");
if ($angelType_source === false) {
- return false;
+ engelsystem_error("Unable to load angeltype.");
}
if (count($angelType_source) > 0) {
return $angelType_source[0];