Fileref:mod/glossary/sl glossary linker.php

From SLIS Second Life Wiki

Jump to: navigation, search

Image:folder.gif (parent)

This Linker Script allows the Sloodle MetaGloss object in Second Life to communicate with Moodle glossaries. There are 2 modes of operation: browse, and lookup. Browse mode will fetch a list of all available (i.e. visible) glossaries in the specified course, while lookup mode will search for a term in a specific glossary.

By default, the script behaves in browse mode, unless the additional parameters required for lookup mode are specified.


Contents

Additional Information

Debug mode will output additional data, indicating what is happening at all points in the script.


Dependencies

Sloodle files:

Moodle files:

  • mod/glossary/lib.php
  • lib/filelib.php


Request Parameters

The following parameters are always required:

  • sloodlepwd = the Prim Password used to authenticate the WebIntercom for this site
  • sloodlecourseid = ID of the course which the request relates to


The following additional parameter are required for lookup mode:

  • sloodlemoduleid = course module instance ID of the desired chatroom
  • sloodleconcept = the term to search for in the glossary


The following parameter is always optional:

  • sloodledebug = activates debug mode


Response

Browse Mode

If the search for glossaries is successful (even if there are no glossaries to find), the status code returned will be 1. Each data line will contain the ID and name of a glossary (remember to check the number of data lines before trying to process them). The format of each data line will be as follows:

<id>|<name>

The 'id' value will be an integer, giving the course module instance ID which should be passed back via the 'sloodlemoduleid' parameter for lookup mode. The 'name' value will be a string, giving the name of the glossary instance.


Lookup Mode

If the glossary search works, then the status code will always be 1 (even if no search results are found). Each data line will contain information about one search result from the glossary, with the following format:

<concept>|<definition>

The 'concept' value is the string which uniquely identifies the glossary entry. Note that the glossary search fetches partial matches to the search term, so for example, searching for "scot" would return results for both "scotland" and "scottish". As such, the concept for each result may not exactly match the original search term. The 'definition' value is the raw-text definition stored in the database. Note that HTML and formatting etc. are stripped out.


Algorithm

  1. Construct SloodleLSLHandler object
  2. Process basic request data
  3. Authenticate request
  4. Fetch additional parameters
  5. Retrieve course data (terminate on failure)
  6. If module ID was specified, then retrieve module instance data (terminate on failure)
  7. If module was specified but concept was not, then terminate on error
  8. Else if concept was specified but module was not, then terminate on error
  9. If module was not specified, then:
    1. (In browse mode)
    2. Fetch list of available glossaries
    3. Output each glossary
  10. Else:
    1. (In lookup mode)
    2. Search selected glossary for specified cocept
    3. Output each entry
  11. Render response
  12. Terminate script


This page is part of the Sloodle documentation
SloodleDocs Home | User Documentation | Administrator Documentation | Developer Documentation | Sloodle Wiki Home