|
|
|
@ -25,7 +25,7 @@ |
|
|
|
|
* Exercise class: This class allows to instantiate an object of type Exercise |
|
|
|
|
* @package dokeos.exercise |
|
|
|
|
* @author Olivier Brouckaert |
|
|
|
|
* @version $Id: exercise.class.php 20776 2009-05-18 12:43:44Z pcool $ |
|
|
|
|
* @version $Id: exercise.class.php 20788 2009-05-18 16:18:01Z iflorespaz $ |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -538,9 +538,14 @@ class Exercise |
|
|
|
|
$end_time = Database::escape_string($this->end_time); |
|
|
|
|
// exercise already exists |
|
|
|
|
if($id) { |
|
|
|
|
/* |
|
|
|
|
title='".Database::escape_string(Security::remove_XSS($exercise))."', |
|
|
|
|
description='".Database::escape_string(Security::remove_XSS(api_html_entity_decode($description),COURSEMANAGER))."'"; |
|
|
|
|
*/ |
|
|
|
|
$sql="UPDATE $TBL_EXERCICES SET |
|
|
|
|
title='".Database::escape_string(Security::remove_XSS($exercise))."', |
|
|
|
|
description='".Database::escape_string(Security::remove_XSS(api_html_entity_decode($description),COURSEMANAGER))."'"; |
|
|
|
|
title='".Database::escape_string($exercise)."', |
|
|
|
|
description='".Database::escape_string($description)."'"; |
|
|
|
|
|
|
|
|
|
if ($type_e != 'simple') { |
|
|
|
|
$sql .= ", sound='".Database::escape_string($sound)."', |
|
|
|
|
type='".Database::escape_string($type)."', |
|
|
|
@ -564,11 +569,22 @@ class Exercise |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} else {// creates a new exercise |
|
|
|
|
//add condition by anonymous user |
|
|
|
|
|
|
|
|
|
/*if (!api_is_anonymous()) { |
|
|
|
|
//is course manager |
|
|
|
|
$cond1=Database::escape_string($exercise); |
|
|
|
|
$cond2=Database::escape_string($description); |
|
|
|
|
} else { |
|
|
|
|
//is anonymous user |
|
|
|
|
$cond1=Database::escape_string(Security::remove_XSS($exercise)); |
|
|
|
|
$cond2=Database::escape_string(Security::remove_XSS(api_html_entity_decode($description),COURSEMANAGER)); |
|
|
|
|
}*/ |
|
|
|
|
$sql="INSERT INTO $TBL_EXERCICES(start_time,end_time,title,description,sound,type,random,active, results_disabled, max_attempt,feedback_type) |
|
|
|
|
VALUES( |
|
|
|
|
'$start_time','$end_time', |
|
|
|
|
'".Database::escape_string(Security::remove_XSS($exercise))."', |
|
|
|
|
'".Database::escape_string(Security::remove_XSS(api_html_entity_decode($description),COURSEMANAGER))."', |
|
|
|
|
'".Database::escape_string($exercise)."', |
|
|
|
|
'".Database::escape_string($description)."', |
|
|
|
|
'".Database::escape_string($sound)."', |
|
|
|
|
'".Database::escape_string($type)."', |
|
|
|
|
'".Database::escape_string($random)."', |
|
|
|
@ -578,8 +594,7 @@ class Exercise |
|
|
|
|
'".Database::escape_string($feedbacktype)."' |
|
|
|
|
)"; |
|
|
|
|
api_sql_query($sql,__FILE__,__LINE__); |
|
|
|
|
|
|
|
|
|
$this->id=mysql_insert_id(); |
|
|
|
|
$this->id=Database::insert_id(); |
|
|
|
|
// insert into the item_property table |
|
|
|
|
|
|
|
|
|
api_item_property_update($_course, TOOL_QUIZ, $this->id,'QuizAdded',$_user['user_id']); |
|
|
|
|