diff --git a/src/KekRozsak/FrontBundle/Entity/ForumPost.php b/src/KekRozsak/FrontBundle/Entity/ForumPost.php new file mode 100644 index 0000000..5b3c49f --- /dev/null +++ b/src/KekRozsak/FrontBundle/Entity/ForumPost.php @@ -0,0 +1,216 @@ +id; + } + + /** + * Set created_at + * + * @param datetime $createdAt + * @return ForumPost + */ + public function setCreatedAt($createdAt) + { + $this->created_at = $createdAt; + return $this; + } + + /** + * Get created_at + * + * @return datetime + */ + public function getCreatedAt() + { + return $this->created_at; + } + + /** + * Set updated_at + * + * @param datetime $updatedAt + * @return ForumPost + */ + public function setUpdatedAt($updatedAt) + { + $this->updated_at = $updatedAt; + return $this; + } + + /** + * Get updated_at + * + * @return datetime + */ + public function getUpdatedAt() + { + return $this->updated_at; + } + + /** + * Set update_reason + * + * @param string $updateReason + * @return ForumPost + */ + public function setUpdateReason($updateReason) + { + $this->update_reason = $updateReason; + return $this; + } + + /** + * Get update_reason + * + * @return string + */ + public function getUpdateReason() + { + return $this->update_reason; + } + + /** + * Set text + * + * @param text $text + * @return ForumPost + */ + public function setText($text) + { + $this->text = $text; + return $this; + } + + /** + * Get text + * + * @return text + */ + public function getText() + { + return $this->text; + } + + /** + * Set created_by + * + * @param KekRozsak\FrontBundle\Entity\User $createdBy + * @return ForumPost + */ + public function setCreatedBy(\KekRozsak\FrontBundle\Entity\User $createdBy = null) + { + $this->created_by = $createdBy; + return $this; + } + + /** + * Get created_by + * + * @return KekRozsak\FrontBundle\Entity\User + */ + public function getCreatedBy() + { + return $this->created_by; + } + + /** + * Set updated_by + * + * @param KekRozsak\FrontBundle\Entity\User $updatedBy + * @return ForumPost + */ + public function setUpdatedBy(\KekRozsak\FrontBundle\Entity\User $updatedBy = null) + { + $this->updated_by = $updatedBy; + return $this; + } + + /** + * Get updated_by + * + * @return KekRozsak\FrontBundle\Entity\User + */ + public function getUpdatedBy() + { + return $this->updated_by; + } + + /** + * Set topic + * + * @param KekRozsak\FrontBundle\Entity\ForumTopic $topic + * @return ForumPost + */ + public function setTopic(\KekRozsak\FrontBundle\Entity\ForumTopic $topic = null) + { + $this->topic = $topic; + return $this; + } + + /** + * Get topic + * + * @return KekRozsak\FrontBundle\Entity\ForumTopic + */ + public function getTopic() + { + return $this->topic; + } +} \ No newline at end of file diff --git a/src/KekRozsak/FrontBundle/Entity/ForumTopic.php b/src/KekRozsak/FrontBundle/Entity/ForumTopic.php index b826634..36a6dc7 100644 --- a/src/KekRozsak/FrontBundle/Entity/ForumTopic.php +++ b/src/KekRozsak/FrontBundle/Entity/ForumTopic.php @@ -240,4 +240,35 @@ class ForumTopic { return $this->topic_group; } + /** + * @var \Doctrine\Common\Collections\ArrayCollection + */ + private $posts; + + public function __construct() + { + $this->posts = new \Doctrine\Common\Collections\ArrayCollection(); + } + + /** + * Add posts + * + * @param KekRozsak\FrontBundle\Entity\ForumPost $posts + * @return ForumTopic + */ + public function addForumPost(\KekRozsak\FrontBundle\Entity\ForumPost $posts) + { + $this->posts[] = $posts; + return $this; + } + + /** + * Get posts + * + * @return Doctrine\Common\Collections\Collection + */ + public function getPosts() + { + return $this->posts; + } } \ No newline at end of file diff --git a/src/KekRozsak/FrontBundle/Entity/User.php b/src/KekRozsak/FrontBundle/Entity/User.php index 22c25f3..b79790f 100644 --- a/src/KekRozsak/FrontBundle/Entity/User.php +++ b/src/KekRozsak/FrontBundle/Entity/User.php @@ -200,4 +200,58 @@ class User implements UserInterface { return $this->password; } + /** + * @var \Doctrine\Common\Collections\ArrayCollection + */ + private $articles; + + /** + * @var \Doctrine\Common\Collections\ArrayCollection + */ + private $forum_posts; + + + /** + * Add articles + * + * @param KekRozsak\FrontBundle\Entity\Article $articles + * @return User + */ + public function addArticle(\KekRozsak\FrontBundle\Entity\Article $articles) + { + $this->articles[] = $articles; + return $this; + } + + /** + * Get articles + * + * @return Doctrine\Common\Collections\Collection + */ + public function getArticles() + { + return $this->articles; + } + + /** + * Add forum_posts + * + * @param KekRozsak\FrontBundle\Entity\ForumPost $forumPosts + * @return User + */ + public function addForumPost(\KekRozsak\FrontBundle\Entity\ForumPost $forumPosts) + { + $this->forum_posts[] = $forumPosts; + return $this; + } + + /** + * Get forum_posts + * + * @return Doctrine\Common\Collections\Collection + */ + public function getForumPosts() + { + return $this->forum_posts; + } } \ No newline at end of file diff --git a/src/KekRozsak/FrontBundle/Resources/config/doctrine/ForumPost.orm.yml b/src/KekRozsak/FrontBundle/Resources/config/doctrine/ForumPost.orm.yml new file mode 100644 index 0000000..ab5191b --- /dev/null +++ b/src/KekRozsak/FrontBundle/Resources/config/doctrine/ForumPost.orm.yml @@ -0,0 +1,33 @@ +KekRozsak\FrontBundle\Entity\ForumPost: + type: entity + table: forum_posts + id: + id: + type: integer + generator: + strategy: AUTO + fields: + created_at: + type: datetime + nullable: false + updated_at: + type: datetime + nullable: true + update_reason: + type: string + nullable: true + text: + type: text + nullable: false + manyToOne: + created_by: + targetEntity: User + inversedBy: forum_posts + nullable: false + updated_by: + targetEntity: User + nullable: true + default: null + topic: + targetEntity: ForumTopic + inversedBy: posts diff --git a/src/KekRozsak/FrontBundle/Resources/config/doctrine/ForumTopic.orm.yml b/src/KekRozsak/FrontBundle/Resources/config/doctrine/ForumTopic.orm.yml index 7a159e3..eb387e9 100644 --- a/src/KekRozsak/FrontBundle/Resources/config/doctrine/ForumTopic.orm.yml +++ b/src/KekRozsak/FrontBundle/Resources/config/doctrine/ForumTopic.orm.yml @@ -23,6 +23,10 @@ KekRozsak\FrontBundle\Entity\ForumTopic: update_reason: type: text nullable: true + oneToMany: + posts: + targetEntity: ForumPost + mappedBy: topic manyToOne: created_by: targetEntity: User diff --git a/src/KekRozsak/FrontBundle/Resources/config/doctrine/User.orm.yml b/src/KekRozsak/FrontBundle/Resources/config/doctrine/User.orm.yml index b858910..1efe6c2 100644 --- a/src/KekRozsak/FrontBundle/Resources/config/doctrine/User.orm.yml +++ b/src/KekRozsak/FrontBundle/Resources/config/doctrine/User.orm.yml @@ -21,6 +21,15 @@ KekRozsak\FrontBundle\Entity\User: display_name: type: string(50) nullable: false + oneToMany: + articles: + targetEntity: Article + mappedBy: created_by + fetch: EXTRA_LAZY + forum_posts: + targetEntity: ForumPost + mappedBy: created_by + fetch: EXTRA_LAZY manyToMany: roles: targetEntity: Role diff --git a/src/KekRozsak/FrontBundle/Resources/views/Forum/post_list.html.twig b/src/KekRozsak/FrontBundle/Resources/views/Forum/post_list.html.twig index bf1f725..d337a7a 100644 --- a/src/KekRozsak/FrontBundle/Resources/views/Forum/post_list.html.twig +++ b/src/KekRozsak/FrontBundle/Resources/views/Forum/post_list.html.twig @@ -1,5 +1,26 @@ {% extends '::main_template.html.twig' %} {% block title %} - Fórum - {{ topicGroup.title }} - {{ topic.title }}{% endblock %} {% block content %} -

Fórum - {{ topicGroup.title }} - {{ topic.title }}

+

Fórum - {{ topicGroup.title }} - {{ topic.title }}

+{% if topic.posts|length > 0 %} + + + + +{% for post in topic.posts %} + + + + +{% endfor %} + +
+ {{ post.createdBy.displayName }}
+ {{ post.createdAt|date('Y-m-d H:i') }}
+ Admin
+ Tagság kezdete: {{ post.createdBy.RegisteredAt|date('Y-m-d') }} +
{{ post.text }}
+{% else %} +A témában még nincsenek hozzászólások. +{% endif %} {% endblock %} diff --git a/src/KekRozsak/FrontBundle/Resources/views/Forum/topic_group_list.html.twig b/src/KekRozsak/FrontBundle/Resources/views/Forum/topic_group_list.html.twig index 72ac09d..1e43569 100644 --- a/src/KekRozsak/FrontBundle/Resources/views/Forum/topic_group_list.html.twig +++ b/src/KekRozsak/FrontBundle/Resources/views/Forum/topic_group_list.html.twig @@ -6,21 +6,26 @@ - - + + + + {% if topicGroup.topics|length > 0 %} {% for topic in topicGroup.topics %} + + + {% endfor %} {% else %} - + {% endif %} diff --git a/src/KekRozsak/FrontBundle/Resources/views/Forum/topic_list.html.twig b/src/KekRozsak/FrontBundle/Resources/views/Forum/topic_list.html.twig index 328eb02..7697feb 100644 --- a/src/KekRozsak/FrontBundle/Resources/views/Forum/topic_list.html.twig +++ b/src/KekRozsak/FrontBundle/Resources/views/Forum/topic_list.html.twig @@ -1,7 +1,7 @@ {% extends '::main_template.html.twig' %} {% block title %} - Fórum - {{ topicGroup.title }}{% endblock %} {% block content %} -

Fórum - {{ topicGroup.title }}

+

Fórum - {{ topicGroup.title }}

{% if topicGroup.topics|length > 0 %}
{{ topicGroup.title }}{{ topicGroup.title }}Témák számaHozzászólások számaUtolsó hozzászólás
[] {{ topic.title }}
Ebben a kategóriában nincsenek témákEbben a kategóriában nincsenek témák
diff --git a/web/css/kekrozsak_front.css b/web/css/kekrozsak_front.css index 932293d..39649cd 100644 --- a/web/css/kekrozsak_front.css +++ b/web/css/kekrozsak_front.css @@ -1,5 +1,6 @@ * { font-family: sans-serif; + font-size: 14px; } body {