You are here

function _ad_report_get_date_from_path in Advertisement 6.3

Same name and namespace in other branches
  1. 5.2 report/ad_report.module \_ad_report_get_date_from_path()
  2. 6.2 report/ad_report.module \_ad_report_get_date_from_path()
  3. 7 report/ad_report.module \_ad_report_get_date_from_path()

Helper function to extract date from URL.

2 calls to _ad_report_get_date_from_path()
ad_report_admin_ad_table in report/ad_report.module
Generate a table reporting on the selected advertisements. Returns an array of ad NIDs in $ads.
ad_report_bargraph in report/ad_report.module
Page to display ad with bargraph.

File

report/ad_report.module, line 663
Provides comprehensive charts and reports about advertising statistics.

Code

function _ad_report_get_date_from_path($path) {
  if (isset($path) && $path) {
    $year = substr($path, 0, 4);
    $month = substr($path, 4, 2);
    $day = substr($path, 6, 2);
    $hour = substr($path, 8, 2);
    if (strlen($path) == 12) {
      $minute = substr($path, 10, 2);
    }
    else {
      $minute = 0;
    }
    $date = strtotime("{$month}/{$day}/{$year} {$hour}:{$minute}");
    if ($date > 0) {
      return $date;
    }
    drupal_set_message(t('Invalid date specified in range.'), 'error');
  }
}