public function renderReport($from = null, $to = null, $return = false)
    {
        // Get dates from querystring
        if (isset($_GET['date_from']) && !empty($_GET['date_from'])) {
            $from = $_GET['date_from'];
        }

        if (isset($_GET['date_to']) && !empty($_GET['date_to'])) {
            $to = $_GET['date_to'];
        }

        if (isset($_GET['date']) && !empty($_GET['date'])) {
            $to = $_GET['date'];
            $from = $_GET['date'];
        }

        // Fallback to last week
        if (empty($from) && empty($to)) {
            $from = date('Y-m-d', strtotime('-1 week'));
            $to = date('Y-m-d');
        }

        // Get data from dates
        $data = $this->getDataBetween($from, $to);

        // Get question
        $mainQuestion = __('Did the information on this page help you?', 'customer-feedback');
        if (!empty(get_field('customer_feedback_main_question_text', 'option'))) {
            $mainQuestion = get_field('customer_feedback_main_question_text', 'option');
        }

        $mainQuestionSub = __('Answer the question to help us improve our information.', 'customer-feedback');
        if (function_exists('get_field') && !empty(get_field('customer_feedback_main_question_sub', 'option'))) {
            $mainQuestionSub = get_field('customer_feedback_main_question_sub', 'option');
        }

        // Render view
        if ($return) {
            ob_start();
            include CUSTOMERFEEDBACK_TEMPLATE_PATH . '/summary-view.php';
            return ob_get_clean();
        } else {
            include CUSTOMERFEEDBACK_TEMPLATE_PATH . '/summary-view.php';
        }
    }
public function renderReport($from = null, $to = null, $return = false)
    {
        // Get dates from querystring
        if (isset($_GET['date_from']) && !empty($_GET['date_from'])) {
            $from = $_GET['date_from'];
        }

        if (isset($_GET['date_to']) && !empty($_GET['date_to'])) {
            $to = $_GET['date_to'];
        }

        if (isset($_GET['date']) && !empty($_GET['date'])) {
            $to = $_GET['date'];
            $from = $_GET['date'];
        }

        // Fallback to last week
        if (empty($from) && empty($to)) {
            $from = date('Y-m-d', strtotime('-1 week'));
            $to = date('Y-m-d');
        }

        // Get data from dates
        $data = $this->getDataBetween($from, $to);

        // Get question
        $mainQuestion = __('Did the information on this page help you?', 'customer-feedback');
        if (!empty(get_field('customer_feedback_main_question_text', 'option'))) {
            $mainQuestion = get_field('customer_feedback_main_question_text', 'option');
        }

        $mainQuestionSub = __('Answer the question to help us improve our information.', 'customer-feedback');
        if (function_exists('get_field') && !empty(get_field('customer_feedback_main_question_sub', 'option'))) {
            $mainQuestionSub = get_field('customer_feedback_main_question_sub', 'option');
        }

        // Render view
        if ($return) {
            ob_start();
            include CUSTOMERFEEDBACK_TEMPLATE_PATH . '/summary-view.php';
            return ob_get_clean();
        } else {
            include CUSTOMERFEEDBACK_TEMPLATE_PATH . '/summary-view.php';
        }
    }
public function renderReport ( $ from = null , $ to = null , $ return = false ) { // Get dates from querystring if ( isset ( $ _GET [ 'date_from' ] ) && ! empty ( $ _GET [ 'date_from' ] ) ) { $ from = $ _GET [ 'date_from' ] ; } if ( isset ( $ _GET [ 'date_to' ] ) && ! empty ( $ _GET [ 'date_to' ] ) ) { $ to = $ _GET [ 'date_to' ] ; } if ( isset ( $ _GET [ 'date' ] ) && ! empty ( $ _GET [ 'date' ] ) ) { $ to = $ _GET [ 'date' ] ; $ from = $ _GET [ 'date' ] ; } // Fallback to last week if ( empty ( $ from ) && empty ( $ to ) ) { $ from = date ( 'Y-m-d' , strtotime ( '-1 week' ) ) ; $ to = date ( 'Y-m-d' ) ; } // Get data from dates $ data = $ this -> getDataBetween ( $ from , $ to ) ; // Get question $ mainQuestion = __ ( 'Did the information on this page help you?' , 'customer-feedback' ) ; if ( ! empty ( get_field ( 'customer_feedback_main_question_text' , 'option' ) ) ) { $ mainQuestion = get_field ( 'customer_feedback_main_question_text' , 'option' ) ; } $ mainQuestionSub = __ ( 'Answer the question to help us improve our information.' , 'customer-feedback' ) ; if ( function_exists ( 'get_field' ) && ! empty ( get_field ( 'customer_feedback_main_question_sub' , 'option' ) ) ) { $ mainQuestionSub = get_field ( 'customer_feedback_main_question_sub' , 'option' ) ; } // Render view if ( $ return ) { ob_start ( ) ; include CUSTOMERFEEDBACK_TEMPLATE_PATH . '/summary-view.php' ; return ob_get_clean ( ) ; } else { include CUSTOMERFEEDBACK_TEMPLATE_PATH . '/summary-view.php' ; } }
Renders summary report
@return void
Renders summary report