diff --git a/app/Resources/translations/messages.ru.yml b/app/Resources/translations/messages.ru.yml index baaaef94..0ff37400 100644 --- a/app/Resources/translations/messages.ru.yml +++ b/app/Resources/translations/messages.ru.yml @@ -14,6 +14,7 @@ post-item: post-info: icon-images: Фото внутри icon-videos: Видео внутри + icon-vu: volleyball.ua icon-hits: Просмотров source: Источник diff --git a/app/Resources/translations/messages.uk.yml b/app/Resources/translations/messages.uk.yml index 7f4f6fba..d1ea3b98 100644 --- a/app/Resources/translations/messages.uk.yml +++ b/app/Resources/translations/messages.uk.yml @@ -14,6 +14,7 @@ post-item: post-info: icon-images: Фото всередині icon-videos: Відео всередині + icon-vu: volleyball.ua icon-hits: Переглядів source: Джерело diff --git a/src/Volley/FaceBundle/Controller/PostController.php b/src/Volley/FaceBundle/Controller/PostController.php index 4bc58446..450364bc 100644 --- a/src/Volley/FaceBundle/Controller/PostController.php +++ b/src/Volley/FaceBundle/Controller/PostController.php @@ -37,6 +37,7 @@ public function indexAction(Request $request) $stateFilter = 12; $featuredFilter = 12; $recommendedFilter = 12; + $vuFilter = 12; $userFilter = null; $searchFilter = ''; $page = 1; @@ -45,6 +46,7 @@ public function indexAction(Request $request) $stateFilter = $request->request->get('state', $session->get('stateFilter', 12)); $featuredFilter = $request->request->get('featured', $session->get('featuredFilter', 12)); $recommendedFilter = $request->request->get('recommended', $session->get('recommendedFilter', 12)); + $vuFilter = $request->request->get('vu', $session->get('vuFilter', 12)); $userFilter = $request->request->get('user', $session->get('userFilter', null)); $searchFilter = $request->request->get('search', $session->get('searchFilter', '')); if ($session->get('stateFilter') != $stateFilter || $session->get('searchFilter') != $searchFilter || $session->get('featuredFilter') != $featuredFilter || $session->get('recommendedFilter') != $recommendedFilter || $session->get('categoryFilter') != $categoryFilter) @@ -57,11 +59,12 @@ public function indexAction(Request $request) $session->set('stateFilter', $stateFilter); $session->set('featuredFilter', $featuredFilter); $session->set('recommendedFilter', $recommendedFilter); + $session->set('vuFilter', $vuFilter); $session->set('userFilter', $userFilter); $session->set('searchFilter', $searchFilter); $session->set('page', $page); - $filter = new Filter($categoryFilter ? $em->getRepository('VolleyFaceBundle:Category')->find($categoryFilter) : null, $stateFilter, $featuredFilter, $recommendedFilter, $userFilter ? $em->getRepository('VolleyUserBundle:User')->find($userFilter) : null, $searchFilter); + $filter = new Filter($categoryFilter ? $em->getRepository('VolleyFaceBundle:Category')->find($categoryFilter) : null, $stateFilter, $featuredFilter, $recommendedFilter, $vuFilter,$userFilter ? $em->getRepository('VolleyUserBundle:User')->find($userFilter) : null, $searchFilter); $filterForm = $this->createForm(new FilterType(), $filter); $query = $em->getRepository('VolleyFaceBundle:Post') @@ -70,6 +73,7 @@ public function indexAction(Request $request) $stateFilter, $featuredFilter, $recommendedFilter, + $vuFilter, $userFilter, $searchFilter ); diff --git a/src/Volley/FaceBundle/Entity/Post.php b/src/Volley/FaceBundle/Entity/Post.php index d70cf376..0fbbe36c 100644 --- a/src/Volley/FaceBundle/Entity/Post.php +++ b/src/Volley/FaceBundle/Entity/Post.php @@ -217,6 +217,13 @@ class Post */ private $translated; + /** + * @var boolean + * + * @ORM\Column(name="vu", type="boolean") + */ + private $vu; + /** * @var string * @@ -755,6 +762,22 @@ public function setTranslated($translated) $this->translated = $translated; } + /** + * @return bool + */ + public function isVu() + { + return $this->vu; + } + + /** + * @param bool $vu + */ + public function setVu($vu) + { + $this->vu = $vu; + } + /** * Set language * diff --git a/src/Volley/FaceBundle/Entity/PostRepository.php b/src/Volley/FaceBundle/Entity/PostRepository.php index 0cb38fe8..eaa2f342 100644 --- a/src/Volley/FaceBundle/Entity/PostRepository.php +++ b/src/Volley/FaceBundle/Entity/PostRepository.php @@ -105,7 +105,7 @@ public function unsetFeatured($entity) ->execute(); } - public function findAllPosts($categoryFilter = null, $stateFilter = 12, $featuredFilter = 12, $recommendedFilter = 12, $userFilter = null, $searchFilter = "") + public function findAllPosts($categoryFilter = null, $stateFilter = 12, $featuredFilter = 12, $recommendedFilter = 12, $vuFilter = 12, $userFilter = null, $searchFilter = "") { $qb = $this->createQueryBuilder('p'); $qb->select('p') @@ -120,6 +120,8 @@ public function findAllPosts($categoryFilter = null, $stateFilter = 12, $feature $qb->andWhere('p.createdBy = ?4')->setParameter(4, $userFilter); if ($recommendedFilter < 12) $qb->andWhere('p.recommended = ?5')->setParameter(5, $recommendedFilter); + if ($vuFilter < 12) + $qb->andWhere('p.vu = ?6')->setParameter(6, $vuFilter); if ($searchFilter != "") $qb->andWhere($qb->expr()->like('p.title', $qb->expr()->literal('%' . $searchFilter . '%'))); diff --git a/src/Volley/FaceBundle/Form/FilterType.php b/src/Volley/FaceBundle/Form/FilterType.php index ec191334..92a40e18 100644 --- a/src/Volley/FaceBundle/Form/FilterType.php +++ b/src/Volley/FaceBundle/Form/FilterType.php @@ -44,6 +44,14 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'expanded' => false, 'empty_value' => false ]) + ->add('vu', 'choice', [ + 'choices' => [12 => "All", 0 => 'None VU', 1 => 'VU'], + 'label' => 'Filter', + 'required' => false, + 'multiple' => false, + 'expanded' => false, + 'empty_value' => false + ]) ->add('user',EntityType::class, [ 'class' => 'Volley\UserBundle\Entity\User', 'required' => false diff --git a/src/Volley/FaceBundle/Form/Model/Filter.php b/src/Volley/FaceBundle/Form/Model/Filter.php index d82b664c..586d3834 100644 --- a/src/Volley/FaceBundle/Form/Model/Filter.php +++ b/src/Volley/FaceBundle/Form/Model/Filter.php @@ -27,6 +27,11 @@ class Filter */ private $recommended; + /** + * @var integer + */ + private $vu; + /** * @var User */ @@ -42,12 +47,13 @@ class Filter */ protected $form; - function __construct($category, $state, $featured, $recommended, $user, $search) + function __construct($category, $state, $featured, $recommended, $vu, $user, $search) { $this->category = $category; $this->state = $state; $this->featured = $featured; $this->recommended = $recommended; + $this->vu = $vu; $this->user = $user; $this->search = $search; } @@ -116,6 +122,22 @@ public function setRecommended($recommended) $this->recommended = $recommended; } + /** + * @return int + */ + public function getVu() + { + return $this->vu; + } + + /** + * @param int $vu + */ + public function setVu($vu) + { + $this->vu = $vu; + } + /** * @return User */ diff --git a/src/Volley/FaceBundle/Form/PostType.php b/src/Volley/FaceBundle/Form/PostType.php index f89d5541..6954bb71 100644 --- a/src/Volley/FaceBundle/Form/PostType.php +++ b/src/Volley/FaceBundle/Form/PostType.php @@ -74,6 +74,10 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'label' => false, 'attr' => ['data-toggle' => 'toggle', 'data-on' => 'Translated', 'data-off' => "Not translated", 'data-onstyle' => 'info'] ]) + ->add('vu',null,[ + 'label' => false, + 'attr' => ['data-toggle' => 'toggle', 'data-on' => 'VU', 'data-off' => "Not VU", 'data-onstyle' => 'info'] + ]) ->add('language') ->add('category','entity', [ 'class' => 'Volley\FaceBundle\Entity\Category', diff --git a/src/Volley/FaceBundle/Resources/public/css/custom/body.css b/src/Volley/FaceBundle/Resources/public/css/custom/body.css index 0e78d75a..52b85c73 100644 --- a/src/Volley/FaceBundle/Resources/public/css/custom/body.css +++ b/src/Volley/FaceBundle/Resources/public/css/custom/body.css @@ -92,7 +92,8 @@ } .news-item .news-info .icon-images, -.news-item .news-info .icon-videos { +.news-item .news-info .icon-videos, +.news-item .news-info .icon-vu { float: right; margin: 5px 0 5px 5px; } @@ -110,6 +111,16 @@ background-image: url('../bundles/volleyface/images/icon-video.png'); } +.news-item .news-info .icon-vu { + width: 21px; + height: 12px; + margin: 6px 0 6px 5px; + background-image: url('../bundles/volleyface/images/icon-vu.png'); + background-size: contain; + background-repeat: no-repeat; + background-position: center center; +} + .underline { display: block; height: 1px; diff --git a/src/Volley/FaceBundle/Resources/public/images/icon-vu.png b/src/Volley/FaceBundle/Resources/public/images/icon-vu.png new file mode 100644 index 00000000..94d6e86d Binary files /dev/null and b/src/Volley/FaceBundle/Resources/public/images/icon-vu.png differ diff --git a/src/Volley/FaceBundle/Resources/views/Default/includes/post.html.twig b/src/Volley/FaceBundle/Resources/views/Default/includes/post.html.twig index 71627738..d208568c 100644 --- a/src/Volley/FaceBundle/Resources/views/Default/includes/post.html.twig +++ b/src/Volley/FaceBundle/Resources/views/Default/includes/post.html.twig @@ -8,14 +8,14 @@ alt="{{ item.title ~ ' ' ~ item.metakey }}">
-
+
{{ item.created|localizeddate('none', 'none', null, null, "cccc, d MMMM") }}
{{ item.category.name }}
{# / {{ item.createdBy }}#}
-
+
{% if item.videos %}
@@ -26,6 +26,11 @@
{% endif %} + {% if item.vu %} + +
+
+ {% endif %}
diff --git a/src/Volley/FaceBundle/Resources/views/Post/edit.html.twig b/src/Volley/FaceBundle/Resources/views/Post/edit.html.twig index aa67d339..e73224d5 100644 --- a/src/Volley/FaceBundle/Resources/views/Post/edit.html.twig +++ b/src/Volley/FaceBundle/Resources/views/Post/edit.html.twig @@ -52,6 +52,7 @@ {{ form_row(edit_form.images) }} {{ form_row(edit_form.videos) }} {{ form_row(edit_form.translated) }} + {{ form_row(edit_form.vu) }}

diff --git a/src/Volley/FaceBundle/Resources/views/Post/index.html.twig b/src/Volley/FaceBundle/Resources/views/Post/index.html.twig index a9d75de7..5608c739 100644 --- a/src/Volley/FaceBundle/Resources/views/Post/index.html.twig +++ b/src/Volley/FaceBundle/Resources/views/Post/index.html.twig @@ -32,6 +32,10 @@ {{ form_widget(filter.recommended) }}
+
+ + {{ form_widget(filter.vu) }} +
{{ form_widget(filter.user) }}