/** * @before _secure * @after setDate */ public function organization() { $this->seo(["title" => "Organization Stats"]); $view = $this->getActionView(); $org = $this->org; $data = Perf::stats($org, ['start' => $this->start, 'end' => $this->end, 'meta' => true]); $view->set($data); }
/** * @before _secure * @after _cleanUp */ public function quickStats($type = 'user', $id = '') { $org = $this->_org; $view = $this->getActionView(); if (!in_array($type, ['user', 'organization', 'ad'])) { return $this->failure('20'); } $perfFields = ['clicks', 'impressions', 'conversions', 'revenue', 'created']; $start = RequestMethods::get("start", date('Y-m-d', strtotime("-5 day"))); $end = RequestMethods::get("end", date('Y-m-d', strtotime('-1 day'))); switch ($type) { case 'user': return $this->earning($id); case 'organization': $data = Perf::stats($org, ['start' => $start, 'end' => $end, 'meta' => true]); $view->set('data', $data); break; } }