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

Class: learnpathItem

Source Location: /main/newscorm/learnpathItem.class.php

Class Overview


lp_item defines items belonging to a learnpath. Each item has a name, a score, a use time and additional


Variables

Methods


Child classes:

aiccBlock
lp_item defines items belonging to a learnpath. Each item has a name, a score, a use time and additional
aiccItem
lp_item defines items belonging to a learnpath. Each item has a name, a score, a use time and additional
aiccObjective
lp_item defines items belonging to a learnpath. Each item has a name, a score, a use time and additional
scormItem
lp_item defines items belonging to a learnpath. Each item has a name, a score, a use time and additional

Class Details

[line 13]
lp_item defines items belonging to a learnpath. Each item has a name, a score, a use time and additional

information that enables tracking a user's progress in a learning path




[ Top ]


Class Variables

$attempt_id =

[line 14]


Type:   mixed


[ Top ]

$children = array()

[line 15]


Type:   mixed


[ Top ]

$condition =

[line 16]


Type:   mixed


[ Top ]

$current_data =  ''

[line 20]


Type:   mixed


[ Top ]

$current_score =

[line 17]


Type:   mixed


[ Top ]

$current_start_time =

[line 18]


Type:   mixed


[ Top ]

$current_stop_time =

[line 19]


Type:   mixed


[ Top ]

$db_id =

[line 21]


Type:   mixed


[ Top ]

$db_item_view_id =  ''

[line 22]


Type:   mixed


[ Top ]

$debug =  0

[line 57]


Type:   mixed


[ Top ]

$description =  ''

[line 23]


Type:   mixed


[ Top ]

$file =

[line 24]


Type:   mixed


[ Top ]

$interactions = array()

[line 27]


Type:   mixed


[ Top ]

$interactions_count =  0

[line 28]


Type:   mixed


[ Top ]

$launch_data =  ''

[line 31]


Type:   mixed


[ Top ]

$lesson_location =  ''

[line 32]


Type:   mixed


[ Top ]

$level =  0

[line 33]


Type:   mixed


[ Top ]

$lp_id =

[line 35]


Type:   mixed


[ Top ]

$mastery_score =

[line 37]


Type:   mixed


[ Top ]

$max_score =

[line 36]


Type:   mixed


[ Top ]

$max_time_allowed =  ''

[line 39]


Type:   mixed


[ Top ]

$min_score =

[line 38]


Type:   mixed


[ Top ]

$name =

[line 40]


Type:   mixed


[ Top ]

$next =

[line 41]


Type:   mixed


[ Top ]

$objectives = array()

[line 29]


Type:   mixed


[ Top ]

$objectives_count =  0

[line 30]


Type:   mixed


[ Top ]

$parent =

[line 42]


Type:   mixed


[ Top ]

$path =

[line 43]


Type:   mixed


[ Top ]

$possible_status = array('not attempted','incomplete','completed','passed','failed','browsed')

[line 44]


Type:   mixed


[ Top ]

$prereqs = array()

[line 47]


Type:   mixed


[ Top ]

$prereq_alert =  ''

[line 46]


Type:   mixed


[ Top ]

$prereq_string =  ''

[line 45]


Type:   mixed


[ Top ]

$prevent_reinit =  1

[line 49]


Type:   mixed


[ Top ]

$previous =

[line 48]


Type:   mixed


[ Top ]

$ref =

[line 50]


Type:   mixed


[ Top ]

$save_on_close =  true

[line 51]


Type:   mixed


[ Top ]

$status =

[line 52]


Type:   mixed


[ Top ]

$title =

[line 53]


Type:   mixed


[ Top ]

$type =

[line 54]


Type:   mixed


[ Top ]

$view_id =

[line 55]


Type:   mixed


[ Top ]



Class Methods


constructor learnpathItem [line 67]

boolean learnpathItem( integer $db_id, integer $user_id)

Class constructor. Prepares the learnpath_item for later launch

Don't forget to use set_lp_view() if applicable after creating the item. Setting an lp_view will finalise the item_view data collection




Tags:

return:  True on success, false on failure


Parameters:

integer   $db_id   Learnpath item ID
integer   $user_id   User ID

[ Top ]

method add_child [line 110]

void add_child( $item)

Adds a child to the current item



Parameters:

   $item  

[ Top ]

method add_interaction [line 126]

void add_interaction( int $index, array $params)

Adds an interaction to the current item



Parameters:

int   $index   Index (order ID) of the interaction inside this item
array   $params   Array of parameters: id(0), type(1), time(2), weighting(3),correct_responses(4),student_response(5),result(6),latency(7)

[ Top ]

method add_objective [line 152]

void add_objective( array $index, $params)

Adds an objective to the current item



Parameters:

array   $index   Array of parameters: id(0), status(1), score_raw(2), score_max(3), score_min(4)
   $params  

[ Top ]

method close [line 166]

boolean close( )

Closes/stops the item viewing. Finalises runtime values. If required, save to DB.



Tags:

return:  True on success, false otherwise


[ Top ]

method delete [line 191]

boolean delete( )

Deletes all traces of this item in the database



Tags:

return:  true. Doesn't check for errors yet.


[ Top ]

method drop_child [line 209]

void drop_child( string $item)

Drops a child from the children array



Parameters:

string   $item   index of child item to drop

[ Top ]

method get_attempt_id [line 226]

integer get_attempt_id( )

Gets the current attempt_id for this user on this item



Tags:

return:  The attempt_id for this item view by this user, or 1 if none defined


[ Top ]

method get_children [line 241]

array get_children( )

Gets a list of the item's children



Tags:

return:  Array of children items IDs


[ Top ]

method get_core_exit [line 257]

void get_core_exit( )

Gets the core_exit value from the database



[ Top ]

method get_credit [line 266]

string get_credit( )

Gets the credit information (rather scorm-stuff) based on current status and reinit

autorization. Credit tells the sco(content) if Dokeos will record the data it is sent (credit) or not (no-credit)




Tags:

return:  'credit' or 'no-credit'. Defaults to 'credit' because if we don't know enough about this item, it's probably because it was never used before.


[ Top ]

method get_current_start_time [line 286]

integer get_current_start_time( )

Gets the current start time property



Tags:

return:  Current start time, or current time if none


[ Top ]

method get_description [line 300]

string get_description( )

Gets the item's description



Tags:

return:  Description


[ Top ]

method get_file_path [line 309]

string get_file_path( [ $path_to_scorm_dir = ''])

Gets the file path from the course's root directory, no matter what tool it is from.



Tags:

return:  The file path, or an empty string if there is no file attached, or '-1' if the file must be replaced by an error page


Parameters:

   $path_to_scorm_dir  

[ Top ]

method get_id [line 358]

integer get_id( )

Gets the DB ID



Tags:

return:  Database ID for the current item


[ Top ]

method get_interactions_count [line 371]

int get_interactions_count( )

Gets the current count of interactions recorded in the database



Tags:

return:  The current number of interactions recorder


[ Top ]

method get_launch_data [line 397]

string get_launch_data( )

Gets the launch_data field found in imsmanifests (this is SCORM- or AICC-related, really)



Tags:

return:  Launch data as found in imsmanifest and stored in Dokeos (read only). Defaults to ''.


[ Top ]

method get_lesson_location [line 408]

string get_lesson_location( )

Gets the lesson location



Tags:

return:  lesson location as recorded by the SCORM and AICC elements. Defaults to ''


[ Top ]

method get_lesson_mode [line 418]

string get_lesson_mode( )

Gets the lesson_mode (scorm feature, but might be used by aicc as well as dokeos paths)

The "browse" mode is not supported yet (because there is no such way of seeing a sco in Dokeos)




Tags:

return:  'browse','normal' or 'review'. Defaults to 'normal'


[ Top ]

method get_level [line 432]

int get_level( )

Gets the depth level



Tags:

return:  Level. Defaults to 0


[ Top ]

method get_mastery_score [line 440]

void get_mastery_score( )

Gets the mastery score



[ Top ]

method get_max [line 449]

int get_max( )

Gets the maximum (score)



Tags:

return:  Maximum score. Defaults to 100 if nothing else is defined


[ Top ]

method get_max_time_allowed [line 475]

string get_max_time_allowed( )

Gets the maximum time allowed for this user in this attempt on this item



Tags:

return:  Time string in SCORM format (HH:MM:SS or HH:MM:SS.SS or HHHH:MM:SS.SS)


[ Top ]

method get_min [line 484]

int get_min( )

Gets the minimum (score)



Tags:

return:  Minimum score. Defaults to 0


[ Top ]

method get_objectives_count [line 384]

int get_objectives_count( )

Gets the current count of objectives recorded in the database



Tags:

return:  The current number of objectives recorder


[ Top ]

method get_parent [line 492]

int get_parent( )

Gets the parent ID



Tags:

return:  Parent ID. Defaults to null


[ Top ]

method get_path [line 505]

string get_path( )

Gets the path attribute.



Tags:

return:  Path. Defaults to ''


[ Top ]

method get_prereq_string [line 514]

string get_prereq_string( )

Gets the prerequisites string



Tags:

return:  Empty string or prerequisites string if defined. Defaults to


[ Top ]

method get_prevent_reinit [line 528]

int get_prevent_reinit( )

Gets the prevent_reinit attribute value (and sets it if not set already)



Tags:

return:  1 or 0 (defaults to 1)


[ Top ]

method get_ref [line 555]

string get_ref( )

Gets the item's reference column



Tags:

return:  The item's reference field (generally used for SCORM identifiers)


[ Top ]

method get_resources_from_source [line 570]

array get_resources_from_source( [string $type = null], [string $abs_path = null], [int $recursivity = 1])

Gets the list of included resources as a list of absolute or relative paths of resources included in the current item. This allows for a better SCORM export.

The list will generally include pictures, flash objects, java applets, or any other stuff included in the source of the current item. The current item is expected to be an HTML file. If it is not, then the function will return and empty list.




Tags:

return:  List of file paths. An additional field containing 'local' or 'remote' helps determine if the file should be copied into the zip or just linked


Parameters:

string   $type   type (one of the Dokeos tools) - optional (otherwise takes the current item's type)
string   $abs_path   path (absolute file path) - optional (otherwise takes the current item's path)
int   $recursivity   level of recursivity we're in

[ Top ]

method get_score [line 896]

float get_score( )

Gets the score



Tags:

return:  The current score or 0 if no score set yet


[ Top ]

method get_scorm_time [line 957]

void get_scorm_time( [string $origin = 'php'], [integer $given_time = null])

Gets the total time spent on this item view so far



Parameters:

string   $origin   Origin of the request. If coming from PHP, send formatted as xxhxx'xx", otherwise use scorm format 00:00:00
integer   $given_time   Given time is a default time to return formatted

[ Top ]

method get_status [line 912]

string get_status( [boolean $check_db = true], [boolean $update_local = false])

Gets the item status



Tags:

return:  Current status or 'Nnot attempted' if no status set yet


Parameters:

boolean   $check_db   Do or don't check into the database for the latest value. Optional. Default is true
boolean   $update_local   Do or don't update the local attribute value with what's been found in DB

[ Top ]

method get_suspend_data [line 946]

void get_suspend_data( )

Gets the suspend data



[ Top ]

method get_title [line 991]

string get_title( )

Returns the item's title



Tags:

return:  Title


[ Top ]

method get_total_time [line 1000]

integer get_total_time( )

Returns the total time used to see that item



Tags:

return:  Total time


[ Top ]

method get_type [line 1017]

string get_type( )

Gets the item type



Tags:

return:  The item type (can be doc, dir, sco, asset)


[ Top ]

method get_view_count [line 1032]

void get_view_count( )

Gets the view count for this item



[ Top ]

method is_done [line 1044]

bool is_done( )

Tells if an item is done ('completed','passed','succeeded') or not



Tags:

return:  True if the item is done ('completed','passed','succeeded'), false otherwise


[ Top ]

method is_restart_allowed [line 1059]

integer is_restart_allowed( )

Tells if a restart is allowed (take it from $this->prevent_reinit and $this->status)



Tags:

return:  -1 if retaking the sco another time for credit is not allowed,
  1. if it is not allowed but the item has to be finished
  2. if it is allowed. Defaults to 1


[ Top ]

method open [line 1083]

boolean open( [ $allow_new_attempt = false])

Opens/launches the item. Initialises runtime values.



Tags:

return:  True on success, false on failure.


Parameters:

   $allow_new_attempt  

[ Top ]

method output [line 1118]

string output( )

Outputs the item contents



Tags:

return:  HTML file (displayable in an <iframe>) or empty string if no path defined


[ Top ]

method parse_HTML_attributes [line 1425]

array parse_HTML_attributes( string $attrString, [array $wanted = array()])

Parses the HTML attributes given as string.



Tags:

return:  An associative array of attributes
author:  Based on a function from the HTML_Common2 PEAR module


Parameters:

string   $attrString   HTML attribute string
array   $wanted   List of attributes that we want to get back

[ Top ]

method parse_prereq [line 1137]

boolean parse_prereq( string $prereqs_string, Array $items, Array $refs_list, integer $user_id)

Parses the prerequisites string with the AICC logic language



Tags:

return:  True if the list of prerequisites given is entirely satisfied, false otherwise


Parameters:

string   $prereqs_string   The prerequisites string as it figures in imsmanifest.xml
Array   $items   Array of items in the current learnpath object. Although we're in the learnpathItem object, it's necessary to have a list of all items to be able to check the current item's prerequisites
Array   $refs_list   List of references (the "ref" column in the lp_item table) that are strings used in the expression of prerequisites.
integer   $user_id   The user ID. In some cases like Dokeos quizzes, it's necessary to have the user ID to query other tables (like the results of quizzes)

[ Top ]

method restart [line 1503]

boolean restart( )

Reinits all local values as the learnpath is restarted



Tags:

return:  True on success, false otherwise


[ Top ]

method save [line 1541]

boolean save( [boolean $from_outside = true], [boolean $prereqs_complete = false])

Saves data in the database



Tags:

return:  True on success, false on failure


Overridden in child classes as:

aiccItem::save()
Save function. Uses the parent save function and adds a layer for AICC.
scormItem::save()
Save function. Uses the parent save function and adds a layer for SCORM.

Parameters:

boolean   $from_outside   Save from URL params (1) or from object attributes (0)
boolean   $prereqs_complete   The results of a check on prerequisites for this item. True if prerequisites are completed, false otherwise. Defaults to false. Only used if not sco or au

[ Top ]

method set_attempt_id [line 1655]

boolean set_attempt_id( integer $num)

Sets the number of attempt_id to a given value



Tags:

return:  TRUE on success, FALSE otherwise


Parameters:

integer   $num   The given value to set attempt_id to

[ Top ]

method set_core_exit [line 1667]

void set_core_exit( $value)

Sets the core_exit value to the one given



Parameters:

   $value  

[ Top ]

method set_description [line 1686]

void set_description( [string $string = ''])

Sets the item's description



Parameters:

string   $string   Description

[ Top ]

method set_lesson_location [line 1695]

boolean set_lesson_location( string $location)

Sets the lesson_location value



Tags:

return:  True on success, false otherwise


Parameters:

string   $location   lesson_location as provided by the SCO

[ Top ]

method set_level [line 1708]

void set_level( [integer $int = 0])

Sets the item's depth level in the LP tree (0 is at root)



Parameters:

integer   $int   Level

[ Top ]

method set_lp_view [line 1717]

void set_lp_view( integer $lp_view_id)

Sets the lp_view id this item view is registered to



Tags:

todo:  //todo insert into lp_item_view if lp_view not exists


Parameters:

integer   $lp_view_id   lp_view DB ID

[ Top ]

method set_max_score [line 1820]

boolean set_max_score( int $score)

Sets the maximum score for this item



Tags:

return:  True on success, false on error


Parameters:

int   $score   Maximum score - must be a decimal or an empty string

[ Top ]

method set_path [line 1771]

void set_path( [string $string = ''])

Sets the path



Parameters:

string   $string   Path

[ Top ]

method set_prevent_reinit [line 1780]

void set_prevent_reinit( integer $prevent)

Sets the prevent_reinit attribute. This is based on the LP value and is set at creation time for each learnpathItem. It is a (bad?) way of avoiding a reference to the LP when saving an item.



Parameters:

integer   $prevent   1 for "prevent", 0 for "don't prevent" saving freshened values (new "not attempted" status etc)

[ Top ]

method set_score [line 1794]

boolean set_score( float $score)

Sets the score value. If the mastery_score is set and the score reaches it, then set the status to 'passed'.



Tags:

return:  True on success, false otherwise


Parameters:

float   $score   Score

[ Top ]

method set_status [line 1836]

boolean set_status( string $status)

Sets the status for this item



Tags:

return:  True on success, false on error


Parameters:

string   $status   Status - must be one of the values defined in $this->possible_status

[ Top ]

method set_time [line 1860]

void set_time( string $scorm_time, [ $format = 'scorm'])

Sets the item viewing time in a usable form, given that SCORM packages often give it as 00:00:00.0000



Parameters:

string   $scorm_time   Time as given by SCORM
   $format  

[ Top ]

method set_title [line 1890]

void set_title( [string $string = ''])

Sets the item's title



Parameters:

string   $string   Title

[ Top ]

method set_type [line 1898]

void set_type( [string $string = ''])

Sets the item's type



Parameters:

string   $string   Type

[ Top ]

method status_is [line 1907]

boolean status_is( [strings_array $list = array()])

Checks if the current status is part of the list of status given



Tags:

return:  True if the status was one of the given strings, false otherwise


Parameters:

strings_array   $list   An array of status to check for. If the current status is one of the strings, return true

[ Top ]

method update_time [line 1932]

void update_time( [integer $total_sec = 0])

Updates the time info according to the given session_time



Parameters:

integer   $total_sec   Time in seconds //TODO @TODO make this method better by allowing better/multiple time slices

[ Top ]

method write_objectives_to_db [line 1970]

boolean write_objectives_to_db( )

Write objectives to DB. This method is separate from write_to_db() because otherwise

objectives are lost as a side effect to AJAX and session concurrent access




Tags:

return:  True or false on error


[ Top ]

method write_to_db [line 2029]

boolean write_to_db( )

Writes the current data to the database



Tags:

return:  Query result


[ Top ]


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