public function getDashboardStats()
    {
        // Graph Range X-Axis Limit to this value
        $limit = 10;
        $success = 1;
        // Values hanler
        $values = array();
        
        if($this->getController()->getRequest()->isPost()) {
            
            $chartFor = get_object_vars($this->getController()->getRequest()->getPost());
            $chartFor = isset($chartFor['chartFor']) ? $chartFor['chartFor'] : 'monthly';
            
            $melisProspectsService = $this->getServiceLocator()->get('MelisProspectsService');
            
            // Last Date/value of the Graph will be the Current Date
            $curdate = date('Y-m-d');
            for ($ctr = $limit ; $ctr > 0 ;$ctr--)
            {
                // Retreve Prospects Values from database
                $nb = $melisProspectsService->getProspectsDataByDate($chartFor,$curdate);
                
                // Checking type of report
                switch ($chartFor) {
                    case 'daily':
                        $values[] = array($curdate, $nb);
                        // Deduct 1 Day every loop
                        $curdate = date('Y-m-d',strtotime($curdate.' -1 days'));
                        break;
                    case 'monthly':
                        $values[] = array($curdate, $nb);
                        // Deduct 1 Month every loop
                        $curdate = date('Y-m-d',strtotime($curdate.' -1 months'));
                        break;
                    case 'yearly':
                        $values[] = array($curdate, $nb);
                        // Deduct 1 Year every loop
                        $curdate = date('Y-m-d',strtotime($curdate.' -1 years'));
                        break;
                    default:
                        # code...
                        break;
                }
            }
        }
        
        return new JsonModel(array(
            'date' => date('Y-m-d'),
            'success' => $success,
            'values' => $values,
        ));
        
    }
public function getDashboardStats()
    {
        // Graph Range X-Axis Limit to this value
        $limit = 10;
        $success = 1;
        // Values hanler
        $values = array();
        
        if($this->getController()->getRequest()->isPost()) {
            
            $chartFor = get_object_vars($this->getController()->getRequest()->getPost());
            $chartFor = isset($chartFor['chartFor']) ? $chartFor['chartFor'] : 'monthly';
            
            $melisProspectsService = $this->getServiceLocator()->get('MelisProspectsService');
            
            // Last Date/value of the Graph will be the Current Date
            $curdate = date('Y-m-d');
            for ($ctr = $limit ; $ctr > 0 ;$ctr--)
            {
                // Retreve Prospects Values from database
                $nb = $melisProspectsService->getProspectsDataByDate($chartFor,$curdate);
                
                // Checking type of report
                switch ($chartFor) {
                    case 'daily':
                        $values[] = array($curdate, $nb);
                        // Deduct 1 Day every loop
                        $curdate = date('Y-m-d',strtotime($curdate.' -1 days'));
                        break;
                    case 'monthly':
                        $values[] = array($curdate, $nb);
                        // Deduct 1 Month every loop
                        $curdate = date('Y-m-d',strtotime($curdate.' -1 months'));
                        break;
                    case 'yearly':
                        $values[] = array($curdate, $nb);
                        // Deduct 1 Year every loop
                        $curdate = date('Y-m-d',strtotime($curdate.' -1 years'));
                        break;
                    default:
                        # code...
                        break;
                }
            }
        }
        
        return new JsonModel(array(
            'date' => date('Y-m-d'),
            'success' => $success,
            'values' => $values,
        ));
        
    }
public function getDashboardStats ( ) { // Graph Range X-Axis Limit to this value $ limit = 10 ; $ success = 1 ; // Values hanler $ values = array ( ) ; if ( $ this -> getController ( ) -> getRequest ( ) -> isPost ( ) ) { $ chartFor = get_object_vars ( $ this -> getController ( ) -> getRequest ( ) -> getPost ( ) ) ; $ chartFor = isset ( $ chartFor [ 'chartFor' ] ) ? $ chartFor [ 'chartFor' ] : 'monthly' ; $ melisProspectsService = $ this -> getServiceLocator ( ) -> get ( 'MelisProspectsService' ) ; // Last Date/value of the Graph will be the Current Date $ curdate = date ( 'Y-m-d' ) ; for ( $ ctr = $ limit ; $ ctr > 0 ; $ ctr -- ) { // Retreve Prospects Values from database $ nb = $ melisProspectsService -> getProspectsDataByDate ( $ chartFor , $ curdate ) ; // Checking type of report switch ( $ chartFor ) { case 'daily' : $ values [ ] = array ( $ curdate , $ nb ) ; // Deduct 1 Day every loop $ curdate = date ( 'Y-m-d' , strtotime ( $ curdate . ' -1 days' ) ) ; break ; case 'monthly' : $ values [ ] = array ( $ curdate , $ nb ) ; // Deduct 1 Month every loop $ curdate = date ( 'Y-m-d' , strtotime ( $ curdate . ' -1 months' ) ) ; break ; case 'yearly' : $ values [ ] = array ( $ curdate , $ nb ) ; // Deduct 1 Year every loop $ curdate = date ( 'Y-m-d' , strtotime ( $ curdate . ' -1 years' ) ) ; break ; default : # code... break ; } } } return new JsonModel ( array ( 'date' => date ( 'Y-m-d' ) , 'success' => $ success , 'values' => $ values , ) ) ; }
Returns JSon datas for the graphs on the dashboard
Returns JSon datas for the graphs on the dashboard