<?php
class Report_Filter
{
public $And_Or;
public $Report_Field_ID;
public $Comparison;
public $Value;
}
class Report_Order_By
{
public $Report_Field_ID;
public $Direction;
}
class Fixed_Width_Info
{
public $Report_Field_ID;
public $Column_Width;
}
class Text_Export_Formatting
{
public $Field_Delimiter = ",";
public $Text_Qualifier = "\"";
public $Include_Headers = true;
public $Apply_Delimiter_To_Headers = true;
public $Apply_Qualifier_To_Headers = true;
public $Fixed_Width = false;
public $Fixed_Widths = array(); // array with Fixed_Width_Info objects
}
class Header_Formatting
{
public $Report_Field_ID;
public $Bold;
public $Italic;
public $Underline;
public $Alignment;
}
class Table_Field
{
public $Area; // Table_Area
public $Index;
}
class Column_Formatting
{
public $Report_Field_ID;
public $Bold;
public $Italic;
public $Underline;
public $Alignment;
public $Data_Type; // Data_Type type
public $Summary_Type; // Summary_Type type
public $Total;
public $Pivot_Table_Field; // = new Table_Field(); // Table_Field type
}
class Table_Theme
{
private $Header_Total_Background_Color = "#538DD5";
private $Header_Total_Font_Color = "#FFFFFF";
private $Alternating_Row_Background_Color = "#DCE6F1";
private $Alternating_Row_Font_Color = "#000000";
}
class Excel_Export_Formatting
{
public $Type;
public $Include_Headers;
public $Include_Data_Tab;
public $Header_Format; // array of Header_Formatting objects
public $Column_Format; // array of Column_Formatting objects
public $Table_Theming; // = new Table_Theme();
}
class Share_Drive_Information
{
public $Address;
public $Username;
public $Password;
}
class EMail_Information
{
public $Recipient;
public $CC_Recipient;
public $BCC_Recipient;
public $Subject;
public $Body;
}
class FTP_Information
{
public $Secure;
public $Address;
public $Port;
public $Path;
public $Username;
public $Password;
}
class Delivery_Method
{
public $Type;
public $Share_Drive_Info; //= new Share_Drive_Information();
public $EMail_Info; //= new EMail_Information();
public $FTP_Info; //= new FTP_Information();
}
class ReportSettings
{
public $Report_Platform_ID = null;
public $Report_Type_ID = null;
public $Report_Field_IDs = array(); // array with native type
public $Report_Filters = array(); // array with Report_Filter objects
public $Report_Order_Bys = array(); // array with Report_Order_By objects
public $Export_Type = "Text";
public $Text_Export; //= new Text_Export_Formatting();
public $Excel_Export; //= new Excel_Export_Formatting();
public $Zip_File = null;
public $Encrypt_File = null;
public $AES_Encrypt = null;
public $Encrypt_Password = "RANDOM PASSWORD";
public $Export_Filename = null;
public $Delivery_Methods; //= new Delivery_Method();
}
$rp = new ReportSettings();
$rp->Report_Platform_ID = 11;
$rp->Report_Type_ID = 11;
$rp->Report_Field_IDs = array(12,54,34,23);
// $filter_list is an array of filters
$filter_list = array(
array(
'And_Or' => null,
'Report_Field_ID' => 12,
'Comparison' => '>=',
'Value' => '5000'
),
array(
'And_Or' => 'or',
'Report_Field_ID' => 12,
'Comparison' => '<=',
'Value' => '15000'
)
);
foreach($filter_list as $f)
{
$o = new Report_Filter();
$o->And_Or = $f['And_Or'];
$o->Report_Field_ID = $f['Report_Field_ID'];
$o->Comparison = $f['Comparison'];
$o->Value = $f['Value'];
$rp->Report_Filters[] = $o;
}
// $sorted_list is an array of sort filters
$sorted_list = array(
array(
'Direction' => 'ASC',
'Report_Field_ID' => 12
)
);
foreach($sorted_list as $s)
{
$o = new Report_Order_By();
$o->Direction = $s['Direction'];
$o->Report_Field_ID = $s['Report_Field_ID'];
$rp->Report_Order_Bys[] = $o;
}
$rp->Export_Type = 'text';
$rp->Text_Export = new Text_Export_Formatting();
// $export_settings is an array of settings
$rp->Text_Export->Field_Delimiter = ',';
$rp->Text_Export->Text_Qualifier = '"';
$rp->Text_Export->Include_Headers = true;
$rp->Text_Export->Apply_Delimiter_To_Headers = true;
$rp->Text_Export->Apply_Qualifier_To_Headers = true;
$rp->Text_Export->Fixed_Width = true;
$fixed_widths = array(
array(
'Column_Width' => '100',
'Report_Field_ID' => 12
),
array(
'Column_Width' => '200',
'Report_Field_ID' => 54
)
);
if($rp->Text_Export->Fixed_Width)
{
foreach ($fixed_widths as $e)
{
$o = new Report_Order_By();
$o->Column_Width = $e['Column_Width'];
$o->Report_Field_ID = $e['Report_Field_ID'];
$rp->Text_Export->Fixed_Widths[] = $o;
}
}
$rp->Zip_File = 'myzipfile.zip';
$rp->Encrypt_File = true;
$rp->AES_Encrypt = false;
$rp->Encrypt_Password = 'mys3cr3tp455w0rd5hhh';
$rp->Export_Filename = 'myreport.txt';
$rp->Delivery_Methods = new Delivery_Method();
$rp->Delivery_Methods->Type = 'ftp';
$rp->Delivery_Methods->FTP_Info = new FTP_Information();
$rp->Delivery_Methods->FTP_Info->Secure = true;
$rp->Delivery_Methods->FTP_Info->Address = 69.54.18.1;
$rp->Delivery_Methods->FTP_Info->Port = 22;
$rp->Delivery_Methods->FTP_Info->Path = '/home/mistermister/htdocs';
$rp->Delivery_Methods->FTP_Info->Username = 'direwolf';
$rp->Delivery_Methods->FTP_Info->Password = 'gh05t';
var_dump($rp);