diff --git a/TODO b/TODO index 2e79b37..bd4361e 100644 --- a/TODO +++ b/TODO @@ -9,17 +9,7 @@ UserData google talk address google talk address public? -Permissions - id - name - description - -Roles - id - name - permission list - -Hírek +News id title slug @@ -36,20 +26,8 @@ BlogPost text poster -ForumTopicGroup - id - title - slug - creator - timestamp - ForumTopic - id - title - slug - creator roles who can access it - topic group ForumPost id diff --git a/src/KekRozsak/FrontBundle/Controller/DefaultController.php b/src/KekRozsak/FrontBundle/Controller/DefaultController.php index 29f2de0..dbfc1db 100644 --- a/src/KekRozsak/FrontBundle/Controller/DefaultController.php +++ b/src/KekRozsak/FrontBundle/Controller/DefaultController.php @@ -26,9 +26,4 @@ class DefaultController extends Controller 'article' => $article )); } - - public function forumMainAction() - { - return $this->forward('KekRozsakFrontBundle:Default:homepage'); - } } diff --git a/src/KekRozsak/FrontBundle/Controller/ForumController.php b/src/KekRozsak/FrontBundle/Controller/ForumController.php new file mode 100644 index 0000000..fdabe29 --- /dev/null +++ b/src/KekRozsak/FrontBundle/Controller/ForumController.php @@ -0,0 +1,46 @@ +getDoctrine()->getRepository('KekRozsakFrontBundle:ForumTopicGroup'); + + $topicGroups = $groupRepo->findAll(); + + return $this->render('KekRozsakFrontBundle:Forum:topic_group_list.html.twig', array( + 'topicGroups' => $topicGroups, + )); + } + + public function topicListAction($topicGroupSlug) + { + $groupRepo = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:ForumTopicGroup'); + if (!($topicGroup = $groupRepo->findOneBySlug($topicGroupSlug))) + throw $this->createNotFoundException('A kért témakör nem létezik!'); + + return $this->render('KekRozsakFrontBundle:Forum:topic_list.html.twig', array( + 'topicGroup' => $topicGroup, + )); + } + + public function postListAction($topicGroupSlug, $topicSlug) + { + $groupRepo = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:ForumTopicGroup'); + if (!($topicGroup = $groupRepo->findOneBySlug($topicGroupSlug))) + throw $this->createNotFoundException('A kért témakör nem létezik!'); + $topicRepo = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:ForumTopic'); + if (!($topic = $topicRepo->findOneBy(array('topic_group' => $topicGroup, 'slug' => $topicSlug)))) + throw $this->createNotFoundException('A kért téma nem létezik!'); + return $this->render('KekRozsakFrontBundle:Forum:post_list.html.twig', array( + 'topicGroup' => $topicGroup, + 'topic' => $topic, + )); + } +} + diff --git a/src/KekRozsak/FrontBundle/Entity/ForumTopic.php b/src/KekRozsak/FrontBundle/Entity/ForumTopic.php new file mode 100644 index 0000000..b826634 --- /dev/null +++ b/src/KekRozsak/FrontBundle/Entity/ForumTopic.php @@ -0,0 +1,243 @@ +id; + } + + /** + * Set title + * + * @param string $title + * @return ForumTopic + */ + public function setTitle($title) + { + $this->title = $title; + return $this; + } + + /** + * Get title + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Set slug + * + * @param string $slug + * @return ForumTopic + */ + public function setSlug($slug) + { + $this->slug = $slug; + return $this; + } + + /** + * Get slug + * + * @return string + */ + public function getSlug() + { + return $this->slug; + } + + /** + * Set created_at + * + * @param datetime $createdAt + * @return ForumTopic + */ + 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 ForumTopic + */ + 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 text $updateReason + * @return ForumTopic + */ + public function setUpdateReason($updateReason) + { + $this->update_reason = $updateReason; + return $this; + } + + /** + * Get update_reason + * + * @return text + */ + public function getUpdateReason() + { + return $this->update_reason; + } + + /** + * Set created_by + * + * @param KekRozsak\FrontBundle\Entity\User $createdBy + * @return ForumTopic + */ + 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 ForumTopic + */ + 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_group + * + * @param KekRozsak\FrontBundle\Entity\ForumTopicGroup $topicGroup + * @return ForumTopic + */ + public function setTopicGroup(\KekRozsak\FrontBundle\Entity\ForumTopicGroup $topicGroup = null) + { + $this->topic_group = $topicGroup; + return $this; + } + + /** + * Get topic_group + * + * @return KekRozsak\FrontBundle\Entity\ForumTopicGroup + */ + public function getTopicGroup() + { + return $this->topic_group; + } +} \ No newline at end of file diff --git a/src/KekRozsak/FrontBundle/Entity/ForumTopicGroup.php b/src/KekRozsak/FrontBundle/Entity/ForumTopicGroup.php new file mode 100644 index 0000000..6310c1e --- /dev/null +++ b/src/KekRozsak/FrontBundle/Entity/ForumTopicGroup.php @@ -0,0 +1,262 @@ +id; + } + + /** + * Set title + * + * @param string $title + * @return ForumTopicGroup + */ + public function setTitle($title) + { + $this->title = $title; + return $this; + } + + /** + * Get title + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Set slug + * + * @param string $slug + * @return ForumTopicGroup + */ + public function setSlug($slug) + { + $this->slug = $slug; + return $this; + } + + /** + * Get slug + * + * @return string + */ + public function getSlug() + { + return $this->slug; + } + + /** + * Set created_at + * + * @param datetime $createdAt + * @return ForumTopicGroup + */ + 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 ForumTopicGroup + */ + 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 text $updateReason + * @return ForumTopicGroup + */ + public function setUpdateReason($updateReason) + { + $this->update_reason = $updateReason; + return $this; + } + + /** + * Get update_reason + * + * @return text + */ + public function getUpdateReason() + { + return $this->update_reason; + } + + /** + * Set created_by + * + * @param KekRozsak\FrontBundle\Entity\User $createdBy + * @return ForumTopicGroup + */ + 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 ForumTopicGroup + */ + 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; + } + /** + * @var \Doctrine\Common\Collections\ArrayCollection + */ + private $topic; + + public function __construct() + { + $this->topic = new \Doctrine\Common\Collections\ArrayCollection(); + } + + /** + * Add topic + * + * @param KekRozsak\FrontBundle\Entity\ForumTopic $topic + * @return ForumTopicGroup + */ + public function addForumTopic(\KekRozsak\FrontBundle\Entity\ForumTopic $topic) + { + $this->topic[] = $topic; + return $this; + } + + /** + * Get topic + * + * @return Doctrine\Common\Collections\Collection + */ + public function getTopic() + { + return $this->topic; + } + /** + * @var \Doctrine\Common\Collections\ArrayCollection + */ + private $topics; + + + /** + * Get topics + * + * @return Doctrine\Common\Collections\Collection + */ + public function getTopics() + { + return $this->topics; + } +} \ No newline at end of file diff --git a/src/KekRozsak/FrontBundle/Entity/Role.php b/src/KekRozsak/FrontBundle/Entity/Role.php index 12e4a47..a988273 100644 --- a/src/KekRozsak/FrontBundle/Entity/Role.php +++ b/src/KekRozsak/FrontBundle/Entity/Role.php @@ -142,4 +142,4 @@ class Role implements RoleInterface { return $this->name; } -} +} \ No newline at end of file diff --git a/src/KekRozsak/FrontBundle/Entity/User.php b/src/KekRozsak/FrontBundle/Entity/User.php index f91b995..22c25f3 100644 --- a/src/KekRozsak/FrontBundle/Entity/User.php +++ b/src/KekRozsak/FrontBundle/Entity/User.php @@ -200,4 +200,4 @@ class User implements UserInterface { return $this->password; } -} +} \ No newline at end of file diff --git a/src/KekRozsak/FrontBundle/Resources/config/doctrine/ForumTopic.orm.yml b/src/KekRozsak/FrontBundle/Resources/config/doctrine/ForumTopic.orm.yml new file mode 100644 index 0000000..7a159e3 --- /dev/null +++ b/src/KekRozsak/FrontBundle/Resources/config/doctrine/ForumTopic.orm.yml @@ -0,0 +1,41 @@ +KekRozsak\FrontBundle\Entity\ForumTopic: + type: entity + table: forum_topics + id: + id: + type: integer + generator: + strategy: AUTO + fields: + title: + type: string(100) + nullable: false + slug: + type: string(100) + nullable: false + unique: true + created_at: + type: datetime + nullable: false + updated_at: + type: datetime + nullable: true + update_reason: + type: text + nullable: true + manyToOne: + created_by: + targetEntity: User + inversedBy: articles + nullable: false + updated_by: + targetEntity: User + nullable: true + default: null + topic_group: + targetEntity: ForumTopicGroup + inversedBy: topics + nullable: false + uniqueConstraint: + uniqueSlugByGroup: + columns: [ topic_group, slug ] diff --git a/src/KekRozsak/FrontBundle/Resources/config/doctrine/ForumTopicGroup.orm.yml b/src/KekRozsak/FrontBundle/Resources/config/doctrine/ForumTopicGroup.orm.yml new file mode 100644 index 0000000..def4cc4 --- /dev/null +++ b/src/KekRozsak/FrontBundle/Resources/config/doctrine/ForumTopicGroup.orm.yml @@ -0,0 +1,38 @@ +KekRozsak\FrontBundle\Entity\ForumTopicGroup: + type: entity + table: forum_topic_groups + id: + id: + type: integer + generator: + strategy: AUTO + fields: + title: + type: string(100) + nullable: false + slug: + type: string(100) + nullable: false + unique: true + created_at: + type: datetime + nullable: false + updated_at: + type: datetime + nullable: true + update_reason: + type: text + nullable: true + manyToOne: + created_by: + targetEntity: User + inversedBy: articles + nullable: false + updated_by: + targetEntity: User + nullable: true + default: null + oneToMany: + topics: + targetEntity: ForumTopic + mappedBy: topic_group diff --git a/src/KekRozsak/FrontBundle/Resources/config/routing.yml b/src/KekRozsak/FrontBundle/Resources/config/routing.yml index d2d3f15..bc24499 100644 --- a/src/KekRozsak/FrontBundle/Resources/config/routing.yml +++ b/src/KekRozsak/FrontBundle/Resources/config/routing.yml @@ -11,4 +11,14 @@ KekRozsakFrontBundle_article: KekRozsakFrontBundle_forum_main: pattern: /forum defaults: - _controller: KekRozsakFrontBundle:Default:forumMain + _controller: KekRozsakFrontBundle:Forum:main + +KekRozsakFrontBundle_forum_topic_list: + pattern: /forum/{topicGroupSlug} + defaults: + _controller: KekRozsakFrontBundle:Forum:topicList + +KekRozsakFrontBundle_forum_post_list: + pattern: /forum/{topicGroupSlug}/{topicSlug} + defaults: + _controller: KekRozsakFrontBundle:Forum:postList diff --git a/src/KekRozsak/FrontBundle/Resources/views/Forum/post_list.html.twig b/src/KekRozsak/FrontBundle/Resources/views/Forum/post_list.html.twig new file mode 100644 index 0000000..bf1f725 --- /dev/null +++ b/src/KekRozsak/FrontBundle/Resources/views/Forum/post_list.html.twig @@ -0,0 +1,5 @@ +{% extends '::main_template.html.twig' %} +{% block title %} - Fórum - {{ topicGroup.title }} - {{ topic.title }}{% endblock %} +{% block content %} +

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

+{% 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 new file mode 100644 index 0000000..72ac09d --- /dev/null +++ b/src/KekRozsak/FrontBundle/Resources/views/Forum/topic_group_list.html.twig @@ -0,0 +1,29 @@ +{% extends '::main_template.html.twig' %} +{% block title %} - Fórum{% endblock %} +{% block content %} +

Fórum

+{% for topicGroup in topicGroups %} + + + + + + + + +{% if topicGroup.topics|length > 0 %} +{% for topic in topicGroup.topics %} + + + + +{% endfor %} +{% else %} + + + +{% endif %} + +
{{ topicGroup.title }}
{{ topic.title }}
Ebben a kategóriában nincsenek témák
+{% endfor %} +{% endblock content %} diff --git a/src/KekRozsak/FrontBundle/Resources/views/Forum/topic_list.html.twig b/src/KekRozsak/FrontBundle/Resources/views/Forum/topic_list.html.twig new file mode 100644 index 0000000..328eb02 --- /dev/null +++ b/src/KekRozsak/FrontBundle/Resources/views/Forum/topic_list.html.twig @@ -0,0 +1,20 @@ +{% extends '::main_template.html.twig' %} +{% block title %} - Fórum - {{ topicGroup.title }}{% endblock %} +{% block content %} +

Fórum - {{ topicGroup.title }}

+{% if topicGroup.topics|length > 0 %} + + + + +{% for topic in topicGroup.topics %} + + + +{% endfor %} + +
{{ topic.title }}
+{% else %} +Ebben a témakörben nincsenek témák. +{% endif %} +{% endblock content %} diff --git a/web/css/kekrozsak_front.css b/web/css/kekrozsak_front.css index efffbd3..932293d 100644 --- a/web/css/kekrozsak_front.css +++ b/web/css/kekrozsak_front.css @@ -109,3 +109,32 @@ p.hir-datum { margin: 0; } +#temakor-lista { + border: 1px solid #3366ff; + border-collapse: collapse; + width: 100%; + margin-bottom: 10px; +} + +#temakor-lista thead td { + font-weight: bold; + height: 1.5em; + border-bottom: 2px solid #3366ff; + padding: 3px; +} + +#temakor-lista thead td a { + color: #3366ff; + text-decoration: none; +} + +#temakor-lista tbody td { + padding: 3px; + border-bottom: 1px solid #3366ff; +} + +#temakor-lista tbody td a { + color: #3366ff; + text-decoration: underline; +} +