/[drupal]/contributions/modules/carbon/carbon_report.inc
ViewVC logotype

Diff of /contributions/modules/carbon/carbon_report.inc

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

revision 1.5 by johnackers, Tue Jan 6 22:19:26 2009 UTC revision 1.6 by johnackers, Sat Jan 10 15:46:14 2009 UTC
# Line 13  Line 13 
13   * The actual content is determined by a specfic class and the class   * The actual content is determined by a specfic class and the class
14   * name is derived from the name of the report.   * name is derived from the name of the report.
15   *   *
16   * Note that the param $uid is the user we are focused on, not the user doing   * Note that the param $uid is the user we are focused on, not necessarily the user
17   * the browsing.   * that is making the query.
18   *   *
19     * Additional information is extracted from the query using GET.
20     *
21   * @param $uid select by uid; set to zero to retrieve footprints from all users   * @param $uid select by uid; set to zero to retrieve footprints from all users
22   * @param $org select by organisation; set to '' or null to retrieve footprints   * @param $org select by organisation; set to '' or null to retrieve footprints
23   * from users in any goup   * from users in any goup
# Line 506  function carbon_report_base($uid, $org, Line 508  function carbon_report_base($uid, $org,
508    while ($record = db_fetch_object($queryResult))    while ($record = db_fetch_object($queryResult))
509    {    {
510      $access = carbon_access("view", $record) or ($org == $record->organization) ;      $access = carbon_access("view", $record) or ($org == $record->organization) ;
   
  //   if ($access)  
511      {      {
512        $record->anonomized_title = $access ? $record->title : carbon_anonomize($record->title);        $record->anonomized_title = $access ? $record->title : carbon_anonomize($record->title);
513        $record->account_link = $access ? l($record->title,"node/".$record->nid) : $record->anonomized_title ;        $record->account_link = $access ? l($record->title,"carbon/".$record->nid) : $record->anonomized_title ;
514        $record->transfer_link = $access ?l($record->title,"carbon/transfer/".$record->nid) : $record->anonomized_title ;        $record->transfer_link = $access ?l($record->title,"carbon/transfer/".$record->nid) : $record->anonomized_title ;
515        $account_map[$record->nid] = $record  ;        $account_map[$record->nid] = $record  ;
516      }      }
# Line 609  function carbon_report_page_chart($accou Line 609  function carbon_report_page_chart($accou
609    return carbon_chart_generate($footprint_by_title, "CO2 emissions");    return carbon_chart_generate($footprint_by_title, "CO2 emissions");
610  }  }
611    
   
   
 function _get_account_array()  
 {  
     global $account_map ;  
   
     if ($account_map == null)  
     {  
         $account_map = carbon_report_base(null,null,array());  
     }  
   
     $account_array = array();  
   
     foreach ($account_map as $account)  
     {  
       $account_options[] = $account->title ;  // TODO CREATE class to map account indexes.  
     }  
 }  
   
612  /**  /**
613   * Provide support for account select boxes   * Provide support for account select boxes
614   */   */
615    
616    
617  class AccountMap  class CarbonAccountMap
618  {  {
619    var $account_map = null ;    var $account_map = null ;
620    var $title_array = array();    var $title_array = array();
# Line 646  class AccountMap Line 627  class AccountMap
627      {      {
628        $this->title_array[] = $account->title ;        $this->title_array[] = $account->title ;
629        $this->nid_array[] = $account->nid ;        $this->nid_array[] = $account->nid ;
630      }      }
631        return $this ;
632    }    }
633    
634    function getArray()    function getArray()
# Line 682  class AccountMap Line 664  class AccountMap
664    {    {
665          return $this->nid_array[$index];          return $this->nid_array[$index];
666    }    }
667    
668      function sortByRevisionDate()
669      {
670        $account_map_recent = array();
671            foreach ($this->account_map as $key=>$account)
672        {
673          $account_map_recent[$account->last_changed] = $account ;
674        }
675        $this->account_map =  $account_map_recent;
676        krsort($this->account_map);
677        return $this->account_map ;
678      }
679  }  }
680    
681    

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

  ViewVC Help
Powered by ViewVC 1.1.3