src/AppBundle/Controller/DefaultController.php line 13

Open in your IDE?
  1. <?php
  2. namespace AppBundle\Controller;
  3. use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  4. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
  5. class DefaultController extends Controller {
  6.     /**
  7.      * @Route("/", name="homepage", schemes={"https"})
  8.      */
  9.     public function indexAction() {
  10.         $em $this->getDoctrine()->getManager();
  11.         $numberOfCallAttemptsSQLQuery $em->getConnection()->prepare("SELECT COUNT(*) as count FROM callattempts");
  12.         $numberOfCallAttemptsSQLQuery->execute();
  13.         $numberOfArchivedCallAttemptsSQLQuery $em->getConnection()->prepare("SELECT COUNT(*) as count FROM archivedcallattempts");
  14.         $numberOfArchivedCallAttemptsSQLQuery->execute();
  15.         $numberOfMinutesTalkedSQLQuery $em->getConnection()->prepare("SELECT ROUND(SUM(TIMEDIFF(c.conversationend,c.conversationbegin)/60), 0) AS duration FROM callattempts c");
  16.         $numberOfMinutesTalkedSQLQuery->execute();
  17.         $numberOfMinutesTalkedArchivedCallAttemptsSQLQuery $em->getConnection()->prepare("SELECT ROUND(SUM(TIMEDIFF(c.conversationend,c.conversationbegin)/60), 0) AS duration FROM archivedcallattempts c");
  18.         $numberOfMinutesTalkedArchivedCallAttemptsSQLQuery->execute();
  19.         $numberOfOpportunitiesSQLQuery $em->getConnection()->prepare("SELECT COUNT(*) as count FROM opportunities");
  20.         $numberOfOpportunitiesSQLQuery->execute();
  21.         $numberOfAppointmentsSQLQuery $em->getConnection()->prepare("SELECT COUNT(*) as count FROM appointments");
  22.         $numberOfAppointmentsSQLQuery->execute();
  23.         return $this->render('index/index.html.twig', array(
  24.                     'entitymanager' => $em,
  25.                     'numberOfCallAttempts' => number_format($numberOfCallAttemptsSQLQuery->fetchAll()[0]['count'] + $numberOfArchivedCallAttemptsSQLQuery->fetchAll()[0]['count'], 0',''.'),
  26.                     'numberOfMinutesTalked' => number_format($numberOfMinutesTalkedSQLQuery->fetchAll()[0]['duration'] + $numberOfMinutesTalkedArchivedCallAttemptsSQLQuery->fetchAll()[0]['duration'], 0',''.'),
  27.                     'numberOfOpportunities' => number_format($numberOfOpportunitiesSQLQuery->fetchAll()[0]['count'], 0',''.'),
  28.                     'numberOfAppointments' => number_format($numberOfAppointmentsSQLQuery->fetchAll()[0]['count'], 0',''.')
  29.         ));
  30.     }
  31.     /**
  32.      * @Route("/phpinfo", name="phpinfo", schemes={"https"})
  33.      */
  34.     public function phpinfoAction() {
  35.         ob_start();
  36.         phpinfo();
  37.         $phpinfo ob_get_clean();
  38.         return $this->render('index/phpinfo.html.twig', array('phpinfo' => $phpinfo'entitymanager' => $this->getDoctrine()->getManager()));
  39.     }
  40.     
  41.     /**
  42.      * @Route("/documentation", name="documentation", schemes={"https"})
  43.      */
  44.     public function documentationAction() {
  45.         return $this->render('index/documentation.html.twig', array('entitymanager' => $this->getDoctrine()->getManager()));
  46.     }
  47.     
  48. }