add page to manage Characters

This commit is contained in:
coderkun 2014-04-23 21:02:30 +02:00
commit f35cfa41ec
7 changed files with 216 additions and 21 deletions

View file

@ -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
);
}
}
?>