[svn r13988] Major improvements in the handling of scores and prerequisites in the learning path tool. Implies database field values update, meaning you need to create a new learning path if you want to try it out in 1.8.5 SVN (without executing the upgrade script). Should close FS#2112.
if($this->debug>0){error_log('New LP - In learnpathItem::close()',0);}
if($this->debug>0){error_log('New LP - In learnpathItem::close()',0);}
$this->current_stop_time = time();
$this->current_stop_time = time();
if($this->get_type() != 'sco'){
$type = $this->get_type();
$this->status = $this->possible_status[2];
if($type != 'sco'){
if($type == TOOL_QUIZ or $type == TOOL_HOTPOTATOES)
{
$this->get_status(true,true);//update status (second option forces the update)
}
else
{
$this->status = $this->possible_status[2];
}
}
}
if($this->save_on_close)
if($this->save_on_close)
{
{
@ -1114,11 +1122,12 @@ class learnpathItem{
/**
/**
* Parses the prerequisites string with the AICC logic language
* Parses the prerequisites string with the AICC logic language
* @param string The prerequisites string as it figures in imsmanifest.xml
* @param string The prerequisites string as it figures in imsmanifest.xml
* @param object Learnpath object pointer. We need it to get a list of other resources the prerequisites might be pointing to.
* @param Array 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
* @param Array List of references (the "ref" column in the lp_item table) that are strings used in the expression of prerequisites.
* @param integer 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)
* @return boolean True if the list of prerequisites given is entirely satisfied, false otherwise
* @return boolean True if the list of prerequisites given is entirely satisfied, false otherwise
* @TODO //TODO if it's a Dokeos LP, use item ID instead of item REF for prereq!!!
*/
*/
function parse_prereq($prereqs_string, $items, $refs_list){
function parse_prereq($prereqs_string, $items, $refs_list,$user_id){
if($this->debug>0){error_log('New LP - In learnpathItem::parse_prereq() for learnpath '.$this->lp_id.' with string '.$prereqs_string,0);}
if($this->debug>0){error_log('New LP - In learnpathItem::parse_prereq() for learnpath '.$this->lp_id.' with string '.$prereqs_string,0);}
//deal with &, |, ~, =, <>, {}, ,, X*, () in reverse order
//deal with &, |, ~, =, <>, {}, ,, X*, () in reverse order