You are here

function ad_report_admin in Advertisement 6.3

Same name and namespace in other branches
  1. 5.2 report/ad_report.module \ad_report_admin()
  2. 6.2 report/ad_report.module \ad_report_admin()
  3. 7 report/ad_report.module \ad_report_admin()
2 string references to 'ad_report_admin'
ad_channel_form_alter in channel/ad_channel.module
Implementation of hook_form_alter(). Generate a form for selecting channels to associate with an advertisement.
ad_report_menu in report/ad_report.module
Implementation of hook_menu().

File

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

Code

function ad_report_admin() {
  $form = array();
  $start = isset($_SESSION['ad_report_start']) ? strtotime($_SESSION['ad_report_start']) : _ad_report_first_day_of_month();
  $end = isset($_SESSION['ad_report_end']) ? strtotime($_SESSION['ad_report_end']) : _ad_report_last_day_of_month();
  $group = isset($_SESSION['ad_report_group']) ? $_SESSION['ad_report_group'] : array(
    'all',
  );
  $form['dates'] = array(
    '#type' => 'fieldset',
    '#title' => t('Report dates'),
    '#prefix' => '<div class="container-inline">',
    '#suffix' => '</div>',
  );
  $form['dates']['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['dates']['space1'] = array(
    '#value' => '&nbsp;&nbsp;',
  );
  $form['dates']['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['dates']['space2'] = array(
    '#value' => '&nbsp;&nbsp;&nbsp;',
  );

  // groups
  $groups = ad_groups_list();
  $form['groups'] = array(
    '#type' => 'fieldset',
    '#title' => t('Groups'),
  );
  $options = array();
  $options['all'] = t('- All -');
  $options = $options + $groups;
  $form['groups']['group'] = array(
    '#type' => 'select',
    '#title' => t('Ad groups'),
    '#options' => $options,
    '#multiple' => TRUE,
    '#required' => TRUE,
    '#default_value' => $group,
  );

  // submit
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Generate report'),
    '#weight' => 10,
  );
  $form['reset'] = array(
    '#type' => 'submit',
    '#value' => t('Reset report'),
    '#weight' => 10,
  );
  return $form;
}