
Public Member Functions | |
| __construct ($table, $attrs, $idname, $id, $alignTable, $realIdname) | |
| Middle link in chain of constructors. | |
| align ($urlOrId, $reason= '') | |
| Add or update an alignment. | |
| approveAlignments ($urlOrId=null) | |
| Approves new, changed and deleted alignments. | |
| cancelAlignments ($urlOrId=null) | |
| Cancels any unapproved changes to alignments. | |
| listAlignments ($what=TSD::MODE_APPROVED, $cnt=false) | |
| Retrieves list of resources aligned to this node. | |
| unalign ($urlOrId) | |
| Remove existing alignment. | |
For internal use only.
This class provides methods for aligning and unaligning resources with TSD objects. The classes through which you should actually align and unalign are TSDStandard, TSDText and TSDWord (which does double duty for representing both a word and its alignments)
Additional Discussion
One of the rules is that there is always a DEV version for any alignment and there *may* be a LIVE version. The only way you can have a DEV version without a LIVE version is if the DEV version is NEW and hasn't been approved yet. If a DEV version is to be deleted, it will simply be marked DELETED and not actually deleted until approval is done
Definition at line 22 of file TSDLeaf.php5.
| TSDLeaf::__construct | ( | $ | table, | |
| $ | attrs, | |||
| $ | idname, | |||
| $ | id, | |||
| $ | alignTable, | |||
| $ | realIdname | |||
| ) |
Middle link in chain of constructors.
For internal use only.
| $table | [string]: name of table in DB (for leaves, is usually not a real table) | |
| $attrs | [array]: list of attributes that this object has | |
| $idname | [string]: name of the primary key or equivalent identifier (e.g., 'objective_id') | |
| $id | [string]: ID to populate on, if provided | |
| $alignTable | [string]: alignments for this leaf are stored in this table (e.g., StandardAlignments) | |
| $realIdname | [string]: name of the field in $alignTable that identifies alignment nodes (e.g., 'objectiveId') |
Definition at line 39 of file TSDLeaf.php5.
| TSDLeaf::align | ( | $ | urlOrId, | |
| $ | reason = '' | |||
| ) |
Add or update an alignment.
You provide either a URL or a resource ID to a CSERD resource. You may also specify a reason for the alignment, although this is not required by TSD (it may be required for certain projects). If the alignment does not exist, it is created and marked as DEV with a status of NEW. If it already exists, then the DEV version is marked as CHANGED. Since there can only be one alignment between a given TSD node and resource, changing the reason for alignment is the only way to mark an alignment as CHANGED.
You must have the 'align' permission (see TSD::setPermission() and TSD::can() for more).
| $urlOrId | [mixed]: CSERD resource URL or resource ID | |
| $reason | [string]: reason for alignment, if any |
Definition at line 148 of file TSDLeaf.php5.
References TSD::can(), TSDObject::getUnique(), TSD::log(), and SObject::setError().
| TSDLeaf::approveAlignments | ( | $ | urlOrId = null |
) |
Approves new, changed and deleted alignments.
When alignments are created, modified or removed using align() and unalign(), only the versions marked as DEV are modified. To actually make these changes visible on production sites that use TSD, you must approve the alignments, using this method. This method will approve all alignments involving the TSD node associated with this object. You can also specify that only a single alignment be approved, by providing a CSERD resource ID or URL.
Once an alignment is approved, both the DEV version and the LIVE version are marked as APPROVED and the LIVE version takes on any changes to the reason field that were made in the DEV version. If the alignment was to be deleted, then it is removed completely from the database (both DEV and LIVE versions). If the alignment was new, then a new LIVE entry for that alignment is created.
You must have the 'approve' permission (see TSD::setPermission() and TSD::can())
| $urlOrId | [mixed]: CSERD resource URL or ID, to approve only a single resource's alignment with this TSD node |
Definition at line 266 of file TSDLeaf.php5.
References TSD::can(), TSDObject::getUnique(), TSD::log(), SObject::setError(), TSD::STATUS_CHANGED, TSD::STATUS_DELETED, and TSD::STATUS_NEW.
| TSDLeaf::cancelAlignments | ( | $ | urlOrId = null |
) |
Cancels any unapproved changes to alignments.
If any alignments with this TSD node were created or modified, you can undo those changes with this method. The alignments will return to the state they were in before they were modified, i.e., they will match the LIVE versions for those alignments (except for NEW alignments, which are discarded altogether).
You must have the 'approve' permission (see TSD::setPermission() and TSD::can())
| $urlOrId | [string]: CSERD resource URL or ID |
Definition at line 359 of file TSDLeaf.php5.
References TSD::can(), TSDObject::getUnique(), TSD::log(), and SObject::setError().
| TSDLeaf::listAlignments | ( | $ | what = TSD::MODE_APPROVED, |
|
| $ | cnt = false | |||
| ) |
Retrieves list of resources aligned to this node.
The result set is in the form of an array with each element containing the following bits of information about the resource/alignment:
id: resource IDreason: reason for alignment, if anyversion: 'DEV' or 'LIVE'status: 'NEW', 'CHANGED', 'DELETED' or 'APPROVED'
| $what | [string]: one of the TSD::MODE_* constants (e.g., TSD::MODE_APPROVED); this determines which kind of alignments should be returned | |
| $cnt | [boolean]: if true, just return the number of alignments, otherwise, return the alignments |
Definition at line 61 of file TSDLeaf.php5.
References SConfig::getDefault(), TSDObject::getUnique(), TSD::MODE_ALL, TSD::MODE_APPROVED, TSD::MODE_CHANGED, TSD::MODE_DELETED, TSD::MODE_DEV, TSD::MODE_DEV_ACTIVE, TSD::MODE_DEV_UNAPPROVED, TSD::MODE_LIVE, TSD::MODE_NEW, and SObject::setError().
| TSDLeaf::unalign | ( | $ | urlOrId | ) |
Remove existing alignment.
If no alignment exists for the given node and CSERD resource, then no action is taken. Removed alignments are marked as DELETED and when approved (see approveAlignments()), they will actually be removed from the database.
You must have the 'align' permission (see TSD::setPermission() and TSD::can())
| $urlOrId | [mixed]: CSERD resource URL or resource ID |
Definition at line 206 of file TSDLeaf.php5.
References TSD::can(), TSDObject::getUnique(), TSD::log(), and SObject::setError().
1.5.6