diff --git a/app/config/services.yml b/app/config/services.yml index b102700f9..cc041f444 100644 --- a/app/config/services.yml +++ b/app/config/services.yml @@ -164,6 +164,9 @@ services: Afup\Site\Association\CotisationsFactory: autowire: true + Afup\Site\Corporate\Page: + autowire: true + Afup\Site\Forum\Facturation: autowire: true diff --git a/sources/Afup/Corporate/Branche.php b/sources/Afup/Corporate/Branche.php deleted file mode 100644 index a85245988..000000000 --- a/sources/Afup/Corporate/Branche.php +++ /dev/null @@ -1,115 +0,0 @@ -bdd = $bdd ?: new _Site_Base_De_Donnees(); - } - - public function navigation_avec_image($bool = false): void - { - if ($bool) { - $this->navigation = 'image'; - } - } - - public function feuillesEnfants($id) - { - $requete = 'SELECT * - FROM afup_site_feuille - WHERE id_parent = ' . $this->bdd->echapper($id) . ' - AND etat = 1 - ORDER BY position'; - return $this->bdd->obtenirTous($requete); - } - - public function getNom($id) - { - $requete = 'SELECT nom - FROM afup_site_feuille - WHERE id = ' . $this->bdd->echapper($id) . ' - AND etat = 1'; - $enregistrement = $this->bdd->obtenirEnregistrement($requete); - - if (false === $enregistrement) { - return null; - } - - return $enregistrement['nom']; - } - - public function naviguer($id, $profondeur = 1, string $identification = ""): string - { - $requete = 'SELECT * - FROM afup_site_feuille - WHERE id = ' . $this->bdd->echapper($id) . ' - AND etat = 1'; - $racine = $this->bdd->obtenirEnregistrement($requete); - - if ($racine === false) { - return ''; - } - - $feuilles = $this->extraireFeuilles($id, $profondeur); - if ($feuilles !== '' && $feuilles !== '0') { - $navigation = ''; - } else { - $navigation = ''; - } - - return $navigation; - } - - public function extraireFeuilles($id, $profondeur): string - { - $extraction = ''; - - $requete = 'SELECT * - FROM afup_site_feuille - WHERE id_parent = ' . $this->bdd->echapper($id) . ' - AND etat = 1 - ORDER BY position'; - $feuilles = $this->bdd->obtenirTous($requete); - - if (is_array($feuilles)) { - foreach ($feuilles as $feuille) { - $class = ""; - if ($extraction === "") { - $class = ' class="top"'; - } - $route = match (true) { - preg_match('#^http://#', (string) $feuille['lien']), preg_match('#^/#', (string) $feuille['lien']) => $feuille['lien'], - default => Site::WEB_PATH . Site::WEB_PREFIX . Site::WEB_QUERY_PREFIX . $feuille['lien'], - }; - $extraction .= ''; - if ($this->navigation == 'image' && $feuille['image'] !== null) { - $extraction .= '' . $feuille['alt'] . '
'; - $extraction .= $feuille['nom'] . '

'; - $extraction .= $feuille['alt']; - } else { - $extraction .= '' . $feuille['nom'] . ''; - } - $extraction .= ''; - if ($profondeur > 0) { - $extraction .= $this->naviguer($feuille['id'], $profondeur - 1); - } - } - } - - return $extraction; - } -} diff --git a/sources/Afup/Corporate/Page.php b/sources/Afup/Corporate/Page.php index 94f127ec1..7500e01de 100644 --- a/sources/Afup/Corporate/Page.php +++ b/sources/Afup/Corporate/Page.php @@ -4,24 +4,21 @@ namespace Afup\Site\Corporate; +use AppBundle\Site\Model\Repository\SheetRepository; use Symfony\Component\Security\Core\User\UserInterface; final readonly class Page { - private _Site_Base_De_Donnees $bdd; - - public function __construct() - { - $this->bdd = new _Site_Base_De_Donnees(); - } + public function __construct( + private SheetRepository $sheetRepository, + ) {} public function header($url = null, UserInterface $user = null): string { - $branche = new Branche($this->bdd); $url = urldecode((string) $url); $str = '