/** * Renderer driver factory * * Load and instantiate a renderer driver. * * @access private * @param mixed $source The rendering container respective to the driver * @param array $options An associative array of the form: * array(optionName => optionValue, ...) * @param string $type The renderer type constant (of the form * DATAGRID_RENDER_*) * @uses Structures_DataGrid_DataSource::_detectRendererType() * @return mixed Returns the renderer driver object or * PEAR_Error on failure */ function &rendererFactory($type, $options = array()) { $type = Structures_DataGrid::_correctDriverName($type, 'Renderer'); if (PEAR::isError($type)) { return $type; } $className = "Structures_DataGrid_Renderer_{$type}"; if (PEAR::isError($driver =& Structures_DataGrid::loadDriver($className))) { return $driver; } if ($options) { $driver->setOptions((array) $options); } return $driver; }
/** * Smarty custom function "getPaging" * * This is only meant to be called from a smarty template, using the * expression: {getPaging <options>} * * <options> are any Pager::factory() options * * @param array $params Options passed from the Smarty template * @param object $smarty Smarty object * @return string Paging HTML links * @access private */ function _smartyGetPaging($params, &$smarty) { // Load and get output from the Pager rendering driver $driver =& Structures_DataGrid::loadDriver('Structures_DataGrid_Renderer_Pager'); // Propagate the selfPath option. Do not override user params if (!isset($params['path']) && !isset($params['filename'])) { $params['path'] = dirname($this->_options['selfPath']); $params['fileName'] = basename($this->_options['selfPath']); $params['fixFileName'] = false; } $driver->setupAs($this, $params); $driver->build(array(), 0); return $driver->getOutput(); }