Source for file learnpathList.class.php
Documentation is available at learnpathList.class.php
* File containing the declaration of the learnpathList class.
* @package dokeos.learningpath
* @author Yannick Warnier <ywarnier@beeznest.org>
* This class is only a learning path list container with several practical methods for sorting the list and
* provide links to specific paths
* @uses Database.lib.php to use the database
* @uses learnpath.class.php to generate learnpath objects to get in the list
var $list = array(); //holds a flat list of learnpaths data from the database
var $ref_list = array(); //holds a list of references to the learnpaths objects (only filled by get_refs())
var $alpha_list = array(); //holds a flat list of learnpaths sorted by alphabetical name order
* This method is the constructor for the learnpathList. It gets a list of available learning paths from
* the database and creates the learnpath objects. This list depends on the user that is connected
* (only displays) items if he has enough permissions to view them.
* @param string Optional course code (otherwise we use api_get_course_id())
if(!empty($course_code)){
//proceed with course code given
$sql = "SELECT * FROM $lp_table ORDER BY display_order ASC, name ASC";
//use domesticate here instead of mysql_real_escape_string because
//it prevents ' to be slashed and the input (done by learnpath.class.php::toggle_visibility())
//is done using domesticate()
$mylink = 'newscorm/lp_controller.php?action=view&lp_id='. $row['id'];
$sql2= "SELECT * FROM $tbl_tool where (name='$myname' and image='scormbuilder.gif' and link LIKE '$mylink%')";
//error_log('New LP - learnpathList::learnpathList - getting visibility - '.$sql2,0);
$pub = $row2['visibility'];
$this->list[$row['id']] = array(
'lp_type' => $row['lp_type'],
'lp_path' => $row['path'],
'lp_view_mode' => $row['default_view_mod'],
'lp_force_commit' => $row['force_commit'],
'lp_proximity' => $row['content_local'],
'lp_encoding' => $row['default_encoding'],
'lp_progress' => $row['progress'],
'lp_prevent_reinit' => $row['prevent_reinit'],
'lp_scorm_debug' => $row['debug'],
'lp_display_order' => $row['display_order'],
$names[$row['name']]= $row['id'];
* Gets references to learnpaths for all learnpaths IDs kept in the local list.
* This applies a transformation internally on list and ref_list and returns a copy of the refs list
* @return array List of references to learnpath objects
foreach($this->list as $id => $dummy)
* Gets a table of the different learnpaths we have at the moment
* @return array Learnpath info as [lp_id] => ([lp_type]=> ..., [lp_name]=>...,[lp_desc]=>...,[lp_path]=>...)
|