Class: DatabaseFacet

A package for generating multi-faceted browsing interfaces for web sites. A facet
will look something like this:

Browse by Section
-----------------
Local(16), Sports(24),
World(21)


Usage Example


<?php

loader_import 
('saf.Database.Facet');

$facet = new DatabaseFacet (db_table ('products''id'), 'category''Category');

$facet->compile ();

echo 
$facet->show ();

?>

Return to Top



Properties


$connection

  • Access: public

Contains the database connection resource.


$path

  • Access: public

Path to the Berkeley Database.


$mode

  • Access: public

Mode to use when opening the database (corresponds to
the modes available to the dba_open () function.


$handler

  • Access: public

The database implementation used (db2, db3, gdbm, etc.).


$persistent

  • Access: public

A 1 or 0 (true or false, and true by default), specifying whether
to establish a persistent connection or not.


$transactions = 0

  • Access: public

Boolean value denoting whether to enable transactions in the
current database.


$driver

  • Access: public

Contains the name of the database driver being used.


$host

  • Access: public

Contains the name of the database host.


$name

  • Access: public

Contains the name of the database being used.


$user

  • Access: public

Contains the username used to connect to the current database.


$pass

  • Access: public

Contains the password used to connect to the current database.


$dbd

  • Access: private

Contains the loaded database driver.


$error = false

  • Access: public

Contains connection error information.


$sql = ''

  • Access: public

Contains the SQL query to be executed.


$rows

  • Access: public

Contains the number of rows returned by the previous fetch() call.


$lastid

  • Access: public

Contains the lastid() of the last insert query sent to the execute()
method.


$tables = false

  • Access: public

Contains a list of tables in the database. Set by getTables().


$pearEmu = false


$sequenceFormat = '%s_seq'


$fetchMode = DB_FETCHMODE_OBJECT


$result = ''

  • Access: public

Contains the result identifier for the current execution.


$field = ''

  • Access: public

Currently unused.


$_fetchModeFunctions = array (
        
DB_FETCHMODE_ASSOC        => 'mysql_fetch_array',
        
DB_FETCHMODE_OBJECT        => 'mysql_fetch_object',
    )


$typemap = array (
        
'bpchar'                    => 'text',
        
'char'                        => 'text',
        
'varchar'                    => 'text',
        
'text'                        => 'textarea',

        
'date'                        => 'date',
        
'time'                        => 'time',
        
'timestamp'                    => 'datetime',
        
'.*'                        => 'text',

        
// arrays
        // booleans
        // blobs
    
)

  • Access: public

Contains a key/value list of database types (regular
expressions are used here to save repeating ourselves) and their
corresponding MailForm widget types.


$column

  • Access: public

Column name of the facet.


$title

  • Access: public

Dispaly name of the facet.


$extra

  • Access: public

Extra info about the facet.


$tableObj

  • Access: public

DatabaseTable object.


$items = array ()

  • Access: public

List of options in the facet.


$type = 'normal'

  • Access: public

Type of the facet. Possible values are 'normal', 'self_ref', 'date', and 'time'.
This value is auto-determined by compile(), but can be customized as well.

Return to Top



Methods


DatabaseFacet (&$tableObj, $column, $title, $extra = '')

  • Access: public

Constructor method.


compile ()

  • Access: public

Compile the facet options from the database.


addItem ($id, $title, $count = 0)

  • Access: public

Add an item to the list. Used internally by compile().


show ($linkUrl = '?')

  • Access: public
  • Return: string

Render the facet to HTML.

Return to Top

Copyright © 2008 Sitellite CMS Project

Powered by Sitellite 5.0 Content Management System