Abstract Class JModel

Description

Abstract Model class

Parent classes to all models. Customisation will generally not involve tampering with this object.

Located in /model/model.php (line 28)

JObject
   |
   --JModel
Direct descendents
Class Description
 class JModelARO
 class JModelAroGroup
 class mosDBTable Legacy class, derive from JModel instead
 class JModelCategory Category model
 class JModelComponent Component model
 class JModelContent Content model
 class JModelMenu Menu model
 class JModelModule Module model
 class JModelPlugin Plugin model
 class JModelSection Section model
 class JModelSession Session model
 class JModelUser Users model
Variable Summary
 string $_error
 string $_tbl
 string $_tbl_key
Method Summary
 JModel __construct (string $table, string $key, mixed &$db)
 null|string bind (mixed $array, [mixed $ignore = ""], array $hash)
 true|false canDelete ([mixed $oid = null], [int $joins = null], string $msg, array 2)
 boolean check ()
 void checkin ([mixed $oid = null])
 void checkout (mixed $who, [mixed $oid = null])
 true delete ([mixed $oid = null])
 void filter ([array $ignoreList = null])
 string getError ()
 database &getInstance (type $type, mixed &$db)
 void hit ([mixed $oid = null])
 boolean isCheckedOut (int $user_id)
 any load ([int $oid = null])
 void move (mixed $dirn, [mixed $where = ''])
 void publish ([array $cid = null], [integer $publish = 1], integer $user_id)
 void publish_array ([mixed $cid = null], [mixed $publish = 1], mixed $user_id)
 TRUE save (array $source, [string $order_filter = ''])
 null|string store ([boolean $updateNulls = false])
 void toXML ([boolean $mapKeysToText = false])
 void updateOrder ([string $where = ''])
Variables
JDatabase $_db = null (line 60)

Database connector

  • access: protected
string $_error = '' (line 52)

Error message

  • access: protected
string $_tbl = '' (line 36)

Name of the table in the db schema relating to child class

  • access: protected
string $_tbl_key = '' (line 44)

Name of the primary key field in the table

  • access: protected
Methods
Constructor __construct (line 71)

Object constructor to set table and key field

Can be overloaded/supplemented by the child class

  • access: protected
JModel __construct (string $table, string $key, mixed &$db)
  • string $table: name of the table in the db schema relating to child class
  • string $key: name of the primary key field in the table

Redefinition of:
JObject::__construct()
Class constructor, overridden in descendant classes.

Redefined in descendants as:
bind (line 146)

Binds a named array/hash to this object

can be overloaded/supplemented by the child class

  • return: null is operation was satisfactory, otherwise returns an error
null|string bind (mixed $array, [mixed $ignore = ""], array $hash)
  • array $hash: named array

Redefined in descendants as:
canDelete (line 380)

Generic check for whether dependancies exist for this object in the db schema

can be overloaded/supplemented by the child class

  • access: public
true|false canDelete ([mixed $oid = null], [int $joins = null], string $msg, array 2)
  • string $msg: Error message returned
  • array 2: Optional array to compiles standard joins: format [label=>'Label',name=>'table name',idfield=>'field',joinfield=>'field']
  • int $joins: Optional key index
check (line 185)

Generic check method

Can be overloaded/supplemented by the child class

  • return: True if the object is ok
  • access: public
boolean check ()

Redefined in descendants as:
checkin (line 508)

Description

  • access: public
void checkin ([mixed $oid = null])
checkout (line 464)

Description

  • access: public
void checkout (mixed $who, [mixed $oid = null])
delete (line 433)

Default delete method

can be overloaded/supplemented by the child class

  • return: if successful otherwise returns and error message
  • access: public
true delete ([mixed $oid = null])

Redefined in descendants as:
filter (line 99)

Filters public properties

  • access: protected
void filter ([array $ignoreList = null])
  • array $ignoreList: List of fields to ignore
getError (line 115)

Returns the error message

string getError ()
getInstance (line 85)

Returns a reference to the a Model object, always creating it

  • return: A database object
  • since: 1.1
database &getInstance (type $type, mixed &$db)
  • type $type: The model type to instantiate
getPublicProperties (line 124)

Returns an array of public properties

array getPublicProperties ()
hit (line 537)

Description

  • access: public
void hit ([mixed $oid = null])
isCheckedOut (line 589)

Tests if item is checked out

  • access: public
boolean isCheckedOut (int $user_id)
  • int $user_id: A user id
load (line 163)

Binds an array/hash to this object

  • return: result from the database operation
  • access: public
any load ([int $oid = null])
  • int $oid: optional argument, if not specifed then the value of current key is used
move (line 222)

Description

  • access: public
void move (mixed $dirn, [mixed $where = ''])
publish (line 642)

Generic Publish/Unpublish function

  • since: 1.0.4
  • access: public
void publish ([array $cid = null], [integer $publish = 1], integer $user_id)
  • array $cid: An array of id numbers
  • integer $publish: 0 if unpublishing, 1 if publishing
  • integer $user_id: The id of the user performnig the operation
publish_array (line 630)
  • deprecated: As of 1.0.3, replaced by publish
void publish_array ([mixed $cid = null], [mixed $publish = 1], mixed $user_id)
save (line 605)

Generic save function

  • return: if completely successful, FALSE if partially or not succesful.
  • access: public
TRUE save (array $source, [string $order_filter = ''])
  • array $source: Source array for binding to class vars
  • string $order_filter: Filter for the order updating
store (line 198)

Inserts a new row if id is zero or updates an existing row in the database table

Can be overloaded/supplemented by the child class

  • return: null if successful otherwise returns and error message
  • access: public
null|string store ([boolean $updateNulls = false])
  • boolean $updateNulls: If false, null object variables are not updated

Redefined in descendants as:
toXML (line 678)

Export item list to xml

  • access: public
void toXML ([boolean $mapKeysToText = false])
  • boolean $mapKeysToText: Map foreign keys to text values

Redefined in descendants as:
updateOrder (line 297)

Compacts the ordering sequence of the selected records

  • access: public
void updateOrder ([string $where = ''])
  • string $where: Additional where query to limit ordering to a particular subset of records

Inherited Methods

Inherited From JObject

 JObject::__construct()
 JObject::JObject()
 JObject::get()
 JObject::set()
 JObject::toString()
 JObject::__destruct()

Documentation generated on Sat, 4 Feb 2006 14:24:21 +0100 by phpDocumentor 1.3.0RC4