Friday, December 21, 2007

The new version 4.2.2 of PHP DataGrid! Last in 2007 year!


Dear friends of PHP DataGrid! This is the last version in 2007 year. I hope you have a fun with this cool script, that becomes more and more advanced (thanks for your efforts :)) I want to wish you and your family excellent financial and professional achievements in 2008. Thank again for all! See you next year here!

The new version 4.2.2 of PHP DataGrid is available for downloading from here.

There are some changes in this version. Read carefully Getting Started.

Main additions and improvements:

1. * Feature: [added] new attributes for fields in view mode "tooltip" and "tooltip_type"
2. * Feature: [added] export to PDF (Provided by zewa666@gmail.com)
3 * Feature: [added] new language (pb) Brazilian Portuguese. Provided by Julio Formiga (form1ga@yahoo.com.br)
4. * Feature: [added] new attributes for fields in view/add/edit/details modes "visible"
5. * Feature: [added] cool DHTML/JavaScript Calendar (Provided by stephane.dekeyzer)
6. * Feature: [added] new attributes for date/time fields in add/edit mode "calendar_type"=>"popup|floating"
7. * Feature: [added] new icon in Control Panel - Refresh Pages (Provided by stephane.dekeyzer)

1. = Feature: [improved] fileAction() renamed in formAction() and placed in dg.js
2. = Feature: [improved] language files
3. = Feature: [improved] added security checking for arguments in download.php
4. = Feature: [improved] css style outputted in separated *.css files
5. = Feature: [improved] added [Clear] option for date/time field types

1. # Bug: [fixed] first letter upper case for header names
2. # Bug: [fixed] with LIMIT for Oracle and MSSQL in setSqlByDbType() method
3. # Bug: [fixed] with "title" attribute in view mode for links and linkbuttons
4. # Bug: [fixed] WYSIWYG doesn't work in Safari - added automatic detecting
and redefining textarea as simple type
5. # Bug: [fixed] in delete operation in edit mode
6. # Bug: [fixed] in listbox with multiple selection while uploading file or image
7. # Bug: [fixed] in debug mode in selectSQL() and executeSql() methods
8. # Bug: [fixed] sorting by date. Solution: using "sort_by" attribute, for sorting by needed field
9. # Bug: [fixed] with strtolower function for non-english letters
10. # Bug: [fixed] missing id attribute in some fields
11. # Bug: [fixed] error in FireFox on pagination event when more then 1 datagrid displayed om the screen
12. # Bug: [fixed] error on filtering when more then 1 datagrid displayed om the screen
13. # Bug: [fixed] in Firefox popup for "time" type field doesn't work
14. # Bug: [fixed] for non-numeric primary keys in multirow view
15. # Bug: [fixed] in setAutoColumnsInView/EditMode
16. # Bug: [fixed] with definition of "resizable" attribute for textarea
17. # Bug: [fixed] in getLcaseFooByDbType() method for pgsql
18. # Bug: [fixed] FF error: delete button (image) in edit mode wrong alignment

etc.


To view a Live Demo click here.

To download new version click here.

Sunday, November 11, 2007

New version 4.2.1 of PHP DataGrid - Beta

The new version 4.2.1 of PHP DataGrid is available for downloading from here.

There are some changes in this version. Read carefully Getting Started.

Main additions and improvements:

1. * Feature: [added] new field type - "time"
2. * Feature: [added] new language: Bulgarian
3. * Feature: [added] option: drawing add button separately (not documented)
4. * Feature: [added] new req_type for checkboxes fields: "c" - checked
5. * Feature: [added] non-documented: setHeadersInColumnarLayout();
6. * Feature: [added] non-documented: setDgMessages();
7. * Feature: [added] ability to write some fileds in "field"=>"f1, f2..." parameter of filtering field
8. * Feature: [added] new parameters for "enum" type: "multiple" and "multiple_size"
9. * Feature: [added] new layout type: customized (drawCustomized()) in view/details mode
10. * Feature: [added] new parameters for "link" type in view mode: "rel" and "title"
11. * Feature: [added] new option: show/hide search types dropdownbox

1. = Feature: [improved] language translation: German, Netherlands
2. = Feature: [improved] "image" size attributes: height and width
3. = Feature: [improved] faster working in view and detail modes
(removed unnecessary including form.scripts.js, resize.js (~60Kb))
4. = Feature: [improved] faster working in add and edit modes
(removed unnecessary including wysiwyg.js (~35Kb))
5. = Feature: [improved] added errors handling for selectSqlItem/executeSql
6. = Feature: [improved] function setBrowserDefinitions in separateed file in folder "functions/"

1. # Bug: [fixed] wrong variable value while uploading
2. # Bug: [fixed] when using GROUP BY in SELECT SQL statement
3. # Bug: [fixed] in drawing foreign keys
4. # Bug: [fixed] with processing datemdy type in calendar
5. # Bug: [fixed] in "link" type with multiple parameters processing
6. # Bug: [fixed] LIMIT (OFFSET) error for PostgreSql statements
7. # Bug: [fixed] error with mysql_real_escape_string for different db types
8. # Bug: [fixed] with alignment of images in view mode
9. # Bug: [fixed] on Update with readonly fields

etc.


To view a Live Demo click here.

To download new version click here.

Saturday, September 29, 2007

New version 4.2.0 of PHP DataGrid - release

The new version 4.2.0 of PHP DataGrid is available for downloading from here.

Special THANKS to all who was helping this project. I think we have now a really stable version. Any way, the list of 'TODO' is full of features I need to add still.

There are many changes in this version. Read carefully Getting Started.

Two short remainders:

1) Remember! This is not an updatable version. If you use old version of PHP DataGrid - you need to reinstall it (see here how you do it).

2) Only version 4.2.0 or above will be supported from now!



To view a Live Demo click here.

To download new version click here.

Friday, September 21, 2007

BETA version 4.1.9 of PHP DataGrid

The BETA version 4.1.9 of PHP DataGrid is available for downloading from here.

Main additions, changes and bugs fixed in this version you can read about in our forum.

Main additions and improvements:

* Feature: [added] uploading images and files from remote hosting: "host"=>"remote"
* Feature: [added] added new source format for "enum" field type:
$fill_from_array = array("0"=>"No", "1"=>"Yes");
* Feature: [added] added new source format for dropdownlist in filtering mode:
$fill_from_array = array("0"=>"No", "1"=>"Yes");
* Feature: [added] new not-documented method getNextId()

* Feature: [improved] reduced page's HTML output (~ upto 6%)
* Feature: [improved] lang.php file splited in separate language files
* Feature: [improved] myDate() method
* Feature: [improved] language file - added Serbian
* Feature: [improved] "enum" field type in "details" mode

# Bug: [Fixed] with using WHERE in SELECT SQL statment in view mode
# Bug: [Fixed] undefined index error in drawFiltering() method
# Bug: [Fixed] wrong detection of "https://" in getProtocol() method
# Bug: [Fixed] wrong placed ")"
# Bug: [Fixed] in filtering with 2 DG's on one page
# Bug: [Fixed] in "maxlength" property for textarea
# Bug: [Fixed] <!--// error in some browsers
# Bug: [Fixed] wrong action onclick event when back button is image or button.

etc.

You can get and test it NOW!!!.

Saturday, September 15, 2007

New 1.0.4 version of JS Auto Form Validator

New 1.0.4 version of JS Auto Form Validator is available for downloading from here.

Changes in this version:
-----------------------
* Feature: [added] third letter for sub-type of field
* Feature: [added] new option - handle each/all error/s
* Feature: [added] new parameter - "handle_hidden_fields" in onSubmitCheck()
* Feature: [improved] filled array of diactric uppers

To view a Live Demo click here.

Friday, August 31, 2007

BETA version 4.1.8 of PHP DataGrid

The BETA version 4.1.8 of PHP DataGrid is available for downloading from here.

Main additions, changes and bugs fixed in this version you can read about in our forum.

Main additions and improvements:

* Feature: [added] new option (not documented): hide grid before serach
* Feature: [added] new parameter: "unique_condition" in add/edit modes
* Feature: [improved] uploading files
* Feature: [improved] ability to use virtual fields in "field_name" parameter for foreign keys ex.: "field_name"=>"CONCAT(name1, ', ', name2) as name3"

* Feature: [improved] added maxlength properties for textarea type
* Feature: [improved] removed updating readonly fields
* Feature: [improved] including javasript files
* Feature: [improved] language file
* Feature: [improved] getVariable method()

# Bug: [Fixed] missing unique prefix for onSubmitMyCheck
# Bug: [Fixed] language including error after search
# Bug: [Fixed] with & (added new data member - $amp)
# Bug: [Fixed] checking of current mode in noDataFound() method
# Bug: [Fixed] in bottom paging turning off
# Bug: [Fixed] showing calendar in add/edit modes when field is readonly
# Bug: [Fixed] the $directory wasn't added to the creation of export.csv and export.xml
# Bug: [Fixed] saves data between pade reloads, while uploading files in add/edit modes

etc.

You can get and test it NOW!!!.

Friday, July 13, 2007

BETA version 4.1.7 of PHP DataGrid

The BETA version 4.1.7 of PHP DataGrid is available for downloading from here.

Main additions, changes and bugs fixed in this version you can read about in our forum.

Main additions and improvements:
* Feature: [added] new method setJsErrorsDisplayStyle() and option to display
all error together
* Feature: [added] new option "textbox" in "view_type" for foreign keys
* Feature: [added] new field type in add/edit modes: "hidden"
* Feature: [added] new field type in add/edit/details modes: "delimiter"

* Feature: [improved] details/delete and multi-row columns have fixed width
* Feature: [improved] parameter "image_name" renamed in "file_name" for "image" and "file" types in add/edit/detail modes
* Feature: [improved] css classes naming and work
* Feature: [improved] encoding of data. Added collation parameter in setEncoding()
* Feature: [improved] debugger messaging system
* Feature: [improved] getting Primary Key and spliting strings in the code

# Bug: [Fixed] error if missing "req_type" parameter in add/edit/detail modes
# Bug: [Fixed] small bug with multi-row in details mode with tabular layout
# Bug: [Fixed] small bug in title for textarea
# Bug: [Fixed] small bug in setInterfaceLang()
# Bug: [Fixed] file uploading error in add mode
# Bug: [Fixed] wrong handling of "unique" parameter in add/edit mode
# Bug: [Fixed] highlighting small bug in view/details mode
# Bug: [Fixed] wrong fieldset width in view mode
# Bug: [Fixed] wrong ORDER BY parameter in SELECT SQL in add mode
# Bug: [Fixed] wrong alignment of foreign key output
# Bug: [Fixed] wrong displaying of datagrid in print preview in edit/detail modes
# Bug: [Fixed] css clas_a/class_a2 missed parameter
# Bug: [Fixed] missed unique prefix for cookie vars in hideUnHideFiltering() function
# Bug: [Fixed] unexpected 'http://'s in link type in view/detail modes

etc.

You can get and test it NOW!!!.

Friday, July 06, 2007

New Wiki format documentation for the DataGrid.

I've decided to improve documentation for DataGrid by using the Wiki. This also allow me to keep the documentation updated by the easiest way. From now you can see, edit or translate (if you wish, of course) all updated documentation in the Wiki format here:

Installation of PHP DataGrid

Getting Started

Saturday, June 30, 2007

BETA version 4.1.6 of PHP DataGrid

The BETA version 4.1.6 of PHP DataGrid is available for downloading from here.

Main additions, changes and bugs fixed in this version you can read about in our forum.

I've started to rewrite current "Installation" & "Step by Step" guides in the Wiki format. If you want to help me and other peoples, you are welcome to translate this page in other languages.

Main additions and improvements:
Feature: [added] new type "linktoedit" for view mode
Feature: [added] display order of columns defined by user, not by order in SELECT SQL
Feature: [added] new parameter "unique" for columns in edit mode
Feature: [added] new parameters for type texarea: "rows"=>"7" and "cols"=>"50"

Feature: [improved] method getRequestVars() renamed in getVariable()
Feature: [improved] downloading of export files
Feature: [improved] detecting filed properties while auto code generation
Feature: [improved] selecting and highlighting rows
Feature: [improved] removed unnecessary sql statments on updating/deleting

Bug: [Fixed] small bug in setModes() function
Bug: [Fixed] strtolower() small bug in some place
Bug: [Fixed] wrong URL after the click on 'Reset' button
Bug: [Fixed] missing WHERE in SQL SELECT error
Bug: [Fixed] LCASE error for Oracle and MSSQL
Bug: [Fixed] canceling of row highlighting, with click on delete button in IE
Bug: [Fixed] wrong syntax with NUMROWS processing for Oracle
Bug: [Fixed] syntax error in setSqlByDbType() and setSqlLimitByDbType()
Bug: [Fixed] FireFox error on carrying out multirow operations and pagging (&)
Bug: [Fixed] empty data error on required numeric fileds while updating
Bug: [Fixed] error on deleting last row from the last page

etc.

You can get and test it NOW!!!.

Friday, June 15, 2007

BETA version 4.1.5 of PHP DataGrid

The BETA version 4.1.5 of PHP DataGrid is available for downloading from here.

Main additions, changes and bugs fixed in this version you can read about in our forum.

Main additions and improvements:
- LIMIT/TOP/NUM_ROWS processing for different database types
- new parameter: "on_js_event"=>"" for Add/Edit/View Modes
- new type "link" for add/edit/details mode
- ability yo use some fields for default order in View Mode
- warnings messages system
- small image preview on uploading
- new parameter for image type: "image_name"=>"Image_Name"
- new parameters for foreign keys:
"order_by_field"=>"Field_Name" and "order_type"=>"ASC|DESC"

etc.

You can get and test it NOW!!!.

Also, -
special thanks to people sending me solutions for found bugs. :)

Friday, June 08, 2007

BETA version 4.1.4 of PHP DataGrid

The BETA version 4.1.4 of PHP DataGrid is available for downloading from here.

Main additions, changes and bugs fixed in this version you can read about in our forum.

Main additions and improvements:
- Auto columns generation
- Multy-rows view details
- export in XML format
- new methods: executeSQL() & selectSQL
- some new parameters for column types
- default values for fields
- new languages
- many things improved
- many bugs fixed (uploading for some files, working in firefox etc.)

So... get it NOW!!!.

Wednesday, May 23, 2007

BETA version 4.1.3 of PHP DataGrid

The BETA version 4.1.3 of PHP DataGrid is available for downloading from here.

Main additions, changes and fixed bugs in this version you can read in our forum.

Saturday, April 07, 2007

New version of PHP DataGrid - 4.1.0

New version 4.1.0 of PHP DataGrid is available for downloading from here.

Main changes in this version:
-----------------------
* Feature: columns summarising
* Feature: multi-row operations (delete)
* Feature: files uploading
and many other...

To view a Live Demo click here.

Friday, March 30, 2007

New version 1.0.3 of JS Auto Form Validator

New version 1.0.3 of JS Auto Form Validator is available for downloading from here.

Changes in this version:
-----------------------
* Feature: [added] background highlighting for non-valid fields
* Feature: [added] diacritic signs for text type fields

To view a Live Demo click here.

How You Can Help the PHP Builder Project

How You Can Help the PHP Builder Project

  • Write documentation for PHP DataGrid and/or JS AFV.

  • Create a new CSS style for PHP DataGrid.

  • Translate the PHP DataGrid and/or JS AFV into other languages.

  • Translate the documentation for PHP DataGrid and/or JS AFV into other languages.

  • Tell others about the PHP Builder Project by:

    • informing your friends about the PHP Builder Project and software.

    • adding a link of your web page, where the software was implemented on our live sites forum.


  • Becoming an active member/moderator of the PHP Builder forum.

  • Developmenting your own module and/or improving existing code for PHP DataGrid and/or JS AFV.

  • Write documentation for PHP Builder software.

  • Promote the PHP Builder software on other web sites.

  • Donate the PHP Builder Project.

Saturday, March 17, 2007

JS (JavaScript) Auto Form Validator v.1.0.2

JS (JavaScript) Auto Form Validator - is a script, which helps you to create pages, that needed form's validation.

The concept is simple: we heed to write NOTHING of javascript code for any html form. How can we do it?

By giving a special prefixes to form elements:

*** first letter :
r - required,
s - simple (not required)
*** second letter :
t - text(including datetime),
n - numeric,
a - alphanumeric,
e - email,
f - float,
y - any,
l - login,
z - zip code,
p - password,
i - integer,
v - verified


For example:
1. First Name:   <input name="rtFirstname" title="First Name">
creates a required validation of the text filed with checking if this filed is text

2. Password:  <input name="rpPassword" title="Password">
creates a required validation of the text filed with checking if this filed is a valid password (length, letters, digits etc.).

3. Confirm Password:  <input name="rvPassword" title="Confirm Password">
creates a required validation of the text filed with checking if this filed is a valid confirmation of the password (length, letters, digits etc.).


To view Live Demo click here

Version 1.0.2 is available for downloading here

Sunday, March 11, 2007

Version 4.1.0 and some more...

Thanks for all peoples who support this project and gives me suggestions, comments etc. It's really makes a lot for the project. Alone I could not create this script such convenient that it is.

OK, first of all, a very interesting thing that I have discovered again for myself: new version - new bugs :) It is nothing to do - life is life. But all of them was fixed and some of new features already added. I think v.4.1.0 will be ready on April 8, 2007. (It is preliminary date)

Also, if you use location version of PHP DataGrid and have translated it into your native language - send me your translation and I will add it to the nearest version. If you want, I can add some short info about the author(name, email or site URL).

Friday, March 09, 2007

Support PHP Builder, Make A Donation

Please make a donation if you enjoy using PHP DataGrid script or JS AFV and believe in the importance of what the PHP Builder project is working to accomplish.

There is the easy way to make a donation to the PHP Builder and support the project:

Donate once

If you have a major credit card (Visa, MasterCard, American Express) or a PayPal account, donating is easy. Just click the button below to get started:

Donate:


Other ways to help and support the PHP Builder project.

Thank you for supporting PHP Builder!

Thursday, March 01, 2007

New PHP DataGrid 4.0.0 version

Hi, everyone... The greatest event we've spoken about so long - has come.
From now - Version 4.0.0 - is available for downloading!

Two short remainders:
1) Remember! This is not an update version. If you use old version of PHP DataGrid - you need to reinstall it .
2) Only version 4.0.0 or above will be supported from now!


--------------------------------------------------------------




--------------------------------------------------------------
PHP DataGrid documentation for version 4.0.0
--------------------------------------------------------------


1. System Requirements
------------------------------
PHP DataGrid is operating system independent. You get it works
on both Linux and Windows. You need following components are
installed:

- PHP 4.0 script engine or later
- Apache 1.3 or above
- mySQL 3.23 or above


2. Lisencing
------------------------------
GNU GPL. See the GNU Lisence.txt file.


3. Installation
------------------------------
See more info about installation:
http://phpbuilder.blogspot.com/2007/02/installation-v400-or-above.html


4. Getting Started
------------------------------
See more info about getting started:
http://phpbuilder.blogspot.com/2007/02/step-by-step-v400-or-above.html


5. General Features
------------------------------
- CSS emb.templates
- Column sorting
- Filtering
- Pagging
- Automatic validation
-- Client side
- View mode
-- Tabular layout
-- Columnar layout
- Details mode
-- Columnar layout
- Add new mode
- Edit mode
-- Tabular layout
-- Columnar layout
- Delete mode
- Printing
- Exporting
- Multi-Database support
- Multi-Language support
- Multi-Browser support
- W3C CSS validation
- WYSIWYG editor

Wednesday, February 28, 2007

Code example for PHP DataGrid v.4.x.x

Data base schema:



Code example for DataGrid v.4.0.0:





<?

################################################################################
## +---------------------------------------------------------------------------+
## | 1. Creating & Calling: |
## +---------------------------------------------------------------------------+
define ("DATAGRID_DIR", "datagrid/");
define ("PEAR_DIR", "datagrid/pear/");

require_once(DATAGRID_DIR.'datagrid.class.php');
require_once(PEAR_DIR.'PEAR.php');
require_once(PEAR_DIR.'DB.php');
##
## *** creating variables that we need for database connection
$DB_USER='root'; /* usually like this: prefix_name */
$DB_PASS='12345'; /* must be already enscrypted (recommended) */
$DB_HOST='localhost'; /* usually localhost */
$DB_NAME='localhost_db'; /* usually like this: prefix_dbName */

ob_start();
## (example of ODBC connection string)
## $myDB =& DB::factory('odbc');
## $myDB -> connect(DB::parseDSN('odbc://root:12345@test_db'));
## (examples of connections to another db types see in "docs/db_odbtp.htm" file
## or check the latest version on - http://odbtp.sourceforge.net/DB_odbtp.html)
$db_conn =& DB::factory('mysql');
$db_conn -> connect(DB::parseDSN('mysql://'.$DB_USER.':'.$DB_PASS.'@'.$DB_HOST.'/'.$DB_NAME));
## *** put a primary key on the first place
$sql=" SELECT "
."tblCountries.CountryID, "
."tblRegions.Name as Region, "
."tblCountries.Name, "
."tblCountries.Description, "
."FORMAT(tblCountries.Population, 0) as Population, "
."tblCountries.PictureURL, "
."tblDemocracy.description as is_democracy "
."FROM tblCountries INNER JOIN tblRegions ON tblCountries.RegionID=tblRegions.RegionID "
."LEFT OUTER JOIN tblDemocracy ON tblCountries.is_democracy=tblDemocracy.did ";
## *** set needed options
$debug_mode = false;
$messaging = true;
$unique_prefix = "f_";
$dgrid = new DataGrid($debug_mode, $messaging, $unique_prefix, DATAGRID_DIR);
## *** set data source with needed options
$default_order_field = "CountryID";
$default_order_type = "DESC";
$dgrid->dataSource($db_conn, $sql, $default_order_field, $default_order_type);
##
##
## +---------------------------------------------------------------------------+
## | 2. General Settings: |
## +---------------------------------------------------------------------------+
## *** set encoding (default - utf8)
$dg_encoding = "utf8";
$dgrid->setEncoding($dg_encoding);
## *** set interface language (default - English)
$dg_language = "en"; // (en) - English, (de) - German, (hr) - Bosnian/Croatian
$dgrid->setInterfaceLang($dg_language);
## *** set direction: "ltr" or "rtr" (default - "ltr")
$direction = "ltr";
$dgrid->setDirection($direction);
## *** set layouts: 0 - tabular(horizontal) - default, 1 - columnar(vertical)
$layouts = array("view"=>0, "edit"=>1, "filter"=>1);
$dgrid->setLayouts($layouts);
## *** set other modes ("type" => "link|button|image")
## *** "byFieldValue"=>"fieldName" - make the field to be a link to edit mode page
$modes = array(
"add"=>array("view"=>true, "edit"=>false, "type"=>"link"),
"edit"=>array("view"=>true, "edit"=>true, "type"=>"link", "byFieldValue"=>""),
"cancel"=>array("view"=>true, "edit"=>true, "type"=>"link"),
"details"=>array("view"=>true, "edit"=>false, "type"=>"link"),
"delete"=>array("view"=>true, "edit"=>true, "type"=>"image")
);
$dgrid->setModes($modes);
## *** set CSS class for datagrid:
$css_class = "default"; // "default" or "blue" or "gray" or "green" or your css file relative path with name
$css_type = "embedded"; // "embedded" - use embedded classes, "file" - link external css file
$dgrid->setCssClass($css_class, $css_type);
## *** set variables that used to get access to the page (like: my_page.php?act=34&id=56 etc.)
$http_get_vars = array("act");
$dgrid->setHttpGetVars($http_get_vars);
## *** set another datagrid/s unique prefixes (if you use few datagrids on one page)
## *** format: array("unique_prefix"=>array("view"=>true|false, "edit"=>true|false, "details"=>true|false));
$anotherDatagrids = array("fp_"=>array("view"=>false, "edit"=>true, "details"=>true));
$dgrid->setAnotherDatagrids($anotherDatagrids);
## *** set DataGrid title
$dg_title = "My Favorite Lovely PHP DataGrid";
$dgrid->setTitle($dg_title);
##
##
## +---------------------------------------------------------------------------+
## | 3. Printing & Exporting Settings: |
## +---------------------------------------------------------------------------+
## *** set printing option: true(default) or false
$printing_option = true;
$dgrid->allowPrinting($printing_option);
## *** set exporting option: true(default) or false
$exporting_option = true;
$dgrid->allowExporting($exporting_option);
##
##
## +---------------------------------------------------------------------------+
## | 4. Sorting & Paging Settings: |
## +---------------------------------------------------------------------------+
## *** set sorting option: true(default) or false
$sorting_option = true;
$dgrid->allowSorting($sorting_option);
## *** set paging option: true(default) or false
$paging_option = true;
$rows_numeration = false;
$numeration_sign = "N #";
$dgrid->allowPaging($paging_option, $rows_numeration, $numeration_sign);
## *** set paging settings
$bottom_paging = array("results"=>true, "results_align"=>"left", "pages"=>true, "pages_align"=>"center", "page_size"=>true, "page_size_align"=>"right");
$top_paging = array();
$pages_array = array(10, 25, 50, 100, 250, 500, 1000);
$default_page_size = 10;
$dgrid->setPagingSettings($bottom_paging, $top_paging, $pages_array, $default_page_size);
##
##
## +---------------------------------------------------------------------------+
## | 5. Filter Settings: |
## +---------------------------------------------------------------------------+
## *** set filtering option: true or false(default)
$filtering_option = true;
$dgrid->allowFiltering($filtering_option);
## *** set fields in filtering mode:
$fill_from_array = array("10000", "250000", "5000000", "25000000", "100000000");
$filtering_fileds = array(
"Country" =>array("table"=>"tblCountries", "field"=>"Name", "data"=>"self", "operator"=>true, "type"=>"textbox", "case_sensitive"=>true, "comparison_type"=>"binary"),
"Region" =>array("table"=>"tblRegions", "field"=>"Name", "data"=>"self", "order"=>"DESC", "operator"=>true, "type"=>"dropdownlist", "case_sensitive"=>false, "comparison_type"=>"binary"),
"Date" =>array("table"=>"tblCountries", "field"=>"PictureURL", "data"=>"self", "operator"=>true, "type"=>"textbox", "case_sensitive"=>false, "comparison_type"=>"binary"),
"Population" =>array("table"=>"tblCountries", "field"=>"Population", "data"=>$fill_from_array, "order"=>"DESC", "operator"=>true, "type"=>"dropdownlist", "case_sensitive"=>false, "comparison_type"=>"numeric")
);
$dgrid->setFieldsFiltering($filtering_fileds);
##
##
## +---------------------------------------------------------------------------+
## | 6. View Mode Settings: |
## +---------------------------------------------------------------------------+
## *** set table properties
// $vm_table_properties = array("width"=>"90%");
// $dgrid->setViewModeTableProperties($vm_table_properties);
## *** set columns in view mode
$vm_colimns = array(
"Region" =>array("header"=>"Region Name", "type"=>"label", "align"=>"left", "wrap"=>"nowrap", "text_length"=>"-1", "case"=>"normal"),
"Name" =>array("header"=>"Country Name", "type"=>"lable", "align"=>"left", "wrap"=>"wrap", "text_length"=>"-1", "case"=>"normal"),
"Population" =>array("header"=>"Population", "type"=>"label", "align"=>"right", "wrap"=>"nowrap", "text_length"=>"-1", "case"=>"normal"),
"Description" =>array("header"=>"Short Description","type"=>"label", "align"=>"left", "wrap"=>"wrap", "text_length"=>"-1", "case"=>"lower"),
"PictureURL" =>array("header"=>"Picture", "type"=>"link", "align"=>"center", "wrap"=>"nowrap", "text_length"=>"-1", "field"=>"PictureURL", "prefix"=>"http://", "target"=>"_new", "case"=>"normal")
);
$dgrid->setColumnsInViewMode($vm_colimns);
##
##
## +---------------------------------------------------------------------------+
## | 7. Edit/Details Mode settings: |
## +---------------------------------------------------------------------------+
## *** set settings for edit/details mode
$table_name = "tblCountries";
$primary_key = "CountryID";
$dgrid->setTableEdit($table_name, $primary_key);
## *** set columns in edit mode
## *** first letter: r - required, s - simple (not required)
## *** second letter: t - text(including datetime), n - numeric, a - alphanumeric, e - email, f - float, y -any, l - login, p - password, i - integer, v - verified
## *** width - optional
$em_columns = array(
"RegionID" =>array("header"=>"Region", "type"=>"textbox", "width"=>"210px", "req_type"=>"rt", "title"=>"Region Name"),
"Name" =>array("header"=>"Country", "type"=>"textbox", "width"=>"210px", "req_type"=>"ry", "title"=>"Country Name"),
"Description" =>array("header"=>"Short Descr.", "type"=>"textarea", "width"=>"210px", "req_type"=>"rt", "title"=>"Short Description", "edit_type"=>"wysiwyg"),
"Population" =>array("header"=>"Peoples", "type"=>"textbox", "width"=>"139px", "req_type"=>"ri", "title"=>"Population(Peoples)"),
"PictureURL" =>array("header"=>"Image URL", "type"=>"textbox", "width"=>"210px", "req_type"=>"st", "title"=>"Image URL"),
"is_democracy" =>array("header"=>"Is Democracy", "type"=>"textbox", "width"=>"210px", "req_type"=>"sy", "title"=>"Is Democraty"),
"independentDate" =>array("header"=>"Independence Day", "type"=>"date", "width"=>"210px", "req_type"=>"rt", "title"=>"Independence Day")
);
$dgrid->setColumnsInEditMode($em_columns);
## *** set foreign keys for edit/details mode (if there are linked tables)
$foreign_keys = array(
"RegionID"=>array("table"=>"tblRegions", "field_key"=>"RegionID", "field_name"=>"Name", "view_type"=>"dropdownlist"),
"is_democracy"=>array("table"=>"tblDemocracy ", "field_key"=>"did", "field_name"=>"description", "view_type"=>"radiobutton")
);
$dgrid->setForeignKeysEdit($foreign_keys);
##
##
## +---------------------------------------------------------------------------+
## | 8. Bind the DataGrid: |
## +---------------------------------------------------------------------------+
## *** set debug mode & messaging options
$dgrid->bind();
ob_end_flush();
##
################################################################################


// if we in EDIT mode of the first datagrid
if(isset($_GET['f_mode']) && (($_GET['f_mode'] == "edit") || ($_GET['f_mode'] == "details"))){

################################################################################
## +---------------------------------------------------------------------------+
## | 1. Creating & Calling: |
## +---------------------------------------------------------------------------+

ob_start();
## *** put a primary key on the first place
$sql=" SELECT "
."tblPresidents.presidentID, "
."tblPresidents.CountryID, "
."tblPresidents.Name, "
."tblPresidents.BirthDate, "
."tblPresidents.Status "
."FROM tblPresidents INNER JOIN tblCountries ON tblPresidents.CountryID=tblCountries.CountryID "
."WHERE tblPresidents.CountryID = ".$dgrid->rid." ";

## *** set needed options
$debug_mode = false;
$messaging = true;
$unique_prefix = "fp_";
$dgrid1 = new DataGrid($debug_mode, $messaging, $unique_prefix, DATAGRID_DIR);
## *** set data source with needed options
$default_order_field = "presidentID";
$default_order_type = "DESC";
$dgrid1->dataSource($db_conn, $sql, $default_order_field, $default_order_type);
##
##
## +---------------------------------------------------------------------------+
## | 2. General Settings: |
## +---------------------------------------------------------------------------+
## *** set encoding (default - utf8)
$dg_encoding = "utf8";
$dgrid1->setEncoding($dg_encoding);
## *** set interface language (default - English)
$dg_language = "en"; // (en) - English, (de) - German, (hr) - Bosnian/Croatian
$dgrid1->setInterfaceLang($dg_language);
## *** set direction: "ltr" or "rtr" (default - "ltr")
$direction = "ltr";
$dgrid1->setDirection($direction);
## *** set layouts: 0 - tabular(horizontal) - default, 1 - columnar(vertical)
$layouts = array("view"=>0, "edit"=>0, "filter"=>1);
$dgrid1->setLayouts($layouts);
## *** set other modes ("type" => "link|button|image")
## *** "byFieldValue"=>"fieldName" - make the field to be a link to edit mode page
if($_GET['f_mode'] == "edit"){
$modes = array(
"add"=>array("view"=>true, "edit"=>false, "type"=>"link"),
"edit"=>array("view"=>true, "edit"=>true, "type"=>"link", "byFieldValue"=>""),
"cancel"=>array("view"=>true, "edit"=>true, "type"=>"link"),
"details"=>array("view"=>false, "edit"=>false, "type"=>"link"),
"delete"=>array("view"=>true, "edit"=>false, "type"=>"image")
);
}else{
$modes = array(
"add"=>array("view"=>false, "edit"=>false, "type"=>"link"),
"edit"=>array("view"=>false, "edit"=>false, "type"=>"link", "byFieldValue"=>""),
"cancel"=>array("view"=>false, "edit"=>true, "type"=>"link"),
"details"=>array("view"=>false, "edit"=>false, "type"=>"link"),
"delete"=>array("view"=>false, "edit"=>false, "type"=>"image")
);
}
$dgrid1->setModes($modes);
## *** set CSS class for datagrid:
$css_class = "default"; // "default" or "gray" or "like adwords" or "salomon" or your css file relative path with name
$css_type = "embedded"; // "embedded" - use embedded classes, "file" - link external css file
$dgrid1->setCssClass($css_class, $css_type);
## *** set variables that used to get access to the page (like: my_page.php?act=34&id=56 etc.)
$http_get_vars = array("act");
$dgrid1->setHttpGetVars($http_get_vars);
## *** set another datagrid/s unique prefixes (if you use few datagrids on one page)
## *** format: array("unique_prefix"=>array("view"=>true|false, "edit"=>true|false, "details"=>true|false));
$anotherDatagrids = array("f_"=>array("view"=>true, "edit"=>true, "details"=>true));
$dgrid1->setAnotherDatagrids($anotherDatagrids);
## *** set DataGrid title
$dg_title = "Presidents";
$dgrid1->setTitle($dg_title);
##
##
## +---------------------------------------------------------------------------+
## | 3. Printing & Exporting Settings: |
## +---------------------------------------------------------------------------+
## *** set printing option: true(default) or false
$printing_option = false;
$dgrid1->allowPrinting($printing_option);
## *** set exporting option: true(default) or false
$exporting_option = false;
$dgrid1->allowExporting($exporting_option);
##
##
## +---------------------------------------------------------------------------+
## | 4. Sorting & Paging Settings: |
## +---------------------------------------------------------------------------+
## *** set sorting option: true(default) or false
$sorting_option = true;
$dgrid1->allowSorting($sorting_option);
## *** set paging option: true(default) or false
$paging_option = true;
$rows_numeration = false;
$numeration_sign = "N #";
$dgrid1->allowPaging($paging_option, $rows_numeration, $numeration_sign);
## *** set paging settings
$bottom_paging = array();
$top_paging = array();
$pages_array = array(10, 25, 50, 100, 250, 500, 1000);
$default_page_size = 10;
$dgrid1->setPagingSettings($bottom_paging, $top_paging, $pages_array, $default_page_size);
##
##
## +---------------------------------------------------------------------------+
## | 6. View Mode Settings: |
## +---------------------------------------------------------------------------+
## *** set table properties
$vm_table_properties = array("width"=>"70%");
$dgrid1->setViewModeTableProperties($vm_table_properties);
## *** set columns in view mode
$vm_colimns = array(
"Name" =>array("header"=>"Name", "type"=>"lable", "align"=>"left", "wrap"=>"wrap", "text_length"=>"20", "case"=>"normal"),
"BirthDate" =>array("header"=>"Birth Date", "type"=>"label", "align"=>"center", "wrap"=>"nowrap", "text_length"=>"-1", "case"=>"normal"),
"Status" =>array("header"=>"Status", "type"=>"label", "align"=>"center", "wrap"=>"nowrap", "text_length"=>"30", "case"=>"normal")
);
$dgrid1->setColumnsInViewMode($vm_colimns);
##
##
## +---------------------------------------------------------------------------+
## | 7. Edit/Details Mode settings: |
## +---------------------------------------------------------------------------+
## *** set settings for edit/details mode
$table_name = "tblPresidents";
$primary_key = "presidentID";
$dgrid1->setTableEdit($table_name, $primary_key);
## *** set columns in edit mode
## *** first letter: r - required, s - simple (not required)
## *** second letter: t - text(including datetime), n - numeric, a - alphanumeric, e - email, f - float, y -any, l - login, p - password, i - integer, v - verified
## *** width - optional
$em_columns = array(
"CountryID" =>array("header"=>"Country", "type"=>"textbox", "width"=>"210px", "req_type"=>"ri", "title"=>"Country"),
"Name" =>array("header"=>"Name", "type"=>"textbox", "width"=>"140px", "req_type"=>"ry", "title"=>"Name"),
"BirthDate" =>array("header"=>"Birth Date", "type"=>"date", "width"=>"80px", "req_type"=>"rt", "title"=>"Birth Date"),
"Status" =>array("header"=>"Status", "type"=>"enum", "width"=>"210px", "req_type"=>"st", "title"=>"Status")
);
$dgrid1->setColumnsInEditMode($em_columns);
## *** set foreign keys for edit/details mode (if there are linked tables)
$foreign_keys = array(
"CountryID"=>array("table"=>"tblCountries ", "field_key"=>"CountryID", "field_name"=>"Name", "view_type"=>"dropdownbox", "condition"=>"")
);
$dgrid1->setForeignKeysEdit($foreign_keys);
##
##
## +---------------------------------------------------------------------------+
## | 8. Bind the DataGrid: |
## +---------------------------------------------------------------------------+
## *** set debug mode & messaging options
$dgrid1->bind();
ob_end_flush();
##
################################################################################

}

?>

Tuesday, February 27, 2007

Installation (v.4.0.0 or above)

PHP DataGrid - Step by Step.

NEW INSTALLATION (for version 4.0.0 or above)
A new installation of PHP DataGrid is a very straight forward process:
========================================================

Step 1.
--------------------------------------------------------

Uncompress the PHP DataGrid version 4.x.x script archive.
The archive will create a directory called "datagrid_4_x_x"

Step 2.
--------------------------------------------------------

Upload content of this folder (all files and directories it includes)
to your document root (public_html, www, htdocs etc.) using FTP.

For example:
public_html/your_site/datagrid


Step 3.
--------------------------------------------------------

Using phpMyAdmin or another tool, create your database and user,
and assign that user to the database. Write down the name of the database,
username, and password for the database installation procedure.

Create all appropriate database tables.

Step 4.
--------------------------------------------------------

Open code_template.php file, uncomment these 4 lines and change variable
values on yours (saved on step 3).


// $DB_USER='name'; /* usually like this: prefix_name */
// $DB_PASS=''; /* must be already enscrypted (recommended) */
// $DB_HOST='localhost'; /* usually localhost */
// $DB_NAME='dbName'; /* usually like this: prefix_dbName */


Define a relative path to datagrid.class.php file and "pear" directory
(relatively to the code_template.php file).

// define ("DATAGRID_DIR", ""); /* Ex.: "datagrid/" */
// define ("PEAR_DIR", "pear/"); /* Ex.: "datagrid/pear/" */
//
// require_once(DATAGRID_DIR.'datagrid.class.php');
// require_once(PEAR_DIR.'PEAR.php');
// require_once(PEAR_DIR.'DB.php');


Step 5.
--------------------------------------------------------

Rename code_template.php file according to your needs.

Congradulations, you now have PHP DataGrid v.4.0.0. Installed!

Saturday, February 24, 2007

Step by Step (v.4.0.0. or above)

PHP DataGrid - Getting Started (for version 4.0.0 or above).

Step 1.
+---------------------------------------------------------------------------+
| Creating & Calling:
+---------------------------------------------------------------------------+

Be sure you write here a right path to the datagrid.class.php file, relatively to code_template.php, PEAR.php and DB.php files. Relative path is recommended,
but you can use a physical path too. Example:
define ("PEAR_DIR", "C:\\Apache2\\htdocs\\dgproject\\datagrid\\pear\\");


define ("DATAGRID_DIR", ""); /* Ex.: "datagrid/" */
define ("PEAR_DIR", "pear/"); /* Ex.: "datagrid/pear/" */

require_once(DATAGRID_DIR.'datagrid.class.php');
require_once(PEAR_DIR.'PEAR.php');
require_once(PEAR_DIR.'DB.php');


Put right values to these variables. Be sure, you use a prefix if you need it.

## *** creating variables that we need for database connection


$DB_USER='name'; /* usually like this: prefix_name */
$DB_PASS=''; /* must be already enscrypted (recommended) */
$DB_HOST='localhost'; /* usually localhost */
$DB_NAME='dbName'; /* usually like this: prefix_dbName */


First of all, we need to be connected to our database.

ob_start();
## *** (example of ODBC connection string)
## *** $result_conn = $db_conn -> connect(DB::parseDSN('odbc://root:12345@test_db'));
## *** (example of Oracle connection string)
## *** $result_conn = $db_conn -> connect(DB::parseDSN('oci8://root:12345@localhost:1521/mydatabase));
## *** (example of PostgreSQL connection string)
## *** $result_conn = $db_conn -> connect(DB::parseDSN('pgsql://root:12345@localhost/mydatabase));
## === (Examples of connections to other db types see in "docs/pear/" folder)


$db_conn =& DB::factory('mysql');
$result_conn = $db_conn -> connect(DB::parseDSN('mysql://'.$DB_USER.':'.$DB_PASS.'@'.$DB_HOST.'/'.$DB_NAME));
if(DB::isError($result_conn)){
die($result_conn->getMessage());
}


Now you have to prepare the SELECT SQL statement. It can be any type of SELECT statement your database supports (with JOIN, UNION etc.), but you must put the primary key on the first place. Also be careful to write all fileds you need them to be shown, because the DataGrid class works with only on fields that you placed in SELECT statement.
Don't add here ORDER BY, LIMIT words or ; at the end of the statement.

## *** put a primary key on the first place


$sql = "SELECT primary_key, filed_1, filed_2 ... FROM tableName ";


Creating the new class instance and linking the DataGrid class to our database.

## *** set needed options and create new class instance

// display SQL statements while processing
$debug_mode = false;
// display system messages on a screen
$messaging = true;
// prevent overlays
$unique_prefix = "_abc";

$dgrid = new DataGrid($debug_mode, $messaging, $unique_prefix, DATAGRID_DIR);


Now we need to set data source for the Grid

## *** set data source with needed options

Make default(first) ordering by thid field
$default_order_field = "field_name";
Default field order type
$default_order_type = "ASC|DESC";

$dgrid->dataSource($db_conn, $sql, $default_order_field, $default_order_type);



Step 2.
+---------------------------------------------------------------------------+
| General Settings:
+---------------------------------------------------------------------------+

We can add an unique prefix (optional) to our datagrid if we want to prevent
using of double names on this page (in case, when you use some datagrids or
forms on one page)

## *** set unique prefix

$u_prefix = "_abc";
$dgrid->setUniqueNames($u_prefix);


If you want to use a local language (not English) - you have to set the right
encoding. The properly fields in your database must be created with the same CHARACTER SET too. Also you need to define in your file: header('Content-type: text/html; charset=XXXX'); where xxxx ISO-8859-1 or UTF-8 or whatever you have.

## *** set encoding (default - utf8)

$dg_encoding = "utf8";
$dgrid->setEncoding($dg_encoding);


Option for some right-to-left languages (Hebrew, Arabic etc.)

## *** set direction: "ltr" or "rtr" (default - ltr)

$direction = "ltr";
$dgrid->setDirection($direction);


Set layouts for datagrid in view or edit mode and for the filtering block

## *** set layouts: 0 - tabular(horizontal) - default, 1 - columnar(vertical)

$layouts = array("view"=>0, "edit"=>1, "filter"=>1);
$dgrid->setLayouts($layouts);


Set various modes for datagrid.
True - allow the operation in this mode("view" or "edit"), false - don't allow.
Type - a type of command button (link, html button or image).
byFieldValue - if you want to make this field to be a link to edit mode page
(instead of edit button), write here a name of the field. If you want to use a standart edit command button leave it empty: "byFieldValue"=>""

## *** set other modes ("type" = "link|button|image"),
## *** ("byFieldValue" - make the field as a link to edit mode page)

$modes = array(
 "add"=>array("view"=>true, "edit"=>false, "type"=>"link"),
 "edit"=>array("view"=>true, "edit"=>true, "type"=>"link",  "byFieldValue"=>"FieldName"),
 "cancel"=>array("view"=>true, "edit"=>true, "type"=>"link"),
 "details"=>array("view"=>true, "edit"=>false, "type"=>"link"),
 "delete"=>array("view"=>true, "edit"=>true, "type"=>"image")
);
$dgrid->setModes($modes);


Set scrolling settings and parameters for DataGrid. If you want the DataGrid will
be displayed with scrolling, allow this option by the next commands.

## *** allow scrolling on datagrid
$scrolling_option = false;
$dgrid->allowScrollingSettings($scrolling_option);

## *** set scrolling settings (optional)
$scrolling_width = "90%";
$scrolling_height = "100%";
$dgrid->setScrollingSettings($scrolling_width, $scrolling_height);


If you want to allow multirow operations for DataGrid, set $multirow_option = true;

## *** allow mulirow operations
$multirow_option = false;
$dgrid->allowMultirowOpeartions($multirow_option);


Set CSS parameters for the datagrid. If you want to use embedded css class - define
$css_type as "embedded" and $css_class as you wish. If you use an external file of
CSS styles - you define $css_type as "file" and $css_class as full path to your
file.
For example: $css_class = "css/style.css".
Embedded CSS styles: "default", "blue", "gray" and "green".


## *** set CSS class for datagrid:

// "default" or "blue" or "gray" or "green" or your css file relative path with name
$css_class = "default";
// "embedded" - use embedded classes, "file" - link external css file
$css_type = "embedded";
$dgrid->setCssClass($css_class, $css_type);


Set variables that you use to get acces to your page

## *** set variables that used to get access to the page
## *** (like: my_page.php?act=34&id=56 etc.)

$http_get_vars = array("act", "id");
$dgrid->setHttpGetVars($http_get_vars);


If you want to use some PHP DataGrid on your page, you need to define properties for another datagrid/s

## *** set another datagrid/s unique prefixes (if you use few datagrids on one page)
## *** format (in wich mode to allow processing of another datagrids)
## *** array("unique_prefix"=>array("view"=>true|false, "edit"=>true|false, "details"=>true|false), [,...]);

$anotherDatagrids = array("abcd_"=>array("view"=>true, "edit"=>true, "details"=>true));
$dgrid->setAnotherDatagrids($anotherDatagrids);


Set datagrid title (caption)

## *** set DataGrid caption

$dg_caption = "My Favorite Lovely PHP DataGrid";
$dgrid->setCaption($dg_caption);



Step 3.
+---------------------------------------------------------------------------+
| Printing & Exporting Settings:
+---------------------------------------------------------------------------+

Set printing as true, if you want to allow this option

## *** set printing option: true(default) or false

$printing_option = true;
$dgrid->allowPrinting($printing_option);


Set exporting as true, if you want to allow this option

## *** set exporting option: true(default) or false

$exporting_option = true;
$dgrid->allowExporting($exporting_option);



Step 4.
+---------------------------------------------------------------------------+
| Sorting & Paging Settings:
+---------------------------------------------------------------------------+

Set sorting option as true, if you want to allow sorting on columns

## *** set sorting option: true(default) or false

$sorting_option = true;
$dgrid->allowSorting($sorting_option);


Set paging option as true, if you want to allow paging on datagrid

## *** set paging option: true(default) or false

$paging_option = true;
$rows_numeration = false;
$numeration_sign = "N #";
$dgrid->allowPaging($paging_option, $rows_numeration, $numeration_sign);


Set aditional paging settings. $top_paging or $bottom_paging both defines paging
(top and bottom) behaviour. We have three parts of the paging line: results, pages and
page size dropdownbox. You need to set parameters for each of them. If you don't want to show any of them or all of them - leave it empty (Ex.: $bottom_paging = array() or $bottom_paging = array("pages"=>true, "pages_align"=>"left");).If you want to define your own dropdown box with page sizes - you can make it in $pages_array array- see example below. Also you need to define default page size in $default_page_size variable.

## *** set paging settings

$bottom_paging = array("results"=>true, "results_align"=>"left", "pages"=>true, "pages_align"=>"center", "page_size"=>true, "page_size_align"=>"right");
$top_paging = array("results"=>true, "results_align"=>"left", "pages"=>true, "pages_align"=>"center", "page_size"=>true, "page_size_align"=>"right");
$pages_array = array(10, 25, 50, 100, 250, 500, 1000);
$default_page_size = 10;
$dgrid->setPagingSettings($bottom_paging, $top_paging, $pages_array, $default_page_size);



Step 5.
+---------------------------------------------------------------------------+
| 5. Filter Settings:
+---------------------------------------------------------------------------+

If you want to allow a filtering mode, set $filtering_option as true.

## *** set filtering option: true or false(default)


$filtering_option = true;
$dgrid->allowFiltering($filtering_option);


Set aditional filtering settings.
"FieldName_1/2/3/.../n"=> - field on which will be made the filtering
"table"=>"tableName_1/2/3/.../n"
"field"=>"fieldName_1/2/3/.../n" - table and field with the filtered field is linked
"source"=>"self"|$fill_from_array - take a values from specific array or not
"operator"=>false|true - draw comparison operators dropdown list or not
"order"=>"ASC|DESC" - dropdown list values order (optional)
"type"=>"textbox|dropdownlist" - view type of filtering filed (textbox - default)
"case_sensitive"=>false|true - whether filtering is case sensitive
"comparison_type"=>"string|numeric|binary" - filtering comparison type

## *** set aditional filtering settings


$fill_from_array = array("1", "2", "3", "4", "5");
$filtering_fields = array(
"FieldName_1"=>array("table"=>"tableName_1", "field"=>"fieldName_1", "source"=>"self"|$fill_from_array, "operator"=>false|true, "order"=>"ASC|DESC", "type"=>"textbox|dropdownlist", "case_sensitive"=>false|true, "comparison_type"=>"string|numeric|binary"),
"FieldName_2"=>array("table"=>"tableName_2", "field"=>"fieldName_2", "source"=>"self"|$fill_from_array, "operator"=>false|true, "order"=>"ASC|DESC", "type"=>"textbox|dropdownlist", "case_sensitive"=>false|true, "comparison_type"=>"string|numeric|binary"),
"FieldName_3"=>array("table"=>"tableName_3", "field"=>"fieldName_3", "source"=>"self"|$fill_from_array, "operator"=>false|true, "order"=>"ASC|DESC", "type"=>"textbox|dropdownlist", "case_sensitive"=>false|true, "comparison_type"=>"string|numeric|binary")
);
$dgrid->setFieldsFiltering($filtering_fields);



Step 6.
+---------------------------------------------------------------------------+
| 6. View Mode Settings:
+---------------------------------------------------------------------------+



## *** set table properties

$vm_table_properties = array("width"=>"90%");
$dgrid->setViewModeTableProperties($vm_table_properties);

This method sets up columns, that will be viewable.
For all types:
"header"=>"..." - name of the column header
"type"=>"..." - type of column: label, image, linktoview, link (http://, mailto:) or password
"align"=>"..." - alignment of the column (left or right)
"width"=>"..." - width of column in pixels or in percents
"wrap"=>"..." - wraping of the column data (wrap or nowrap)
"text_length"=>"..." - viewable length of text in characters (any integer number - truncate after this number of characters, "-1" - don't truncate )
"case"=>"..." - text case (normal, upper or lower)
"summarize"=>... - summarize values in this column (true or false)
For link type:
"field_key"=>"..." - field for href parameter in <a href="field_key">
"field_data"=>"..." - field for <a href="">field_data</a>
"href"=>"..." - href parameter, {0} will be chaanged on "field_key" value
"target"=>"..." - target parameter


## *** set columns in view mode

$vm_colimns = array(
"FieldName_1"=>array("header"=>"Name_A", "type"=>"label", "align"=>"left", "width"=>"X%|Xpx", "wrap"=>"wrap|nowrap", "text_length"=>"-1", "case"=>"normal|upper|lower", "summarize"=>true|false),
"FieldName_2"=>array("header"=>"Name_B", "type"=>"image", "align"=>"left", "width"=>"X%|Xpx", "wrap"=>"wrap|nowrap", "text_length"=>'-1', "case"=>"normal|upper|lower", "summarize"=>true|false),
"FieldName_3"=>array("header"=>"Name_C", "type"=>"linktoview", "align"=>"left", "width"=>"X%|Xpx", "wrap"=>"wrap|nowrap", "text_length"=>'-1', "case"=>"normal|upper|lower", "summarize"=>true|false),
"FieldName_4"=>array("header"=>"Name_D", "type"=>"link", "align"=>"left", "width"=>"X%|Xpx", "wrap"=>"wrap|nowrap", "text_length"=>"-1", "case"=>"normal|upper|lower", "summarize"=>true|false, "field_key"=>"field_name_1", "field_data"=>"field_name_2", "href"=>"{0}", "target"=>"_new"),
"FieldName_5"=>array("header"=>"Name_E", "type"=>"link", "align"=>"left", "width"=>"X%|Xpx", "wrap"=>"wrap|nowrap", "text_length"=>"-1", "case"=>"normal|upper|lower", "summarize"=>true|false, "field_key"=>"field_name_1", "field_data"=>"field_name_2", "href"=>"mailto:{0}", "target"=>"_new"),
"FieldName_6"=>array("header"=>"Name_F", "type"=>"link", "align"=>"left", "width"=>"X%|Xpx", "wrap"=>"wrap|nowrap", "text_length"=>"-1", "case"=>"normal|upper|lower", "summarize"=>true|false, "field_key"=>"field_name_1", "field_data"=>"field_name_2", "href"=>"http://mydomain.com?act={0}&code=ABC", "target"=>"_new"),
"FieldName_7"=>array("header"=>"Name_G", "type"=>"password", "align"=>"left", "width"=>"X%|Xpx", "wrap"=>"wrap|nowrap", "text_length"=>"-1", "case"=>"normal|upper|lower", "summarize"=>true|false),
"FieldName_8"=>array("header"=>"Name_H", "type"=>"barchart", "align"=>"left", "width"=>"X%|Xpx", "wrap"=>"wrap|nowrap", "text_length"=>"-1", "case"=>"normal|upper|lower", "summarize"=>true|false, "field"=>"field_name", "maximum_value"=>"value")
);
$dgrid->setColumnsInViewMode($vm_colimns);


To be continued...

Live Demo v.4.0.0.

You can see now Live Demo of the version 4.0.0.

Also version vomparison is available, too...

Monday, February 05, 2007

Some tasty things from the nearest version...

They are:

-- PEAR (multiple database supporting)
-- WYSIWYG editor for <teaxarea> fields
-- print mode
-- export mode
-- 2 or more datagrids on one page

and etc.

I think it's a really tasty things.... U-u-u-ah!
Date of v.4.0.0 release - 1.03.07!

By the way, you can see here all version comparison (including v 4.x.x).