示例#1
0
 public function actionIndex()
 {
     $metrika = new Metrika();
     if (Yii::$app->request->isAjax && Yii::$app->request->get('id')) {
         return $metrika->getData(Yii::$app->request->get('id'));
     }
     return $this->render('index');
 }
示例#2
0
 public function actionIndex()
 {
     $metrika = new Metrika();
     if (Yii::$app->request->isAjax && ($i = Yii::$app->request->get('id'))) {
         switch ($i) {
             case "traffic":
                 return $metrika->getData(Metrika::TRAFFIC);
                 break;
             case "sources":
                 return $metrika->getData(Metrika::SOURCES);
                 break;
             case "geo":
                 return $metrika->getData(Metrika::GEO);
                 break;
             case "content":
                 return $metrika->getData(Metrika::CONTENT);
                 break;
         }
     }
     return $this->render('index');
 }