completed api comments
This commit is contained in:
parent
239c2b1684
commit
b35a32ef52
|
@ -1,26 +1,44 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete an Angeltype.
|
||||||
|
* @param Angeltype $angeltype
|
||||||
|
*/
|
||||||
function AngelType_delete($angeltype) {
|
function AngelType_delete($angeltype) {
|
||||||
sql_query("DELETE FROM `NeededAngelTypes` WHERE `angel_type_id`=" . sql_escape($angeltype['id']) . " LIMIT 1");
|
return sql_query("
|
||||||
sql_query("DELETE FROM `ShiftEntry` WHERE `TID`=" . sql_escape($angeltype['id']) . " LIMIT 1");
|
DELETE FROM `AngelTypes`
|
||||||
sql_query("DELETE FROM `UserAngelTypes` WHERE `angeltype_id`=" . sql_escape($angeltype['id']) . " LIMIT 1");
|
WHERE `id`=" . sql_escape($angeltype['id']) . "
|
||||||
return sql_query("DELETE FROM `AngelTypes` WHERE `id`=" . sql_escape($angeltype['id']) . " LIMIT 1");
|
LIMIT 1");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update Angeltype.
|
||||||
|
*
|
||||||
|
* @param int $angeltype_id
|
||||||
|
* @param string $name
|
||||||
|
* @param boolean $restricted
|
||||||
|
*/
|
||||||
function AngelType_update($angeltype_id, $name, $restricted) {
|
function AngelType_update($angeltype_id, $name, $restricted) {
|
||||||
return sql_query("
|
return sql_query("
|
||||||
UPDATE `AngelTypes` SET
|
UPDATE `AngelTypes` SET
|
||||||
`name`='" . sql_escape($name) . "',
|
`name`='" . sql_escape($name) . "',
|
||||||
`restricted`=" . sql_escape($restricted) . "
|
`restricted`=" . sql_escape($restricted ? 1 : 0) . "
|
||||||
WHERE `id`=" . sql_escape($angeltype_id) . "
|
WHERE `id`=" . sql_escape($angeltype_id) . "
|
||||||
LIMIT 1");
|
LIMIT 1");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an Angeltype.
|
||||||
|
*
|
||||||
|
* @param string $name
|
||||||
|
* @param boolean $restricted
|
||||||
|
* @return New Angeltype id
|
||||||
|
*/
|
||||||
function AngelType_create($name, $restricted) {
|
function AngelType_create($name, $restricted) {
|
||||||
$result = sql_query("
|
$result = sql_query("
|
||||||
INSERT INTO `AngelTypes` SET
|
INSERT INTO `AngelTypes` SET
|
||||||
`name`='" . sql_escape($name) . "',
|
`name`='" . sql_escape($name) . "',
|
||||||
`restricted`=" . sql_escape($restricted));
|
`restricted`=" . sql_escape($restricted ? 1 : 0));
|
||||||
if ($result === false)
|
if ($result === false)
|
||||||
return false;
|
return false;
|
||||||
return sql_id();
|
return sql_id();
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete all unconfirmed UserAngelTypes for given Angeltype.
|
||||||
|
*
|
||||||
|
* @param int $angeltype_id
|
||||||
|
*/
|
||||||
function UserAngelTypes_delete_all($angeltype_id) {
|
function UserAngelTypes_delete_all($angeltype_id) {
|
||||||
return sql_query("
|
return sql_query("
|
||||||
DELETE FROM `UserAngelTypes`
|
DELETE FROM `UserAngelTypes`
|
||||||
|
@ -7,6 +12,12 @@ function UserAngelTypes_delete_all($angeltype_id) {
|
||||||
AND `confirm_user_id` IS NULL");
|
AND `confirm_user_id` IS NULL");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Confirm all unconfirmed UserAngelTypes for given Angeltype.
|
||||||
|
*
|
||||||
|
* @param int $angeltype_id
|
||||||
|
* @param User $confirm_user
|
||||||
|
*/
|
||||||
function UserAngelTypes_confirm_all($angeltype_id, $confirm_user) {
|
function UserAngelTypes_confirm_all($angeltype_id, $confirm_user) {
|
||||||
return sql_query("
|
return sql_query("
|
||||||
UPDATE `UserAngelTypes`
|
UPDATE `UserAngelTypes`
|
||||||
|
@ -15,6 +26,12 @@ function UserAngelTypes_confirm_all($angeltype_id, $confirm_user) {
|
||||||
AND `confirm_user_id` IS NULL");
|
AND `confirm_user_id` IS NULL");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Confirm an UserAngelType with confirming user.
|
||||||
|
*
|
||||||
|
* @param int $user_angeltype_id
|
||||||
|
* @param User $confirm_user
|
||||||
|
*/
|
||||||
function UserAngelType_confirm($user_angeltype_id, $confirm_user) {
|
function UserAngelType_confirm($user_angeltype_id, $confirm_user) {
|
||||||
return sql_query("
|
return sql_query("
|
||||||
UPDATE `UserAngelTypes`
|
UPDATE `UserAngelTypes`
|
||||||
|
@ -23,6 +40,11 @@ function UserAngelType_confirm($user_angeltype_id, $confirm_user) {
|
||||||
LIMIT 1");
|
LIMIT 1");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete an UserAngelType.
|
||||||
|
*
|
||||||
|
* @param UserAngelType $user_angeltype
|
||||||
|
*/
|
||||||
function UserAngelType_delete($user_angeltype) {
|
function UserAngelType_delete($user_angeltype) {
|
||||||
return sql_query("
|
return sql_query("
|
||||||
DELETE FROM `UserAngelTypes`
|
DELETE FROM `UserAngelTypes`
|
||||||
|
@ -30,6 +52,12 @@ function UserAngelType_delete($user_angeltype) {
|
||||||
LIMIT 1");
|
LIMIT 1");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an UserAngelType.
|
||||||
|
*
|
||||||
|
* @param User $user
|
||||||
|
* @param Angeltype $angeltype
|
||||||
|
*/
|
||||||
function UserAngelType_create($user, $angeltype) {
|
function UserAngelType_create($user, $angeltype) {
|
||||||
$result = sql_query("
|
$result = sql_query("
|
||||||
INSERT INTO `UserAngelTypes` SET
|
INSERT INTO `UserAngelTypes` SET
|
||||||
|
@ -40,6 +68,11 @@ function UserAngelType_create($user, $angeltype) {
|
||||||
return sql_id();
|
return sql_id();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get an UserAngelType by its id.
|
||||||
|
*
|
||||||
|
* @param int $user_angeltype_id
|
||||||
|
*/
|
||||||
function UserAngelType($user_angeltype_id) {
|
function UserAngelType($user_angeltype_id) {
|
||||||
$angeltype = sql_select("
|
$angeltype = sql_select("
|
||||||
SELECT *
|
SELECT *
|
||||||
|
@ -53,6 +86,12 @@ function UserAngelType($user_angeltype_id) {
|
||||||
return $angeltype[0];
|
return $angeltype[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get an UserAngelType by user and angeltype.
|
||||||
|
*
|
||||||
|
* @param User $user
|
||||||
|
* @param Angeltype $angeltype
|
||||||
|
*/
|
||||||
function UserAngelType_by_User_and_AngelType($user, $angeltype) {
|
function UserAngelType_by_User_and_AngelType($user, $angeltype) {
|
||||||
$angeltype = sql_select("
|
$angeltype = sql_select("
|
||||||
SELECT *
|
SELECT *
|
||||||
|
|
Loading…
Reference in New Issue