TSD Class Reference
[Core Objects]

Core utility class for the TSD API. More...

Inheritance diagram for TSD:

Inheritance graph
[legend]

List of all members.

Static Public Member Functions

static can ($what, $uid= '')
 Determines whether user is permitted to execute requested action.
static getAlignments ($url, $mode=TSD::MODE_LIVE)
 Retrieves all alignments for a given CSERD ID or URL.
static getDBI ()
 Retrieves the DBI object connected to the CSERD database.
static getLocalDBI ()
 Retrieves the DBI object connected to the TSD database.
static getParties ()
 Retrieves list of all users who have been granted any permissions.
static log ($description, $query)
 INSERT BRIEF DESCRIPTION HERE.
static setPermission ($uid, $which, $how)
 Modifies permission for user.
static stringToMode ($modeString)
 Converts descriptive name of mode to constant value.

Public Attributes

Mode constants
const MODE_ALL
 all versions
const MODE_APPROVED
 dev versions that are marked APPROVED
const MODE_CHANGED
 dev versions that are marked CHANGED
const MODE_DELETED
 dev versions that are marked DELETED
const MODE_DEV
 dev versions (of any status)
const MODE_DEV_ACTIVE
 dev versions excluding DELETED
const MODE_DEV_UNAPPROVED
 dev versions excluding APPROVED
const MODE_LIVE
 live versions (always approved)
const MODE_NEW
 dev versions that are marked NEW
Status constants
const STATUS_APPROVED
 alignment/relationship that is visible on live site
const STATUS_CHANGED
 alignment/relationship that has been modified
const STATUS_DELETED
 alignment/relationship that has been marked for deletion
const STATUS_NEW
 newly created alignment/relationship
Version constants
const VERSION_DEV
 dev version of alignment/relationship
const VERSION_LIVE
 live version of alignment/relationship (status must be TSD::STATUS_APPROVED)


Detailed Description

Core utility class for the TSD API.

This class provides TSD initialization functions, permission functions and a few utility functions. It is meant to be a static (singleton) class and cannot be instantiated.


Member Function Documentation

static TSD::can ( what,
uid = '' 
) [static]

Determines whether user is permitted to execute requested action.

The available actions are: 'edit', 'approve' and 'align'. These permissions are checked by the API when making TSD-modifying calls, and also by the TSD admin tool. No permissions are checked for reading from the database.

Parameters:
$what [string]: which of the three available actions listed above is to be checked for
$uid [int]: user ID of the user to check permission for; defaults to current user
Returns:
[boolean]: true if user has permission, false if not, null if there was an error

static TSD::getAlignments ( url,
mode = TSD::MODE_LIVE 
) [static]

Retrieves all alignments for a given CSERD ID or URL.

You can provide either a URL or an ID. This method just calls getResourceAlignments() on TSDText, TSDStandard and TSDWord for the same URL/ID and concatenates the results. It is thus merely a convenience method.

Parameters:
$url [mixed]: CSERD URL or CSERD ID
$mode [int]: alignment mode: only retrieve alignments matching this mode (one of the TSD::MODE_* constants)
Returns:
[array]: multilevel array; the first level has three keys: 'sections', 'objectives', and 'words'. Each of these keys contains an array of TSDText, TSDStandard and TSDWord objects. Returns null if there was an error.

static TSD::getDBI (  )  [static]

Retrieves the DBI object connected to the CSERD database.

All TSD nodes and alignments are stored in this database.

Returns:
[DBI]: DBI object connected to CSERD database, or null if it could not connect

static TSD::getLocalDBI (  )  [static]

Retrieves the DBI object connected to the TSD database.

The TSD database is now only used to keep track of permissions and vocabulary for the metadata editor tool.

Returns:
[DBI]: DBI object connected to TSD database, or null if it could not connect

static TSD::getParties (  )  [static]

Retrieves list of all users who have been granted any permissions.

Users who have been denied all permissions are removed from the database, so they will not show up in this list, even if they had permissions before.

Returns:
[array]: array of user IDs for each user that has at least one permission granted

static TSD::log ( description,
query 
) [static]

INSERT BRIEF DESCRIPTION HERE.

INSERT FULL DESCRIPTION HERE

Parameters:
$description [TYPE]: DESCRIPTION
$query [TYPE]: DESCRIPTION
Returns:
[TYPE]: RETURN DESCRIPTION

static TSD::setPermission ( uid,
which,
how 
) [static]

Modifies permission for user.

Parameters:
$uid [int]: user to change permission for
$which [string]: permission to change; one of: 'edit', 'approve' or 'align'
$how [boolean]: true if granting the permission, false if revoking
Returns:
[boolean]: success or failure

static TSD::stringToMode ( modeString  )  [static]

Converts descriptive name of mode to constant value.

Rather than have a thousand pieces of code that convert, e.g., 'devUnapproved' to TSD::MODE_DEV_UNAPPROVED, this function is provided for convenience.

Parameters:
$modeString [string]: string description of mode
Returns:
[string]: one of the TSD::MODE_* constants


The documentation for this class was generated from the following file:

Generated on Wed Nov 24 02:04:53 2010 for Common by  doxygen 1.5.6