<?php

namespace OfficeBrain\Bundle\ReportBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\JsonResponse;
use OfficeBrain\Bundle\ReportBundle\Form\ReportType;
use OfficeBrain\Bundle\ReportBundle\Entity\Report;

/**
 *
 * @author software
 * @Route("admin/{_locale}/")
 */
class ReportController extends Controller
{
    private $reportService;
    public function __construct()
    {
    }
    public function initAction()
    {
        $this->request= $this->getRequest();
        $this->reportService=$this->get("office_brain_report_manager");
        $this->responseArray['period']=$this->request->get('period','day');
        $this->responseArray['todaydate']=$this->request->get('date',new \DateTime());     
    }  
  
    /**
     *
     *
     * @Route("report/view",
     * 	name="office_brain_bundle_report_visitor_view",
     * )
     *
     * @Template("OfficeBrainReportBundle:Chart:report.html.twig")
     */
    public function VisitorReportAction()
    {    	   	
    	$this->initAction();
    	return $this->responseArray;    
    }
    
    /**
     *
     *
     * @Route("report/action",
     * 	name="office_brain_bundle_report_action_view",
     * )
     *
     * @Template("OfficeBrainReportBundle:Chart:actionreport.html.twig")
     */
    public function AllActionReportAction()
    {
    	$this->initAction();
    	return $this->responseArray;
    }
    
    /**
     *
     *
     * @Route("report/sitesearch",
     * 	name="office_brain_bundle_report_sitesearch_view",
     * )
     *
     * @Template("OfficeBrainReportBundle:Chart:sitesearchreport.html.twig")
     */
    public function SiteSearchReportAction()
    {
    	$this->initAction();
    	return $this->responseArray;
    }    

    /**
     *
     *
     * @Route("report/ecommerce",
     * 	name="office_brain_bundle_report_ecommerce_view",
     * )
     *
     * @Template("OfficeBrainReportBundle:Chart:ecommercereport.html.twig")
     */
    public function EcommerceReportAction()
    {
    	$this->initAction();
    	return $this->responseArray;
    }
    
    
    /**
     *
     *
     * @Route("report/search/view",
     * 	name="office_brain_bundle_report_visitor_searchviewAjax",
     * )
     *
     * @Template("OfficeBrainReportBundle:Chart:searchreport.html.twig")   
     * 
     */
    public function searchviewAjaxAction()
    {   
    	
    	$this->initAction();
    	$this->responseArray['period'] = $this->request->get('option',null);
    	$this->responseArray['todaydate'] = $this->request->get('date1',null);
    	$this->responseArray['date2'] = $this->request->get('date2',null);
    	
    	return $this->responseArray;
    }    
    
    /**
     *
     *
     * @Route("report/action/view",
     * 	name="office_brain_bundle_report_visitor_actionviewAjax",
     * )
     *
     * @Template("OfficeBrainReportBundle:Chart:actionsearchreport.html.twig")
     * @method("POST")
     *
     */
    public function actionviewAjaxAction()
    {
    	$this->initAction();
    	$this->responseArray['period'] = $this->request->get('option',null);
    	$this->responseArray['todaydate'] = $this->request->get('date1',null);
    	$this->responseArray['date2'] = $this->request->get('date2',null);
    	 
    	return $this->responseArray;
    }
    
    /**
     *
     *
     * @Route("report/sitesearch/view",
     * 	name="office_brain_bundle_report_visitor_sitesearchviewAjax",
     * )
     *
     * @Template("OfficeBrainReportBundle:Chart:sitesearchinnerreport.html.twig")
     * @method("POST")
     *
     */
    public function sitesearchviewAjaxAction()
    {
    	$this->initAction();
    	$this->responseArray['period'] = $this->request->get('option',null);
    	$this->responseArray['todaydate'] = $this->request->get('date1',null);
    	$this->responseArray['date2'] = $this->request->get('date2',null);
    
    	return $this->responseArray;
    }
    /**
     *
     *
     * @Route("report/ecommerce/view",
     * 	name="office_brain_bundle_report_ecommerce_searvhviewAjax",
     * )
     *
     * @Template("OfficeBrainReportBundle:Chart:ecommercesearchreport.html.twig")
     *
     */
    public function ecommerceviewAjaxAction()
    {
    	 
    	$this->initAction();
    	$this->responseArray['period'] = $this->request->get('option',null);
    	$this->responseArray['todaydate'] = $this->request->get('date1',null);
    	$this->responseArray['date2'] = $this->request->get('date2',null);
    	 
    	return $this->responseArray;
    }
    
    
}
