, * Olivier Guilyardi , * Mark Wiesemann * Sascha Grossenbacher * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * The names of the authors may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * CSV file id: $Id$ * * @version $Revision: 1.85 $ * @package Structures_DataGrid * @category Structures * @license http://opensource.org/licenses/bsd-license.php New BSD License */ /** * Base class of all Renderer drivers * * SUPPORTED OPTIONS: * * - buildHeader: (bool) Whether to build the header. * - buildFooter: (bool) Whether to build the footer. * - fillWithEmptyRows: (bool) Ensures that all pages have the same number of * rows. * - numberAlign: (bool) Whether to right-align numeric values. * - defaultCellValue: (string) What value to put by default into empty cells. * - defaultColumnValues: (array) Per-column default cell value. This is an array * of the form: array(fieldName => value, ...). * - hideColumnLinks: (array) By default sorting links are enabled on all * columns. With this option it is possible to * disable sorting links on specific columns. This * is an array of the form: array(fieldName, ...). * This option only affects drivers that support * sorting. * - encoding: (string) The content encoding. If the mbstring extension * is present the default value is set from * mb_internal_encoding(), otherwise it is ISO-8859-1. * - extraVars: (array) Variables to be added to the generated HTTP * queries. * - excludeVars: (array) Variables to be removed from the generated * HTTP queries. * - columnAttributes: (array) Column cells attributes. This is an array of * the form: * array(fieldName => array(attribute => value, ...) ...) * This option is only used by XML/HTML based * drivers. * - onMove: (string) Name of a Javascript function to call on * onClick/onSubmit events when the user is either paging * or sorting the data. This function * receives a single object argument of the * form: { page: , sort: [{field: , * direction: }, ...], * data: }. Remark: setting this * option doesn't remove the href attribute, * you should return false from your handler * function to void it (eg: for AJAX, etc..). * - onMoveData: (string) User data passed in the "data" member of the * object argument passed to onMove. No JSON * serialization is performed, this is assigned * as a raw string to the "data" attribute. * It's up to you to add quotes, slashes, etc... * * --- DRIVER INTERFACE --- * * Methods (none required): * - Constructor * - setContainer() * - getContainer() * - init() * - defaultCellFormatter() * - buildHeader() * - buildBody() * - buildRow() * - buildEmptyRow() * - buildFooter() * - finalize() * - flatten() * - render() * - getPaging() (deprecated) * * Properties (all read-only): * - $_columns * - $_columnsNum * - $_currentSort * - $_firstRecord * - $_lastRecord * - $_multiSort * - $_options * - $_page * - $_pageLimit * - $_pagesNum * - $_records * - $_recordsNum * - $_requestPrefix * - $_sortableFields * - $_totalRecordsNum * * Options that drivers may handle: * - encoding * - fillWithEmptyRows * - numberAlign * - extraVars * - excludeVars * * @version $Revision: 1.85 $ * @author Olivier Guilyardi * @author Mark Wiesemann * @author Sascha Grossenbacher * @access public * @package Structures_DataGrid * @category Structures * @abstract */ class Structures_DataGrid_Renderer { /** * Columns' fields names and labels * * Drivers can read the content of this property but must not change it. * * @var array Structure: * array( => array(field => , * label=>