Overview

Packages

  • blesta
    • app
      • controllers
      • models
    • components
      • auth
        • ldap
        • motp
        • oath
      • delivery
        • interfax
        • postal
          • methods
      • download
      • email
      • events
      • exchange
        • rates
          • currency
            • layer
          • fixer
          • open
            • exchange
              • rates
          • x
            • rates
      • gateway
        • payments
      • gateways
      • invoice
        • delivery
        • templates
          • perforated
            • invoice
          • quickbooks
            • invoice
          • templates
            • default
      • modules
      • net
        • amazon
          • s3
        • http
        • net
          • geo
            • ip
      • plugins
      • reports
        • aging
          • invoices
        • client
          • data
            • portability
        • custom
          • report
        • invoice
          • creation
        • package
          • revenue
        • tax
          • liability
        • transactions
          • applied
          • received
      • security
      • session
        • cart
      • settingscollection
      • upgrades
        • tasks
      • upload
      • vcard
    • core
      • Automation
        • Tasks
          • Common
          • Task
        • Type
          • Common
          • Cron
      • Pricing
        • ItemComparator
        • MetaItem
        • Modifier
          • Type
            • Description
              • Type
                • Discount
                • Option
                • Service
                • Tax
            • Discount
            • Price
            • Proration
        • Presenter
          • Build
            • Invoice
            • InvoiceData
            • Options
            • Service
            • ServiceChange
            • ServiceData
          • Collection
          • Format
            • Fields
            • Type
              • Discount
              • Item
              • Option
              • Options
              • Package
              • Pricing
              • Service
              • Tax
          • Items
            • Invoice
            • Service
          • Type
      • ServiceProviders
      • Util
        • Captcha
          • Captchas
          • Common
        • Common
          • Traits
        • Events
          • Common
          • Handlers
          • Observers
        • Filters
          • Common
        • GeoIp
        • Input
          • Fields
            • Common
        • Tax
        • Widgets
    • helpers
      • currency
        • format
      • data
        • structure
          • array
          • string
      • text
        • parser
      • widget
        • client
  • minPHP
    • helpers
      • color
      • data
        • structure
  • None
  • PHP

Classes

  • Accounts
  • Actions
  • ApiKeys
  • Backup
  • CalendarEvents
  • ClientGroups
  • Clients
  • Companies
  • Contacts
  • Countries
  • Coupons
  • CouponTerms
  • CronTasks
  • Currencies
  • EmailGroups
  • Emails
  • EmailVerifications
  • Encryption
  • GatewayManager
  • Invoices
  • InvoiceTemplateManager
  • Languages
  • Logs
  • Marketplace
  • MessageGroups
  • Messages
  • MessengerManager
  • ModuleClientMeta
  • ModuleManager
  • ModuleTypes
  • Navigation
  • PackageGroups
  • PackageOptionGroups
  • PackageOptions
  • Packages
  • Payments
  • Permissions
  • PluginManager
  • Pricings
  • ReportManager
  • ServiceChanges
  • ServiceInvoices
  • Services
  • Settings
  • Staff
  • StaffGroups
  • States
  • SystemEvents
  • Taxes
  • Themes
  • Transactions
  • Users
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated

Class ReportManager

Report Manager

Model
Extended by AppModel uses Blesta\Core\Util\Common\Traits\Container
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
The type of report to fetch the name for

Returns

string
The name of the report
public array
# getAvailable( string $format = 'any' )

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)

Parameters

$format
The format the reports must support (optional)

Returns

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

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
The type of report to fetch the options for
$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
The type of report to fetch
$vars
A list of option values to pass to the report
$format
The format of the report to generate (optional, default csv)
$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
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
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
The report type

Returns

boolean
True if the report type exists, false otherwise
public boolean
# validateFormat( string $format, string $type )

Validates that the given format is valid for the report type given

Validates that the given format is valid for the report type given

Parameters

$format
The report format
$type
The report type

Returns

boolean
True if the format is valid, false otherwise
public stdClass
# getReport( integer $id )

Fetch a custom report

Fetch a custom report

Parameters

$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
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

Returns

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

Edit a custom report

Edit a custom report

Parameters

$id
$vars

Returns

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

Save report fields

Save report fields

Parameters

$id
The ID of the report whose fields to save
$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
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
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
The field type
$required
Required option
$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
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 used from Blesta\Core\Util\Common\Traits\Container
getFromContainer()
Properties inherited from AppModel
$logger, $replacement_keys
Blesta API documentation generated by ApiGen