NsmReports
[ class tree: NsmReports ] [ index: NsmReports ] [ all elements ]

Class: Nsm_reports_mcp

Source Location: /mcp.nsm_reports.php

Class Overview


The Module Control Panel class


Methods



Class Details

[line 30]
The Module Control Panel class



[ Top ]


Class Methods


constructor __construct [line 52]

void __construct( )

PHP5 constructor function.

Prepares instance of ExpressionEngine for object scope, sets addon_id, prepares extension settings, loads date helper and prepares required file-system paths.

If there has been no 'report_path' directory set in the extension settings the 'reports' sub-directory in this add-on is used as a default location.




Tags:

access:  public


[ Top ]

method configure [line 112]

string configure( [bool|string $preview_html = false], [bool|string $error = false])

Generates the report summary and configuration form for the selected report.

Method also allows pre-generated report results and/or a report error to be passed as parameters. If a save_id has been added to the page request then the report will be configured to use the preset data and inform the user that a a preset is being used.




Tags:

return:  Returns the Expression Engine processed page View
access:  public


Parameters:

bool|string   $preview_html   Pre-generated report results to be displayed on page
bool|string   $error   If an error was encountered it will be displayed on the page

[ Top ]

method configure_submit [line 187]

mixed configure_submit( )

Manages program flow for submitted data sent from method Nsm_reports_mcp::configure.

Form input 'action' determines what action should be taken next.




Tags:

return:  The return data is the return value of the method called in the switch statement
access:  public


[ Top ]

method delete_saved [line 430]

string delete_saved( )

Displays a confirmation form for the delete command and lists items to be deleted.



Tags:

return:  Returns the Expression Engine processed page View
access:  public


[ Top ]

method delete_saved_submit [line 458]

void delete_saved_submit( )

Deletes all presets where ID is sent in Nsm_report_mcp::delete_saved form.



Tags:

return:  Method will always redirect to new page
access:  public


[ Top ]

method download_generated_report [line 481]

mixed download_generated_report( )

Security checkpoint for downloading generated reports.

First checks that user is logged in and is a member of can_download group (set in extension settings). Then gets all files in generated reports directory and iterates over files. On each file compare the requested file hash against the md5 hash of the file. If file hash is equal to the filename hash force file download.




Tags:

return:  Either a forced file download or an error message
access:  public


[ Top ]

method generate [line 215]

mixed generate( )

Generates a report result-set and performs an action depending on conditions

Actions that can happen include:

  • renders results to browser by passing generated report as a parameter to Nsm_reports_mcp::configure
  • saves report data as a zip-file and emails download link to selected email address
  • forces a download of the report in the browser using the output format that has been chosen
This method will configure a report to use a preset if the id and key are set or configures report using post data.




Tags:

return:  Returns either the output of Nsm_reports_mcp::configure or a php die
access:  public


[ Top ]

method index [line 80]

string index( )

Processes the module's DashBoard page by finding all reports and listing them.



Tags:

return:  Returns the Expression Engine processed page View
access:  public


[ Top ]

method save [line 309]

string|void save( [bool $save_as_new = false])

Saves a report configuration as a preset and stores options in the database.

If parameter 'save_as_new' is set to true the method will ignore update actions. Some basic form validation takes place in this method and if an error occurs then return the output of the Nsm_reports::configure method and pass the form validation error message as the $error parameter.




Tags:

return:  Return Code Igniter View if form validation is false else redirect to new page
access:  public


Parameters:

bool   $save_as_new   If TRUE then data will always be inserted and never updated

[ Top ]

method saved_reports [line 375]

string saved_reports( )

Displays all saved report presets and displays them as a table.

Method checks that report exists before showing the associated presets.

Saved preset objects are converted into view-friendly arrays.

Form showed on page manages presets to be included in delete command.




Tags:

return:  Returns the Expression Engine processed page View
access:  public


[ Top ]

method _renderLayout [line 526]

mixed _renderLayout( string $page, [string $out = FALSE], [array $page_replacements = array()])

Manages View display for Expression Engine control panel.

Uses parameters to build the control panel page and associated navigation items.




Tags:

return:  Either a forced file download or an error message
access:  public


Parameters:

string   $page   The base array key to use when retrieving data from the Language object
string   $out   String version of processed Expression Engine View
array   $page_replacements   Collection of string replacements to commit to page title

[ Top ]


Documentation generated on Fri, 11 Mar 2011 10:05:49 +1100 by phpDocumentor 1.4.3