phpBMS

Changeset 731 for trunk

Show
Ignore:
Timestamp:
01/08/10 10:43:14 (2 years ago)
Author:
brieb
Message:
  • updated mailchimp export report to conform to new standards
Location:
trunk/phpbms/modules/mailchimp/report
Files:
1 removed
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/phpbms/modules/mailchimp/report/client_mailchimp_export.php

    r704 r731  
    3737 +-------------------------------------------------------------------------+ 
    3838*/ 
    39  
    40 require("../../../include/session.php"); 
    41  
    42 class MCReport{ 
     39if(!class_exists("phpbmsReport")) 
     40    include("../../../report/report_class.php"); 
     41 
     42class MCReport extends phpbmsReport{ 
    4343 
    4444        var $selectcolumns; 
     
    4747        var $reportOutput = ""; 
    4848 
    49         function MCReport($db,$variables = NULL){ 
    50                 $this->db = $db; 
     49        function MCReport($db, $reportUUID, $tabledefUUID, $variables = NULL){ 
     50 
     51            parent::phpbmsReport($db, $reportUUID, $tabledefUUID); 
    5152 
    5253                //next we do the columns 
     
    6162 
    6263 
    63                 if($variables){ 
    64                         //$tempArray = explode("::", $variables["columns"]); 
    65                         $tempArray = json_decode($variables["columns"], true); 
    66  
    67                         foreach($tempArray as $id) 
    68                                 $this->selectcolumns[] = $this->columns[$id]; 
    69                         $this->selectcolumns = array_reverse($this->selectcolumns); 
    70  
    71                         $this->selecttable = "`clients`"; 
    72  
    73                         $this->whereclause = $_SESSION["printing"]["whereclause"]; 
    74                         if($this->whereclause=="") $this->whereclause="WHERE clients.id != -1"; 
    75  
    76                         if($this->whereclause!="") $this->whereclause=" WHERE (".substr($this->whereclause,6).") "; 
    77                 }// endif 
     64            $this->selecttable = "`clients`"; 
    7865 
    7966        }//end method 
    8067 
     68 
     69        function processFromPost($variables){ 
     70 
     71            $tempArray = json_decode($variables["columns"], true); 
     72 
     73            foreach($tempArray as $id) 
     74                    $this->selectcolumns[] = $this->columns[$id]; 
     75            $this->selectcolumns = array_reverse($this->selectcolumns); 
     76 
     77 
     78        }//end function processFromPost 
     79 
     80 
     81        function processFromSettings(){ 
     82 
     83            foreach($this->settings as $key=>$value) 
     84                if(strpos($key, "column") === 0) 
     85                    $this->selectcolumns[substr($key,6)-1] = $this->columns[$value]; 
     86 
     87            ksort($this->selectcolumns); 
     88            $this->selectcolumns = array_reverse($this->selectcolumns); 
     89 
     90        }//end function processFromSettings 
    8191 
    8292        function addColumn($name, $field, $format = NULL){ 
     
    91101 
    92102        function generate(){ 
     103 
     104            $this->whereClause = $_SESSION["printing"]["whereclause"]; 
     105            if($this->whereClause=="") 
     106                $this->whereclause="WHERE clients.id != -1"; 
     107 
     108            if($this->whereClause!="") 
     109                $this->whereClause = " WHERE (".substr($this->whereClause,6).") "; 
    93110 
    94111                $querystatement = "SELECT "; 
     
    234251}//endclass 
    235252 
    236 // Processing =================================================================================================================== 
    237 if(!isset($dontProcess)){ 
     253 
     254/** 
     255 * PROCESSING 
     256 * ============================================================================= 
     257 */ 
     258if(!isset($noOutput)){ 
     259 
     260    require("../../../include/session.php"); 
     261 
     262        checkForReportArguments(); 
     263 
     264        $report = new MCReport($db, $_GET["rid"], $_GET["tid"]); 
     265 
    238266        if(isset($_POST["columns"])){ 
    239                 $myreport= new MCReport($db,$_POST); 
    240                 $myreport->generate(); 
    241                 $myreport->output(); 
     267 
     268            $report->processFromPost($_POST); 
     269            $report->generate(); 
     270            $report->output(); 
     271 
     272        } elseif(isset($report->settings["column1"])) { 
     273 
     274            $report->processFromSettings(); 
     275            $report->generate(); 
     276            $report->output(); 
     277 
    242278        } else { 
    243                 //$myreport = new MCReport($db); 
    244                 //$myreport->showSelectScreen(); 
    245         } 
    246 }?> 
     279 
     280            $report->showSelectScreen(); 
     281 
     282        }//endif 
     283 
     284}//endif 
     285 
     286/** 
     287 * When adding a new report record, the add/edit needs to know what the class 
     288 * name is so that it can instantiate it, and grab it's default settings. 
     289 */ 
     290if(isset($addingReportRecord)) 
     291    $reportClass = "MCReport"; 
     292?> 
phpBMS vulnerability assesment provided by Orvant Inc. Copyright © 2010 Kreotek, LLC. All Rights reserved.