Public Member Functions | |
countRelevantVersions ($constraint=array(), $limit=array(), $order=array()) | |
Retrieves count relevant versions of this resource. | |
countVersions ($constraint=array(), $limit=array(), $order=array()) | |
Retrieves number of versions in this resource, using constraints. | |
createVersion ($oldVersion=null) | |
Creates a new version for this resource. | |
listActions ($constraint=array(), $limit=array(), $order=array()) | |
Lists all actions that have occurred on versions of this resource. | |
listRelevantVersions ($constraint=array(), $limit=array(), $order=array()) | |
Retrieves relevant versions of this resource. | |
listVersions ($constraint=array(), $limit=array(), $order=array()) | |
Retrieves array of objects representing the versions of this resource. | |
setValidDate ($validDate) | |
Changes the valid date field associated with this resource. | |
toCacheDump () | |
INSERT BRIEF DESCRIPTION HERE. | |
Static Public Member Functions | |
static | _cancelDestroy () |
INSERT BRIEF DESCRIPTION HERE. | |
static | lookup ($path) |
Retrieves a resource by path. | |
static | retrieve ($id) |
Retrieves a resource by ID. | |
Public Attributes | |
const | TYPE_CSS |
CSS Stylesheets. | |
const | TYPE_HTML |
Plain Old HTML (no external objects). | |
const | TYPE_INTERACTIVATE_INSTRUCTOR |
Interactivate Instructors. | |
const | TYPE_INTERACTIVATE_LESSON |
Interactivate Lessons. | |
const | TYPE_JAVASCRIPT |
Javascript Files. | |
const | TYPE_LESSONPLAN |
Experimental lesson plan XML. | |
const | TYPE_MEDIA_AGENTSHEETS |
Agentsheets Applets. | |
const | TYPE_MEDIA_DOCUMENT |
PDF and MS Word documents. | |
const | TYPE_MEDIA_FILE |
Generic file XML. | |
const | TYPE_MEDIA_IMAGE |
Images. | |
const | TYPE_MEDIA_INTERACTIVATE |
Interactivate Java Applets. | |
const | TYPE_MEDIA_NETLOGO |
Netlogo Applets. | |
const | TYPE_STDXML |
Standard XML 3.0 (no external objects). | |
Static Public Attributes | |
static | $ATTRIBUTES |
A resource represents one logical piece of content. It is a field, just like directories (see SnapFile), and thus can be linked, unlinked, deleted, etc. It cannot have its own children, though. Instead of children, it has zero or more versions, which store particular revisions of the content logically contained in the resource. The resource itself does not store content. Two special versions will be considered active and when the content needs to be gathered from the resource, it comes from one of these versions. One version is the "dev" version and the other is the "live" version. If the server is a dev server (such as newdev), then the dev version is used for content, or the live version if there is no dev version. If the server is a production server (such as "www"), then only the live version is consulted. If there is no live version, then there is no active content for the resource.
Resources also have types. The type determines the nature of the content. The basic types are HTML and XML, in which case, the versions simply store raw HTML or XML in their content field. Other types support various types of media, such as images and applets. These types require management of external files and that involves a lot of complexity. Content modules (see SnapContent and its derivates) handle these details and make it as easy as possible to add new content types.
static SnapResource::_cancelDestroy | ( | ) | [static] |
INSERT BRIEF DESCRIPTION HERE.
INSERT FULL DESCRIPTION HERE
SnapResource::countRelevantVersions | ( | $ | constraint = array() , |
|
$ | limit = array() , |
|||
$ | order = array() | |||
) |
Retrieves count relevant versions of this resource.
A relevant version is one that is not defunct, or is defunct but is a direct "parent" of a non-defunct version. See listVersions() for more on the constraint parameters.
$constraint | [array]: trim down results by conditions | |
$limit | [array]: limit number of results by count and offset | |
$order | [array]: sort results |
SnapResource::countVersions | ( | $ | constraint = array() , |
|
$ | limit = array() , |
|||
$ | order = array() | |||
) |
Retrieves number of versions in this resource, using constraints.
See the documentation for listContents() for more on the parameters to this method
$constraint | [array]: trim down results by conditions | |
$limit | [array]: limit number of results by count and offset | |
$order | [array]: sort results |
SnapResource::createVersion | ( | $ | oldVersion = null |
) |
Creates a new version for this resource.
The version can be created out of nothing, or it can be created as a copy of an existing version. In the latter case, pass in a SnapVersion object as the sole parameter to this method. The new version will be in the 'In Progress' state and will be owned by the current user. You must have the Edit permission on this resource to create a new version.
$oldVersion | [SnapVersion]: version to copy from (if desired) |
SnapResource::listActions | ( | $ | constraint = array() , |
|
$ | limit = array() , |
|||
$ | order = array() | |||
) |
Lists all actions that have occurred on versions of this resource.
Actions are things like "Edit", "Submit", etc. That is, changes in state of a version. This is useful for tracking progress. This method will list those actions. The result array consists of subarrays which contain three fields: 'uid', which is the user ID of the user who performed the action; 'action', which is a string naming the action; 'actionTime', which is a MySQL timestamp of when the action occurred; and 'id', which is the ID of the version upon which the action was performed. See listContents() for more on the constraint parameters.
$constraint | [array]: trim down results by conditions | |
$limit | [array]: limit number of results by count and offset | |
$order | [array]: sort results |
SnapResource::listRelevantVersions | ( | $ | constraint = array() , |
|
$ | limit = array() , |
|||
$ | order = array() | |||
) |
Retrieves relevant versions of this resource.
A relevant version is one that is not defunct, or is defunct but is a direct "parent" of a non-defunct version. See listVersions() for more on the constraint parameters.
$constraint | [array]: trim down results by conditions | |
$limit | [array]: limit number of results by count and offset | |
$order | [array]: sort results |
SnapResource::listVersions | ( | $ | constraint = array() , |
|
$ | limit = array() , |
|||
$ | order = array() | |||
) |
Retrieves array of objects representing the versions of this resource.
This method allows you to trim down the result set and sort it, mostly arbitrarily. The first parameter can be an array that specifies constraints that are converted into a WHERE clause on the database query. See [[SWAT_Model2::Simple_Entities]] for more on how to specify a constraint array. The second parameter lets you limit the number of results. As a simple number, a 'LIMIT x' is appended to the query. If an array of two numbers is given, then the first number specifies the offset to start the resultset at and the second specifies the number of records after that. The final parameter specifies how to order the results. If the elements in the array are not associative, then they are passed directly to the ORDER BY clause as is. If they are associative, then the key specifies the column and the value specifies either ASC or DESC.
$constraint | [array]: trim down results by conditions | |
$limit | [array]: limit number of results by count and offset | |
$order | [array]: sort results |
static SnapResource::lookup | ( | $ | path | ) | [static] |
Retrieves a resource by path.
Use this method to retrieve a resource if you know its path. You cannot instantiate a resource and have it populate via a path anyways, but don't try, or badder things will happen.
$path | [string]: path to resource |
Reimplemented from SnapFile.
static SnapResource::retrieve | ( | $ | id | ) | [static] |
Retrieves a resource by ID.
Use this method to get a SnapREsource object if you know the ID. Do not instantiate a SnapResource object directly, or bad things will happen.
$id | [integer]: ID of resource |
SnapResource::setValidDate | ( | $ | validDate | ) |
Changes the valid date field associated with this resource.
The valid date indicates when the resource is considered to be applicable. It's meaning is user-defined.
$validDate | [string]: MySQL-acceptable timestamp for new valid date |
SnapResource::toCacheDump | ( | ) |
INSERT BRIEF DESCRIPTION HERE.
INSERT FULL DESCRIPTION HERE
Reimplemented from SnapObject.
SnapResource::$ATTRIBUTES [static] |
Database attributes for resources