Add Wanted Page + fixs
This commit is contained in:
4
.env
4
.env
@@ -19,6 +19,6 @@ MAILER_SENDER=noreply@vision
|
|||||||
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
|
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
|
||||||
#
|
#
|
||||||
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
|
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
|
||||||
# DATABASE_URL="mysql://db_user:db_password@127.0.0.1:3306/db_name?serverVersion=5.7&charset=utf8mb4"
|
DATABASE_URL="mysql://db_user:db_password@127.0.0.1:3306/db_name?serverVersion=5.7&charset=utf8mb4"
|
||||||
DATABASE_URL="postgresql://symfony:ChangeMe@127.0.0.1:5432/app?serverVersion=13&charset=utf8"
|
# DATABASE_URL="postgresql://symfony:ChangeMe@127.0.0.1:5432/app?serverVersion=13&charset=utf8"
|
||||||
###< doctrine/doctrine-bundle ###
|
###< doctrine/doctrine-bundle ###
|
||||||
@@ -43,6 +43,7 @@ security:
|
|||||||
- { path: ^/verify/password, roles: PUBLIC_ACCESS }
|
- { path: ^/verify/password, roles: PUBLIC_ACCESS }
|
||||||
- { path: ^/reset-password, roles: PUBLIC_ACCESS }
|
- { path: ^/reset-password, roles: PUBLIC_ACCESS }
|
||||||
- { path: ^/share, roles: PUBLIC_ACCESS }
|
- { path: ^/share, roles: PUBLIC_ACCESS }
|
||||||
|
- { path: ^/wanted, roles: PUBLIC_ACCESS }
|
||||||
- { path: ^/admin, roles: ROLE_ADMIN }
|
- { path: ^/admin, roles: ROLE_ADMIN }
|
||||||
- { path: ^/directory/history, roles: ROLE_ADMIN }
|
- { path: ^/directory/history, roles: ROLE_ADMIN }
|
||||||
- { path: ^/, roles: IS_AUTHENTICATED_REMEMBERED } #IS_AUTHENTICATED_REMEMBERED= user is logged, with form or with cookie
|
- { path: ^/, roles: IS_AUTHENTICATED_REMEMBERED } #IS_AUTHENTICATED_REMEMBERED= user is logged, with form or with cookie
|
||||||
|
|||||||
31
migrations/Version20221031135251.php
Normal file
31
migrations/Version20221031135251.php
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace DoctrineMigrations;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auto-generated Migration: Please modify to your needs!
|
||||||
|
*/
|
||||||
|
final class Version20221031135251 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this up() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('ALTER TABLE directory ADD wanted_public_display TINYINT(1) DEFAULT \'0\' NOT NULL');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this down() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('ALTER TABLE directory DROP wanted_public_display');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -85,7 +85,8 @@ class GroupController extends AbstractController
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
$User->getMainRank()->getPower() >= $currentUser->getMainRank()->getPower()
|
null != $User->getMainRank()
|
||||||
|
&& $User->getMainRank()->getPower() >= $currentUser->getMainRank()->getPower()
|
||||||
&& !$currentUser->getAdminMode()
|
&& !$currentUser->getAdminMode()
|
||||||
) {
|
) {
|
||||||
$this->addFlash('danger', 'alert_error_cant_fire_superior_or_same_rank');
|
$this->addFlash('danger', 'alert_error_cant_fire_superior_or_same_rank');
|
||||||
|
|||||||
22
src/Controller/WantedController.php
Normal file
22
src/Controller/WantedController.php
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use App\Repository\DirectoryRepository;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
|
|
||||||
|
class WantedController extends AbstractController
|
||||||
|
{
|
||||||
|
#[Route('/wanted', name: 'app_wanted')]
|
||||||
|
public function index(DirectoryRepository $DirectoryRepository): Response
|
||||||
|
{
|
||||||
|
return $this->render('wanted/index.html.twig', [
|
||||||
|
'controller_name' => 'WantedController',
|
||||||
|
'wanted' =>
|
||||||
|
$DirectoryRepository->list()->notDead()->wanted()->wantedPublicDisplay()->getResult(),
|
||||||
|
'shared' => true
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -421,6 +421,12 @@ class Directory
|
|||||||
*/
|
*/
|
||||||
private $wantedDisplay = true;
|
private $wantedDisplay = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="boolean", options={"default":"0"})
|
||||||
|
* @Gedmo\Versioned
|
||||||
|
*/
|
||||||
|
private $wantedPublicDisplay = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\OneToMany(targetEntity=Infringement::class, mappedBy="directory", orphanRemoval=true)
|
* @ORM\OneToMany(targetEntity=Infringement::class, mappedBy="directory", orphanRemoval=true)
|
||||||
* @ORM\OrderBy({"createdAt" = "DESC"})
|
* @ORM\OrderBy({"createdAt" = "DESC"})
|
||||||
@@ -1358,6 +1364,18 @@ class Directory
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getWantedPublicDisplay(): ?bool
|
||||||
|
{
|
||||||
|
return $this->wantedPublicDisplay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setWantedPublicDisplay(bool $wantedPublicDisplay): self
|
||||||
|
{
|
||||||
|
$this->wantedPublicDisplay = $wantedPublicDisplay;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Collection|Infringement[]
|
* @return Collection|Infringement[]
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ class DirectoryType extends AbstractType
|
|||||||
->add('wanted', null, ['label' => 'form_label_wanted'])
|
->add('wanted', null, ['label' => 'form_label_wanted'])
|
||||||
->add('wantedReason', null, ['label' => 'form_label_wantedReason', 'help' => 'form_help_wantedReason'])
|
->add('wantedReason', null, ['label' => 'form_label_wantedReason', 'help' => 'form_help_wantedReason'])
|
||||||
->add('wantedDisplay', null, ['label' => 'form_label_wantedDisplay'])
|
->add('wantedDisplay', null, ['label' => 'form_label_wantedDisplay'])
|
||||||
|
->add('wantedPublicDisplay', null, ['label' => 'form_label_wantedPublicDisplay'])
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -83,6 +83,12 @@ class DirectoryRepository extends ServiceEntityRepository
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function wantedPublicDisplay()
|
||||||
|
{
|
||||||
|
$this->qb->andWhere('d.wantedPublicDisplay = 1');
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function wantedNotDisplay()
|
public function wantedNotDisplay()
|
||||||
{
|
{
|
||||||
$this->qb->andWhere('d.wantedDisplay = 0');
|
$this->qb->andWhere('d.wantedDisplay = 0');
|
||||||
|
|||||||
34
templates/wanted/index.html.twig
Normal file
34
templates/wanted/index.html.twig
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
{% extends 'base.html.twig' %}
|
||||||
|
|
||||||
|
{% block title %}{% trans %}title_wanted{% endtrans %}{% endblock %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
{% if wanted %}
|
||||||
|
<div class="row p-5">
|
||||||
|
{% for i in wanted %}
|
||||||
|
{% set path_directories_uploads = 'uploads/directories' %}
|
||||||
|
{% if i.faceImageSize != 0 %}{% set faceImage = path_directories_uploads ~ '/' ~ i.faceImageName
|
||||||
|
%}{% else %}{% set faceImage = 'img/nophoto.jpg' %}{% endif %}
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<div class="card prod-p-card background-pattern">
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="row align-items-center m-b-0">
|
||||||
|
<div class="col">
|
||||||
|
<h6 class="m-b-5">{% trans %}title_wanted{% endtrans %}</h6>
|
||||||
|
<h3 class="m-b-0">{{i.fullname}}</h3>
|
||||||
|
</div>
|
||||||
|
<div class="col-auto">
|
||||||
|
<a data-toggle="lightbox" data-gallery="wanted"
|
||||||
|
data-caption="{% trans %}title_wanted{% endtrans %}: {{ i.fullname }}"
|
||||||
|
href="{{ asset(faceImage) }}"><img class="img-fluid"
|
||||||
|
style="max-height: 100px;" src="{{ asset(faceImage) }}"
|
||||||
|
alt="{{ i.fullname}}"></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
@@ -363,6 +363,7 @@ form_label_vehicle_type: Vehicle type
|
|||||||
form_label_versus: Versus
|
form_label_versus: Versus
|
||||||
form_label_wanted: This person is wanted
|
form_label_wanted: This person is wanted
|
||||||
form_label_wantedDisplay: Display wanted card on homepage
|
form_label_wantedDisplay: Display wanted card on homepage
|
||||||
|
form_label_wantedPublicDisplay: Show on public wanted page
|
||||||
form_label_wantedReason: Reason for searching for this person
|
form_label_wantedReason: Reason for searching for this person
|
||||||
form_placeholder_email: Email
|
form_placeholder_email: Email
|
||||||
form_placeholder_firstname: First name
|
form_placeholder_firstname: First name
|
||||||
|
|||||||
@@ -363,6 +363,7 @@ form_label_vehicle_type: Type de véhicule
|
|||||||
form_label_versus: Contre
|
form_label_versus: Contre
|
||||||
form_label_wanted: Cette personne est recherchée
|
form_label_wanted: Cette personne est recherchée
|
||||||
form_label_wantedDisplay: Afficher la recherche sur l'accueil
|
form_label_wantedDisplay: Afficher la recherche sur l'accueil
|
||||||
|
form_label_wantedPublicDisplay: Afficher la recherche sur la page publique
|
||||||
form_label_wantedReason: Raison de la recherche de cette personne
|
form_label_wantedReason: Raison de la recherche de cette personne
|
||||||
form_placeholder_email: Email
|
form_placeholder_email: Email
|
||||||
form_placeholder_firstname: Prénom
|
form_placeholder_firstname: Prénom
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
"version": "0.2.17"
|
"version": "0.2.18"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user