Commit 5ba1865118fbb20260968e26077bc9310a2dcb3c
1 parent
5940d3c6
docs
Showing
2 changed files
with
0 additions
and
57 deletions
Show diff stats
app/library/App/Bootstrap/RouteBootstrap.php
| @@ -50,61 +50,6 @@ class RouteBootstrap implements BootstrapInterface | @@ -50,61 +50,6 @@ class RouteBootstrap implements BootstrapInterface | ||
| 50 | $view->setVar('documentationPath', $config->hostName . '/export/documentation.json'); | 50 | $view->setVar('documentationPath', $config->hostName . '/export/documentation.json'); |
| 51 | return $view->render('general/documentation'); | 51 | return $view->render('general/documentation'); |
| 52 | }); | 52 | }); |
| 53 | - | ||
| 54 | - $api->get('/test.html', function() use ($api) { | ||
| 55 | - | ||
| 56 | - /** @var \Phalcon\Mvc\View\Simple $view */ | ||
| 57 | - $view = $api->di->get(Services::VIEW); | ||
| 58 | - | ||
| 59 | - putenv('GOOGLE_APPLICATION_CREDENTIALS=/var/www/phalcon/ca4a1bd8aa14.json'); | ||
| 60 | - $client = new Google_Client(); | ||
| 61 | - $client->useApplicationDefaultCredentials(); | ||
| 62 | - $client->setScopes(['https://www.googleapis.com/auth/analytics.readonly']); | ||
| 63 | - $analytics = new Google_Service_AnalyticsReporting($client); | ||
| 64 | - | ||
| 65 | - $param[] = ['metric' => 'ga:sessions', 'alias' => 'Сессии']; | ||
| 66 | - $param[] = ['metric' => 'ga:users', 'alias' => 'Пользователи']; | ||
| 67 | - //$param[] = ['metric' => 'ga:CTR', 'alias' => 'CTR']; | ||
| 68 | - //$param[] = ['metric' => 'ga:goal1Value', 'alias' => 'цель "Корзина"']; | ||
| 69 | - | ||
| 70 | - $VIEW_ID = "119240817"; | ||
| 71 | - | ||
| 72 | - foreach ($param as $item) { | ||
| 73 | - | ||
| 74 | - // Создание объекта DateRange. | ||
| 75 | - $dateRange = new Google_Service_AnalyticsReporting_DateRange(); | ||
| 76 | - $dateRange->setStartDate("30daysAgo"); | ||
| 77 | - $dateRange->setEndDate("today"); | ||
| 78 | - | ||
| 79 | - // Создание объекта Metrics. | ||
| 80 | - $sessions = new Google_Service_AnalyticsReporting_Metric(); | ||
| 81 | - $sessions->setExpression($item['metric']); | ||
| 82 | - $sessions->setAlias($item['alias']); | ||
| 83 | - | ||
| 84 | - | ||
| 85 | - // Создание объекта ReportRequest. | ||
| 86 | - $request = new Google_Service_AnalyticsReporting_ReportRequest(); | ||
| 87 | - $request->setViewId($VIEW_ID); | ||
| 88 | - $request->setDateRanges($dateRange); | ||
| 89 | - $request->setMetrics(array($sessions)); | ||
| 90 | - | ||
| 91 | - $body = new Google_Service_AnalyticsReporting_GetReportsRequest(); | ||
| 92 | - $body->setReportRequests( array( $request) ); | ||
| 93 | - | ||
| 94 | - $response = $analytics->reports->batchGet( $body ); | ||
| 95 | - } | ||
| 96 | - | ||
| 97 | - | ||
| 98 | - $var_2 = var_dump($response); | ||
| 99 | - | ||
| 100 | - $msg = "testing fine"; | ||
| 101 | - | ||
| 102 | - return $view->render('general/test', [ | ||
| 103 | - 'var1' => $msg, | ||
| 104 | - 'var2' => $var_2 | ||
| 105 | - ]); | ||
| 106 | - }); | ||
| 107 | } | 53 | } |
| 108 | 54 | ||
| 109 | - | ||
| 110 | } | 55 | } |
| 111 | \ No newline at end of file | 56 | \ No newline at end of file |
app/library/App/Controllers/ExportController.php
| @@ -20,8 +20,6 @@ class ExportController extends CollectionController | @@ -20,8 +20,6 @@ class ExportController extends CollectionController | ||
| 20 | $documentation->addManyCollections($this->application->getCollections()); | 20 | $documentation->addManyCollections($this->application->getCollections()); |
| 21 | $documentation->addManyRoutes($this->application->getRouter()->getRoutes()); | 21 | $documentation->addManyRoutes($this->application->getRouter()->getRoutes()); |
| 22 | 22 | ||
| 23 | - var_dump($documentation->getRoutes()); | ||
| 24 | - | ||
| 25 | return $this->createItemResponse($documentation, new DocumentationTransformer(), 'documentation'); | 23 | return $this->createItemResponse($documentation, new DocumentationTransformer(), 'documentation'); |
| 26 | } | 24 | } |
| 27 | 25 |