private function PiwikReportsController::piwik_reports_select_period in Piwik Reports 8
Helper function to return the starting and ending dates according to the selected period.
Parameters
int $period: Selected period.
Return value
string Formatted date.
1 call to PiwikReportsController::piwik_reports_select_period()
- PiwikReportsController::reports in src/
Controller/ PiwikReportsController.php - Reports.
File
- src/
Controller/ PiwikReportsController.php, line 343 - Contains \Drupal\piwik_reports\Controller\PiwikReportsController.
Class
- PiwikReportsController
- Class PiwikReportsController.
Namespace
Drupal\piwik_reports\ControllerCode
private function piwik_reports_select_period($period) {
switch ($period) {
case 0:
$date = date("Y-m-d");
break;
case 1:
$d = mktime(0, 0, 0, date("m"), date("d") - 1, date("Y"));
$date = date("Y-m-d", $d);
break;
case 2:
$d = mktime(0, 0, 0, date("m"), date("d") - 7, date("Y"));
$date = date("Y-m-d", $d);
break;
case 3:
$d = mktime(0, 0, 0, date("m") - 1, date("d"), date("Y"));
$date = date("Y-m-d", $d);
break;
case 4:
$d = mktime(0, 0, 0, date("m"), date("d"), date("Y") - 1);
$date = date("Y-m-d", $d);
break;
}
return $date;
}