public function actionGetRatesJson($quoteid) { $dates = Rate::getDatesForLiderTab('year'); $startdate = $dates[0]; $enddate = $dates[1]; $response = Yii::$app->response; $response->format = Response::FORMAT_JSON; $response->data = $this->getRatesForPeriod($quoteid, $startdate, $enddate); return $response; }
public function actionGetLeadersAndLoosers($period) { if ($period == 'day') { $dates = Rate::getDatesForLiderTab('day'); } elseif ($period == 'month') { $dates = Rate::getDatesForLiderTab('month'); } elseif ($period == 'year') { $dates = Rate::getDatesForLiderTab('year'); } elseif ($period == 'all') { $dates = Rate::getDatesForLiderTab('all'); } $leaders = Rate::getLidersBetweenSelectedDates($dates[0], $dates[1]); $loosers = Rate::getLidersBetweenSelectedDates($dates[0], $dates[1], false); $return = array($leaders, $loosers); $response = Yii::$app->response; $response->format = Response::FORMAT_JSON; $response->data = $return; return $response; }