src/Controller/AdminController.php
public function IndexAction()
  {
    // Checks if the user is connected
    if (Session::islogged())
    {
      // Checks if the user is the administrator
      if (Session::userEmail() == User::adminEmail())
      {
        // Reads all articles, users & comments, then stores them
        $allArticles  = ModelFactory::get('Article')->list();
        $allComments  = ModelFactory::get('Comment')->list();
        $allUsers     = ModelFactory::get('User')   ->list();

        // Returns the rendering of the view admin with the user datas
        return $this->render('admin/admin.twig', [
          'allArticles'       => $allArticles,
          'allComments'       => $allComments,
          'allUsers'          => $allUsers
        ]);
      }
      else {
        // Creates a warning message to inform that only the admin can access to this page
        htmlspecialchars(Session::createAlert('Access reserved for the site administrator', 'warning'));

        // Redirects to the view home
        $this->redirect('home');
      }
    }
    else {
      // Creates a cancel message to ask to be connected
      htmlspecialchars(Session::createAlert('You must be logged in to access the administration', 'cancel'));

      // Redirects to the view loginUser
      $this->redirect('user!login');
    }
  }
public function IndexAction()
  {
    // Checks if the user is connected
    if (Session::islogged())
    {
      // Checks if the user is the administrator
      if (Session::userEmail() == User::adminEmail())
      {
        // Reads all articles, users & comments, then stores them
        $allArticles  = ModelFactory::get('Article')->list();
        $allComments  = ModelFactory::get('Comment')->list();
        $allUsers     = ModelFactory::get('User')   ->list();

        // Returns the rendering of the view admin with the user datas
        return $this->render('admin/admin.twig', [
          'allArticles'       => $allArticles,
          'allComments'       => $allComments,
          'allUsers'          => $allUsers
        ]);
      }
      else {
        // Creates a warning message to inform that only the admin can access to this page
        htmlspecialchars(Session::createAlert('Access reserved for the site administrator', 'warning'));

        // Redirects to the view home
        $this->redirect('home');
      }
    }
    else {
      // Creates a cancel message to ask to be connected
      htmlspecialchars(Session::createAlert('You must be logged in to access the administration', 'cancel'));

      // Redirects to the view loginUser
      $this->redirect('user!login');
    }
  }
*********************************************************************\
Reads all objects for CRUD actions from the database, then display them
@return mixed => the rendering of the view admin