diff --git a/controllers/CharactersController.inc b/controllers/CharactersController.inc index 63b9e344..c13d571e 100644 --- a/controllers/CharactersController.inc +++ b/controllers/CharactersController.inc @@ -308,7 +308,7 @@ } // Get XP-levels - $xplevels = $this->Characters->getXPLevelsForSeminary($seminary['id']); + $xplevels = $this->Xplevels->getXPLevelsForSeminary($seminary['id']); // Get Avatars if(count($xplevels) > 0) @@ -563,7 +563,7 @@ } // Get XP-levels - $xplevels = $this->Characters->getXPLevelsForSeminary($seminary['id']); + $xplevels = $this->Xplevels->getXPLevelsForSeminary($seminary['id']); // Set titile diff --git a/controllers/CharactertypesController.inc b/controllers/CharactertypesController.inc index 63bff727..c54c7176 100644 --- a/controllers/CharactertypesController.inc +++ b/controllers/CharactertypesController.inc @@ -31,167 +31,375 @@ * * @var array */ - public $models = array('charactertypes'); + public $models = array('charactertypes', 'xplevels', 'avatars', 'media'); /** * User permissions * * @var array */ public $permissions = array( - 'manage' => array('admin', 'moderator', 'user') + 'index' => array('admin', 'moderator', 'user'), + 'create' => array('admin', 'moderator', 'user'), + 'edit' => array('admin', 'moderator', 'user'), + 'delete' => array('admin', 'moderator', 'user') ); /** - * Action: manage. + * Action: index. * - * Manage Characters. + * List Character types. * * @throws IdNotFoundException * @param string $seminaryUrl URL-Title of a Seminary */ - public function manage($seminaryUrl) + public function index($seminaryUrl) { // Get seminary $seminary = $this->Seminaries->getSeminaryByUrl($seminaryUrl); - + // Check permissions if( - (is_null(self::$character) && count(array_intersect(array('admin', 'moderator'), \hhu\z\controllers\IntermediateController::$user['roles'])) == 0) || - (!is_null(self::$character) && count(array_intersect(array('admin', 'moderator'), self::$character['characterroles'])) == 0) + (is_null(self::$character) && count(array_intersect(array('admin', 'moderator'), \hhu\z\controllers\IntermediateController::$user['roles'])) == 0) && + $seminary['created_user_id'] != self::$user['id'] ) { - throw new AccessDeniedException(); + throw new \nre\exceptions\AccessDeniedException(); } - - // Get Charactertypes + + // Get Character types $charactertypes = $this->Charactertypes->getCharacterTypesForSeminary($seminary['id']); - - // Values - $charactertypesNames = array(); - foreach($charactertypes as &$charactertype) { - $charactertypesNames[$charactertype['id']] = $charactertype['name']; - } - $deleteCharactertypes = null; - $charactertypeName = ''; - $validations = array( - 'edit-charactertypes' => true, - 'create-charactertype' => true - ); - - // Edit - $action = null; - if($this->request->getRequestMethod() == 'POST') + + // Get Avatars + $xplevels = $this->Xplevels->getXPLevelsForSeminary($seminary['id']); + if(count($xplevels) > 0) { - // Edit and delete Charactertypes - if(!is_null($this->request->getPostParam('edit-charactertypes'))) + foreach($charactertypes as &$type) { - $action = 'edit-charactertypes'; - - // Get params and validate them - $charactertypesNames = $this->request->getPostParam('charactertypes'); - $deleteCharactertypes = $this->request->getPostParam('delete-charactertypes'); - foreach($charactertypes as &$charactertype) - { - if(!is_null($deleteCharactertypes) && array_key_exists($charactertype['id'], $deleteCharactertypes)) { - continue; - } - - $name = $charactertypesNames[$charactertype['id']]; - $charactertypeValidation = $this->Validation->validate($name, \nre\configs\AppConfig::$validation['charactertypename']); - if($charactertypeValidation !== true) - { - if(!is_array($validations['edit-charactertypes'])) { - $validations['edit-charactertypes'] = array(); - } - if(!array_key_exists($charactertype['id'], $validations['edit-charactertypes']) || !is_array($validations['edit-charactertypes'][$charactertype['id']])) { - $validations['edit-charactertypes'][$charactertype['id']] = array(); - } - $validations['edit-charactertypes'][$charactertype['id']] = $this->Validation->addValidationResults($validations['edit-charactertypes'][$charactertype['id']], 'charactertypename', $charactertypeValidation); - } - if($this->Charactertypes->charactertypeNameExists($seminary['id'], $name, $charactertype['id'])) - { - if(!is_array($validations['edit-charactertypes'])) { - $validations['edit-charactertypes'] = array(); - } - if(!array_key_exists($charactertype['id'], $validations['edit-charactertypes']) || !is_array($validations['edit-charactertypes'][$charactertype['id']])) { - $validations['edit-charactertypes'][$charactertype['id']] = array(); - } - $validations['edit-charactertypes'][$charactertype['id']] = $this->Validation->addValidationResult($validations['edit-charactertypes'][$charactertype['id']], 'charactertypename', 'exist', true); - } + try { + $type['avatar'] = $this->Avatars->getAvatarByTypeAndLevel($seminary['id'], $type['url'], $xplevels[0]['level']); } - - // Edit and delete - if($validations['edit-charactertypes'] === true) - { - foreach($charactertypes as &$charactertype) - { - // Delete - if(!is_null($deleteCharactertypes) && array_key_exists($charactertype['id'], $deleteCharactertypes)) { - $this->Charactertypes->deleteCharactertype($charactertype['id']); - } - // Edit - elseif(!is_null($charactertypesNames) && array_key_exists($charactertype['id'], $charactertypesNames)) - { - $name = $charactertypesNames[$charactertype['id']]; - $this->Charactertypes->editCharactertype($charactertype['id'], $name); - } - } - - // Redirect - //$this->redirect($this->linker->link(array('seminaries', 'index'))); - $this->redirect($this->linker->link(null, 3)); - } - } - - // Create Charactertype - if(!is_null($this->request->getPostParam('create-charactertype'))) - { - $action = 'create-charactertype'; - - // Get params and validate them - $validations[$action] = $this->Validation->validateParams($this->request->getPostParams(), array('charactertypename')); - $charactertypeName = $this->request->getPostParam('charactertypename'); - if($this->Charactertypes->charactertypeNameExists($seminary['id'], $charactertypeName)) { - $validations[$action] = $this->Validation->addValidationResult($validations[$action], 'charactertypename', 'exist', true); - } - - // Create - if($validations[$action] === true) - { - $this->Charactertypes->createCharactertype( - $this->Auth->getUserId(), - $seminary['id'], - $charactertypeName - ); - $charactertypeName = ''; - - // Redirect - $this->redirect($this->linker->link(null, 3)); + catch(\nre\exceptions\IdNotFoundException $e) { + // No Avatar available } } } - - // Get validation settings - $validationSettings = array( - 'charactertypename' => \nre\configs\AppConfig::$validation['charactertypename'] - ); - - + + // Set titile - $this->addTitleLocalized('Manage Charactertypes'); + $this->addTitleLocalized('Charactertypes'); $this->addTitle($seminary['title']); // Pass data to view $this->set('seminary', $seminary); - $this->set('charactertypesNames', $charactertypesNames); - $this->set('deleteCharactertypes', $deleteCharactertypes); - $this->set('charactertypeName', $charactertypeName); - $this->set('action', $action); - $this->set('validations', $validations); + $this->set('xplevels', $xplevels); + $this->set('charactertypes', $charactertypes); + } + + + /** + * Action: create. + * + * Create new Character type for a Seminary. + * + * @throws IdNotFoundException + * @param string $seminaryUrl URL-Title of a Seminary + */ + public function create($seminaryUrl) + { + // Get seminary + $seminary = $this->Seminaries->getSeminaryByUrl($seminaryUrl); + + // Check permissions + if( + $seminary['created_user_id'] != self::$user['id'] && + (is_null(self::$character) && count(array_intersect(array('admin'), \hhu\z\controllers\IntermediateController::$user['roles'])) == 0) + ) { + throw new \nre\exceptions\AccessDeniedException(); + } + + // Values + $name = ''; + $fields = array('charactertypename'); + $validation = array(); + + // Create new Charactertype + if($this->request->getRequestMethod() == 'POST' && !is_null($this->request->getPostParam('create'))) + { + // Get params and validate them + $validation = $this->Validation->validateParams($this->request->getPostParams(), $fields); + $name = $this->request->getPostParam('charactertypename'); + if($this->Charactertypes->charactertypeNameExists($seminary['id'], $name)) { + $validation = $this->Validation->addValidationResult($validation, 'charactertypename', 'exist', true); + } + + // Create new Charactertype + if($validation === true) + { + $charactertypeId = $this->Charactertypes->createCharactertype( + $this->Auth->getUserId(), + $seminary['id'], + $name + ); + $charactertype = $this->Charactertypes->getCharactertypeById($charactertypeId); + + // Redirect to editing + $this->redirect($this->linker->link(array('edit', $seminary['url'], $charactertype['url']), 1)); + } + } + + // Get validation settings + $validationSettings = array(); + foreach($fields as &$field) { + $validationSettings[$field] = \nre\configs\AppConfig::$validation[$field]; + } + + + // Set titile + $this->addTitleLocalized('Create new Charactertype'); + $this->addTitle($seminary['title']); + + // Pass data to view + $this->set('seminary', $seminary); + $this->set('name', $name); + $this->set('validation', $validation); $this->set('validationSettings', $validationSettings); } + + + /** + * Action: edit. + * + * Edit Character type for a Seminary. + * + * @throws IdNotFoundException + * @param string $seminaryUrl URL-title of a Seminary + * @param string $charactertypeUrl URL-title of Character type + */ + public function edit($seminaryUrl, $charactertypeUrl) + { + // Get seminary + $seminary = $this->Seminaries->getSeminaryByUrl($seminaryUrl); + + // Check permissions + if( + $seminary['created_user_id'] != self::$user['id'] && + (is_null(self::$character) && count(array_intersect(array('admin', 'moderator'), \hhu\z\controllers\IntermediateController::$user['roles'])) == 0) + ) { + throw new \nre\exceptions\AccessDeniedException(); + } + + // Get Character type + $charactertype = $this->Charactertypes->getCharactertypeByUrl($seminary['id'], $charactertypeUrl); + + // XP-levels + $xplevels = $this->Xplevels->getXPLevelsForSeminary($seminary['id']); + foreach($xplevels as &$xplevel) + { + try { + $xplevel['avatar'] = $this->Avatars->getAvatarByTypeAndLevel($seminary['id'], $charactertype['url'], $xplevel['level']); + } + catch(\nre\exceptions\IdNotFoundException $e) { + // No Avatar available + } + } + + // Get allowed mimetypes + $mimetypes = \nre\configs\AppConfig::$mimetypes['moodpics']; + + // Values + $name = $charactertype['name']; + $fields = array('charactertypename'); + $validation = array(); + $avatarVariants = array('portrait', 'avatar'); + $avatarsValidation = true; + + // Check request method + if($this->request->getRequestMethod() == 'POST' && !is_null($this->request->getPostParam('edit'))) + { + // Get params and validate them + $validation = $this->Validation->validateParams($this->request->getPostParams(), $fields); + $name = $this->request->getPostParam('charactertypename'); + if($this->Charactertypes->charactertypeNameExists($seminary['id'], $name, $charactertype['id'])) { + $validation = $this->Validation->addValidationResult($validation, 'charactertypename', 'exist', true); + } + + // Validate and upload avatars + if(array_key_exists('avatars', $_FILES)) + { + foreach($xplevels as &$xplevel) + { + if(array_key_exists($xplevel['id'], $_FILES['avatars']['error'])) + { + foreach($avatarVariants as &$variant) + { + if(array_key_exists($variant, $_FILES['avatars']['error'][$xplevel['id']]) && $_FILES['avatars']['error'][$xplevel['id']][$variant] !== UPLOAD_ERR_NO_FILE) + { + $avatar = array( + 'name' => $_FILES['avatars']['name'][$xplevel['id']][$variant], + 'type' => $_FILES['avatars']['type'][$xplevel['id']][$variant], + 'tmp_name' => $_FILES['avatars']['tmp_name'][$xplevel['id']][$variant], + 'error' => $_FILES['avatars']['error'][$xplevel['id']][$variant], + 'size' => $_FILES['avatars']['size'][$xplevel['id']][$variant] + ); + $avatarValidation = true; + + // Check error + if($avatar['error'] !== UPLOAD_ERR_OK) { + $avatarValidation = $this->Validation->addValidationResult($avatarValidation, 'avatar', 'error', $avatar['error']); + } + + // Check mimetype + $avatarMimetype = null; + $avatar['mimetype'] = \hhu\z\Utils::getMimetype($avatar['tmp_name'], $avatar['type']); + foreach($mimetypes as &$mimetype) { + if($mimetype['mimetype'] == $avatar['mimetype']) { + $avatarMimetype = $mimetype; + break; + } + } + if(is_null($avatarMimetype)) { + $avatarValidation = $this->Validation->addValidationResult($avatarValidation, 'avatar', 'mimetype', $avatar['mimetype']); + } + elseif($avatar['size'] > $avatarMimetype['size']) { + $avatarValidation = $this->Validation->addValidationResult($avatarValidation, 'avatar', 'size', $avatarMimetype['size']); + } + + // Add validation result + if(!$avatarValidation !== true) + { + if(!is_array($avatarsValidation)) { + $avatarsValidation = array(); + } + if(!array_key_exists($xplevel['id'], $avatarsValidation)) { + $avatarsValidation[$xplevel['id']] = array(); + } + $avatarsValidation[$xplevel['id']][$variant] = $avatarValidation; + } + + // Upload avatar + if($avatarValidation === true) + { + $avatar['media_id'] = $this->Media->createAvatarPicture( + $this->Auth->getUserId(), + $seminary['id'], + sprintf('avatar-%d-%d-%s', $charactertype['id'], $xplevel['id'], $variant), + '', + $avatar['mimetype'], + $avatar['tmp_name'] + ); + + // Set avatar + if($variant == 'portrait') { + $this->Avatars->setAvatarPortraitForTypeAndLevel( + $this->Auth->getUserId(), + $charactertype['id'], + $xplevel['id'], + $avatar['media_id'] + ); + } + else { + $this->Avatars->setAvatarForTypeAndLevel( + $this->Auth->getUserId(), + $charactertype['id'], + $xplevel['id'], + $avatar['media_id'] + ); + } + } + } + } + } + } + } + + // Edit Charactertype + if($validation === true && $avatarsValidation === true) + { + $this->Charactertypes->editCharactertype( + $charactertype['id'], + $name + ); + $charactertype = $this->Charactertypes->getCharactertypeById($charactertype['id']); + + // Redirect to overview + $this->redirect($this->linker->link(array('index', $seminary['url']), 1)); + } + } + + // Get validation settings + $validationSettings = array(); + foreach($fields as &$field) { + $validationSettings[$field] = \nre\configs\AppConfig::$validation[$field]; + } + + + // Set titile + $this->addTitleLocalized('Edit Charactertype'); + $this->addTitle($seminary['title']); + + // Pass data to view + $this->set('seminary', $seminary); + $this->set('charactertype', $charactertype); + $this->set('xplevels', $xplevels); + $this->set('name', $name); + $this->set('mimetypes', $mimetypes); + $this->set('validation', $validation); + $this->set('avatarsValidation', $avatarsValidation); + $this->set('avatarVariants', $avatarVariants); + $this->set('validationSettings', $validationSettings); + } + + + /** + * Action: delete. + * + * Delete Character type for a Seminary. + * + * @throws IdNotFoundException + * @param string $seminaryUrl URL-title of a Seminary + * @param string $charactertypeUrl URL-title of Character type + */ + public function delete($seminaryUrl, $charactertypeUrl) + { + // Get seminary + $seminary = $this->Seminaries->getSeminaryByUrl($seminaryUrl); + + // Check permissions + if( + $seminary['created_user_id'] != self::$user['id'] && + (is_null(self::$character) && count(array_intersect(array('admin'), \hhu\z\controllers\IntermediateController::$user['roles'])) == 0) + ) { + throw new \nre\exceptions\AccessDeniedException(); + } + + // Get Character type + $charactertype = $this->Charactertypes->getCharactertypeByUrl($seminary['id'], $charactertypeUrl); + + // Check request method + if($this->request->getRequestMethod() == 'POST') + { + // Check confirmation + if(!is_null($this->request->getPostParam('delete'))) + { + // Delete Character type + $this->Charactertypes->deleteCharactertype($charactertype['id']); + } + + // Redirect to overview + $this->redirect($this->linker->link(array('index', $seminary['url']), 1)); + } + + + // Set titile + $this->addTitleLocalized('Delete Charactertype'); + $this->addTitle($seminary['title']); + + // Pass data to view + $this->set('seminary', $seminary); + $this->set('charactertype', $charactertype); + } } diff --git a/models/AvatarsModel.inc b/models/AvatarsModel.inc index 9c3d3701..ad6af355 100644 --- a/models/AvatarsModel.inc +++ b/models/AvatarsModel.inc @@ -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 + ); + } } diff --git a/models/CharactersModel.inc b/models/CharactersModel.inc index b94ee0a3..7a6c669b 100644 --- a/models/CharactersModel.inc +++ b/models/CharactersModel.inc @@ -578,25 +578,6 @@ } - /** - * Get all XP-levels for a Seminary. - * - * @param int $seminaryId ID of Seminary - * @return array List of XP-levels - */ - public function getXPLevelsForSeminary($seminaryId) - { - return $this->db->query( - 'SELECT id, xps, level, name '. - 'FROM xplevels '. - 'WHERE seminary_id = ? '. - 'ORDER BY level ASC', - 'i', - $seminaryId - ); - } - - /** * Get Characters with the given Character role. * diff --git a/models/CharactertypesModel.inc b/models/CharactertypesModel.inc index 7e63db04..eaa69e58 100644 --- a/models/CharactertypesModel.inc +++ b/models/CharactertypesModel.inc @@ -43,7 +43,7 @@ public function getCharacterTypesForSeminary($seminaryId) { return $this->db->query( - 'SELECT id, name, url '. + 'SELECT id, seminary_id, name, url '. 'FROM charactertypes '. 'WHERE seminary_id = ? '. 'ORDER BY name ASC', @@ -51,6 +51,56 @@ $seminaryId ); } + + + /** + * Get Character type by its URL. + * + * @param int $seminaryId ID of Seminary + * @param string $charactretypeUrl URL-title of Character type + * @return array Character type data + */ + public function getCharactertypeByUrl($seminaryId, $charactertypeUrl) + { + $data = $this->db->query( + 'SELECT id, seminary_id, name, url '. + 'FROM charactertypes '. + 'WHERE seminary_id = ? AND url = ?', + 'is', + $seminaryId, + $charactertypeUrl + ); + if(empty($data)) { + throw new \nre\exceptions\IdNotFoundException($charactertypeUrl); + } + + + return $data[0]; + } + + + /** + * Get Character type by its ID. + * + * @param string $charactertypeId ID of Character type + * @return array Character type data + */ + public function getCharactertypeById($charactertypeId) + { + $data = $this->db->query( + 'SELECT id, seminary_id, name, url '. + 'FROM charactertypes '. + 'WHERE id = ?', + 'i', + $charactertypeId + ); + if(empty($data)) { + throw new \nre\exceptions\IdNotFoundException($charactertypeId); + } + + + return $data[0]; + } /** @@ -75,8 +125,8 @@ return (!empty($data) && (is_null($charactertypeId) || $charactertypeId != $data[0]['id'])); } - - + + /** * Create a new Charactertype for a Seminary. * @@ -87,19 +137,47 @@ */ public function createCharactertype($userId, $seminaryId, $name) { - $this->db->query( - 'INSERT INTO charactertypes '. - '(created_user_id, seminary_id, name, url) '. - 'VALUES '. - '(?, ?, ?, ?) ', - 'iiss', - $userId, - $seminaryId, - $name, - \nre\core\Linker::createLinkParam($name) - ); - - return $this->db->getInsertId(); + $charactertypeId = null; + $this->db->setAutocommit(false); + try { + // Create Charactertype + $this->db->query( + 'INSERT INTO charactertypes '. + '(created_user_id, seminary_id, name, url) '. + 'VALUES '. + '(?, ?, ?, ?) ', + 'iiss', + $userId, + $seminaryId, + $name, + \nre\core\Linker::createLinkParam($name) + ); + $charactertypeId = $this->db->getInsertId(); + + // Create avatars + $this->db->query( + 'INSERT INTO avatars '. + '(created_user_id, charactertype_id, xplevel_id) '. + 'SELECT ?, ?, xplevels.id '. + 'FROM xplevels '. + 'WHERE seminary_id = ?', + 'iii', + $userId, + $charactertypeId, + $seminaryId + ); + + $this->db->commit(); + } + catch(\Exception $e) { + $this->db->rollback(); + $this->db->setAutocommit(true); + throw $e; + } + $this->db->setAutocommit(true); + + + return $charactertypeId; } diff --git a/models/MediaModel.inc b/models/MediaModel.inc index 1b678d49..f1616d4f 100644 --- a/models/MediaModel.inc +++ b/models/MediaModel.inc @@ -173,6 +173,60 @@ return $mediaId; } + + /** + * Create a new Avatar picture for a Charactertype by creating a new Seminarymedia and + * adding it to the list of Avatar pictures. + * + * @param int $userId ID of user that does the upload + * @param int $seminaryId ID of Seminary + * @param string $filename Filename of uploading media + * @param string $description Description for media + * @param string $mimetype Mimetype of media + * @param string $tmpFilename Name of temporary uploaded file + * @return mixed ID of media record or false if upload failed + */ + public function createAvatarpicture($userId, $seminaryId, $filename, $description, $mimetype, $tmpFilename) + { + $mediaId = false; + $this->db->setAutocommit(false); + + try { + // Create Seminary media record + $mediaId = $this->createSeminaryMedia($userId, $seminaryId, $filename, $description, $mimetype); + + // Add media to Achievements media + $this->db->query( + 'INSERT INTO avatarpictures '. + '(seminarymedia_id, created_user_id) '. + 'VALUES '. + '(?, ?) '. + 'ON DUPLICATE KEY UPDATE '. + 'created_user_id = ?', + 'iii', + $mediaId, + $userId, + $userId + ); + + // Create filename + $filename = ROOT.DS.\nre\configs\AppConfig::$dirs['seminarymedia'].DS.$mediaId; + if(!move_uploaded_file($tmpFilename, $filename)) + { + $this->db->rollback(); + $mediaId = false; + } + } + catch(\nre\exceptions\DatamodelException $e) { + $this->db->rollback(); + $this->db->setAutocommit(true); + } + + + $this->db->setAutocommit(true); + return $mediaId; + } + /** * Create a new Questgroup picture (Moodpic). @@ -339,6 +393,18 @@ } + /** + * Create a new Achievement media by creating a new Seminarymedia and + * adding it to the list of media for Achievements. + * + * @param int $userId ID of user that does the upload + * @param int $seminaryId ID of Seminary + * @param string $filename Filename of uploading media + * @param string $description Description for media + * @param string $mimetype Mimetype of media + * @param string $tmpFilename Name of temporary uploaded file + * @return mixed ID of media record or false if upload failed + */ public function createAchievementMedia($userId, $seminaryId, $filename, $description, $mimetype, $tmpFilename) { $mediaId = false; diff --git a/views/html/charactertypes/create.tpl b/views/html/charactertypes/create.tpl new file mode 100644 index 00000000..46a642af --- /dev/null +++ b/views/html/charactertypes/create.tpl @@ -0,0 +1,45 @@ + +
=$type['name']?>
+ +=\hhu\z\Utils::t($seminary['description'])?>
=sprintf(_('created by %s on %s'), $seminary['creator']['username'], $dateFormatter->format(new \DateTime($seminary['created'])))?>
+ + + + =_('Manage XP-levels')?> + 0) : ?> + =_('Manage Charactertypes')?> + + + 0) : ?> =_('Create a Character')?> - 0) : ?> - =_('Manage Charactertypes')?>=sprintf(_('Your Character “%s” has not been activated yet'), $seminary['usercharacter']['name'])?>
- -