You are here

function ad_report_range_form in Advertisement 7

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

Return a form for selecting a date range for generating a report.

1 string reference to 'ad_report_range_form'
ad_report_bargraph in report/ad_report.module
Page to display ad with bargraph.

File

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

Code

function ad_report_range_form($form_state, $node, $url = NULL, $start = NULL, $end = NULL, $data = array()) {
  $form = array();
  $start = $start ? $start : _ad_report_first_day_of_month();
  $end = $end ? $end : _ad_report_last_day_of_month();
  $form['data'] = array(
    '#type' => 'fieldset',
    '#title' => t('Report data'),
  );
  $form['data']['impressions'] = array(
    '#type' => 'checkbox',
    '#title' => t('Impressions'),
    '#default_value' => empty($data) || isset($data['i']) ? TRUE : FALSE,
  );
  $form['data']['clicks'] = array(
    '#type' => 'checkbox',
    '#title' => t('Clicks'),
    '#default_value' => isset($data['c']) ? TRUE : FALSE,
  );
  $form['report'] = array(
    '#type' => 'fieldset',
    '#title' => t('Report dates'),
    '#prefix' => '<div class="container-inline">',
    '#suffix' => '</div>',
  );
  $form['report']['nid'] = array(
    '#value' => $node->nid,
    '#type' => 'hidden',
  );
  $form['report']['url'] = array(
    '#value' => $url,
    '#type' => 'hidden',
  );
  if (isset($data['goto'])) {
    $form['report']['goto'] = array(
      '#value' => $data['goto'],
      '#type' => 'hidden',
    );
  }
  $form['report']['start'] = array(
    '#type' => 'textfield',
    '#title' => t('Start'),
    '#size' => 24,
    '#maxlength' => 64,
    '#default_value' => _ad_report_format_date_human($start),
    // display pop up calendar if jstools jscalendar module enabled
    '#attributes' => array(
      'class' => 'jscalendar',
    ),
    '#jscalendar_ifFormat' => '%Y-%m-%d %H:%M',
    '#jscalendar_timeFormat' => '24',
  );
  $form['report']['space1'] = array(
    '#value' => '&nbsp;&nbsp;',
  );
  $form['report']['end'] = array(
    '#type' => 'textfield',
    '#title' => t('End'),
    '#size' => 24,
    '#maxlength' => 64,
    '#default_value' => _ad_report_format_date_human($end),
    // display pop up calendar if jstools jscalendar module enabled
    '#attributes' => array(
      'class' => 'jscalendar',
    ),
    '#jscalendar_ifFormat' => '%Y-%m-%d %H:%M',
  );
  $form['report']['space2'] = array(
    '#value' => '&nbsp;&nbsp;&nbsp;',
  );
  $form['report']['generate'] = array(
    '#type' => 'submit',
    '#value' => t('Generate report'),
  );
  return $form;
}