TSDService Class Reference
[XML Service Objects]

Backend for TSD XML service (to be used with SDR). More...

Inheritance diagram for TSDService:

Inheritance graph
[legend]

List of all members.

Static Public Member Functions

static buildConstraints ($req, $limit, $blah)
 INSERT BRIEF DESCRIPTION HERE.
static getAlignments ($req)
 Retrieves XML listing of standard/textbooks/words aligned to given resource(s).
static getAlignmentsByStatus ($req, $keyOn= 'resource', $asXML=false)
 INSERT BRIEF DESCRIPTION HERE.
static getRelationships ($req, $asXML=true)
 Retrieves a list of resources related to a give resource.
static getResourcesAligned ($type, $id, $mode=TSDRequest::MODE_APPROVED, $offset=false, $limit=false)
 Retrieves list of resources aligned to a given standard/textbook/word.
static getTree ($rootType, $rootId= '', $recursive=true)
 Retrieves XML describing some portion of the standards/textbook/dictionary tree.


Detailed Description

Backend for TSD XML service (to be used with SDR).

If you are accessing TSD directly in your project, you should use the other TSD classes. This class is only meant to be used by SDR to provide information for remote requests, such as would be used by the Advanced Search Service.


Member Function Documentation

static TSDService::buildConstraints ( req,
limit,
blah 
) [static]

INSERT BRIEF DESCRIPTION HERE.

INSERT FULL DESCRIPTION HERE

Parameters:
$req [TYPE]: DESCRIPTION
$limit [TYPE]: DESCRIPTION
$blah [TYPE]: DESCRIPTION
Returns:
[TYPE]: RETURN DESCRIPTION

static TSDService::getAlignments ( req  )  [static]

Retrieves XML listing of standard/textbooks/words aligned to given resource(s).

The XML is hierarchical and includes information about the ancestors of the actual aligned items. For example, if a standard objective is aligned to the resource, then the XML for that would be:

 <organization>
   <id>2</id>
   <name>Foobar</name>
   ...
   <grade>
     <id>1337</id>
     <name>6th</name>
     <category>
       <id>605</id>
       <name>Algebra</name>
       <objective>
         <id>314</id>
         <name>Teaching stuff</name>
       </objective>
     </category>
   </grade>
 </organization>
 

And if there were multiple alignments, they would be put in the appropriate places in the tree, possibly resulting in additional organizations, categories, etc. being in the XML. The same rules are true for textbooks. Words have no hierarchy, so the XML is simply a list of word ~ definition pairs:

 <word>
   <word>foo</name>
   <definition>First canonical metasyntactic variable</definition>
 </word>
 

For each resource ID provided, there will be an entry in the return array containing the XML trees as described above, surrounded by the tags <alignments>...</alignments>.

All parameters are provided through a TSDRequest object. This method looks at the mode, types and resourceIds parameters in TSDRequest.

Parameters:
$req [TSDRequest]: request object providing parameters for this method
Returns:
[array]: array of XML strings, one for each resource ID requested, or null if there was an error

static TSDService::getAlignmentsByStatus ( req,
keyOn = 'resource',
asXML = false 
) [static]

INSERT BRIEF DESCRIPTION HERE.

INSERT FULL DESCRIPTION HERE

Parameters:
$req [TYPE]: DESCRIPTION
$keyOn [TYPE]: DESCRIPTION
$asXML [TYPE]: DESCRIPTION
Returns:
[TYPE]: RETURN DESCRIPTION

static TSDService::getRelationships ( req,
asXML = true 
) [static]

Retrieves a list of resources related to a give resource.

For each specified resource ID, the following XML tree is generated, with one <relationship> entry for each relationship to that resource ID:

 <relationships>
   <resourceId>42</resourceId>
   <relationship>
     <resourceId>17</resourceId>
     <description>foo</description>
     <version>dev</version>
     <status>approved</status>
   </relationship>
   <relationship>
     ...
   </relationship>
   <relationship>
     ...
   </relationship>
 </relationships>
 

The TSDRequest object that must be passed as an argument must provide the mode, and resourceIds parameters.

Parameters:
$req [TSDRequest]: request object providing parameters for this operation
$asXML [boolean]: if true, returns XML as described above, if false, returns nested array with the same information
Returns:
[array]: array of XML strings (as described above), one for each resource ID given, or null if there was an error

static TSDService::getResourcesAligned ( type,
id,
mode = TSDRequest::MODE_APPROVED,
offset = false,
limit = false 
) [static]

Retrieves list of resources aligned to a given standard/textbook/word.

Parameters:
$type [string]: one of 'section' (for textbooks), 'objective' (for standards) or 'word' (for dictionary)
$id [int]: the section, objective id, or word that we are checking alignments against
$mode [int]: trim down results based on status of alignment (see TSDRequest::MODE_* constants)
$offset [int]: if provided, use as the offset for a LIMIT clause
$limit [int]: if provided, use as the count for a LIMIT clause
Returns:
[array]: array of resource IDs that are aligned to the given standard, textbook or work, or null if there was an error

static TSDService::getTree ( rootType,
rootId = '',
recursive = true 
) [static]

Retrieves XML describing some portion of the standards/textbook/dictionary tree.

This function is used to get information about available standards, textbooks and dictionary words. It does not return information about alignments or resource relationships. The resultset can be large, so avoid querying, e.g., the entire standards tree (which is over 400KB of XML).

There are three distinct trees: standards, textbooks and the dictionary. You cannot have the results of all three or any combination thereof in a single resultset (that is, you can only get results for all or part of one of the trees). If you specify the $rootType to be 'book', 'organization' or 'word', you will get the whole standards, textbooks or dictionary trees (respectively) unless you also specify a $rootId, which will only give the tree for a given book, organization or word. If you specify a $rootType that is lower than the top level, then information will still be given about the higher levels of the tree, but only for ancestry purposes. For example, if you want to list all objectives in a given category, you will still given information about that category's grade and that grade's organization. But you will not get information about other categories, grades or organizations. This is the same behavior as in TSDService::getAlignments().

The $recursive option determines whether information about sublevels should be returned as well. If it is false, then only information about the given $rootType and $rootId is returned. If $rootId is empty, then you get a listing of all $rootType items in the tree, regardless of parentage. A more flexible system may be implemented in the future.

Parameters:
$rootType [string]: one of 'book', 'chapter', 'section', 'organization', 'grade', 'category', 'objective' or 'word'. This gives the top level of the tree (but, see explanation above).
$rootId [int]: ID of top element in result tree, or empty for all items of the root type or for when query the top level of the tree.
$recursive [boolean]: whether to return details about levels in the tree lower than the one selected by $rootType
Returns:
[string]: XML string describing part of the TSD tree or null if there is an error.


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

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