Blesta
  • Package
  • Class
  • Tree
  • Deprecated

Packages

  • blesta
    • app
      • controllers
      • models
    • components
      • areyouahuman
      • auth
        • motp
        • oath
      • delivery
        • interfax
        • postal
          • methods
      • download
      • email
      • events
        • default
      • exchange
        • rates
          • google
            • finance
          • yahoo
            • finance
      • gateway
        • payments
      • gateways
      • invoice
        • delivery
        • templates
          • quickbooks
            • invoice
      • json
      • modules
      • net
        • amazon
          • s3
        • http
        • net
          • geo
            • ip
      • plugins
      • recaptcha
      • reports
        • aging
          • invoices
        • custom
          • report
        • invoice
          • creation
        • tax
          • liability
        • transactions
          • applied
          • received
      • security
      • session
        • cart
      • settingscollection
      • upgrades
        • tasks
      • upload
      • vcard
    • helpers
      • currency
        • format
      • data
        • structure
          • array
          • string
      • text
        • parser
      • widget
        • client
  • minPHP
    • components
      • input
      • record
    • helpers
      • color
      • data
        • structure
      • date
      • form
      • html
      • javascript
      • xml
    • lib
  • None
  • PHP

Classes

  • Accounts
  • ApiKeys
  • CalendarEvents
  • ClientGroups
  • Clients
  • Companies
  • Contacts
  • Countries
  • Coupons
  • CronTasks
  • Currencies
  • EmailGroups
  • Emails
  • Encryption
  • GatewayManager
  • Invoices
  • InvoiceTemplateManager
  • Languages
  • Logs
  • Marketplace
  • ModuleClientMeta
  • ModuleManager
  • Navigation
  • PackageGroups
  • PackageOptionGroups
  • PackageOptions
  • Packages
  • Payments
  • Permissions
  • PluginManager
  • Pricings
  • ReportManager
  • ServiceChanges
  • Services
  • Settings
  • Staff
  • StaffGroups
  • States
  • Taxes
  • Themes
  • Transactions
  • Users

Class ReportManager

Report Manager

Model
Extended by AppModel
Extended by ReportManager
Package: blesta\app\models
Copyright: Copyright (c) 2013, Phillips Data, Inc.
License: The Blesta License Agreement
Link: Blesta
Located at app/models/report_manager.php

Methods summary

public
# __construct( )

Load language

Load language

Overrides

AppModel::__construct
public array
# getFormats( )

Retrieves a list of report formats

Retrieves a list of report formats

Returns

array
A list of report formats and their language
public string
# getName( string $type )

Retrieves the name for the given report type

Retrieves the name for the given report type

Parameters

$type
string
$type The type of report to fetch the name for

Returns

string
The name of the report
public array
# getAvailable( )

Retrieves a list of all available reports (those that exist on the file system)

Retrieves a list of all available reports (those that exist on the file system)

Returns

array
An array representing each report and its name
public string
# getOptions( string $type, array $vars = array() )

Retrieves the options for the given report type. Sets Input errors on failure

Retrieves the options for the given report type. Sets Input errors on failure

Parameters

$type
string
$type The type of report to fetch the options for
$vars
array
$vars A list of option values to pass to the report (optional)

Returns

string
The options as a view
public mixed
# fetchAll( string $type, array $vars, string $format = "csv", string $return = "download" )

Generates the report type with the given vars. Sets Input errors on failure

Generates the report type with the given vars. Sets Input errors on failure

Parameters

$type
string
$type The type of report to fetch
$vars
array
$vars A list of option values to pass to the report
$format
string
$format The format of the report to generate (optional, default csv)
$return
string
$return (optional, default "download") One of the following: - download To build and send the report to the browser to prompt for download; returns null - false To build and send the report to the browser to prompt for download; returns null - object To return a PDOStatement object representing the report data; returns PDOStatement - true To return a PDOStatement object representing the report data; returns PDOStatement - file To build the report and store it on the file system; returns the path to the file

Returns

mixed
A PDOStatement, string, or void based on the $return parameter
protected mixed
# formatCsv( mixed $field )

Uses Excel-style formatting for CSV fields (individual cells)

Uses Excel-style formatting for CSV fields (individual cells)

Parameters

$field
mixed
$field A single string of data representing a cell, or an array of fields representing a row

Returns

mixed
An escaped and formatted single cell or array of fields as given
protected string
# buildCsvRow( array $fields )

Builds a CSV row

Builds a CSV row

Parameters

$fields
array
$fields A list of data to place in each cell

Returns

string
A CSV row containing the field data
public boolean
# validateType( string $type )

Validates that the given report type exists

Validates that the given report type exists

Parameters

$type
string
$type The report type

Returns

boolean
True if the report type exists, false otherwise
public stdClass
# getReport( integer $id )

Fetch a custom report

Fetch a custom report

Parameters

$id
integer
$id The ID of the custom report

Returns

stdClass
The custom report
protected array
# getReportFields( integer $id )

Fetch custom report fields

Fetch custom report fields

Parameters

$id
integer
$id The ID of the custom report

Returns

array
An array of stdClass objects representing custom report fields
public array
# getReports( )

Get all custom reports available

Get all custom reports available

Returns

array
An array of stdClass objects each representing a report
public stdClass
# addReport( array $vars )

Add a custom report

Add a custom report

Parameters

$vars
array
$vars

Returns

stdClass
The report added
public stdClass
# editReport( integer $id, array $vars )

Edit a custom report

Edit a custom report

Parameters

$id
integer
$id
$vars
array
$vars

Returns

stdClass
The report updated
protected
# saveReportFields( integer $id, array $report_fields )

Save report fields

Save report fields

Parameters

$id
integer
$id
$report_fields
array
$report_fields A numerically indexed array of report fields containing: - id - name - label - type - values - regex
public
# deleteReport( integer $id )

Delete a custom report

Delete a custom report

Parameters

$id
integer
$id The ID of the custom report to delete
public boolean
# validateQuery( string $sql )

Validate that only one query is present, and it is a select query

Validate that only one query is present, and it is a select query

Parameters

$sql
string
$sql The user provided query

Returns

boolean
True if the query is valid, false otherwise
public array
# reportFieldTypes( )

Fetch report field types

Fetch report field types

Returns

array
An array of key/value pairs
public array
# reportRequiredType( )

Fetche report field required types

Fetche report field required types

Returns

array
An array of key/value pairs
protected string
# requiredToRegex( string $type, string $required, string $regex = null )

Convert the report field type and required status to a regex

Convert the report field type and required status to a regex

Parameters

$type
string
$type The field type
$required
string
$required Required option
$regex
string
$regex Defined regex (if any)

Returns

string
The regex to use
protected string
# reportDefaultRegex( string $type )

Fetch the default regex for the given report field type

Fetch the default regex for the given report field type

Parameters

$type
string
$type The field type

Returns

string
The default regex to use for that type

Methods inherited from AppModel

_(), boolToInt(), currencyToDecimal(), dateToUtc(), errors(), getPerPage(), ifSet(), loadCrypto(), setDefaultIfEmpty(), setPerPage(), setRulesIfSet(), strToBool(), systemDecrypt(), systemEncrypt(), systemHash(), truncateDecimal(), validateExists(), validateStateCountry()

Methods inherited from Model

affectedRows(), begin(), commit(), getConnection(), lastInsertId(), makeDSN(), prepare(), query(), rollBack(), setAttribute(), setFetchMode()

Magic methods summary

Properties summary

Properties inherited from AppModel

$replacement_keys

Blesta API documentation generated by ApiGen 2.8.0