Translation2
[ class tree: Translation2 ] [ index: Translation2 ] [ all elements ]

Class: Translation2_Container_dataobjectsimple

Source Location: /Translation2-2.0.0beta8/Container/dataobjectsimple.php

Class Overview

Translation2_Container
   |
   --Translation2_Container_dataobjectsimple

Simple storage driver for fetching data from a db with DB_DataObject


Author(s):

Version:

  • CVS: $Id: dataobjectsimple.php,v 1.12 2005/09/08 17:27:37 quipo Exp $

Copyright:

  • 2004-2005 Alan Knowles

Methods


Child classes:

Translation2_Admin_Container_dataobjectsimple
Storage driver for storing/fetching data to/from a database

Inherited Variables

Inherited Methods

Class: Translation2_Container

Translation2_Container::Translation2_Container()
Constructor
Translation2_Container::fetchLangs()
Fetch the available langs if they're not cached yet.
Translation2_Container::getLang()
Gets the current lang
Translation2_Container::getLangData()
Gets the array data for the lang
Translation2_Container::getLangs()
Gets the available languages
Translation2_Container::getOne()
Get a single item from the container, without caching the whole page Containers should implement this method.
Translation2_Container::getPage()
Returns an array of the strings in the selected page Containers should implement this method.
Translation2_Container::getStringID()
Get the stringID for the given string
Translation2_Container::raiseError()
Trigger a PEAR error
Translation2_Container::setLang()
Sets the current lang
Translation2_Container::_parseOptions()
Parse options passed to the container class

Class Details

[line 77]
Simple storage driver for fetching data from a db with DB_DataObject

This storage driver can use all databases which are supported by the PEAR::DB abstraction layer to fetch data.

Database Structure:

  // meta data etc. not supported yet...

  create table translations (
     id int(11) auto_increment not null primary key,
     string_id int(11),
     page varchar(128),
     lang varchar(10),
     translation text
     );
 alter table translations add index page (page);
 alter table translations add index lang (lang);
 alter table translations add index string_id (string_id);
 

  • then just run the dataobjects createtables script.



[ Top ]


Method Detail

fetchLangs   [line 116]

void fetchLangs( )

Fetch the available langs if they're not cached yet.

Overrides Translation2_Container::fetchLangs() (Fetch the available langs if they're not cached yet.)
[ Top ]

getOne   [line 174]

string getOne( mixed $string, [string $pageID = null], [string $langID = null], string $stringID)

Get a single item from the container, without caching the whole page

Overrides Translation2_Container::getOne() (Get a single item from the container, without caching the whole page Containers should implement this method.)

Parameters:

string   $stringID     
string   $pageID     
string   $langID     

[ Top ]

getPage   [line 146]

array &getPage( [string $pageID = null], [string $langID = null])

Returns an array of the strings in the selected page

Overrides Translation2_Container::getPage() (Returns an array of the strings in the selected page Containers should implement this method.)

Parameters:

string   $pageID     
string   $langID     

[ Top ]

getStringID   [line 212]

string getStringID( mixed $string, [string $pageID = null], string $stringID)

Get the stringID for the given string

Overrides Translation2_Container::getStringID() (Get the stringID for the given string)

Parameters:

string   $stringID     
string   $pageID     

[ Top ]

init   [line 87]

boolean init( [string $table = null])

Initialize the container
  • Return: true

Parameters:

string   $table     table name

[ Top ]


Documentation generated on Sun, 09 Oct 2005 06:32:13 -0400 by phpDocumentor 1.2.3. PEAR Logo Copyright © PHP Group 2004.