Procedural File: learnpath_functions.inc.php
Source Location: /main/newscorm/learnpath_functions.inc.php
Page Details:
This is a function library for the learning path.
Due to the face that the learning path has been built upon the resoucelinker, naming conventions have changed at least 2 times. You can see here in order the : - name used in the first version of the resourcelinker
- name used in the first version of the LP
- name used in the second (current) version of the LP
- 2. 3.
Category = Chapter = Module Item (?) = Item = Step
Tags:
array_learnpath_categories [line 387]
array array_learnpath_categories(
)
|
|
This function returns an array with all the learnpath categories/chapters
Tags:
CopyNCreate [line 2658]
boolean CopyNCreate(
string $source, string $dest)
|
|
Copy file and create directories in the path if needed.
Tags:
Parameters
| string |
$source |
Source path |
| string |
$dest |
Destination path |
createimsmanifest [line 2432]
void createimsmanifest(
array $circle1_files, integer $learnpath_id)
|
|
This function writes the imsmanifest.xml and exports the chapter names
Parameters
| array |
$circle1_files |
Array containing filenames |
| integer |
$learnpath_id |
Learnpath_id |
deldir [line 2173]
boolean deldir(
string $dir)
|
|
This function deletes an entire directory
Tags:
Parameters
| string |
$dir |
The directory path |
deleteitem [line 56]
boolean deleteitem(
$id, integer $id:)
|
|
This function deletes an item
Tags:
Parameters
| integer |
$id: |
the item we want to delete |
| |
$id |
|
deletemodule [line 92]
boolean deletemodule(
integer $parent_item_id)
|
|
This function deletes a module(chapter) and all its steps(items).
Tags:
Parameters
| integer |
$parent_item_id |
id of the chapter we want to delete |
deletepath [line 147]
void deletepath(
$path_id, integer $id:)
|
|
This function deletes an entire path.
Parameters
| integer |
$id: |
the path we want to delete |
| |
$path_id |
|
display_all_learnpath [line 653]
void display_all_learnpath(
)
|
|
Displays all learning paths.
Tags:
display_learnpath_chapters [line 414]
void display_learnpath_chapters(
[integer $parent_item_id = 0], [array $tree = array ()], [integer $level = 0])
|
|
Displays the learnpath chapters(=modules,categories) and their contents.
Tags:
Parameters
| integer |
$parent_item_id |
Chapter ID to display now (enables recursive behaviour) |
| array |
$tree |
The array as returned by get_learnpath_tree, with all the elements of a learnpath compiled and structured into the array, by chapter id |
| integer |
$level |
Level (the depth of the call - helps in display) |
display_learnpath_items [line 705]
void display_learnpath_items(
integer $categoryid)
|
|
Displays the learning path items/steps.
Tags:
Parameters
| integer |
$categoryid |
Category ID |
display_toc_chapter_contents [line 1153]
array display_toc_chapter_contents(
array $tree, [integer $parent_item_id = 0], integer $learnpath_id, integer $uid, boolean $wrap, [integer $level = 0])
|
|
Displays the structure of a chapter recursively. Takes the result of get_learnpath_tree as argument
Tags:
Parameters
| array |
$tree |
Chapter structure |
| integer |
$parent_item_id |
Chapter ID (start point in the tree) |
| integer |
$learnpath_id |
Learnpath ID |
| integer |
$uid |
User ID |
| boolean |
$wrap |
Indicates if the style is wrapped (true) or extended (false) |
| integer |
$level |
Level reached so far in the tree depth (enables recursive behaviour) |
exportdescription [line 2158]
void exportdescription(
integer $id, string $item_type, string $description)
|
|
This function exports the given item's description into a separate file
Parameters
| integer |
$id |
Item id |
| string |
$item_type |
Item type |
| string |
$description |
Description |
exportitem [line 1625]
void exportitem(
integer $id, integer $item_id, string $item_type, [boolean $add_scorm_communications = false])
|
|
This function exports the given item
Tags:
Parameters
| integer |
$id |
Id from learnpath_items table |
| integer |
$item_id |
Item id |
| string |
$item_type |
Itm type |
| boolean |
$add_scorm_communications |
Shall the SCORM communications features be added? (true). Default: false. |
exportpath [line 2209]
resource exportpath(
integer $learnpath_id)
|
|
This functions exports the given path. This is the opener function, which is called first
Tags:
Parameters
| integer |
$learnpath_id |
The path id |
exportSCORM [line 2347]
void exportSCORM(
string $scormname, array $course)
|
|
Export SCORM content into a zip file Basically, all this function does is put the scorm directory back into a zip file (like the one that was most probably used to import the course at first)
Tags:
Parameters
| string |
$scormname |
Name of the SCORM path (or the directory under which it resides) |
| array |
$course |
Not used right now. Should replace the use of global $_course |
exporttofile [line 1375]
void exporttofile(
string $filename, string $LPname, integer $LPid, string $content)
|
|
This function writes $content to $filename
Parameters
| string |
$filename |
Destination filename |
| string |
$LPname |
Learnpath name |
| integer |
$LPid |
Learnpath ID |
| string |
$content |
Content to write |
export_exercise [line 1404]
string export_exercise(
integer $item_id)
|
|
This function exports the given Dokeos test
Tags:
Parameters
GetSRCTags [line 2621]
mixed GetSRCTags(
string $fileName)
|
|
Gets the tags of the file given as parameter if $filename is not found, GetSRCTags(filename) will return FALSE
Tags:
Parameters
| string |
$fileName |
file path |
get_learnpath_tree [line 1047]
array get_learnpath_tree(
$learnpath_id)
|
|
Constructs the tree that will be used to build the learnpath structure
Tags:
Parameters
get_ordered_items_list [line 1117]
array get_ordered_items_list(
array $tree, [integer $chapter = 0], [boolean $include_chapters = false])
|
|
Gives a list of sequencial elements IDs for next/previous actions
Tags:
Parameters
| array |
$tree |
The elements tree as returned by get_learnpath_tree() |
| integer |
$chapter |
The chapter id to start from |
| boolean |
$include_chapters |
Whether to include chapters or not |
get_tracking_table [line 1260]
void get_tracking_table(
integer $learnpath_id, integer $user_id, [integer $parent_item_id = 0], [array $tree = false], [integer $level = 0], [integer $counter = 0])
|
|
Returns a string to display in the tracking frame within the contents.php page (for example)
Tags:
Parameters
| integer |
$learnpath_id |
Learnpath id |
| integer |
$user_id |
Current user id |
| integer |
$parent_item_id |
Starting chapter id |
| array |
$tree |
Tree of elements as returned by get_learnpath_tree() |
| integer |
$level |
Level of recursivity we have reached |
| integer |
$counter |
Counter of elements already displayed |
insert_item [line 327]
integer insert_item(
[string $type = 'item'], string $name, [string $chapter_description = ''], [integer $parent_id = 0], [integer $learnpath_id = 0], [mixed $params = null])
|
|
Inserts a new element in a learnpath table (item or chapter)
Tags:
Parameters
| string |
$type |
Element type ('chapter' or 'item') |
| string |
$name |
Chapter name |
| string |
$chapter_description |
Chapter description (optional) |
| integer |
$parent_id |
Parent chapter ID (default: 0) |
| integer |
$learnpath_id |
Learnpath ID |
| mixed |
$params |
If type 'item', then array(prereq_id=>value, prereq_..) |
is_empty [line 1335]
This function returns false if there is at least one item in the path
Tags:
Parameters
is_prereq [line 871]
boolean is_prereq(
integer $learnpath_id)
|
|
This function tells if a learnpath contains items which are prerequisite to other items
Tags:
Parameters
| integer |
$learnpath_id |
Learnpath id |
learnpath_chapters [line 846]
array learnpath_chapters(
integer $learnpath_id)
|
|
This function returns the chapters belonging to the path that contais the given chapter (brother chapters)
Tags:
Parameters
| integer |
$learnpath_id |
Learnpath id |
learnpath_items [line 819]
array learnpath_items(
integer $itemid)
|
|
This function returns the items belonging to the chapter that contains the given item (brother items)
Tags:
Parameters
moveitem [line 175]
boolean moveitem(
$direction, integer $id, $moduleid, [ $type = 'item'], string $direction:, integer $moduleid:)
|
|
This function moves an item.
Tags:
Parameters
| string |
$direction: |
move the given chapter up or down |
| integer |
$moduleid: |
the id of the chapter the element resides in |
| integer |
$id |
Item ID |
| |
$direction |
|
| |
$moduleid |
|
| |
$type |
|
movemodule [line 265]
void movemodule(
$direction, $id, string $direction:, integer $id:)
|
|
This function moves a module (also called chapter or category).
Parameters
| string |
$direction: |
move the given chapter up or down |
| integer |
$id: |
the id of the chapter we want to move |
| |
$direction |
|
| |
$id |
|
prereqcheck [line 901]
string prereqcheck(
integer $id_in_path)
|
|
This function returns the prerequisite sentence
Tags:
Parameters
| integer |
$id_in_path |
Item ID |
rcopy [line 2679]
void rcopy(
$source, $dest)
|
|
Parameters
xmltagwrite [line 2385]
string xmltagwrite(
string $tagname, string $which, array $data, [string $linebreak = "yes"])
|
|
This function returns an xml tag $data behaves as the content in case of full tags $data is an array of attributes in case of returning an opening tag
Parameters
| string |
$tagname |
|
| string |
$which |
|
| array |
$data |
|
| string |
$linebreak |
|
|