
Public Member Functions | |
| __construct ($id="") | |
| Constructs a new SnapResource object (do not call directly!). | |
| 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 | _destroyCMs () |
| 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 |
Protected Member Functions | |
| _canCreateVersion ($oldVersion=null) | |
| _canSetValidDate ($timestamp) | |
| INSERT BRIEF DESCRIPTION HERE. | |
| doDestroy () | |
| loadActiveVersion () | |
| loadDevVersion () | |
| loadLiveVersion () | |
| loadMaxOrdinal () | |
Static Private Attributes | |
| static | $DELETED_VERSIONS |
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.
Definition at line 44 of file SnapResource.php5.
| SnapResource::__construct | ( | $ | id = "" |
) |
Constructs a new SnapResource object (do not call directly!).
For internal use only.
The constructor should only be used within the API. If you need to get a resource object, use the retrieve() and lookup() methods instead.
| $id | [integer]: resource ID |
Definition at line 91 of file SnapResource.php5.
References SnapObject::setSave().
| static SnapResource::_cancelDestroy | ( | ) | [static] |
INSERT BRIEF DESCRIPTION HERE.
INSERT FULL DESCRIPTION HERE
Definition at line 243 of file SnapResource.php5.
Referenced by SnapFile::destroy().
| SnapResource::_canCreateVersion | ( | $ | oldVersion = null |
) | [protected] |
For internal use only.
Definition at line 254 of file SnapResource.php5.
References SnapObject::convertReference(), SnapFile::getPermission(), and SnapObject::setReason().
| SnapResource::_canSetValidDate | ( | $ | timestamp | ) | [protected] |
INSERT BRIEF DESCRIPTION HERE.
For internal use only.
INSERT FULL DESCRIPTION HERE
| $timestamp | [TYPE]: DESCRIPTION |
Definition at line 277 of file SnapResource.php5.
References SnapFile::getPermission(), and SnapObject::setReason().
Referenced by setValidDate().
| static SnapResource::_destroyCMs | ( | ) | [static] |
For internal use only.
Deletes all versions scheduled for deleted
Definition at line 226 of file SnapResource.php5.
Referenced by SnapFile::destroy().
| 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 |
Definition at line 687 of file SnapResource.php5.
| 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 |
Definition at line 587 of file SnapResource.php5.
| 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) |
Definition at line 404 of file SnapResource.php5.
References SnapDBI::cancelTransaction().
| SnapResource::doDestroy | ( | ) | [protected] |
For internal use only.
Schedules all versions to be deleted (puts them in ()$DELETED_VERSIONS array)
Reimplemented from SnapFile.
Definition at line 212 of file SnapResource.php5.
References listVersions().
| 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 |
Definition at line 730 of file SnapResource.php5.
| 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 |
Definition at line 637 of file SnapResource.php5.
| 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 |
Definition at line 539 of file SnapResource.php5.
Referenced by doDestroy().
| SnapResource::loadActiveVersion | ( | ) | [protected] |
For internal use only.
Dynamic loader to load the activeVersion field, which contains a SnapVersion object for whichever version is active for this server, if any
Definition at line 183 of file SnapResource.php5.
References SConfig::getDefault(), SnapObject::getId(), SnapObject::getType(), and SnapCache::updateById().
| SnapResource::loadDevVersion | ( | ) | [protected] |
For internal use only.
Dynamic loader to load the devVersion field, which contains a SnapVersion object for the dev version associated with this resource
Definition at line 150 of file SnapResource.php5.
References SnapObject::getId(), SnapObject::getType(), SnapVersion::retrieve(), and SnapCache::updateById().
| SnapResource::loadLiveVersion | ( | ) | [protected] |
For internal use only.
Dynamic loader to load the liveVersion field, which contains a SnapVersion object for the live version associated with this resource
Definition at line 167 of file SnapResource.php5.
References SnapObject::getId(), SnapObject::getType(), SnapVersion::retrieve(), and SnapCache::updateById().
| SnapResource::loadMaxOrdinal | ( | ) | [protected] |
For internal use only.
Dynamic loader to load the maxOrdinal field, which gives the highest ordinal of all the versions belonging to this resource
Definition at line 130 of file SnapResource.php5.
References SnapObject::getId(), SnapObject::getType(), SnapDBI::query(), SObject::setError(), and SnapCache::updateById().
| 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.
Definition at line 335 of file SnapResource.php5.
References Snap2::checkInit(), and SnapCache::getByPath().
Referenced by SnapFile::addStylesheet(), SnapObject::convertReference(), SnapFile::getStylesheets(), SnapFile::lookup(), Snap2::lookup(), STransHTMLMedia::replaceMediaTag(), TSDBook::setCoverImage(), STransStdXMLHelper::translateContent(), STransStdXML3Helper::translateListPage(), STransStdXMLHelper::translateMedia(), STransStdXML3Helper::translateSectionData(), and TSDBook::uploadCoverImage().
| 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 |
Definition at line 306 of file SnapResource.php5.
References Snap2::checkInit(), SnapCache::getById(), SnapObject::getId(), and SnapCache::putById().
Referenced by SnapObject::convertReference(), TSDBook::delete(), SnapVersion::loadResource(), STransHTMLMedia::replaceMediaTag(), STransStdXML3Helper::translateListPage(), STransStdXMLHelper::translateMedia(), and STransStdXML3Helper::translateSectionData().
| 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 |
Definition at line 489 of file SnapResource.php5.
References _canSetValidDate(), SnapObject::checkValid(), SObject::setError(), and SnapDBI::startTransaction().
| SnapResource::toCacheDump | ( | ) |
INSERT BRIEF DESCRIPTION HERE.
INSERT FULL DESCRIPTION HERE
Reimplemented from SnapObject.
Definition at line 113 of file SnapResource.php5.
SnapResource::$ATTRIBUTES [static] |
Database attributes for resources
Definition at line 73 of file SnapResource.php5.
Referenced by SnapSearch::execute(), and SnapDirectory::listContents().
SnapResource::$DELETED_VERSIONS [static, private] |
For internal use only.
Used to store list of versions to be deleted after a resource (or series of resources) has been destroyed
Definition at line 81 of file SnapResource.php5.
1.5.6