Public Member Functions | |
approveForDev () | |
Marks a version as visible on the dev site. | |
approveForLive () | |
Marks a version as visible on the live site. | |
defunct () | |
Mark this version as being defunct (inactive). | |
deny () | |
Return a 'Pending' version to the 'In Progress' state. | |
destroy () | |
Permanently delete version. | |
getAllPaths () | |
INSERT BRIEF DESCRIPTION HERE. | |
getCanonicalPath () | |
Retrieves canonical path of this version. | |
listActions ($constraint=array(), $limit=array(), $order=array()) | |
Retrieves list of actions performed on this version. | |
steal () | |
Take control of an 'In Progress' version. | |
submit () | |
Marks a version as 'Pending'. | |
update ($newCM) | |
Updates the content of a version. | |
Static Public Member Functions | |
static | lookup ($path) |
Retrieve version by path. | |
static | retrieve ($id) |
Retrieves version by ID. | |
Public Attributes | |
const | STATUS_DEFUNCT |
Version is in 'Defunct' state (zombie). | |
const | STATUS_DEV |
Version is in 'Dev' state (visible on dev site). | |
const | STATUS_LIVE |
Version is in 'Live' state (visible on live site). | |
const | STATUS_PENDING |
Version is in 'Pending' state (ready to be approved for dev or live). | |
const | STATUS_PRIVATE |
Version is in 'In Progress' state (can be edited). | |
Static Public Attributes | |
static | $ATTRIBUTES |
static | $STAT_NAMES |
static | $STAT_VALUES |
A version represents a particular revision of content for a resource. A resource may contain multiple versions, but a version belongs to only one resource. A version will be in one of many states:
STATUS_PRIVATE
: Version is in 'In Progress' state STATUS_PENDING
: Version is in 'Pending' state STATUS_DEV
: Version is in 'Dev' state (visible on dev site) STATUS_LIVE
: Version is in 'Live' state (visible on live site) STATUS_DEFUNCT
: Version is in 'Defunct' state (zombie)
STATUS_*
constants)
SnapVersion::approveForDev | ( | ) |
Marks a version as visible on the dev site.
The version must be in the 'Pending' state to be marked as dev. You must also have the ApproveDev permission on the version's resource, or AdminResource to approve for dev. The old dev version becomes defunct after this operation.
SnapVersion::approveForLive | ( | ) |
Marks a version as visible on the live site.
The version must either be in the 'Pending' state or the 'Dev' state to be approved for live. You must also have the ApproveLive permission on the version's resource, or AdminResource. The old live version is marked as defunct, and if this version was dev previously, there will no longer be a dev version for the resource.
SnapVersion::defunct | ( | ) |
Mark this version as being defunct (inactive).
Once a version is defuncted, it can no longer be used in any capacity, except to be copied from. To defunct a version, it must not already be defunct (for obvious reasons), and you must have the Edit permission to defunct an 'In Progress' or 'Pending' version, ApproveDev to defunct a 'Dev' version, ApproveLive to defunct a 'Live' version, or AdminResource to defunct all states. If the version was dev or live, then there will no longer be a dev or live version for the resource.
SnapVersion::deny | ( | ) |
Return a 'Pending' version to the 'In Progress' state.
The use case for this method is that a version may need more work before it could be considered ready for approval. In order to deny a version, the version must be in the 'Pending' state and you must have ApproveDev or ApproveLive permission on the version's resource, or AdminResource.
SnapVersion::destroy | ( | ) |
Permanently delete version.
When a version is destroyed, any external files associated with its content are deleted, and the version is removed from the database. This operation cannot be undone. You must have AdminResource on the version's resource to perform this operation.
SnapVersion::getAllPaths | ( | ) |
INSERT BRIEF DESCRIPTION HERE.
INSERT FULL DESCRIPTION HERE
SnapVersion::getCanonicalPath | ( | ) |
Retrieves canonical path of this version.
The canonical path of a version is just the canonical path of its resource with '@' and the version's ordinal appended. For example, '//test/foo@5'.
SnapVersion::listActions | ( | $ | constraint = array() , |
|
$ | limit = array() , |
|||
$ | order = array() | |||
) |
Retrieves list of actions performed on this version.
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 for just this version. 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.
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 SnapVersion::lookup | ( | $ | path | ) | [static] |
Retrieve version by path.
Use this method to retrieve a version if you know its path. There is no other way to retrieve a version by path, so don't even try.
$path | [string]: path to version |
static SnapVersion::retrieve | ( | $ | id | ) | [static] |
Retrieves version by ID.
Use this method to retrieve a version if you know its ID. Do not construct a version directly, or bad things will happen.
$id | [integer]: ID of version to retrieve |
SnapVersion::steal | ( | ) |
Take control of an 'In Progress' version.
Only the current author of a version can edit it. If you have Edit permission, or AdminResource on the version's resource, then you can steal the version and now you can edit it. The version must be in the 'In Progress' state to steal it.
SnapVersion::submit | ( | ) |
Marks a version as 'Pending'.
If a version is in the 'In Progress' state it can be marked as ready for approval (or denial) using this method. You must have the Edit permission on the version's owning resource, or AdminResource.
SnapVersion::update | ( | $ | newCM | ) |
Updates the content of a version.
This method modifies the content of the version. You must pass in a content module which contains information about the new content. That content module should be created directly and then modified with an appropriate modification function (see the documentation of the relevant content module for more). Typically, you would call this method in the following fashion: $cm = new SnapContentXml($version); $cm->setXML('...some xml string...'); $version->update($cm);
You must have the Edit permission on the version's resource to update the version. AdminResource and the ADMIN privilege also work. The version must also be in the 'In Progress' state to be updated.
$newCM | [SnapContent]: content module describing new content |
SnapVersion::$ATTRIBUTES [static] |
Database attributes
SnapVersion::$STAT_NAMES [static] |
Array that associates status constants with friendly names, like 'In Progress'
SnapVersion::$STAT_VALUES [static] |
Array that associates standard friendly names, like 'In Progress', with status constants