Class CMS_superResource

Description

General-purpose Class

Gathers the most usual functions of an object class for Automne

  • author:

    Sébastien Pauchet <sebastien.pauchet@ws-interactive.fr>

    HOW TO USE THIS CLASS Fillin all class default vars with correspondant database informations change the class name and the constructor name to respect the var $_className value in case of special datatype wich need to be controlled, some switch are present in code to make these controls see the constructor, setString(), setObject() methods A useage example of this file is in the file /automne/classes/modules/superResourceExample.php

Located in /automne/classes/modules/super_resource.php (line 34)

CMS_grandFather
   |
   --CMS_resource
      |
      --CMS_superResource
Direct descendents
Class Description
 class CMS_example CMS_example Class extends CMS_superResource This file is a useage example for the superResource.
 class CMS_forms_action Class CMS_forms_action
Method Summary
 void CMS_superResource ([integer $id = 0], [boolean $public = false])
 boolean destroy ([CMS_user $cms_user = false])
 boolean getBoolean ( $boolean, string $string)
 string getDefaultValue ( $name)
 string getExternalLink ()
 string getFilePath (string $name, [boolean $withPath = false], [string $dataLocation = RESOURCE_DATA_LOCATION_EDITED], [integer $relativeTo = PATH_RELATIVETO_WEBROOT], [boolean $withFilename = true])
 integer getID ()
 string getImagePath (string $imageName, [boolean $withPath = false], [string $dataLocation = RESOURCE_DATA_LOCATION_EDITED], [integer $relativeTo = PATH_RELATIVETO_WEBROOT], [boolean $withFilename = true])
 integer getInteger (string $integer)
 array(linkType,linkValue) getLink ( $linkName)
 string getLinkType ( $linkName)
 array() getList (string $stringName, [array() $whereConditions = array()], [array() $orderConditions = array()], [boolean $public = false], [ $withIndex = false])
 CMS_object getObject (string $object)
 integer getOrder ()
 integer getOrderMax ([ $whereConditions = array()], [boolean $public = false], array() $searchConditions)
 string getString (string $string)
 array() getTableData ()
 CMS_date getTheDate (string $date)
 mixed getValue (string $name)
 boolean moveDown ([ $whereConditions = array()], [boolean $public = false], array() $searchConditions)
 boolean moveTo (integer $moveTo, [ $whereConditions = array()], [boolean $public = false], array() $searchConditions)
 boolean moveUp ([ $whereConditions = array()], [boolean $public = false], array() $searchConditions)
 array() search ([array() $searchConditions = array()], [array() $orderConditions = array()], [boolean $outputObjects = false], [boolean $public = false], [ $operator = "="])
 boolean setBoolean (string $booleanName, boolean $booleanValue)
 boolean setDate (string $dateName, dateValue $dateValue)
 boolean setExternalLink (string $url)
 boolean setFile (string $name, string $filename)
 boolean setImage (string $imageName, string $filename)
 boolean setInteger (string $integerName, boolean $integerValue)
 boolean setInternalLink (integer $pageID)
 boolean setLink ( $linkName,  $linkType,  $linkValue, integer $type)
 boolean setObject (string $objectName, integer $objectValue, [boolean $valueIsObject = false])
 integer setOrder ( $order)
 boolean setString (string $stringName, string $stringValue)
 mixed setValue (string $name, [mixed $value = null])
 boolean writeToPersistence ()
 boolean _hasResource ()
 boolean _initObjects ()
Methods
Constructor CMS_superResource (line 127)

Constructor.

initializes object if the id is given.

  • access: public
void CMS_superResource ([integer $id = 0], [boolean $public = false])
  • integer $id: DB id
  • boolean $public: wich type of data (default=false : edited)
destroy (line 1494)

Destroy the object

  • return: true on success, false on failure
  • access: public
boolean destroy ([CMS_user $cms_user = false])
  • CMS_user $cms_user: needed if object have a resource : the user who make the action

Redefinition of:
CMS_resource::destroy()
Totally destroys the resource from persistence. Also destroys the status.
getBoolean (line 380)

Gets a boolean value of the object

  • return: The wanted boolean
  • access: public
boolean getBoolean ( $boolean, string $string)
  • string $string: The boolean to return
  • $boolean
getDefaultValue (line 231)

Gets the default value of a data.

  • return: the default value of the data
  • access: public
string getDefaultValue ( $name)
  • $name
getExternalLink (line 1095)

Gets the URL of the external link

  • return: The URL
  • access: public
string getExternalLink ()
getFilePath (line 969)

Gets a file.

Can return relative to web root of filesystem root, and with or without path.

  • return: The image path, false on error
  • access: public
string getFilePath (string $name, [boolean $withPath = false], [string $dataLocation = RESOURCE_DATA_LOCATION_EDITED], [integer $relativeTo = PATH_RELATIVETO_WEBROOT], [boolean $withFilename = true])
  • string $name: The file wanted
  • boolean $withPath: If false, only returns the filename
  • string $dataLocation: Where does the data lies ? See CMS_resource constants
  • integer $relativeTo: Can be web root or filesystem relative, see base constants
  • boolean $withFilename: Should the function return the filename too or only the path ?
getID (line 209)

Gets the DB ID of the instance.

  • return: the DB id
  • access: public
integer getID ()

Redefinition of:
CMS_resource::getID()
Gets the DB ID of the instance.
getImagePath (line 905)

Gets an image of the object.

Can return relative to web root of filesystem root, and with or without path.

  • return: The image path, false on error
  • access: public
string getImagePath (string $imageName, [boolean $withPath = false], [string $dataLocation = RESOURCE_DATA_LOCATION_EDITED], [integer $relativeTo = PATH_RELATIVETO_WEBROOT], [boolean $withFilename = true])
  • string $imageName: The name of the image wanted
  • boolean $withPath: If false, only returns the filename
  • string $dataLocation: Where does the data lies ? See CMS_resource constants
  • integer $relativeTo: Can be web root or filesystem relative, see base constants
  • boolean $withFilename: Should the function return the filename too or only the path ?
getInteger (line 421)

Gets a integer value of the object

  • return: The wanted integer
  • access: public
integer getInteger (string $integer)
  • string $integer: The integer to return
getInternalLinkPage (line 1067)

Gets the internal link (a page or false if no link)

  • access: public
CMS_page getInternalLinkPage ()
getLink (line 1037)

Gets the link

  • access: public
array(linkType,linkValue) getLink ( $linkName)
  • $linkName
getLinkType (line 1026)

Gets the type of the link

  • return: The link type
  • access: public
string getLinkType ( $linkName)
  • $linkName
getList (line 1209)

Gets an list of distinct string values.

Can return distinct string values of the database with where clauses and ordered by clause

  • return: The list of string ordered
  • access: public
array() getList (string $stringName, [array() $whereConditions = array()], [array() $orderConditions = array()], [boolean $public = false], [ $withIndex = false])
  • string $stringName: The data name of the list wanted OR array of data names to get
  • array() $whereConditions: to construct the where clause (default none) format array("database column name" => "database value", ... => ..., ...)
  • array() $orderConditions: to construct the order by clause (default none) format array("database column name" => "order type : asc or desc", ... => ..., ...)
  • boolean $public: the data location wich needed (defaul false : edited)
  • $withIndex
getObject (line 482)

Gets an object of the object

  • return: The wanted object
  • access: public
CMS_object getObject (string $object)
  • string $object: The object name to return
getOrder (line 576)

Get the object Order (search order field then return value)

  • return: the object order
  • access: public
integer getOrder ()
getOrderMax (line 629)

Get the current max objects Order (search order field then return value)

  • return: the max order
  • access: public
integer getOrderMax ([ $whereConditions = array()], [boolean $public = false], array() $searchConditions)
  • array() $searchConditions: to construct the where clause (default none) format array("database column name" => "database value", ... => ..., ...)
  • boolean $public: the data location wich needed (defaul false : edited)
  • $whereConditions
getString (line 319)

Gets a string of the object

  • return: The wanted string
  • access: public
string getString (string $string)
  • string $string: The string to return
getTableData (line 220)

Gets the DB type of data.

  • return: the DB data
  • access: public
array() getTableData ()
getTheDate (line 535)

Get a date object

  • return: The wanted object
  • access: public
CMS_date getTheDate (string $date)
  • string $date: The date name to return
getValue (line 1124)

* Short hand to get value by property name

  • return: The attribute or false if it does not exist
  • access: public
mixed getValue (string $name)
  • string $name: The name of the attribute to get
moveDown (line 760)

Move the current object Order to the bottom (order+1) (search order field then change it)

  • return: true on success, false on failure
  • access: public
boolean moveDown ([ $whereConditions = array()], [boolean $public = false], array() $searchConditions)
  • array() $searchConditions: to construct the where clause (default none) format array("database column name" => "database value", ... => ..., ...)
  • boolean $public: the data location wich needed (defaul false : edited)
  • $whereConditions
moveTo (line 831)

Move the current object Order to a given position, the other object move to the current object position (search order field then change it)

  • return: true on success, false on failure
  • access: public
boolean moveTo (integer $moveTo, [ $whereConditions = array()], [boolean $public = false], array() $searchConditions)
  • integer $moveTo: the order to move to
  • array() $searchConditions: to construct the where clause (default none) format array("database column name" => "database value", ... => ..., ...)
  • boolean $public: the data location wich needed (defaul false : edited)
  • $whereConditions
moveUp (line 690)

Move the current object Order to the top (order-1) (search order field then change it)

  • return: true on success, false on failure
  • access: public
boolean moveUp ([ $whereConditions = array()], [boolean $public = false], array() $searchConditions)
  • array() $searchConditions: to construct the where clause (default none) format array("database column name" => "database value", ... => ..., ...)
  • boolean $public: the data location wich needed (defaul false : edited)
  • $whereConditions
search (line 1320)

make a search of objects in database Can return object or object ID values of the database with where clauses and ordered by clause

  • return: array of objects or array of object IDs (function of outputObjects value)
  • access: public
array() search ([array() $searchConditions = array()], [array() $orderConditions = array()], [boolean $outputObjects = false], [boolean $public = false], [ $operator = "="])
  • array() $searchConditions: to construct the where clause (default none) format array("database column name" => "database value", ... => ..., ...)
  • array() $orderConditions: to construct the order by clause (default none) format array("database column name" => "order type : asc or desc", ... => ..., ...)
  • boolean $outputObjects: the data to return (array of objects or array of object IDs) default is false (array of object IDs)
  • boolean $public: the data location wich needed (defaul false : edited)
  • $operator
setBoolean (line 398)

Set a boolean of the object

  • return: true on success, false on failure
  • access: public
boolean setBoolean (string $booleanName, boolean $booleanValue)
  • string $booleanName: The boolean name to set
  • boolean $booleanValue: The boolean value to set (0/1/true/false only)
setDate (line 553)

Set a date object

  • return: true on success, false on failure
  • access: public
boolean setDate (string $dateName, dateValue $dateValue)
  • string $dateName: The date name to set
  • dateValue $dateValue: the object date
setExternalLink (line 1107)

Sets the external link

  • return: true on success, false on failure
  • access: public
boolean setExternalLink (string $url)
  • string $url: The url to set
setFile (line 1009)

Set a file

  • return: true on success, false on failure
  • access: public
boolean setFile (string $name, string $filename)
  • string $name: The file to set
  • string $filename: The filename value to set
setImage (line 946)

Set an image filename

  • return: true on success, false on failure
  • access: public
boolean setImage (string $imageName, string $filename)
  • string $imageName: The image name to set
  • string $filename: The filename value to set
setInteger (line 439)

Set an integer of the object

  • return: true on success, false on failure
  • access: public
boolean setInteger (string $integerName, boolean $integerValue)
  • string $integerName: The integer name to set
  • boolean $integerValue: The integer or positiveInteger value to set
setInternalLink (line 1083)

Sets the internal link

  • return: true on success, false on failure
  • access: public
boolean setInternalLink (integer $pageID)
  • integer $pageID: The DB ID of the page linked
setLink (line 1049)

Sets the type of link

  • return: true on success, false on failure
  • access: public
boolean setLink ( $linkName,  $linkType,  $linkValue, integer $type)
  • integer $type: The type to set
  • $linkName
  • $linkType
  • $linkValue
setObject (line 501)

Set an object

  • return: true on success, false on failure
  • access: public
boolean setObject (string $objectName, integer $objectValue, [boolean $valueIsObject = false])
  • string $objectName: The string name to set
  • boolean $valueIsObject: the type of $objectValue (ID or object) default is false (ID)
  • integer $objectValue: or object $objectValue the object ID or the object itself
setOrder (line 598)

Get the object Order (search order field then return value)

  • return: the object order
  • access: public
integer setOrder ( $order)
  • $order
setString (line 337)

Set a string of the object

  • return: true on success, false on failure
  • access: public
boolean setString (string $stringName, string $stringValue)
  • string $stringName: The string name to set
  • string $stringValue: The string value to set
setValue (line 1170)

Short hand to set value by property name

  • return: The attribute or false if it does not exist
  • access: public
mixed setValue (string $name, [mixed $value = null])
  • string $name: The name of the attribute to get
  • mixed $value: The value to set for the attribute
writeToPersistence (line 1394)

Writes the object data into persistence (MySQL for now), along with base data.

  • return: true on success, false on failure
  • access: public
boolean writeToPersistence ()

Redefinition of:
CMS_resource::writeToPersistence()
Writes the resource into persistence (MySQL for now).
_hasResource (line 242)

if this object use Automne resource ?

  • return: true if it use Automne resource, false otherwise
  • access: private
boolean _hasResource ()
_initObjects (line 261)

initialise all objects for this resource

  • return: true, false otherwise
  • access: private
boolean _initObjects ()

Inherited Methods

Inherited From CMS_resource

 CMS_resource::CMS_resource()
 CMS_resource::addEdition()
 CMS_resource::addValidationRefused()
 CMS_resource::cancelAllEditions()
 CMS_resource::destroy()
 CMS_resource::getAllDataLocations()
 CMS_resource::getAllLinkTypes()
 CMS_resource::getEditors()
 CMS_resource::getEditorsStack()
 CMS_resource::getID()
 CMS_resource::getLocation()
 CMS_resource::getLock()
 CMS_resource::getLockDate()
 CMS_resource::getProposedLocation()
 CMS_resource::getPublication()
 CMS_resource::getPublicationDateEnd()
 CMS_resource::getPublicationDateStart()
 CMS_resource::getStatus()
 CMS_resource::isProposedForOutsideUserspace()
 CMS_resource::lock()
 CMS_resource::removeProposedLocation()
 CMS_resource::resetEditorsStack()
 CMS_resource::setProposedLocation()
 CMS_resource::setPublicationDates()
 CMS_resource::unlock()
 CMS_resource::validateEdition()
 CMS_resource::validateProposedLocation()
 CMS_resource::writeToPersistence()

Inherited From CMS_grandFather

 CMS_grandFather::autoload()
 CMS_grandFather::hasError()
 CMS_grandFather::log()
 CMS_grandFather::PHPErrorHandler()
 CMS_grandFather::raiseError()
 CMS_grandFather::setDebug()
 CMS_grandFather::setLog()
 CMS_grandFather::_raiseError()
 CMS_grandFather::__call()
Class Constants

Documentation generated on Wed, 15 Feb 2012 15:39:54 +0100 by phpDocumentor 1.4.3