Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /var/www/html/lens/lensman/gen/propallpage.php on line 30 allowEmptyFilter
Filtering and Searching
allowEmptyFilter
When user performs an empty filter/search, show all records?Default: If set to false, when no filter/search criteria is defined, no query is performed.
Setting to true seems to be more natural, while false will improve database performance.
Always save even if record has not changed when set to trueDefault: Before saving a record, we check if the record has changed. If it is not changed, we normally do not save it again as an optimization. Setting
$lens->alwaysSave = true;
overrides this default behaviour. Useful when all records in editMultiple have to be saved in a specific sequence.
Store blobs are downloadable attachmentsDefault: Attachments are files which are stored in the database. These are stored using blob, image or bytea (for postgresql) types. When you store the attachment, phplens will also store the file name and file size in readable format in a separate varchar field. If the blob field is called myblob and the varchar field is called myfiledetails, then set
$lens->attachment = 'myblob;myfiledetails';
The second field (myfiledetails) is optional.
You need to configure your phplens SQL statement in a special manner when using attachments. If the table is called myfiles, and has a primary key id then the following SQL is required:
$lens->sql = 'select id, myfiledetails, 0 as "_ATTACHMENT_" from myfiles';
You do not directly access the attachment fields in your SQL because you don't want to retrieve the attachment data (it could be a several very large attachments) everytime you view the phpLens grid. _ATTACHMENT_ is a special alias to the actual field, with a dummy value (0 in this case, though it could be any constant value). PhpLens will detect the _ATTACHMENT_ field and will display a download link when viewing the grid or details. When editing or creating records, the standard upload field form will be shown.
The file info field, myfiledetails in the above example, is also special. You can make it visible in the grid or details. But make sure it is readonly or hidden in the edit/new record form. This field will be automatically filled with the file name and size on record update.
The maximum size of an upload is determined by the imageMaxSize property. There can only be 1 attachment field per record.
Blob Header Format
All BLOBs begin with a header. The first bytes of the header are defined by a constant LENS_ATTACH_HDR in phplens.inc.php. The final bytes of the header consists of '/'.LENS_ATTACH_HDR. Between the header and the end of the header is the header contents.
In phpLens 3.5.0, the header contents is the name of the attachment. In phpLens 3.5.1 and later, it is a MIME content-type definition that looks like this:
Sets tag attributes for date and timestamp input fieldsDefault: Typically used to set the CSS class selector of input fields for date and timestamp fields when editing or creating records.
Makes phpLens autogenerate an integer to be stored into keyCol when inserting a new recordDefault: Set this property to true to enable generation of keys by phpLens. If you want to use a custom generator, set this property to the name of the PHP function that returns the key. The generated key is also passed to the eventPostInsertSQL property, and also stored in the generatedKey property after Render() is called.
Note that is only required on selected databases which do not have an auto-incement primary key, including early-PostgreSQL versions, Interbase and Oracle (oci8) currently. Internally, phpLens will create sequences or tables to manage the integer generation.
If you are using autoincrement columns generated by the database (eg. mysql or mssql), you can get the last inserted value using $lens->connection->Insert_ID();
Regular expression describing which tags are banned for data entryDefault: Only works if htmlLens is set for that column. Otherwise all tags are converted by htmlspecialchars() to their html entities. Uses Perl compatible regular expressions.
Note: since phpLens 3.0, we no longer ban table, th, td. tr tags by default. This is because the new htmlEditLens allows HTML tables to be created.
Set table borders to 0Default: 0 = use table borders set to border="0"
1 = no borders in cells nor around table
2 = no borders between cells, but place a border around table
It is recommended you do not manually modify this property in an editor, but use the Dynamic Editor as phpLens does special processing on this property.
If you want to manually change the borders, phpLens will not modify the border if you set the border without the quotes, or uppercase the attribute, eg.
Cache data in $ADODB_CACHE_DIR for cacheData secondsDefault: Make sure that the global variable $ADODB_CACHE_DIR points to the correct directory. See cacheLookups property for more examples.
Data is only cached if the data is set to readonly (no editing/deleting/inserting). Do not set this to true when you have multiple Web servers accessing the same data.
And if scrollLinks is set, then the number of links to display is also cached. This occurs whether or not the data is readonly. In other words, the SELECT COUNT(*) performed by scrollLinks is cached.
Cache lookup values for cacheLookups seconds in the $ADODB_CACHE_DIR directory.Default: PhpLens uses the ADODB database library internally. ADODB has the ability to cache queries and recordsets in a directory defined by the variable $ADODB_CACHE_DIR. You should define this constant at the top of your script.
This property can speed up phpLens significantly by reducing queries to the database.
Show Delete button and allow deletesDefault: Clicking on the button will ask for confirmation from the user if Javascript is enabled on the browser.
The icon can be modified. It is configured in the language class $lens->lang->iconDel.
Also requires the keyTable and keyCol properties to be defined.
If you want only selected rows to be deletable, you can define an additional column called "_CANDELETE_" and set the value to 0 or 1. Non-zero values means that the row can be deleted. This is available since 2.2.0.
For example, set $lens->sql to the following if you want the user to only be able to delete products that begin with 'A' (assuming your database supports CASE)
SELECT productname, supplier, unitinstock, unitprice,
CASE
WHEN substr(productname,1,1) = 'A' THEN 1
ELSE 0
END "_CANDELETE_"
FROM products
Show Edit button and allow record updatesDefault: Also requires the keyTable and keyCol properties to be defined.
The icon can be modified in $lens->lang->iconEdit.
If you want only selected rows to be editable, you can define an additional column called "_CANEDIT_" and set the value to 0 or 1. Non-zero values means that the row is editable. Available since 2.2.0.
For example, set $lens->sql to the following if you want the user to be able to only edit products that begin with 'A' (assuming your database supports CASE)
SELECT productname, supplier, unitinstock, unitprice,
CASE
WHEN substr(productname,1,1) = 'A' THEN 1
ELSE 0
END "_CANEDIT_"
FROM products
Fields listed in this lens are displayed as chartsDefault: The field must be of type integer or numeric. There are two types of charts you can create.
Bar Charts
The first is a horizontal bar chart. If the chart has both negative and positive numbers, you can choose two different colors for the negative and positive values.
Chart dimensions must be set for bar charts. This is the maximum size of a chart. Set the width and height.
To fit the chart into the chart dimensions, phpLens needs to estimate the maximum and minimum values of the field. You can provide an SQL statement to calculate it here, or hard-code numeric values (this is faster).
Icon Chart
The other chart is the icon chart, which shows a picture for every Scale units (rounded up).
Setting Chart Min/Max
The scale of the chart is determined by these settings. Chart Min is the smallest possible value and Chart Max is the largest possible value in that column. You can set this value manually (default), or execute an SQL statement to do this, normally:
select min(col),max(col) from table
From these values and the Chart Dimensions, phpLens is able to scale the chart correctly.
Stores charting parameters set when dynamic editing enabledDefault: If you need to save the chart settings as source code, set your charting parameters using dynamic editing, generate the PHP code, then copy and save the chartParms and chartLens properties.
Syntax Not documented currently because the format will change in future versions.
Will make a set of checkboxes appear on the grid, one for each row. There will be a menu to select "Move Records" and "Hide Records". Make sure that the keyCol property (defines the primary key) is also set to ensure that the checkboxes return something meaningful.
To process records, check multiple records, then select an item from the menu, say "Move Records", then click on Go. This will cause a POST to occur, with $id being the applet id:
$_POST[$id.'__cbopt']
set to 'move'
$_POST[$id.'__cbstr']
Primary keys of the checked records stored as a string, delimited by the value of $lens->checkBoxesSep, eg. '!#@'.
$_POST[$id.'__cbnotstr']
Primary keys of the unchecked records stored as a string, delimited by the value of $lens->checkBoxesSep, eg. '!#@'.
Then you will have to write some PHP code to process this $_POST yourself, eg.
if (isset($_POST[$id.'__cbopt']) && $_POST[$id.'__cbopt'] == 'move') {
$arr = explode('!#@', $_POST[$id.'__cbstr'];
foreach($arr as $primkey) {
# some code to move records based on $primkey ...
}
}
The checkbox posting code uses javascript to post the data, so will not interfere with any form tags you have embedded inside the grid, or the editMultiple property form tags.
Special Flags
_auto_
The default dropdown menu has a Go button that needs to be pressed before the form results are submitted. Setting this flag will cause selecting from the dropdown menu to submit the results.
When a user selects 'move', then all checked records will be updated with 'move':
UPDATE $keyTable SET statusfld='move' where (statusfld != 'move' or statusfld) is null and $keyCol=$checkedPrimaryKey
The $updateflds parameter is useful when you need to update additional information. For example:
UPDATE $keyTable SET statusfld='move',modified=sysdate where (statusfld != 'move' or statusfld) is null and $keyCol=$checkedPrimaryKey
_col_^$colname[^$emptyval][^$updateflds]
This ties the checkbox to a database column. Useful for approvals and similar functionality. When the user changes the field, the database is also updated.
If the value of the field satisfies the PHP empty() function [null or 0 or '' or '0' or false], then the checkbox is unchecked, otherwise the checkbox is checked.
In this mode, only the records that are changed (clicked on by the user) are POSTed to the server.
So records that are checked will be updated with:
UPDATE $keyTable SET select_field=1 WHERE (select_field!=1 or select_field is null) and $keyCol=$checkedPrimaryKey
and records that are unchecked:
UPDATE $keyTable SET select_field=0 WHERE (select_field!=0 or select_field is null) and $keyCol=$uncheckedPrimaryKey
The _update_ flag is ignored in when _col_ is defined.
The $updateflds parameter is useful when you need to update additional information, and is used in the same way as in _update_.
Replaces the details grid with an editor to create/edit recordsDefault: Legal settings:
Create and Edit
New record form is the default, unless a record is selected for editing
Edit Only
Always show the edit record form for the current record
Create Only
Always show the new record form
Edit and Create
Show edit record form for the current record is the default. When the new record icon is clicked, show the new record form in details
This is called childLens because internally, it creates a second phpLens object(the child) to do the editing.
Syntax:
$lens->childLens = '{id of child phplens}[;editdetail][;newdetail][;editfirst]';
The string editdetail is a constant that specifies editing is allowed in the detail grid.
The string newdetail is optional and when defined, will display the create new record screen in the detail grid when no record has been clicked on. The editdetail constant must also be set for newdetail to work.
The id of the child phpLens should be a unique value that is not used by other phpLens objects.
Since phpLens 2.4, both editdetail and newdetail are optional.
Since phpLens 2.4.8, a new optional setting, editfirst is available. When makes editing the default instead of creating a new record if both editdetail and newdetail are defined.
Color of even rows in gridDefault: Set the bgcolor in the TR tag. Addional TR properties can be placed after the color, for example:
$lens->colorEven = 'yellow valign=bottom';
Dynamicly change color of column or cell, and column attributes too.Default: You can use this property to enter a grid background color such as 'white' or 'black', or use the numeric RGB values where #000000 and #FFFFFF is white.
To set dynamic colors in your columns, set the first character to an equals (=), then you can use the PHP's ternary logical operator or your own pre-defined function to perform checks and comparisons.
PHP has a nice way of allowing you to choose between multiple values in one line of code: = (expr) ?
"value if expr is true" : "value if expr is false"
An example is given a column named UnitsInStock, and we want to color the column red if the units are less than 10: =({UnitsInStock} < 10)? "red" : ""
You can also use any global variables defined in the $GLOBALS array using {$VARNAME}, for example {$PHP_SELF}.
The colorLens property can access any column in the current row using the {columnname} syntax just like the powerLens.
Additional Macro Variables Available
{NBSP} = ' '
{SEMICOLON} = ';'
{_HILITE_RECNO_} = current record number
{_LENSID_} = the phpLens object's id
{_ODDC_} = the odd row color
{_EVENC_} = the even row color
{_SELECTC_} = the hilite color for the current line
{_HASDETAILS_} = whether the detail grid is visible
Changing Column Attributes
You can also change column widths with this property by taking advantage of a side-effect. Any attribute can be added to the TD tag using colorLens. See example in syntax. Note that setting the column width is discretionary. The browser can override this setting if it wants to.
However since phpLens 2.6, we have the tdLens property, which allows you direct access to all td attributes. Note however that tdLens does not do column interpolation (eg {col1}) nor php code processing (with =).
Title and Input Background Colors
Since phpLens 4.9, you can control the background color of the detail, edit and new titles, and the input background colors. To set the title background color for field FIELD1 to black, the title font to white, and the input background to lightyellow, use
Color of the navigation bar cellsDefault: This property determines the color inside the menu option cells. ColorNavBorder sets the border color of the cells.
Color of odd rows in gridDefault: Set the bgcolor in the TR tag. Addional TR properties can be placed after the color, for example:
$lens->colorOdd = 'yellow valign=bottom';
Color of column/field title cellDefault: Set the bgcolor in the TH tag. Addional TH properties can be placed after the color, for example:
$lens->colorTitle = 'yellow align=right';
Number of columns to display in gridDefault: Auto-Resizing
If $lens->columns > 1 and $this->pageSize >= 1000, then phpLens will auto-resize the grid to fit all records in one page by adjusting the number of records per column.
Holds the ADOdb connection objectDefault: This represents the connection to the database. You can access access the connection resource directly using $lens->connection->_connectionID.
See also rs, the recordset property, and the ADOdb manual.
Instead of using the default connection, use this connection for sql lookupsDefault: There are 2 ways to use it. First is to set it to an existing database connection:
CSS include file.Default: CSS file to include that contains CSS definitions. Should be the absolute path if defined. See the CSS Blue and CSS Red examples, which make use of the default phplens/img/phplens.css file.
'VIEW' means view the normal grid
'EDIT' means edit a record
'FILTER' is when we are in the search screen but have not initiated a search.
'FILTERVIEW' means we have initiated a search
'NEW' is when we are creating a new record
'EDITSAVE', see below, has been available since phpLens 2.4.2.
'HIDE' hides the phplens object. Available since phpLens 3.2.
This property is read-only and should not be changed directly. To force a record edit or to create a new record or to force a search, use GET variables instead, as documented in the FAQ at http://phplens.com/lens/faq/faq.php?#402
New to phpLens 2.4.2 is the EDITSAVE state. Set firstState = 'EDITSAVE' when we want to display an EDIT screen in firstState, but after we successfully save, we want switch to VIEW.
Also if firstState is EDIT and we click on Save and save was successful, we set curState to EDITSAVE. This is a state that is otherwise identical to EDIT. To maintain backward compatiblity, to detect EDIT state, we suggest using
substr($this->curState,0,4) == 'EDIT'
HIDE
The curState property is normally read-only, but you can hide the phpLens object for 1 page request by setting $lens->curState = 'HIDE'.
Print SQL generated by phpLens and halt execution.Default: Useful for debugging poorly optimized SQL that is running too long. The SQL is not executed.
On new record, these are the default values of specified fieldsDefault: When creating a new record, you might want a default value to be automatically entered. You can enter a normal string (without quotes) or number, or generate the value dynamicly using PHP or your RDBMS.
Default values can be hard-coded values, or you can execute PHP code if you prefix with the equals(=) character.
Dates can either be generated in Unix timestamp format provided you return the value as an integer, or in 'Y-m-d H:i:s' format.
Executing PHP Code
When you want the value to be dynamically generated by PHP, set the first character to an equals (=) to treat the following text as PHP code.
To generate the current date, use the PHP time function like this:
=time()
PHP Globals
To access global variables, before 3.2, you needed to use the following:
=$GLOBALS['PHP_SELF']
Since 3.2, you can use this directly:
=$PHP_SELF
Database Example
To access the ADODB connection from here, use the following example, which passes the connection object to the getvalue function:
Executing SQL Code
Sometimes, you have a read-only field whose value is generated by your SQL server and not by the user. You can do this by setting the first character to percentage (%) to treat the following text as SQL code. Since 2.5.2, you can also put PHP global variables in the SQL string.
To set a column to a random number in Microsoft SQL server, use the rand function like this:
%rand()
Syntax To set a field called thetime to the current datetime:
$lens->defaultLens = 'thetime^=time()'
To execute a standard SQL function for a field called rr:
The separator used to display the checkbox choicesDefault: When selecting multiple checkboxes, the choices selected are stored in the field, using the displaySep as the separator. For example, you have a set of checkboxes storing the following values: "Giraffe", "Lion", "Zebra". The user selects the first two values, so we store in the database "Giraffe, Lion".
If the displaySep was '||', then we would store "Giraffe||Lion".
Turn on dynamic editingDefault: Use this to determine whether users can modify phpLens dynamic settings.
When dynEdit is disabled, all dynamic edit settings are not loaded from the phpLens table. So make sure you Generate PHP Code and paste your changes into your .php file before turning off dynEdit.
Sometimes the phpLens source code settings are in conflict with the dynamic editing settings. In this case you should Generate PHP Code and save it as a backup. Then click on the Remove Settings to wipe out all dynamic editing settings that might be in conflict with your PHP source code. Finally, manually merge any settings from the backup to that are missing in the original source code.
Use dynamic editing settingsDefault: Set this to false if you want to ignore dynamic editing settings. This will speed up phpLens because phpLens will not query the phpLens table to get configuration settings.
This means that all dynamic editor settings are ignored. When using applets, dynUseSession is always set to false.
Set to true to edit a record when you click anywhere in a rowDefault: Due to problems with browser incompatibilities, this property is no longer supported. Though we will leave it available for backward compatibility, we will not entertain any support requests regarding using this property.
Set to true to enable.
This only works when the keyCol property is defined (eg. the primary key is known), editMultiple = false and no child editor is configured (childLens property).
Define hidden input tags to be included in edit formDefault: Any invisible tag can be defined here. These tags can be used to embed any additional information that you require for your own processing.
This lens sets which fields are shown when editingDefault: This is normally combined with readonlyLens for fields that are viewable but not modifiable.