CYap CYap(
[array
$search_field = array()], [array
$show_field = array()], [array
$db_info = array()], [array
$show_info = array()], [mixed
$modify_info = array()]
)
|
|
Table viev class reference
Request (post/get) parameters of: OrderField set when the user click on the header filedname. It change the field to use to order the table. Values: field name. None = use the current order field (session var OrderField) ot: OrderDirection, chenge the order direction on the field specified by of DetailMode: (default false), if true yap shows the full detail row, if false the class shows the table. If it doesn't exist, the class looks for it into the session vars and into the configuration params. Pag: page number, the class shows the request page. If it doesn't exist, the class looks for it into session var (show the same page as the referrer). If the class doesn't find it, the first page will be shown . ev: event occurred to the form. id: row identification value used by update/delete function. If it doesn't set, the class swicth into insert mode (if cmd=m).
Parameters:
|
array |
$search_field: |
|
|
array |
$show_field: |
|
|
array |
$db_info: |
|
|
array |
$show_info: |
|
API Tags:
The function parse the text from the search box and build the information
required to perform the query
API Tags:
void check_db(
array
$info
)
|
|
Check and load the configuration information about the database connection coming from the caller
Parameters:
|
array |
$info: |
parameters from the caller |
API Tags:
void check_modify_info(
array
$info
)
|
|
Check and load the configuration information about the add/modify/delete row
Parameters:
|
array |
$info: |
parameters from the caller or configuration file |
API Tags:
Look into the $_REQUEST for the sort parameter. If any, the function update the contents of OrderField and/or OrderDirection
CGI parameter of -> orderField ot -> Order Type = order direction Session parameter OrderField set OrderDirection set
API Tags:
void check_search(
array
$info
)
|
|
Check and load the configuration information about the search box coming from the caller
Parameters:
|
array |
$info: |
parameters from the caller |
API Tags:
void check_showfield(
array
$info
)
|
|
Check and load the configuration information about the fields to show coming from the caller
Parameters:
|
array |
$info: |
parameters from the caller |
API Tags:
void check_show_info(
array
$info
)
|
|
Check and load the configuration information coming from the caller
Parameters:
|
array |
$info: |
parameters from the caller |
API Tags:
Clean all session parameters. It is usefull to avoid conflict with another execution of this class within the same session
API Tags:
InDetailMode - Am I in 'deatil mode'?
API Tags:
void load_previous_data(
)
|
|
Class behaviour setup from session or post parameter.
The post parameter has the precedence over the session parameter
API Tags:
Perform the query on database to retrieve the rows to show
API Tags:
| Return: | true on success, false on error |
| Access: | private |
boolean RegisterEvent(
string
$EventName, string
$Handler
)
|
|
Register a new or modify an event, and its handler
Parameters:
|
string |
$EventName: |
event name |
|
string |
$Handler: |
function handler |
API Tags:
select_page from a list of 5 pages before and 5 pages after
API Tags:
void showpage(
[string
$ForcedEvent = '']
)
|
|
function to show the page
Parameters:
|
string |
$ForcedEvent: |
forced event. If any th function looks for $_REQUEST['ev'] if set. |
API Tags:
void show_detail_row(
array
$DataRow, [boolean
$Show = true], array
$Fields, object CYap_DetailView
&$clsTable
)
|
|
Show one data row. Detail view. Called by _ShowDetailMode, this function fills each table cells.
It is called when the module is set to detail mode
Parameters:
|
array |
$DataRow: |
array associativo con il record restituito dalla query |
|
boolean |
$Show: |
should I show the table or return it as string? (true->show, false->return as string) |
|
array |
$Fields: |
list of filed to be shown |
|
object CYap_DetailView |
$clsTable: |
reference to the class used to print the table |
API Tags:
Show the search box. The function make the HTMl code for the form,
The box is shown through the module CYapBox (called by the function _ShowSearchBox)
API Tags:
void show_header(
object CYap_table
&$clsTable
)
|
|
Show the column header
Each header is a link to this page with parameters to change the sort direction and field
Parameters:
|
object CYap_table |
$clsTable: |
reference to the class used to print the table |
API Tags:
Page picker (begin,previuos,next,end)
API Tags:
void show_single_row(
array
$RowData, integer
$RowNumber, object CYap_table
&$clsTable
)
|
|
Show one table row. Called by _ShowTableMode, the function fills one row of the table.
It takes the list of the required fields from configuration var $this->show_field, and the field's data from the parameter $RowData.
Parameters:
|
object CYap_table |
$clsTable: |
reference to the class used to print the table |
|
array |
$RowData: |
associative array containing the row data from the query statement |
|
integer |
$RowNumber: |
number of row's table. First row: 1 |
API Tags:
Show rows: main function to open the table, and retrieve data from database
API Tags:
string var_padding(
integer
$size, string
$padding, string
$paddingchar, string
$text
)
|
|
Pad the given field to match the requested size
Parameters:
|
integer |
$size: |
the output size |
|
string |
$padding: |
type of pad (none,left,right,center) |
|
string |
$paddingchar: |
char to use to pad |
|
string |
$text: |
input text |
API Tags:
| Return: | the 'padded' string |
| Access: | private |
If allowed, add the link to the add row function
Parameters:
API Tags:
void _Apice(
string
$fieldType
)
|
|
String quote, for each type of Mysql field the function return the single quote
if required
Parameters:
|
string |
$fieldType: |
Mysql field type |
API Tags:
array _BuildControlTable(
array
$tblFields
)
|
|
Build the control object for each field and return it.
Parameters:
|
array |
$tblFields: |
array of all table columns |
API Tags:
| Return: | array of all created control to manage each field |
| Access: | private |
bool _CheckAuthorization(
string
$Key, string
$Action
)
|
|
Ask to the callback function (if I have one ) if the current
user may perform the requested function The allowed action are: RemoveRow, AddRow, ModifyRow If I haven't any callback function return true
Parameters:
|
string |
$Key: |
row key to apply the action |
|
string |
$Action: |
action The allowed action are: RemoveRow, AddRow, ModifyRow |
API Tags:
| Return: | true-> perform the job, false user not allowed |
| Access: | private |
bool _CheckFieldCallBack(
array
$row, string
$Key
)
|
|
Check if the field name in $Key contains a valid value. If not return false The function perform the check by the provided callback function. If any return true.
Parameters:
|
array |
$row: |
all the row value returned from the form |
|
string |
$Key: |
field name |
API Tags:
array _CompileFieldType(
array
$meta, string
$flags, array
$CfgParam
)
|
|
Build the array that contains all information about the field
Parameters:
|
array |
$meta: |
information from mysql |
|
string |
$flags: |
field's flags |
|
array |
$CfgParam: |
information about the field from the configuration paramaters |
API Tags:
Ok, I get the confirm to remove the row, I do it!
API Tags:
| Return: | successed or not |
| Access: | private |
string _DeleteHrefLink(
array
$RowData
)
|
|
If allowed, add the link to the delete function for the currente row
Parameters:
|
array |
$RowData: |
row values |
API Tags:
void _DeleteRequestConfirm(
)
|
|
Request the confirm to remove the row
API Tags:
string _DetHrefLink(
integer
$RowNumber, array
$RowData
)
|
|
function to show the link to the detail mode for the current record
Parameters:
|
integer |
$RowNumber: |
current row number. First row: 1 |
|
array |
$RowData: |
row values |
API Tags:
Perform the actions required to display the rows (table/detail mode)
API Tags:
void _DoEvent(
string
$ev
)
|
|
Execute the function related to the given event. Note, it recognizes only the evens
whose name begins with YAP_
Parameters:
API Tags:
The user is not allowed to perform the operation, show the message
API Tags:
array _FillFromRequest(
array
$row, array
$Fields
)
|
|
For each field, check from the request, if I have some value
from the previous input field (an insert/modify not approved)
Parameters:
|
array |
$row: |
It contains each field and its values from the database |
|
array |
$Fields: |
List of all required fields |
API Tags:
void _InitializeSessionVar(
)
|
|
Initialize the session vars
API Tags:
Send the Javascript code required by Yap to output the tooltip
API Tags:
void _JsSearchBoxCheck(
)
|
|
Js code to validate the search box form.
The base class implementation do nothing (return always true), but it allows extend and customize the checks on value entered into the search box.
API Tags:
void _LoadCfg(
string
$FileName
)
|
|
Load the configuration file
Parameters:
API Tags:
Parse the output formats from info['outformat'], and converts that informations into executable commands.
Set the default formats Default formats: NONE: no format applied NUMERIC_IT: numeric number, Italian format x.xxx.xxx NUMERIC_EN: numeric number, English format x,xxx,xxx.xx MONEY_IT : monetary Italian format x.xxx.xxx,xx MONEY_EN : monetary English format x,xxx,xxx.xx DATE_IN : convert timestamps into Italian dormat date day/month/year DATE_US : convert timestamps into US format date month/day/year Initialise the $this->OutFormat array;
API Tags:
void _ModifyExecute(
bool
$Add
)
|
|
Add/Update the record
Parameters:
|
bool |
$Add: |
True=add mode (I have not the key value, field id) |
API Tags:
string _ModifyHrefLink(
array
$RowData
)
|
|
If allowed, add the link to the modify function for the currente row
Parameters:
|
array |
$RowData: |
row values |
API Tags:
void _ModifyInputForm(
bool
0, string
1
)
|
|
Show the form for modify/insert a new row
Parameters:
|
bool |
0: |
True=add mode (I have not the key value, field id) |
|
string |
1: |
record id (used only in Modify Mode) |
API Tags:
Operation (add/modify) executed with success, draw the messge
API Tags:
Ops, I don't want remove this row
API Tags:
Click on 'abort button' on 'new row' form
API Tags:
Click on 'OK' button on the form 'Command executed'
API Tags:
Click on button show row detail
API Tags:
ok, the modify form is filled, store the new values
API Tags:
Yes delete this row
API Tags:
Ok, the 'new row' form is filled, store the data
API Tags:
Draw the data from the current status
API Tags:
First time the module is called. Initialize the internal status and don't expect any information
from session
API Tags:
Click on 'modify row' link
API Tags:
Click on 'add row' button
API Tags:
Click on table header to change the order type
API Tags:
Click on table header to change the order type
API Tags:
Click on 'delete row' link
API Tags:
Filled the search form. Parse the new search parameters, and display the new result.
API Tags:
Click on button show rows table
API Tags:
Skip to a new page. This event expects the pag parameter to know which is the new page
to show up
API Tags:
Open the connection to the database
array _RetrieveFieldType(
[resource
$res = NULL], [boolean
$ModifyMode = true]
)
|
|
Retrieve the field definition from the database
Parameters:
|
resource |
$res: |
return by mysql_query from whom get the field type |
|
boolean |
$ModifyMode: |
true if I return the list of the field to be changed (use modify_info) false if I return all field from the table (view mode) |
API Tags:
array _RetrieveRow(
string
$KeyValue, array
$Fields
)
|
|
Retrieve the row contents from the database
Parameters:
|
string |
$KeyValue: |
key the affected row |
|
array |
$Fields: |
fields type |
API Tags:
Run the display function based on mode switch
API Tags:
Store some information into session
API Tags:
void _SetDefaultHandler(
)
|
|
Set the event table to the default handler
API Tags:
void _ShowDetailMode(
array
$Fields, resource
$result
)
|
|
Shows the row detail. Actually the function doesn't show anything, it calls the various function from the class tabledatail. Those functions make the html code to show the data.
Parameters:
|
array |
$Fields: |
it contains the list of fields to be shown |
|
resource |
$result: |
Database query handler |
API Tags:
void _ShowModifyBox(
array
$Row, array
$Fields, bool
$Add, string
$KeyValue, array
$Controls
)
|
|
Build the form for the input/add row
Parameters:
|
array |
$Row: |
array of the value for each field |
|
array |
$Fields: |
it contains the fields informations from the database |
|
bool |
$Add: |
I'm adding or modifing the row? |
|
string |
$KeyValue: |
Value of the index key for the row to modify |
|
array |
$Controls: |
array carrying the objects required to show the form |
API Tags:
void _ShowSearchBox(
string
$txt
)
|
|
Call the CYapBox to show th search box. This function is splitted from the previous to allow to override it if you need to cheng the search box layout.
Parameters:
|
string |
$txt: |
Html code to show the search form |
API Tags:
void _ShowTableMode(
array
$Fields, resource
$result
)
|
|
Shows the requested row. Actually the function doesn't show anything, it calls the various function from the class tableview. Those functions make the html code to show the data.
Parameters:
|
array |
$Fields: |
it contains the list of fields to be shown |
|
resource |
$result: |
Database query handler |
API Tags:
Javascript code required to draw the tooltips
API Tags:
Html code require do draw the tool tips
This function is expected to run inside the body of the page
API Tags: