/[drupal]/contributions/modules/hof/hof.module
ViewVC logotype

Diff of /contributions/modules/hof/hof.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.13, Fri Dec 12 03:44:17 2008 UTC revision 1.14, Sun Dec 14 22:35:53 2008 UTC
# Line 1  Line 1 
1  <?php  <?php
2  /*  /*
3   * $Id: hof.module,v 1.12 2008/12/08 04:19:46 syscrusher Exp $   * $Id: hof.module,v 1.13 2008/12/12 03:44:17 syscrusher Exp $
4   *   *
5   * Hall-Of-Fame is a module that reports summary statistics for a Drupal   * Hall-Of-Fame is a module that reports summary statistics for a Drupal
6   * web site, with an emphasis on reports that are of interest to visitors   * web site, with an emphasis on reports that are of interest to visitors
# Line 176  function hof_settings_form() { Line 176  function hof_settings_form() {
176      '#default_value' => variable_get('hof_nodes_include_images', 0),      '#default_value' => variable_get('hof_nodes_include_images', 0),
177      '#return_value' => 1,      '#return_value' => 1,
178    );    );
179      $form['hof_reports']['hof_site_create_date_manual'] = array(
180        '#type' => 'checkbox',
181        '#title' => t('Set first online date manually'),
182        '#description' => t('If you set this option, the date below will display as the site\'s initial online date in the Site Statistics section. If this option is disabled, then the first published content will establish the site\'s starting date.'),
183        '#default_value' => variable_get('hof_site_create_date_manual', FALSE),
184      );
185      $form['hof_reports']['hof_site_create_date'] = array(
186        '#type' => 'date',
187        '#title' => t('Site first online date'),
188        '#default_value' => variable_get('hof_site_create_date', null),
189        '#description' => t('This date is used only if the checkbox above is set. <strong>This is interpreted as your site\'s default timezone.</strong>'),
190      );
191    
192    return system_settings_form($form);    return system_settings_form($form);
193  }  }
# Line 410  function _hof_page_section_all() { Line 422  function _hof_page_section_all() {
422   * Site statistics (general summary)   * Site statistics (general summary)
423   */   */
424  function _hof_page_section_site() {  function _hof_page_section_site() {
425    $sql="SELECT MIN(created) FROM {node} WHERE status=1 AND moderate=0";    if (variable_get('hof_site_create_date_manual', FALSE)) {
426    $first_tstmp = db_result(db_query($sql));      // Get the manually-set date
427        $ymd = variable_get('hof_site_create_date', array());
428        $first_tstmp = gmmktime(0, 0, 0, $ymd['month'], $ymd['day'], $ymd['year'], FALSE) - variable_get('date_default_timezone', 0);
429      } else {
430        $sql="SELECT MIN(created) FROM {node} WHERE status=1 AND moderate=0";
431        $first_tstmp = db_result(db_query($sql));
432      }
433    $founded = format_date($first_tstmp, "long");    $founded = format_date($first_tstmp, "long");
434    $duration = format_interval(time() - $first_tstmp, 3);    $duration = format_interval(time() - $first_tstmp, 3);
435    $html = "<p><ul>\n";    $html = "<p><ul>\n";
# Line 492  function _hof_page_section_site() { Line 510  function _hof_page_section_site() {
510  function _hof_page_section_bytype() {  function _hof_page_section_bytype() {
511    $html = '';    $html = '';
512    $intervals = $GLOBALS['hof_intervals'];    $intervals = $GLOBALS['hof_intervals'];
513    $sql = "SELECT DISTINCT n.type, count(*) AS quantity, sum(totalcount) AS total_reads FROM {node} n LEFT JOIN {node_counter} nc ON (n.nid=nc.nid OR nc.nid IS NULL) WHERE n.status=1 AND n.changed>=%d GROUP BY type ORDER BY type";    $sql = "SELECT DISTINCT n.type, nt.name, count(*) AS quantity, sum(totalcount) AS total_reads FROM {node} n LEFT JOIN {node_type} nt ON n.type=nt.type LEFT JOIN {node_counter} nc ON (n.nid=nc.nid OR nc.nid IS NULL) WHERE n.status=1 AND n.changed>=%d GROUP BY type ORDER BY type";
514    foreach ($intervals as $interval=>$tstmp) {    foreach ($intervals as $interval=>$tstmp) {
515      if ($interval == t('epoch')) {      if ($interval == t('epoch')) {
516        $label = t("For All Time");        $label = t("For All Time");
# Line 504  function _hof_page_section_bytype() { Line 522  function _hof_page_section_bytype() {
522      $result = db_query($sql, $tstmp);      $result = db_query($sql, $tstmp);
523      if ($result) {      if ($result) {
524        while ($row = db_fetch_array($result)) {        while ($row = db_fetch_array($result)) {
525          $rows[] = array('data'=>array(t($row['type']), intval($row['quantity']), intval($row['total_reads'])), 'align'=>'right');          $type_name = empty($row['name']) ? $row['type'] : $row['name'];
526            $rows[] = array('data'=>array(t($type_name), intval($row['quantity']), intval($row['total_reads'])), 'align'=>'right');
527        }        }
528        $headers = array(t('Content Type'),t('Total Published'),t('Total Reads'));        $headers = array(t('Content Type'),t('Total Published'),t('Total Reads'));
529  // In the near future, will make this themeable, but need to do the whole  // In the near future, will make this themeable, but need to do the whole

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.14

  ViewVC Help
Powered by ViewVC 1.1.2