Class: learnpath

Source Location: /learnpath.class.php

Class Overview [line 12]


Defines the learnpath parent class

Author(s):

Version:

Copyright:

Variables

Methods


Child classes:

scorm
Defines the "scorm" child of class "learnpath"

Inherited Variables

Inherited Methods



Class Details

Defines the learnpath parent class

[ Top ]


Class Variables

$cc =

[line 13]

Type: mixed

Overrides:

[ Top ]

$current =

[line 14]

Type: mixed

Overrides:

[ Top ]

$current_score =

[line 15]

Type: mixed

Overrides:

[ Top ]

$current_time_start =

[line 16]

Type: mixed

Overrides:

[ Top ]

$current_time_stop =

[line 17]

Type: mixed

Overrides:

[ Top ]

$db =

[line 18]

Type: mixed

Overrides:

[ Top ]

$db_id =

[line 19]

Type: mixed

Overrides:

[ Top ]

$error =  ''

[line 20]

Type: mixed

Overrides:

[ Top ]

$last =

[line 21]

Type: mixed

Overrides:

[ Top ]

$log_file =

[line 22]

Type: mixed

Overrides:

[ Top ]

$name =

[line 23]

Type: mixed

Overrides:

[ Top ]

$resource_list = array()

[line 24]

Type: mixed

Overrides:

[ Top ]

$user_id =

[line 25]

Type: mixed

Overrides:

[ Top ]


Class Methods

learnpath

boolean learnpath( resource &$db, string $course, integer $id, mixed $user_id)

[line 35]

Class constructor. Needs a database handler, a course code and a learnpath id from the database.

Also builds the list of items into $resource_list.

Tags:

  • return - True on success, false on error

Parameters:

  • resource &$db - Database handler (already opened of course). Should use opened handler by default
  • string $course - Course code
  • integer $id - Learnpath ID

[ Top ]

add_lp

void add_lp( string $course, string $name, string $zipname, [string $origin = 'zip'], [string $learnpath = 'guess'], integer 5)

[line 303]

Static admin function allowing addition of a learnpath to a course.

Parameters:

  • integer 5 - The new learnpath ID on success, 0 on failure
  • string $course - Course code
  • string $name - Learnpath name
  • string $zipname - Zip file containing the learnpath or directory containing the learnpath
  • string $origin - Type of files origin (default = 'zip', others = 'dir','web_dir',...)
  • string $learnpath - Type of learnpath (default = 'guess', others = 'dokeos', 'aicc',...)

[ Top ]

autosave

void autosave( )

[line 146]

Autosaves the current results into the database for the whole learnpath

Parameters:

[ Top ]

autosave_item

void autosave_item( integer $id)

[line 153]

Autosaves the current results into the database for the current element

Parameters:

  • integer $id - Element ID in this learnpath

[ Top ]

close

boolean close( )

[line 164]

Closes the current resource

Stops the timer Saves into the database if required Clears the current resource data from this object

Tags:

  • return - True on success, false on failure

Parameters:

[ Top ]

del_lp

boolean del_lp( string $course, integer $id, string $delete)

[line 313]

Static admin function allowing removal of a learnpath

Tags:

  • return - True on success, false on failure (might change that to return number of elements deleted)

Parameters:

  • string $course - Course code
  • integer $id - Learnpath ID
  • string $delete - Whether to delete data or keep it (default: 'keep', others: 'remove')

[ Top ]

edit_add

integer edit_add( integer $parent, integer $previous, [string $type = 'file'], string $id_or_path)

[line 334]

Adds an item to the current learnpath

Tags:

  • return - New element ID

Parameters:

  • integer $parent - Parent ID
  • integer $previous - Previous elem ID (0 if first)
  • string $type - Resource type to add ('file','dokeos_item')
  • string $id_or_path - Resource ID or path if 'file'

[ Top ]

edit_del

integer edit_del( integer $parent, integer $id, [integer $remove = 'keep'])

[line 344]

Removes an item from the current learnpath

Tags:

  • return - Number of elements moved

Parameters:

  • integer $parent - Parent ID
  • integer $id - Elem ID (0 if first)
  • integer $remove - Whether to remove the resource/data from the system or leave it (default: 'keep', others 'remove')

[ Top ]

edit_update

boolean edit_update( integer $id, string $content)

[line 353]

Updates an item's content in place

Tags:

  • return - True on success, false on error

Parameters:

  • integer $id - Element ID
  • string $content - New content

[ Top ]

export_lp

string export_lp( string $course, integer $id, string $zipname)

[line 323]

Static admin function exporting a learnpath into a zip file

Tags:

  • return - Zip file path

Parameters:

  • string $course - Course code
  • integer $id - Learnpath ID
  • string $zipname - Zip file name

[ Top ]

get_first

string get_first( )

[line 195]

Gets the first element URL.

Tags:

  • return - URL to load into the viewer

Parameters:

[ Top ]

get_last

string get_last( )

[line 203]

Gets the last element URL.

Tags:

  • return - URL to load into the viewer

Parameters:

[ Top ]

get_next

string get_next( )

[line 210]

Gets the next resource in queue (url). Also initialises time values for this viewing.

Tags:

  • return - URL to load into the viewer

Parameters:

[ Top ]

get_previous

string get_previous( )

[line 218]

Gets the previous resource in queue (url). Also initialises time values for this viewing

Tags:

  • return - URL to load into the viewer

Parameters:

[ Top ]

get_stats

array get_stats( )

[line 226]

Returns a usable array of stats related to the current learnpath and user

Tags:

  • return - Well-formatted array containing status for the current learnpath

Parameters:

[ Top ]

get_stats_course

array get_stats_course( string $course)

[line 235]

Static method. Can be re-implemented by children. Gives an array of statistics for

the given course (for all learnpaths and all users)

Tags:

  • return - Well-formatted array containing status for the course's learnpaths

Parameters:

  • string $course - Course code

[ Top ]

get_stats_lp

array get_stats_lp( string $course, integer $lp)

[line 245]

Static method. Can be re-implemented by children. Gives an array of statistics for

the given course and learnpath (for all users)

Tags:

  • return - Well-formatted array containing status for the specified learnpath

Parameters:

  • string $course - Course code
  • integer $lp - Learnpath ID

[ Top ]

get_stats_lp_user

array get_stats_lp_user( string $course, integer $lp, integer $user)

[line 256]

Static method. Can be re-implemented by children. Gives an array of statistics for the given course, learnpath and user.

Tags:

  • return - Well-formatted array containing status for the specified learnpath and user

Parameters:

  • string $course - Course code
  • integer $lp - Learnpath ID
  • integer $user - User ID

[ Top ]

get_stats_user

array get_stats_user( string $course, integer $user)

[line 266]

Static method. Can be re-implemented by children. Gives an array of statistics for

the given course and learnpath (for all users)

Tags:

  • return - Well-formatted array containing status for the user's learnpaths

Parameters:

  • string $course - Course code
  • integer $user - User ID

[ Top ]

log

boolean log( string $msg)

[line 370]

Logs a message into a file

Tags:

  • return - True on success, false on error or if msg empty

Parameters:

  • string $msg - Message to log

[ Top ]

open

boolean open( integer $id)

[line 275]

Open a resource = initialise all local variables relative to this resource. Depending on the child class, this might be redefined to allow several behaviours depending on the document type.

Tags:

  • return - True on success, false otherwise

Overridden in child classes as:

scorm::open()
Opens a resource

Parameters:

  • integer $id - Resource ID

[ Top ]

publish

void publish( integer $id, string $name)

[line 362]

Publishes a learnpath. This basically means rendering the given learnpath in a format defined

by the child implementation of this method (scorm for example)

Parameters:

  • integer $id - Learnpath ID
  • string $name - New learnpath name

[ Top ]

restart

string restart( )

[line 290]

Restart the whole learnpath. Return the URL of the first element.

Make sure the results are saved with anoter method. This method should probably be redefined in children classes.

Tags:

  • return - URL to load in the viewer

Parameters:

[ Top ]


Documentation generated on Sun, 22 Jan 2006 23:26:39 +0000 by phpDocumentor 1.2.3