__construct | This method is the class constructor, it's called when an instance of the 'ReportOptions' class is created! Additionally, it initializes the new instance with the access mode of the report, the data source, and the report name. |
sub_totals | This function adds subtotals to your report to get the sum, average, minimum, maximum, or count of any column(s) for each group of records. Additionally, at the end of the report, grand totals should be listed. |
sort_by | This method is used for sorting the report that you want to generate by any given column in it. This can be done either in an ascending or descending order based on the value of the order parameter, which if omitted, the ascending order will be used. |
set_title | This is one of the appearance customization methods supported in Smart Report Engine. It allows you to add a title for your report that should appear in the header area of your report. |
set_style_name | This is one of the appearance customization methods supported in Smart Report Engine. It sets the style of your report which can be "blue", "grey", "teal", or "mobile". Please be aware that your users can change the report's style from within the report. |
set_sql | If you are creating a SQL-based report, you need to call this method to define the SQL query you want to use for your report. Please note that the data source is defined when calling the 'ReportOptions' class constructor, where there is only two available options table-based data source "SRE_Table" and SQL-based data source "SRE_SQL" |
set_records_per_page | This method sets the number of records per page in the generated reports. The default value is 25 records per page. Your generated report will have a pager to navigate through pages, additionality it will have the ability to print and export a single page or all pages.
|
set_mysql_hostname | This method is used only if you want to override the default MYSQL connection hostname, stored in the engine's configuration file, in the generated report. |
set_mysql_db_name | This method is used only if you want to override the default MYSQL database name, stored in the engine's configuration file, in the generated report. |
set_mysql_connection_username | This method is used only if you want to override the default MYSQL connection username, stored in the engine's configuration file, in the generated report. |
set_mysql_connection_password | This method is used only if you want to override the default MYSQL connection password, stored in the engine's configuration file, in the generated report. |
set_layout | This is one of the appearance customization methods supported in Smart Report Engine. It sets the layout of your report, which can be "AlignLeft", "Block", "Stepped", "Outline", "Horizontal" or "mobile". Please be aware that your users can change the report's layout from within the report menu. |
set_language | This method defines the language of your generated report. Smart Report engine supports six languages which are:
"en", "de", "ar", "es", "fr" and "it". Smart Report Engine language files can be found at : "/sre_reports/shared/languages/". |
set_header | This is one of the appearance customization methods supported in Smart Report Engine. It allows you to add a custom header for your report. |
set_grouping | Using Smart Report Engine, you can generate reports with multiple grouping levels; for example, you could group your report by Country and then by City to get more informative results. This method defines the grouping levels of the report that you want to generate. |
set_footer | This is one of the appearance customization methods supported in Smart Report Engine. It allows you to add a footer for your report that should appear in the footer area of your report. |
set_chksearch | This method is used to show or hide the search box in the generated report if its data source is table-based. Please note that the search capabilities are supported only in table-based reports. So, no need to call this method with SQL-based reports |
select_tables | Smart Report Engine supports two report data sources, which are:
1- Table-based data source (the default data source ): The report is based on one or more MYSQL tables.
2- SQL-based data source: The report is based on a SQL query. You should use this data source if you want to convert some queries to reports.
Usually, the report data source is defined when calling the 'ReportOptions' class constructor. So, If you are creating a table-based report, you need to call this method to define the table(s) you want to use for your report. You can select one or more tables. |
select_fields | This method should be used if you want to show only some columns of the selected table(s) in your report. Therefore, you should either call this method or the “select_all_fields” method (which shows all columns). But, If both methods are called for generating the same report, the latter method will override the former. |
select_all_fields | This method should be used if you want to show all columns ( of the selected tables ) in your report. Therefore, you should either call this method or the “select_fields” method (which shows only selected columns). But, If both methods are called for generating the same report, the latter method will override the former. |
security_init | This security method should be used to set the main security parameters for private reports. These security parameters are the login page to which the engine should redirect any unauthorized users, the logout page to which the engine should redirect users when they click the "logout" link on the report's menu and the session name which is used in your project. If any of these parameters are omitted, their default values, which you can find in the engine configuration file will be used.
This method should only used for private reports, and after calling it, you should call one or more of the session verification methods to define all the session validations that you want Smart Report Engine to perform before allowing any access to your private report.
|
security_check_session_saved_user_key | This is one of the session verification methods, it configures your report to check whether or not the session of the user (who is trying to access it) has a given key (such as the active user-id) and if this key does not exist in the session, the user should be redirected to the login page that you passed to the "security_init" method.
So, this method is meant to be helpful if you are using a login page in your project, for validating the login credentials of each user, and if these credentials are valid, you store a certain key (probably, the active user_id) in the session, and you want Smart Report Engine to only allow users whose sessions have this key to access your report. |
security_check_session_saved_ip_key | This is one of the session verification methods that should be used only with private reports! It configures your report to check both the existence of a given session key and its value which should be equal to the IP address of the active user. If this session validation fails, the user should be redirected to the login page that you passed to the "security_init" method. |
security_check_session_saved_group_key | This is one of the session verification methods for private reports! It configures your report to check both the existence of a given session key (such as the active user's group or group id) and its value which should be an element in the "$allowed_group_array" parameter. This method should be used if your project supports user groups, and you choose to allow only certain groups to access your report. So, in your login page, and after validating the login credentials of each user, you store the active user's group or group id in the session, and you want Smart Report Engine to check this key and allow only the users of the allowed group(s) to be able to access your private report.
Like other session verification methods of Smart Report Engine, if this session validation fails, the user should be redirected to the login page that you passed to the "security_init" method. |
security_check_session_saved_exact_value_key | This is one of the session verification methods that should be used only with private reports! This method configures your report to check both the existence of a given session key and its value which should be equal to the "$correct_value" parameter. If this session validation fails, the user should be redirected to the login page that you passed to the "security_init" method. |
security_check_session_saved_exact_data_type_key | This is one of the session verification methods that should be used with private reports! This method sets your report to check both the existence of a given session key and its value's data type which should be equal to the "$correct_data_type" parameter. If this session validation fails, the user should be redirected to the login page that you passed to the "security_init" method. |
label | This method gives a label to any given column in your report to make it friendly, using an alias rather than its original SQL name. If you want to give labels to many columns in your report, you will have to call this method many times as shown in the example below. |
format_suffix_text_to_column | This is one of the appearance customization methods supported in Smart Report Engine. It attaches any text you want as a suffix to all records in any column of your report. For example, adding °F or °C to a temperature column. |
format_rating_column | This is one of the appearance customization methods supported in Smart Report Engine. It displays a certain column in your report as stars rating! So, it is meant to be helpful, if you apply a five-point rating scale and are saving the ratings in a numeric data type column in your MYSQL database and you want to show this column in your report as stars ratings. |
format_prefix_text_to_column | This is one of the appearance customization methods supported in Smart Report Engine. It attaches any text you want as a prefix to all records in any column of your report. For example, adding an "$" to a price column. |
format_link_column | This is one of the appearance customization methods supported in Smart Report Engine. It displays a column in your report as clickable hyperlinks! This method is meant to be helpful if you have URLs stored in columns in your MYSQL database and you want to show this column in your report as clickable hyperlinks. |
format_image_column | This is one of the appearance customization methods supported in Smart Report Engine. It displays any certain column(s) in your report as clickable image thumbnails. When clicking on one of these images a lightbox will popup whereby your visitor can view the clicked image with its actual size.
This method is meant to be helpful if you have a column in your MYSQL database for storing names or paths of some images and you want to display these actual images in your report instead. |
format_country_flag_column | This is one of the appearance customization methods supported in Smart Report Engine. It displays small country flags beside their names! This method meant to be helpful if you have countries stored in a column in your MYSQL database and you want to show the flags of these countries besides their names in your report. This should look nice especially if you are grouping your report by country. |
format_check_box_column | This is one of the appearance customization methods supported in Smart Report Engine. It displays a certain column in your report as checkboxes! This method is meant to be helpful if you have a boolean, bit or tiny-int column in your MYSQL database for storing 0, 1 values or true, false values and you want to show this column in your report as checkboxes where checked means true or 1 and unchecked means 0 or false. |
filter_not_null | This is one of the filter functions. Applying this function on any column should return records with NO null values in this filtered column. |
filter_not_like | This filter should be used with a string data type column to get the data that is not like a certain string parameter value. Please note that you can combine multiple filters for the same report.
|
filter_not_equal | This filter should be used with a numeric or DateTime column to get the data that is not equal to a certain parameter value. Please note that you can combine multiple filters for the same report. |
filter_more | This filter should be used with a numeric or DateTime column to get the data that is higher than a certain parameter value. Please note that you can combine multiple filters for the same report. |
filter_like | This filter should be used with a textual data type column to get the data that is like a certain textual parameter value. Please note that you can combine multiple filters for the same report. |
filter_less | This filter should be used with a numeric or DateTime column to get the data that is less than a certain parameter value. Please note that you can combine multiple filters for the same report. |
filter_is_today | This is one of the dynamic date filters. Applying this function on any date-type column should return records of the current day which is very helpful if you want to create daily reports. |
filter_is_null | This is one of the data-filtration functions. Applying this function on any column should return records with null values in this filtered column. |
filter_is_current_year | This is one of the dynamic date filters. Applying this function on any date-type column should return records of the current year which is very helpful if you want to create an annual report. |
filter_is_current_month | This is one of the dynamic date filters. Applying this function on any date-type column should return records of the current month which is very helpful if you want to create a monthly report. |
filter_is_current_active_user | This data filtration function should filter any report by the current user ID so that each logged-in user sees only their records. In other words, this function should make each user sees only their records even when multiple users are accessing the exact same report.
In the following code example, any logged-in user when accessing the "orders" report, should see only the records related to them. Smart Report Engine should implements this by querying the "Orders" table with a where clause for filtering the "Employee_id" column by the value of the "user_id" session key which Smart Report Engine will expect to find in the logged-in user's PHP session. Please note that usually, on logging in, any session-based login system stores some reference identifying the user (often the user's ID) in their PHP session. |
filter_equal | This filter should be used with a numeric or DateTime column to get the data that is equal to a certain parameter value. Please note that you can combine multiple filters for the same report. |
filter_between | This is one of the many filters supported in the Smart Report Engine to filter your report by the data of any column in it. And, you can combine many filters in the same report. This method filters any specific column between two numbers or two dates. |
dynamic_filter_not_equal | This is one of the dynamic filters supported in the Smart Report Engine to filter your report by parameters entered by your end users. In other words, your end users can change the output of generated reports based on the parameter values they enter before previewing the reports. For example, using this type of filter you can easily create a sales per region report where each end user can select the regions they don't want to see. And, you can combine many filters in the same report.
This filter should be used to filter any column you specify and return all records that are not equal to the filter parameter entered by each end user. Please note that you can combine multiple filters for the same report. |
dynamic_filter_more | This is one of the dynamic filters supported in the Smart Report Engine to filter your report by parameters entered by your end users. In other words, your end users can change the output of generated reports based on the parameter values they enter before previewing the reports. For example, using this type of filter you can easily create a performance report where each end user can set certain indicators.
This method should be used with a numeric, date, or DateTime column to get all records that are more than the parameter entered by each end user. Please note that you can combine multiple filters for the same report. |
dynamic_filter_less | This is one of the dynamic filters supported in the Smart Report Engine to filter your report by parameters entered by your end users. In other words, your end users can change the output of generated reports based on the parameter values they enter before previewing the reports. For example, using this type of filter you can easily create a performance report where each end user can set certain indicators.
This method should be used with a numeric, date, or DateTime column to get all records that are less than the parameter entered by each end user. Please note that you can combine multiple filters for the same report. |
dynamic_filter_equal | This is one of the dynamic filters supported in the Smart Report Engine to filter your report by parameters entered by your end users. In other words, your end users can change the output of generated reports based on the parameter values they enter before previewing the reports. For example, using this type of filter you can easily create a sales per region report where each end user can select the region they want to see. And, you can combine many filters in the same report.
This method filters any specific column by a parameter entered by your end user. So all you need to specify is just the column you want to filter and the table containing it. |
dynamic_filter_between | This is one of the dynamic filters supported in the Smart Report Engine to filter your report by parameters entered by your end users. In other words, your end users can change the output of generated reports based on the parameter values they enter before previewing the reports. For example, using this type of filter you can easily create a sales report by date range where each end user can define the date range they want to see. And, you can combine many filters in the same report.
This method filters any specific column between two numbers or two dates entered by the end user(s) of the report. Therefore, all you need to specify is just the filtered column and the table containing it. You don't need to specify filter values, this will be done by your end user in a dialogue box before displaying the report. |
conditional_format_not_equal | This method changes the background color of any cells in a given column to any color you like if the values of these cells are not equal to a given parameter. |
conditional_format_more | This method changes the background color of any cells in a given column to any color you like if the values of these cells are more than a given parameter. |
conditional_format_less | This method changes the background color of any cells in a given column to any color you like if the values of these cells are less than a given parameter. |
conditional_format_equal | This method changes the background color of any cells in a given column to any color you like if the values of these cells are equal to a given parameter. |
conditional_format_end_with | This method changes the background color of any cells in a given column to any color you like if the values of these cells end with a given sub-string parameter. |
conditional_format_contain | This method changes the background color of any cells in a given column to any color you like if the values of these cells contain a given sub-string parameter. |
conditional_format_between | This is one of the many conditional formatting methods in Smart Report Engine, which are used to change the background color of any column cells based on their values. This method highlights the background of any cells in any given column, with any selected color, if their values lie between a lower and an upper bound. |
conditional_format_begin_with | This method changes the background color of any cells in a given column to any color you like if the values of these cells begin with a given sub-string parameter. |
check_session_saved_client_agent_key | This is one of the session verification methods that should be used only with private reports! This method configures your report to check both the existence of a given session key and its value which should be equal to the active user's user agent, which should be obtained using the PHP variable $_SERVER['HTTP_USER_AGENT']. If this session validation fails, the user should be redirected to the login page that you passed to the "security_init" method. |
calculatedcolumns | Calculated columns are virtual columns that are not physically stored in your database table Instead, their values are calculated from one or more other columns. In each generated report by Smart Report Engine, you should find a configuration file named “calculated_columns.php”. This file is for configuring any number of calculated columns needed for any report generated by Smart Report Engine. You can find this file at:
/{Smart-Report-Engine-PATH}/SRM8/SRM/Reports8/rep{report-name}/calculated_columns.php
where: {Smart-Report-Engine-PATH}: The path in which you uploaded Smart Report Engine on your local or remote server.
{report-name}: Your generated report's name.
Inside the "calculated_columns.php" configuration file, you should find the "$calculated_columns" predefined array. In this array, you can define each calculated column you want to add to your report along with the method to calculate it as shown in the code example below.
In the following code snippet, we define one calculated column “total_price” and linked it to the function that should be used to calculate its value. Please note that the value of any calculated column is calculated by the function linked to it and which should accept only one parameter “$row” which represents any row in the report. Therefore if we need to include any column in the calculation formula we should refer to that column as $row[“name_of_the_column”] For example, $row[“unit_price”]. Once we save the calculated_column.php file changes and refresh the browser we should be able to see the calculated columns displayed in the report. |
add_relationship | This method defines the relationship between any two tables. Therefore, It should be used for reports that are based on multiple tables. |