add page to manage Characters
This commit is contained in:
parent
2185a7c2a4
commit
f35cfa41ec
7 changed files with 216 additions and 21 deletions
|
|
@ -52,6 +52,49 @@
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a role to a Character.
|
||||
*
|
||||
* @param int $characterId ID of Character to add role to
|
||||
* @param string $characterrole Role to add
|
||||
*/
|
||||
public function addCharacterroleToCharacter($characterId, $characterrole)
|
||||
{
|
||||
$this->db->query(
|
||||
'INSERT IGNORE INTO characters_characterroles '.
|
||||
'(character_id, characterrole_id) '.
|
||||
'SELECT ?, id '.
|
||||
'FROM characterroles '.
|
||||
'WHERE name = ?',
|
||||
'is',
|
||||
$characterId,
|
||||
$characterrole
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove a role from a Character.
|
||||
*
|
||||
* @param int $characterId ID of Character to remove role from
|
||||
* @param string $characterrole Role to remove
|
||||
*/
|
||||
public function removeCharacterroleFromCharacter($characterId, $characterrole)
|
||||
{
|
||||
$this->db->query(
|
||||
'DELETE FROM characters_characterroles '.
|
||||
'WHERE character_id = ? AND characterrole_id = ('.
|
||||
'SELECT id '.
|
||||
'FROM characterroles '.
|
||||
'WHERE name = ?'.
|
||||
')',
|
||||
'is',
|
||||
$characterId,
|
||||
$characterrole
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue