improve CRUD for Character types (issue #319) and implement CRUD for Avatars (issue #37)

This commit is contained in:
coderkun 2014-07-10 12:57:25 +02:00
commit 7873ee0d5b
12 changed files with 760 additions and 245 deletions

View file

@ -86,6 +86,60 @@
return $data[0];
}
/**
* Set the picture for an Avatar.
*
* @param int $userId ID of creating user
* @param int $charactertypeId ID of Charactertype of Avatar
* @param int $xplevelId ID of XP-level of Avatar
* @param int $avatarpictureId ID of Avatar picture to set
*/
public function setAvatarForTypeAndLevel($userId, $charactertypeId, $xplevelId, $avatarpictureId)
{
$this->db->query(
'INSERT INTO avatars '.
'(created_user_id, charactertype_id, xplevel_id, avatarpicture_id) '.
'VALUES '.
'(?, ?, ?, ?) '.
'ON DUPLICATE KEY UPDATE '.
'avatarpicture_id = ?',
'iiiii',
$userId,
$charactertypeId,
$xplevelId,
$avatarpictureId,
$avatarpictureId
);
}
/**
* Set the portrait picture for an Avatar.
*
* @param int $userId ID of creating user
* @param int $charactertypeId ID of Charactertype of Avatar
* @param int $xplevelId ID of XP-level of Avatar
* @param int $avatarpictureId ID of Avatar portrait picture to set
*/
public function setAvatarPortraitForTypeAndLevel($userId, $charactertypeId, $xplevelId, $avatarpictureId)
{
$this->db->query(
'INSERT INTO avatars '.
'(created_user_id, charactertype_id, xplevel_id, small_avatarpicture_id) '.
'VALUES '.
'(?, ?, ?, ?) '.
'ON DUPLICATE KEY UPDATE '.
'small_avatarpicture_id = ?',
'iiiii',
$userId,
$charactertypeId,
$xplevelId,
$avatarpictureId,
$avatarpictureId
);
}
}