dokeos-learnpath
[ class tree: dokeos-learnpath ] [ index: dokeos-learnpath ] [ all elements ]

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 :

  1. name used in the first version of the resourcelinker
  2. name used in the first version of the LP
  3. name used in the second (current) version of the LP
  1. 2. 3.
Category = Chapter = Module Item (?) = Item = Step




Tags:

author:  Yannick Warnier <yannick.warnier@dokeos.com>, multi-level learnpath behaviour + new SCORM tool
author:  Denes Nagy <darkden@evk.bke.hu>, main author
author:  Roan Embrechts, some code cleaning
todo:  rewrite functions to comply with phpDocumentor
todo:  remove code duplication
todo:  rename functions to coding conventions: not deleteitem but delete_item, etc
access:  public
filesource:  Source Code for this file








array_learnpath_categories [line 387]

array array_learnpath_categories( )

This function returns an array with all the learnpath categories/chapters



Tags:

return:  List of learnpath chapter titles


[ Top ]



CopyNCreate [line 2658]

boolean CopyNCreate( string $source, string $dest)

Copy file and create directories in the path if needed.



Tags:

return:  true on success, false on failure


Parameters

string   $source   Source path
string   $dest   Destination path
[ Top ]



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
[ Top ]



deldir [line 2173]

boolean deldir( string $dir)

This function deletes an entire directory



Tags:

return:  True on success, false on failure


Parameters

string   $dir   The directory path
[ Top ]



deleteitem [line 56]

boolean deleteitem( $id, integer $id:)

This function deletes an item



Tags:

return:  True if item was deleted, false if not found or error


Parameters

integer   $id:   the item we want to delete
   $id  
[ Top ]



deletemodule [line 92]

boolean deletemodule( integer $parent_item_id)

This function deletes a module(chapter) and all its steps(items).



Tags:

return:  True on success and false if not found or error


Parameters

integer   $parent_item_id   id of the chapter we want to delete
[ Top ]



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  
[ Top ]



display_all_learnpath [line 653]

void display_all_learnpath( )

Displays all learning paths.



Tags:

todo:  eliminate all global $lang declarations, use get_lang, improve structure.


[ Top ]



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:

author:  Denes Nagy
author:  Roan Embrechts
author:  Yannick Warnier <yannick.warnier@dokeos.com> - complete redesign for multi-level learnpath chapters
todo:  eliminate all global $lang declarations, use get_lang, improve structure.


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)
[ Top ]



display_learnpath_items [line 705]

void display_learnpath_items( integer $categoryid)

Displays the learning path items/steps.



Tags:

todo:  eliminate all global $lang declarations, use get_lang, improve structure.


Parameters

integer   $categoryid   Category ID
[ Top ]



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:

return:  Number of items, Number of items completed
author:  Many changes by Yannick Warnier <yannick.warnier@dokeos.com>


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)
[ Top ]



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
[ Top ]



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:

return:  (outputs a zip file)
todo:  Try using the SCORM communications addition (adding a button and several javascript calls to the SCORM API) elsewhere than just in the export feature, so it doesn't look like an incoherent feature


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.
[ Top ]



exportpath [line 2209]

resource exportpath( integer $learnpath_id)

This functions exports the given path. This is the opener function, which is called first



Tags:

return:  A zip file, containing a hopefully Scorm compliant course made from the LP. This might happen when we don't actually exit the function first :-)


Parameters

integer   $learnpath_id   The path id
[ Top ]



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:

author:  imandak80


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
[ Top ]



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
[ Top ]



export_exercise [line 1404]

string export_exercise( integer $item_id)

This function exports the given Dokeos test



Tags:

return:  The test itself as an HTML string


Parameters

integer   $item_id   Test ID
[ Top ]



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:

return:  array of strings on success, false on failure
author:  unknown
author:  included by imandak80


Parameters

string   $fileName   file path
[ Top ]



get_learnpath_tree [line 1047]

array get_learnpath_tree( $learnpath_id)

Constructs the tree that will be used to build the learnpath structure



Tags:

return:  Tree of the learnpath structure
author:  Yannick Warnier <yannick.warnier@dokeos.com>


Parameters

   $learnpath_id  
[ Top ]



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:

return:  List of elements in the first to last order
author:  Yannick Warnier <yannick.warnier@dokeos.com>


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
[ Top ]



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:

author:  Yannick Warnier <yannick.warnier@dokeos.com>


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
[ Top ]



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:

return:  The new chapter ID, or false on failure
TODO:  Finish this function before it is used. Currently only chapters can be added using it.


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_..)
[ Top ]



is_empty [line 1335]

boolean is_empty( Learnpath $id)

This function returns false if there is at least one item in the path



Tags:

return:  True if nothing was found, false otherwise


Parameters

Learnpath   $id   ID
[ Top ]



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:

return:  True if this learnpath contains an item which is a prerequisite to something


Parameters

integer   $learnpath_id   Learnpath id
[ Top ]



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:

return:  Table containing the chapters


Parameters

integer   $learnpath_id   Learnpath id
[ Top ]



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:

return:  Table containing the items


Parameters

integer   $itemid   Item id
[ Top ]



moveitem [line 175]

boolean moveitem( $direction, integer $id, $moduleid, [ $type = 'item'], string $direction:, integer $moduleid:)

This function moves an item.



Tags:

return:  Returns false on error


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  
[ Top ]



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  
[ Top ]



prereqcheck [line 901]

string prereqcheck( integer $id_in_path)

This function returns the prerequisite sentence



Tags:

return:  Prerequisite warning text


Parameters

integer   $id_in_path   Item ID
[ Top ]



rcopy [line 2679]

void rcopy( $source, $dest)



Parameters

   $source  
   $dest  
[ Top ]



xmltagwrite [line 2385]

string xmltagwrite( string $tagname, string $which, array $data, [string $linebreak = &quot;yes&quot;])

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  
[ Top ]



Documentation generated on Thu, 12 Jun 2008 13:58:30 -0500 by phpDocumentor 1.4.1