Add Wanted Page + fixs
This commit is contained in:
@@ -85,7 +85,8 @@ class GroupController extends AbstractController
|
||||
}
|
||||
|
||||
if (
|
||||
$User->getMainRank()->getPower() >= $currentUser->getMainRank()->getPower()
|
||||
null != $User->getMainRank()
|
||||
&& $User->getMainRank()->getPower() >= $currentUser->getMainRank()->getPower()
|
||||
&& !$currentUser->getAdminMode()
|
||||
) {
|
||||
$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;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="boolean", options={"default":"0"})
|
||||
* @Gedmo\Versioned
|
||||
*/
|
||||
private $wantedPublicDisplay = false;
|
||||
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity=Infringement::class, mappedBy="directory", orphanRemoval=true)
|
||||
* @ORM\OrderBy({"createdAt" = "DESC"})
|
||||
@@ -709,9 +715,9 @@ class Directory
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param File|\Symfony\Component\HttpFoundation\File\UploadedFile|null $backImageFile
|
||||
*/
|
||||
*
|
||||
* @param File|\Symfony\Component\HttpFoundation\File\UploadedFile|null $backImageFile
|
||||
*/
|
||||
public function setBackImageFile(?File $backImageFile = null): void
|
||||
{
|
||||
$this->backImageFile = $backImageFile;
|
||||
@@ -748,7 +754,7 @@ class Directory
|
||||
return $this->backImageSize;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
*
|
||||
* @param File|\Symfony\Component\HttpFoundation\File\UploadedFile|null $leftImageFile
|
||||
*/
|
||||
@@ -1358,6 +1364,18 @@ class Directory
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getWantedPublicDisplay(): ?bool
|
||||
{
|
||||
return $this->wantedPublicDisplay;
|
||||
}
|
||||
|
||||
public function setWantedPublicDisplay(bool $wantedPublicDisplay): self
|
||||
{
|
||||
$this->wantedPublicDisplay = $wantedPublicDisplay;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection|Infringement[]
|
||||
*/
|
||||
|
||||
@@ -68,6 +68,7 @@ class DirectoryType extends AbstractType
|
||||
->add('wanted', null, ['label' => 'form_label_wanted'])
|
||||
->add('wantedReason', null, ['label' => 'form_label_wantedReason', 'help' => 'form_help_wantedReason'])
|
||||
->add('wantedDisplay', null, ['label' => 'form_label_wantedDisplay'])
|
||||
->add('wantedPublicDisplay', null, ['label' => 'form_label_wantedPublicDisplay'])
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
@@ -83,6 +83,12 @@ class DirectoryRepository extends ServiceEntityRepository
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function wantedPublicDisplay()
|
||||
{
|
||||
$this->qb->andWhere('d.wantedPublicDisplay = 1');
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function wantedNotDisplay()
|
||||
{
|
||||
$this->qb->andWhere('d.wantedDisplay = 0');
|
||||
|
||||
Reference in New Issue
Block a user