/[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.11.2.1, Thu Apr 26 00:53:07 2007 UTC revision 1.11.2.2, Mon Dec 15 23:25:08 2008 UTC
# Line 1  Line 1 
1  <?php  <?php
2  /*  /*
3   * $Id: hof.module,v 1.11 2007/03/23 01:37:01 syscrusher Exp $   * $Id: hof.module,v 1.11.2.1 2007/04/26 00:53:07 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 433  function _hof_page_section_all() { Line 445  function _hof_page_section_all() {
445   * Site statistics (general summary)   * Site statistics (general summary)
446   */   */
447  function _hof_page_section_site() {  function _hof_page_section_site() {
448    $sql="SELECT MIN(created) FROM {node} WHERE status=1 AND moderate=0";    if (variable_get('hof_site_create_date_manual', FALSE)) {
449    $first_tstmp = db_result(db_query($sql));      // Get the manually-set date
450        $ymd = variable_get('hof_site_create_date', array());
451        $first_tstmp = gmmktime(0, 0, 0, $ymd['month'], $ymd['day'], $ymd['year'], FALSE) - variable_get('date_default_timezone', 0);
452      } else {
453        $sql="SELECT MIN(created) FROM {node} WHERE status=1 AND moderate=0";
454        $first_tstmp = db_result(db_query($sql));
455      }
456    $founded = format_date($first_tstmp, "long");    $founded = format_date($first_tstmp, "long");
457    $duration = format_interval(time() - $first_tstmp, 3);    $duration = format_interval(time() - $first_tstmp, 3);
458    $html = "<p><ul>\n";    $html = "<p><ul>\n";
# Line 515  function _hof_page_section_site() { Line 533  function _hof_page_section_site() {
533  function _hof_page_section_bytype() {  function _hof_page_section_bytype() {
534    $html = '';    $html = '';
535    $intervals = $GLOBALS['hof_intervals'];    $intervals = $GLOBALS['hof_intervals'];
536    $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";
537    foreach ($intervals as $interval=>$tstmp) {    foreach ($intervals as $interval=>$tstmp) {
538      if ($interval == t('epoch')) {      if ($interval == t('epoch')) {
539        $label = t("For All Time");        $label = t("For All Time");
# Line 527  function _hof_page_section_bytype() { Line 545  function _hof_page_section_bytype() {
545      $result = db_query($sql, $tstmp);      $result = db_query($sql, $tstmp);
546      if ($result) {      if ($result) {
547        while ($row = db_fetch_array($result)) {        while ($row = db_fetch_array($result)) {
548          $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'];
549            $rows[] = array('data'=>array(t($type_name), intval($row['quantity']), intval($row['total_reads'])), 'align'=>'right');
550        }        }
551        $headers = array(t('Content Type'),t('Total Published'),t('Total Reads'));        $headers = array(t('Content Type'),t('Total Published'),t('Total Reads'));
552  // 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.11.2.1  
changed lines
  Added in v.1.11.2.2

  ViewVC Help
Powered by ViewVC 1.1.2