diff --git a/configs/AppConfig.inc b/configs/AppConfig.inc index f33044de..45ccb0fe 100644 --- a/configs/AppConfig.inc +++ b/configs/AppConfig.inc @@ -96,6 +96,11 @@ 'password' => array( 'minlength' => 5, 'maxlength' => 64 + ), + 'charactername' => array( + 'minlength' => 5, + 'maxlength' => 32, + 'regex' => '/^\w*$/' ) ); @@ -109,7 +114,7 @@ public static $routes = array( array('css/?(.*)', 'css/$1?layout=stylesheet', true), array('users/([^/]+)/(edit|delete)', 'users/$2/$1', true), - array('users/(?!(index|login|register|logout|create|edit|delete))', 'users/user/$1', true), + array('users/(?!(index|login|register|logout|create|edit|delete))', 'users/user/$1', true), array('seminaries/([^/]+)/(edit|delete)', 'seminaries/$2/$1', true), array('seminaries/(?!(index|create|edit|delete))', 'seminaries/seminary/$1', true), /*// z/ ⇒ z/seminaries/seminary/ @@ -118,7 +123,7 @@ array('^([^/]+)/([^/]+)/?$', 'questgropus/questgroup/$1/$2', true), // z/// ⇒ z/quests/quest/// array('^([^/]+)/([^/]+)/([^/]+)/?$', 'quests/quest/$1/$2/3', true)*/ - array('characters/(?!(index|character))', 'characters/index/$1', true), + array('characters/(?!(index|character|register))', 'characters/index/$1', true), array('charactergroups/(?!(index|groupsgroup|group))', 'charactergroups/index/$1', true), array('charactergroupsquests/(?!(quest))', 'charactergroupsquests/quest/$1', true), array('media/(.*)', 'media/$1?layout=binary', false), diff --git a/controllers/CharactergroupsController.inc b/controllers/CharactergroupsController.inc index 1028d28c..594cba12 100644 --- a/controllers/CharactergroupsController.inc +++ b/controllers/CharactergroupsController.inc @@ -24,7 +24,7 @@ * * @var array */ - public $models = array('seminaries', 'charactergroups', 'charactergroupsquests'); + public $models = array('seminaries', 'charactergroups', 'charactergroupsquests', 'avatars', 'media'); /** * User permissions * @@ -57,6 +57,9 @@ { // Get seminary $seminary = $this->Seminaries->getSeminaryByUrl($seminaryUrl); + if(!is_null($seminary['media_id'])) { + $seminary['media'] = $this->Media->getMediaById($seminary['media_id']); + } // Get Character groups-groups $groupsgroups = $this->Charactergroups->getGroupsroupsForSeminary($seminary['id']); @@ -82,6 +85,9 @@ { // Get seminary $seminary = $this->Seminaries->getSeminaryByUrl($seminaryUrl); + if(!is_null($seminary['media_id'])) { + $seminary['media'] = $this->Media->getMediaById($seminary['media_id']); + } // Get Character groups-group $groupsgroup = $this->Charactergroups->getGroupsgroupByUrl($seminary['id'], $groupsgroupUrl); @@ -116,15 +122,26 @@ { // Get seminary $seminary = $this->Seminaries->getSeminaryByUrl($seminaryUrl); + if(!is_null($seminary['media_id'])) { + $seminary['media'] = $this->Media->getMediaById($seminary['media_id']); + } // Get Character groups-group $groupsgroup = $this->Charactergroups->getGroupsgroupByUrl($seminary['id'], $groupsgroupUrl); // Get Character group $group = $this->Charactergroups->getGroupByUrl($groupsgroup['id'], $groupUrl); + $group['characters'] = $this->Characters->getCharactersForGroup($group['id']); + $group['rank'] = $this->Charactergroups->getXPRank($groupsgroup['id'], $group['xps']); - // Get Characters - $characters = $this->Characters->getCharactersForGroup($group['id']); + // Get Character avatars + foreach($group['characters'] as &$character) + { + $avatar = $this->Avatars->getAvatarById($character['avatar_id']); + if(!is_null($avatar['small_avatarpicture_id'])) { + $character['small_avatar'] = $this->Media->getSeminaryMediaById($avatar['small_avatarpicture_id']); + } + } // Get Character groups Quests $quests = $this->Charactergroupsquests->getQuestsForGroup($group['id']); @@ -134,7 +151,6 @@ $this->set('seminary', $seminary); $this->set('groupsgroup', $groupsgroup); $this->set('group', $group); - $this->set('characters', $characters); $this->set('quests', $quests); } diff --git a/controllers/CharactergroupsquestsController.inc b/controllers/CharactergroupsquestsController.inc index fb9d18c8..478d8700 100644 --- a/controllers/CharactergroupsquestsController.inc +++ b/controllers/CharactergroupsquestsController.inc @@ -61,6 +61,9 @@ { // Get seminary $seminary = $this->Seminaries->getSeminaryByUrl($seminaryUrl); + if(!is_null($seminary['media_id'])) { + $seminary['media'] = $this->Media->getMediaById($seminary['media_id']); + } // Get Character groups-group $groupsgroup = $this->Charactergroups->getGroupsgroupByUrl($seminary['id'], $groupsgroupUrl); diff --git a/controllers/CharactersController.inc b/controllers/CharactersController.inc index e64cb63f..8486a2fc 100644 --- a/controllers/CharactersController.inc +++ b/controllers/CharactersController.inc @@ -19,6 +19,18 @@ */ class CharactersController extends \hhu\z\controllers\SeminaryRoleController { + /** + * Required models + * + * @var array + */ + public $models = array('seminaries', 'characters', 'users', 'charactergroups', 'charactertypes', 'seminarycharacterfields', 'avatars', 'media'); + /** + * Required components + * + * @var array + */ + public $components = array('validation'); /** * User permissions * @@ -26,14 +38,18 @@ */ public $permissions = array( 'index' => array('admin', 'moderator'), - 'character' => array('admin', 'moderator', 'user') + 'character' => array('admin', 'moderator', 'user'), + 'register' => array('admin', 'moderator', 'user') ); /** - * Required models + * User seminary permissions * * @var array */ - public $models = array('seminaries', 'characters', 'users', 'charactergroups', 'seminarycharacterfields'); + public $seminaryPermissions = array( + 'index' => array('admin', 'moderator'), + 'character' => array('admin', 'moderator', 'user') + ); @@ -50,6 +66,9 @@ { // Get Seminary $seminary = $this->Seminaries->getSeminaryByUrl($seminaryUrl); + if(!is_null($seminary['media_id'])) { + $seminary['media'] = $this->Media->getMediaById($seminary['media_id']); + } // Get registered Characters $characters = $this->Characters->getCharactersForSeminary($seminary['id']); @@ -59,6 +78,12 @@ { // Level $character['xplevel'] = $this->Characters->getXPLevelOfCharacters($character['id']); + + // Avatar + $avatar = $this->Avatars->getAvatarById($character['avatar_id']); + if(!is_null($avatar['small_avatarpicture_id'])) { + $character['small_avatar'] = $this->Media->getSeminaryMediaById($avatar['small_avatarpicture_id']); + } } @@ -82,6 +107,9 @@ // Get Seminary $seminary = $this->Seminaries->getSeminaryByUrl($seminaryUrl); $seminary['achievable_xps'] = $this->Seminaries->getTotalXPs($seminary['id']); + if(!is_null($seminary['media_id'])) { + $seminary['media'] = $this->Media->getMediaById($seminary['media_id']); + } // Get Character $character = $this->Characters->getCharacterByUrl($seminary['id'], $characterUrl); @@ -107,6 +135,104 @@ $this->set('groups', $groups); } + + /** + * Acton: register. + * + * Register a new character for a Seminary. + * + * @throws IdNotFoundException + * @throws ParamsNotValidException + * @param string $seminaryUrl URL-Title of a Seminary + */ + public function register($seminaryUrl) + { + // Get seminary + $seminary = $this->Seminaries->getSeminaryByUrl($seminaryUrl); + + // Character types + $types = $this->Charactertypes->getCharacterTypesForSeminary($seminary['id']); + + // Character fields + $fields = $this->Seminarycharacterfields->getFieldsForSeminary($seminary['id']); + + // Register Character + $charactername = ''; + $validation = true; + $fieldsValidation = true; + if($this->request->getRequestMethod() == 'POST' && !is_null($this->request->getPostParam('create'))) + { + // Validate Character properties + $validation = $this->Validation->validateParams($this->request->getPostParams(), array('charactername')); + $charactername = $this->request->getPostParam('charactername'); + + // Validate type + $typeIndex = null; + foreach($types as $index => &$type) + { + $type['selected'] = ($type['url'] == $this->request->getPostParam('type')); + if($type['selected']) { + $typeIndex = $index; + } + } + if(is_null($typeIndex)) { + throw new \nre\exceptions\ParamsNotValidException($characterType); + } + + // Validate fields + $fieldsValues = $this->request->getPostParam('fields'); + foreach($fields as &$field) + { + if(!array_key_exists($field['url'], $fieldsValues)) { + throw new \nre\exceptions\ParamsNotValidException($index); + } + if($field['required']) + { + $fieldValidation = $this->Validation->validate($fieldsValues[$field['url']], array('regex'=>$field['regex'])); + if($fieldValidation !== true) + { + if(!is_array($fieldsValidation)) { + $fieldsValidation = array(); + } + $fieldsValidation[$field['url']] = $fieldValidation; + } + } + } + + // Register + if($validation === true && $fieldsValidation === true) + { + $characterId = $this->Characters->createCharacter($this->Auth->getUserId(), $types[$typeIndex]['id'], $charactername); + + // Add Seminary fields + foreach($fields as &$field) { + if(!empty($fieldsValues[$field['url']])) { + $this->Characters->setSeminaryFieldOfCharacter($characterId, $field['id'], $fieldsValues[$field['url']]); + } + } + + // Redirect + $this->redirect($this->linker->link(array('seminaries'))); + } + } + + // Medium + $media = null; + if(!is_null($seminary['media_id'])) { + $media = $this->Media->getMediaById($seminary['media_id']); + } + + + // Pass data to view + $this->set('seminary', $seminary); + $this->set('types', $types); + $this->set('fields', $fields); + $this->set('media', $media); + $this->set('charactername', $charactername); + $this->set('validation', $validation); + $this->set('fieldsValidation', $fieldsValidation); + } + } ?> diff --git a/controllers/SeminariesController.inc b/controllers/SeminariesController.inc index 8294c0f7..50d1aac5 100644 --- a/controllers/SeminariesController.inc +++ b/controllers/SeminariesController.inc @@ -24,7 +24,7 @@ * * @var array */ - public $models = array('seminaries', 'users', 'questgroupshierarchy', 'questgroups', 'media'); + public $models = array('seminaries', 'users', 'userseminaryroles', 'questgroupshierarchy', 'questgroups', 'media'); /** * User permissions * @@ -64,6 +64,8 @@ // Get additional data foreach($seminaries as &$seminary) { + $seminary['description'] = \hhu\z\Utils::shortenString($seminary['description'], 100, 120).' …'; + // Created user $seminary['creator'] = $this->Users->getUserById($seminary['created_user_id']); @@ -71,6 +73,15 @@ if(!is_null($seminary['media_id'])) { $seminary['media'] = $this->Media->getMediaById($seminary['media_id']); } + + // Character of currently logged-in user + try { + $seminary['usercharacter'] = $this->Characters->getCharacterForUserAndSeminary($this->Auth->getUserId(), $seminary['id']); + } + catch(\nre\exceptions\IdNotFoundException $e) { + } + $seminary['userroles'] = $this->Userseminaryroles->getUserseminaryrolesForUserById(IntermediateController::$user['id'], $seminary['id']); + } diff --git a/controllers/UsersController.inc b/controllers/UsersController.inc index 4ba97dab..535dcbbe 100644 --- a/controllers/UsersController.inc +++ b/controllers/UsersController.inc @@ -36,7 +36,7 @@ * * @var array */ - public $models = array('users', 'characters'); + public $models = array('users', 'characters', 'avatars', 'media', 'userseminaryroles'); /** * Required components * @@ -86,8 +86,20 @@ // Additional Character information foreach($characters as &$character) { + // Seminary roles + $character['user_seminaryroles'] = $this->Userseminaryroles->getUserseminaryrolesForUserById(\hhu\z\controllers\IntermediateController::$user['id'], $character['seminary_id']); + $character['user_seminaryroles'] = array_map(function($a) { return $a['name']; }, $character['user_seminaryroles']); + // Level $character['xplevel'] = $this->Characters->getXPLevelOfCharacters($character['id']); + + // Avatar + $avatar = $this->Avatars->getAvatarById($character['avatar_id']); + if(!is_null($avatar['small_avatarpicture_id'])) + { + //$character['seminary'] = + $character['small_avatar'] = $this->Media->getSeminaryMediaById($avatar['small_avatarpicture_id']); + } } diff --git a/controllers/components/ValidationComponent.inc b/controllers/components/ValidationComponent.inc index 8034e47d..dbe5b0b3 100644 --- a/controllers/components/ValidationComponent.inc +++ b/controllers/components/ValidationComponent.inc @@ -44,13 +44,12 @@ /** * Validate an user input. * - * @param mixed $input User input to validate - * @param string $name Name of the field to validate against - * @return mixed True or the settings the validation fails on + * @param mixed $input User input to validate + * @param array $settings Validation setting + * @return mixed True or the settings the validation fails on */ - public function validate($input, $name) + public function validate($input, $settings) { - $settings = $this->config[$name]; $validation = array(); // Min string length @@ -93,10 +92,13 @@ } // Check parameter - $param = $params[$index]; - $check = $this->validate($param, $index); - if($check !== true) { - $validation[$index] = $check; + if(array_key_exists($index, $this->config)) + { + $param = $params[$index]; + $check = $this->validate($param, $this->config[$index]); + if($check !== true) { + $validation[$index] = $check; + } } } diff --git a/models/AvatarsModel.inc b/models/AvatarsModel.inc new file mode 100644 index 00000000..115d1fb2 --- /dev/null +++ b/models/AvatarsModel.inc @@ -0,0 +1,62 @@ + + * @copyright 2014 Heinrich-Heine-Universität Düsseldorf + * @license http://www.gnu.org/licenses/gpl.html + * @link https://bitbucket.org/coderkun/the-legend-of-z + */ + + namespace hhu\z\models; + + + /** + * Model to interact with Avatars-tables. + * + * @author Oliver Hanraths + */ + class AvatarsModel extends \hhu\z\Model + { + + + + + /** + * Construct a new AvatarsModel. + */ + public function __construct() + { + parent::__construct(); + } + + + + + /** + * Get an Avatar by its ID + * + * @param int $avatarId ID of Avatar + * @return array Avatar data + */ + public function getAvatarById($avatarId) + { + $data = $this->db->query( + 'SELECT id, charactertype_id, xplevel_id, avatarpicture_id, small_avatarpicture_id '. + 'FROM avatars '. + 'WHERE id = ?', + 'i', + $avatarId + ); + if(!empty($data)) { + return $data[0]; + } + + + return null; + } + + } + +?> diff --git a/models/CharactergroupsModel.inc b/models/CharactergroupsModel.inc index ce6e8b61..e88b1826 100644 --- a/models/CharactergroupsModel.inc +++ b/models/CharactergroupsModel.inc @@ -88,7 +88,7 @@ public function getGroupsForGroupsgroup($groupsgroupId) { return $this->db->query( - 'SELECT id, name, url, xps '. + 'SELECT id, name, url, xps, motto '. 'FROM v_charactergroups '. 'WHERE charactergroupsgroup_id = ?', 'i', @@ -128,7 +128,7 @@ public function getGroupByUrl($groupsgroupId, $groupUrl) { $data = $this->db->query( - 'SELECT id, name, url, xps '. + 'SELECT id, name, url, xps, motto '. 'FROM v_charactergroups '. 'WHERE charactergroupsgroup_id = ? AND url = ?', 'is', @@ -142,6 +142,31 @@ return $data[0]; } + + /** + * Get the rank of a XP-value of a Character. + * + * @param int $seminaryId ID of Seminary + * @param int $xps XP-value to get rank for + * @return int Rank of XP-value + */ + public function getXPRank($groupsgroupId, $xps) + { + $data = $this->db->query( + 'SELECT count(id) AS c '. + 'FROM v_charactergroups '. + 'WHERE charactergroupsgroup_id = ? AND xps > ?', + 'id', + $groupsgroupId, $xps + ); + if(!empty($data)) { + return $data[0]['c'] + 1; + } + + + return 1; + } + } ?> diff --git a/models/CharactersModel.inc b/models/CharactersModel.inc index 43406b0a..a502916a 100644 --- a/models/CharactersModel.inc +++ b/models/CharactersModel.inc @@ -43,7 +43,7 @@ public function getCharactersForUser($userId) { return $this->db->query( - 'SELECT characters.id, characters.created, characters.charactertype_id, characters.name, characters.url, characters.xps, characters.xplevel, charactertypes.name AS charactertype_name, charactertypes.url AS charactertypes_url, seminaries.id AS seminary_url, seminaries.title AS seminary_title, seminaries.url AS seminary_url '. + 'SELECT characters.id, characters.created, characters.charactertype_id, characters.name, characters.url, characters.xps, characters.xplevel, characters.avatar_id, charactertypes.name AS charactertype_name, charactertypes.url AS charactertypes_url, seminaries.id AS seminary_id, seminaries.url AS seminary_url, seminaries.title AS seminary_title, seminaries.url AS seminary_url '. 'FROM v_characters AS characters '. 'LEFT JOIN charactertypes ON charactertypes.id = characters.charactertype_id '. 'LEFT JOIN seminaries ON seminaries.id = charactertypes.seminary_id '. @@ -63,7 +63,7 @@ public function getCharactersForSeminary($seminaryId) { return $this->db->query( - 'SELECT characters.id, characters.created, characters.charactertype_id, characters.name, characters.url, characters.user_id, characters.xps, characters.xplevel, charactertypes.name AS charactertype_name, charactertypes.url AS charactertypes_url, seminaries.id AS seminary_url, seminaries.title AS seminary_title, seminaries.url AS seminary_url '. + 'SELECT characters.id, characters.created, characters.charactertype_id, characters.name, characters.url, characters.user_id, characters.xps, characters.xplevel, characters.avatar_id, charactertypes.name AS charactertype_name, charactertypes.url AS charactertypes_url, seminaries.id AS seminary_url, seminaries.title AS seminary_title, seminaries.url AS seminary_url '. 'FROM v_characters AS characters '. 'LEFT JOIN charactertypes ON charactertypes.id = characters.charactertype_id '. 'LEFT JOIN seminaries ON seminaries.id = charactertypes.seminary_id '. @@ -83,7 +83,7 @@ public function getCharactersForGroup($groupId) { return $this->db->query( - 'SELECT characters.id, characters.created, characters.charactertype_id, characters.name, characters.url, characters.user_id, characters.xps, charactertypes.name AS charactertype_name, charactertypes.url AS charactertypes_url '. + 'SELECT characters.id, characters.created, characters.charactertype_id, characters.name, characters.url, characters.user_id, characters.xps, characters.avatar_id, charactertypes.name AS charactertype_name, charactertypes.url AS charactertypes_url '. 'FROM v_characters AS characters '. 'LEFT JOIN characters_charactergroups ON characters_charactergroups.character_id = characters.id '. 'LEFT JOIN charactertypes ON charactertypes.id = characters.charactertype_id '. @@ -105,7 +105,7 @@ public function getCharacterForUserAndSeminary($userId, $seminaryId) { $data = $this->db->query( - 'SELECT characters.id, characters.created, characters.charactertype_id, characters.name, characters.url, characters.user_id, characters.xps, characters.xplevel, charactertypes.name AS charactertype_name, charactertypes.url AS charactertypes_url '. + 'SELECT characters.id, characters.created, characters.charactertype_id, characters.name, characters.url, characters.user_id, characters.xps, characters.xplevel, characters.avatar_id, charactertypes.name AS charactertype_name, charactertypes.url AS charactertypes_url '. 'FROM v_characters AS characters '. 'LEFT JOIN charactertypes ON charactertypes.id = characters.charactertype_id '. 'WHERE characters.user_id = ? AND charactertypes.seminary_id = ?', @@ -132,7 +132,7 @@ public function getCharacterByUrl($seminaryId, $characterUrl) { $data = $this->db->query( - 'SELECT characters.id, characters.created, characters.charactertype_id, characters.name, characters.url, characters.user_id, characters.xps, characters.xplevel, charactertypes.name AS charactertype_name, charactertypes.url AS charactertypes_url, seminarymedia.url AS avatar_url, seminarymedia.description AS avatar_description '. + 'SELECT characters.id, characters.created, characters.charactertype_id, characters.name, characters.url, characters.user_id, characters.xps, characters.xplevel, characters.avatar_id, charactertypes.name AS charactertype_name, charactertypes.url AS charactertypes_url, seminarymedia.url AS avatar_url, seminarymedia.description AS avatar_description '. 'FROM v_characters AS characters '. 'LEFT JOIN charactertypes ON charactertypes.id = characters.charactertype_id '. 'LEFT JOIN avatars ON avatars.id = characters.avatar_id '. @@ -161,7 +161,7 @@ public function getCharacterById($characterId) { $data = $this->db->query( - 'SELECT characters.id, characters.created, characters.charactertype_id, characters.name, characters.url, characters.user_id, characters.xps, characters.xplevel, charactertypes.name AS charactertype_name, charactertypes.url AS charactertypes_url, seminarymedia.url AS avatar_url, seminarymedia.description AS avatar_description '. + 'SELECT characters.id, characters.created, characters.charactertype_id, characters.name, characters.url, characters.user_id, characters.xps, characters.xplevel, characters.avatar_id, charactertypes.name AS charactertype_name, charactertypes.url AS charactertypes_url, seminarymedia.url AS avatar_url, seminarymedia.description AS avatar_description '. 'FROM v_characters AS characters '. 'LEFT JOIN charactertypes ON charactertypes.id = characters.charactertype_id '. 'LEFT JOIN avatars ON avatars.id = characters.avatar_id '. @@ -336,6 +336,58 @@ ); } + + /** + * Create a new Character. + * + * @param int $userId User-ID that creates the new character + * @param int $charactertypeId ID of type of new Character + * @param string $characterName Name for the new Character + * @return int ID of Character + */ + public function createCharacter($userId, $charactertypeId, $characterName) + { + $this->db->query( + 'INSERT INTO characters '. + '(user_id, charactertype_id, name, url) '. + 'VALUES '. + '(?, ?, ?, ?)', + 'iiss', + $userId, + $charactertypeId, + $characterName, + \nre\core\Linker::createLinkParam($characterName) + ); + + + return $this->db->getInsertId(); + } + + + /** + * Set the value of a Seminary field for a Character. + * + * @param int $characterId ID of Character + * @param int $seminarycharacterfieldId ID of seminarycharacterfield to set value of + * @param string $value Value to set + */ + public function setSeminaryFieldOfCharacter($characterId, $seminarycharacterfieldId, $value) + { + $this->db->query( + 'INSERT INTO characters_seminarycharacterfields '. + '(character_id, seminarycharacterfield_id, value) '. + 'VALUES '. + '(?, ?, ?) '. + 'ON DUPLICATE KEY UPDATE '. + 'value = ?', + 'iiss', + $characterId, + $seminarycharacterfieldId, + $value, + $value + ); + } + } ?> diff --git a/models/CharactertypesModel.inc b/models/CharactertypesModel.inc new file mode 100644 index 00000000..07c8d5e9 --- /dev/null +++ b/models/CharactertypesModel.inc @@ -0,0 +1,57 @@ + + * @copyright 2014 Heinrich-Heine-Universität Düsseldorf + * @license http://www.gnu.org/licenses/gpl.html + * @link https://bitbucket.org/coderkun/the-legend-of-z + */ + + namespace hhu\z\models; + + + /** + * Model to interact with Charactertypes-table. + * + * @author Oliver Hanraths + */ + class CharactertypesModel extends \hhu\z\Model + { + + + + + /** + * Construct a new CharactertypesModel. + */ + public function __construct() + { + parent::__construct(); + } + + + + + /** + * Get all Character types of a Seminary. + * + * @param int $seminaryId ID of Seminary to get types of + * @return array Character types + */ + public function getCharacterTypesForSeminary($seminaryId) + { + return $this->db->query( + 'SELECT id, name, url '. + 'FROM charactertypes '. + 'WHERE seminary_id = ? '. + 'ORDER BY name ASC', + 'i', + $seminaryId + ); + } + + } + +?> diff --git a/models/SeminarycharacterfieldsModel.inc b/models/SeminarycharacterfieldsModel.inc index c881df2c..efad3bde 100644 --- a/models/SeminarycharacterfieldsModel.inc +++ b/models/SeminarycharacterfieldsModel.inc @@ -34,6 +34,26 @@ + /** + * Get all Character fields of a Seminary. + * + * @param int $seminaryId ID of Seminary to get fields of + * @param array Seminary Character fields + */ + public function getFieldsForSeminary($seminaryId) + { + return $this->db->query( + 'SELECT seminarycharacterfields.id, seminarycharacterfields.title, seminarycharacterfields.url, seminarycharacterfields.regex, seminarycharacterfields.required, seminarycharacterfieldtypes.id AS type_id, seminarycharacterfieldtypes.title AS type_title, seminarycharacterfieldtypes.url AS type_url '. + 'FROM seminarycharacterfields '. + 'LEFT JOIN seminarycharacterfieldtypes ON seminarycharacterfieldtypes.id = seminarycharacterfields.seminarycharacterfieldtype_id '. + 'WHERE seminarycharacterfields.seminary_id = ? '. + 'ORDER BY pos ASC', + 'i', + $seminaryId + ); + } + + /** * Get Seminary Character fields of a Character. * diff --git a/views/html/charactergroups/group.tpl b/views/html/charactergroups/group.tpl index ff53d1cf..9a66595d 100644 --- a/views/html/charactergroups/group.tpl +++ b/views/html/charactergroups/group.tpl @@ -1,54 +1,34 @@ +
- +
+

+

- Schweb wie ein Schmetterling! Stich wie eine Biene! +
    -
  • 7. Platz
  • -
  • XP
  • -
  • 6 Mitglieder
  • +
  • .
  • +
  •  XPs
  • +
  • 1) ? _('Members') : _('Member')?>

    - +
  • -

    -

    -

    XP

    -
  • -
  • -

    -

    -

    XP

    -
  • -
  • -

    -

    -

    XP

    -
  • -
  • -

    -

    -

    XP

    -
  • -
  • -

    -

    -

    XP

    -
  • -
  • -

    + +

    +

    XP

  • diff --git a/views/html/charactergroups/groupsgroup.tpl b/views/html/charactergroups/groupsgroup.tpl index 016742b6..c604328a 100644 --- a/views/html/charactergroups/groupsgroup.tpl +++ b/views/html/charactergroups/groupsgroup.tpl @@ -1,3 +1,8 @@ + +
    + +
    +

    diff --git a/views/html/charactergroups/index.tpl b/views/html/charactergroups/index.tpl index 0a2cd85b..483c0f2e 100644 --- a/views/html/charactergroups/index.tpl +++ b/views/html/charactergroups/index.tpl @@ -1,3 +1,8 @@ + +
    + +
    +

    diff --git a/views/html/charactergroupsquests/quest.tpl b/views/html/charactergroupsquests/quest.tpl index c02a4558..6837cfff 100644 --- a/views/html/charactergroupsquests/quest.tpl +++ b/views/html/charactergroupsquests/quest.tpl @@ -1,7 +1,12 @@ -

    -

    -

    -
    + +
    + +
    + +

    +

    +

    +

    diff --git a/views/html/characters/character.tpl b/views/html/characters/character.tpl index b621cff0..c347a9d0 100644 --- a/views/html/characters/character.tpl +++ b/views/html/characters/character.tpl @@ -1,3 +1,8 @@ + +
    + +
    +

    diff --git a/views/html/characters/index.tpl b/views/html/characters/index.tpl index 94759710..478c0a65 100644 --- a/views/html/characters/index.tpl +++ b/views/html/characters/index.tpl @@ -1,8 +1,19 @@ + +
    + +
    +

    -
      +
        -
      • ( XPs, : )
      • +
      • + +

        + +

        +

        XP

        +
      diff --git a/views/html/characters/register.tpl b/views/html/characters/register.tpl new file mode 100644 index 00000000..f6d2b15e --- /dev/null +++ b/views/html/characters/register.tpl @@ -0,0 +1,72 @@ + +
      + +
      + +

      +

      + +
      + +
        + &$settings) : ?> +
      • +
          + $value) : ?> +
        • + +
        • + +
        +
      • + +
      + +
      + + +
      + + +
      + + +
        + &$settings) : ?> +
      • + +
      + +
      + + + + + required="required"/> + + + + +
      + +
      diff --git a/views/html/seminaries/index.tpl b/views/html/seminaries/index.tpl index 611fdaf8..4ad92986 100644 --- a/views/html/seminaries/index.tpl +++ b/views/html/seminaries/index.tpl @@ -1,16 +1,32 @@

      + 0) : ?> +
      • -

        +

        + 0) : ?> + + + + +

        - format(new \DateTime($seminary['created'])))?> + +
        + format(new \DateTime($seminary['created'])))?>
        + + + + + +
      • diff --git a/views/html/users/register.tpl b/views/html/users/register.tpl index 5ba5671e..184e0a0c 100644 --- a/views/html/users/register.tpl +++ b/views/html/users/register.tpl @@ -1,10 +1,9 @@

        - +
          &$settings) : ?> -
          • $value) : ?> @@ -67,7 +66,6 @@
        • -
        diff --git a/views/html/users/user.tpl b/views/html/users/user.tpl index e40d2fb0..f5615f3e 100644 --- a/views/html/users/user.tpl +++ b/views/html/users/user.tpl @@ -11,9 +11,21 @@

        -
          +
            -
          • ( XPs, : ) ()
          • +
          • + +

            + +

            + 0) : ?> + + + + +

            +

            +