You are here

function uc_csv_report_grid in Ubercart CSV 6.2

Same name and namespace in other branches
  1. 7.2 uc_csv.module \uc_csv_report_grid()
1 string reference to 'uc_csv_report_grid'
uc_csv_menu in ./uc_csv.module
implementation of hook_menu();

File

./uc_csv.module, line 100

Code

function uc_csv_report_grid() {
  $i = 0;
  $rows = array();
  $header = array(
    array(
      'data' => t('Export Name'),
    ),
    array(
      'data' => t('Last Exported'),
      'style' => 'text-align: center;',
    ),
    array(
      'data' => t('Last Order ID'),
      'style' => 'text-align: center;',
    ),
    array(
      'data' => t('Actions'),
      'style' => 'text-align: center;',
    ),
  );
  $result = db_query('SELECT * FROM {uc_csv_reports} ORDER BY report_name ASC');
  while ($data = db_fetch_object($result)) {

    /* if this is an untrackable report, then it is not necessary for list the last exported */

    /* number since it will always be zero */
    if ($data->track < 1) {
      $data->last_order_id = 'N/A';
    }
    $row = array();
    $row[] = $data->report_name;
    $row[] = array(
      'data' => $data->last_exported,
      'style' => 'text-align: center;',
    );
    $row[] = array(
      'data' => $data->last_order_id,
      'style' => 'text-align: center;',
    );
    $row[] = array(
      'data' => l(t('Edit'), 'admin/store/export/reports/update/' . $data->rid) . ' | ' . l(t('Delete'), 'admin/store/export/reports/delete/' . $data->rid),
      'style' => 'text-align: center;',
    );
    $rows[] = $row;
  }
  if (count($rows) == 0) {
    $rows = array(
      array(
        'data' => array(
          array(
            'align' => 'center',
            'colspan' => 4,
            'data' => t('THERE ARE CURRENTLY NO CONFIGURED EXPORT REPORTS'),
          ),
        ),
      ),
    );
  }
  $output = theme('table', $header, $rows);
  return $output;
}