frontend/controllers/ReferralController.php
/**
     * Renders referrals chart
     *
     * @param string $link referal link id
     * @param string $startDate date in yyyy-mm-dd format
     * @param string $endDate date in yyyy-mm-dd format
     * @return mixed
     */
Renders referrals chart
@param string $link referal link id
@param string $startDate date in yyyy-mm-dd format
@param string $endDate date in yyyy-mm-dd format
@return mixed
Renders referrals chart @param string $link referal link id @param string $startDate date in yyyy - mm - dd format @param string $endDate date in yyyy - mm - dd format @return mixed
public function actionRenderEarnings ($link, $startDate, $endDate)
    {
        $form = new EarningsFilterForm();
        $form->refLinkId = $link;
        $form->startDate = $startDate;
        $form->endDate = $endDate;
        $resp = array();
        if ((list($link, $startDate, $endDate) = $form->prepareData()) !== false) {
            $resp['success'] = true;
        } else {
            $resp['success'] = false;
            $resp['errorHtml'] = $this->renderAjax('_alert', ['type' => 'error', 'message' => $form->getFirstErrors()]);
        }
        $resp['chartHtml'] = $this->renderAjax('_chart', ['refLink' => $link,'startDate' => $startDate,'endDate' => $endDate]);
        $resp['avgClicksPerDayHtml'] = $this->renderAjax('_avgClicksPerDay', ['refLink' => $link,'startDate' => $startDate,'endDate' => $endDate]);
        $resp['avgLeadsPerDayHtml'] = $this->renderAjax('_avgLeadsPerDay', ['refLink' => $link,'startDate' => $startDate,'endDate' => $endDate]);
        Yii::$app->response->format = 'json';
        return $resp;
    }
public function actionRenderEarnings ( $ link , $ startDate , $ endDate ) { $ form = new EarningsFilterForm ( ) ; $ form -> refLinkId = $ link ; $ form -> startDate = $ startDate ; $ form -> endDate = $ endDate ; $ resp = array ( ) ; if ( ( list ( $ link , $ startDate , $ endDate ) = $ form -> prepareData ( ) ) !== false ) { $ resp [ 'success' ] = true ; } else { $ resp [ 'success' ] = false ; $ resp [ 'errorHtml' ] = $ this -> renderAjax ( '_alert' , [ 'type' => 'error' , 'message' => $ form -> getFirstErrors ( ) ] ) ; } $ resp [ 'chartHtml' ] = $ this -> renderAjax ( '_chart' , [ 'refLink' => $ link , 'startDate' => $ startDate , 'endDate' => $ endDate ] ) ; $ resp [ 'avgClicksPerDayHtml' ] = $ this -> renderAjax ( '_avgClicksPerDay' , [ 'refLink' => $ link , 'startDate' => $ startDate , 'endDate' => $ endDate ] ) ; $ resp [ 'avgLeadsPerDayHtml' ] = $ this -> renderAjax ( '_avgLeadsPerDay' , [ 'refLink' => $ link , 'startDate' => $ startDate , 'endDate' => $ endDate ] ) ; Yii :: $ app -> response -> format = 'json' ; return $ resp ; }
Renders referrals chart
 @param string $link referal link id
 @param string $startDate date in yyyy-mm-dd format
 @param string $endDate date in yyyy-mm-dd format
 @return mixed
Renders referrals chart @param string $link referal link id @param string $startDate date in yyyy - mm - dd format @param string $endDate date in yyyy - mm - dd format @return mixed