From 68ace5837fbaba936336b86bdb4b9e71bc384ee6 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Fri, 23 Jan 2009 21:11:22 +0100 Subject: [PATCH] [svn r17972] Added the max_item_allowed option in Tests and in the LP(developed by Nicolas Raynaud (Cyim) added/modified by jmontoya) FS#3515 --- main/exercice/exercice.php | 10 +- main/exercice/exercice_submit.php | 10 +- main/exercice/exercise_result.php | 207 +++++++++++----------- main/exercice/question.class.php | 7 +- main/exercice/question_list_admin.inc.php | 92 +++++----- main/inc/lib/events.lib.inc.php | 16 +- main/newscorm/learnpath.class.php | 102 ++++++----- main/newscorm/lp_controller.php | 53 +++--- 8 files changed, 239 insertions(+), 258 deletions(-) diff --git a/main/exercice/exercice.php b/main/exercice/exercice.php index 52d2c28ec6..4fc10324ea 100644 --- a/main/exercice/exercice.php +++ b/main/exercice/exercice.php @@ -1,4 +1,4 @@ -1 $user_id_and $session_id_and AND ce.active <>-1 AND orig_lp_id = 0 AND orig_lp_item_id = 0 @@ -1002,7 +1002,7 @@ if ($_configuration['tracking_enabled'] AND ($show == 'result') ) $user_id_and = ' AND te.exe_user_id = ' . Database::escape_string ( api_get_user_id() ).' '; $sql="SELECT CONCAT(lastname,' ',firstname) as users,ce.title, te.exe_result , - te.exe_weighting, UNIX_TIMESTAMP(te.exe_date),te.exe_id,email,UNIX_TIMESTAMP(te.start_date),steps_counter,user_id + te.exe_weighting, UNIX_TIMESTAMP(te.exe_date),te.exe_id,email,UNIX_TIMESTAMP(te.start_date),steps_counter,user_id,te.exe_duration FROM $TBL_EXERCICES AS ce , $TBL_TRACK_EXERCICES AS te, $TBL_USER AS user WHERE te.exe_exo_id = ce.id AND te.status != 'incomplete' AND user_id=te.exe_user_id AND te.exe_cours_id='".Database::escape_string($_cid)."' AND user.status<>1 $user_id_and $session_id_and AND ce.active <>-1 AND orig_lp_id = 0 AND orig_lp_item_id = 0 @@ -1016,7 +1016,7 @@ if ($_configuration['tracking_enabled'] AND ($show == 'result') ) } - $results=getManyResultsXCol($sql,10); + $results=getManyResultsXCol($sql,11); $hpresults=getManyResultsXCol($hpsql,5); $NoTestRes = 0; @@ -1063,6 +1063,7 @@ if ($_configuration['tracking_enabled'] AND ($show == 'result') ) $test = $results[$i][1]; $dt = strftime($dateTimeFormatLong,$results[$i][4]); $res = $results[$i][2]; + $duration = intval($results[$i][11]); echo ''; echo ''.$add_start_date.format_locale_date('%b %d, %Y %H:%M',$results[$i][4]).'';//get_lang('dateTimeFormatLong') + echo ''.sprintf(get_lang('DurationFormat'), $duration).''; echo ''.round(($res/($results[$i][3]!=0?$results[$i][3]:1))*100).'% ('.$res.' / '.$results[$i][3].')'; echo ''.(($is_allowedToEdit||$is_tutor)? "". diff --git a/main/exercice/exercice_submit.php b/main/exercice/exercice_submit.php index 163b496d59..2baf75f5b7 100644 --- a/main/exercice/exercice_submit.php +++ b/main/exercice/exercice_submit.php @@ -1,4 +1,4 @@ -0) { + $answer = Database::result($res,0,"id"); + exercise_attempt($questionScore,$answer,$quesId,$exeId,0); + } + } else { exercise_attempt($questionScore,$answer,$quesId,$exeId,0); } } @@ -1079,117 +1077,110 @@ $exerciseTitle=api_parse_tex($exerciseTitle); ============================================================================== */ -if($_configuration['tracking_enabled']) -{ +if($_configuration['tracking_enabled']) { // Updates the empty exercise $safe_lp_id = $learnpath_id==''?0:(int)$learnpath_id; $safe_lp_item_id = $learnpath_item_id==''?0:(int)$learnpath_item_id; - update_event_exercice($exeId, $objExercise->selectId(),$totalScore,$totalWeighting,api_get_session_id(),$safe_lp_id,$safe_lp_item_id); + $quizDuration = (!empty($_SESSION['quizStartTime']) ? time() - $_SESSION['quizStartTime'] : 0); + update_event_exercice($exeId, $objExercise->selectId(),$totalScore,$totalWeighting,api_get_session_id(),$safe_lp_id,$safe_lp_item_id,$quizDuration); } -if($objExercise->results_disabled) -{ +if($objExercise->results_disabled) { ob_end_clean(); Display :: display_normal_message(get_lang('ExerciseFinished').'
'.get_lang('Back').'',false); } -if ($origin != 'learnpath') -{ +if ($origin != 'learnpath') { //we are not in learnpath tool Display::display_footer(); -}else{ +} else { //record the results in the learning path, using the SCORM interface (API) echo ''."\n"; echo ''; } -if(count($arrques)>0) -{ -$mycharset = api_get_setting('platform_charset'); -$msg = ' - - '; -$msg .= ' -
-

'.get_lang('OpenQuestionsAttempted').' : -

-

'.get_lang('AttemptDetails').' : >
-

- - - - - - - - - - - - - - - - -

  '.get_lang('CourseName').'

#course#

  '.get_lang('TestAttempted').'#exercise#
  '.get_lang('StudentName').'#firstName# #lastName#
  '.get_lang('StudentEmail').' #mail#
-


'.get_lang('OpenQuestionsAttemptedAre').' :

- '; - for($i=0;$i - - - - - - '; - - $msg1= str_replace("#exercise#",$exerciseTitle,$msg); - $msg= str_replace("#firstName#",$firstName,$msg1); - $msg1= str_replace("#lastName#",$lastName,$msg); - $msg= str_replace("#mail#",$mail,$msg1); - $msg1= str_replace("#questionName#",$arrques[$i],$msg); - $msg= str_replace("#answer#",$arrans[$i],$msg1); - $msg1= str_replace("#i#",$i,$msg); - $msg= str_replace("#course#",$courseName,$msg1); - } - $msg.='
#questionName#
  '.get_lang('Answer').' #answer#

- '.get_lang('ClickToCommentAndGiveFeedback').',
-#url#
'; - - $msg1= str_replace("#url#",$url,$msg); - $mail_content = stripslashes($msg1); - $student_name = $_SESSION['_user']['firstName'].' '.$_SESSION['_user']['lastName']; - $subject = get_lang('OpenQuestionsAttempted'); - - $from = api_get_setting('noreply_email_address'); - if($from == ''){ - if(isset($_SESSION['id_session']) && $_SESSION['id_session'] != ''){ - $sql = 'SELECT user.email,user.lastname,user.firstname FROM '.TABLE_MAIN_SESSION.' as session, '.TABLE_MAIN_USER.' as user - WHERE session.id_coach = user.user_id - AND session.id = "'.Database::escape_string($_SESSION['id_session']).'" - '; - $result=api_sql_query($sql,__FILE__,__LINE__); - $from = mysql_result($result,0,'email'); - $from_name = mysql_result($result,0,'firstname').' '.mysql_result($result,0,'lastname'); - } - else{ - $array = explode(' ',$_SESSION['_course']['titular']); - $firstname = $array[1]; - $lastname = $array[0]; - $sql = 'SELECT email,lastname,firstname FROM '.TABLE_MAIN_USER.' - WHERE firstname = "'.Database::escape_string($firstname).'" - AND lastname = "'.Database::escape_string($lastname).'" - '; - $result=api_sql_query($sql,__FILE__,__LINE__); - $from = mysql_result($result,0,'email'); - $from_name = mysql_result($result,0,'firstname').' '.mysql_result($result,0,'lastname'); - } +if(count($arrques)>0) { + $mycharset = api_get_setting('platform_charset'); + $msg = ' + + '; + $msg .= ' +
+

'.get_lang('OpenQuestionsAttempted').' : +

+

'.get_lang('AttemptDetails').' : >
+

+ + + + + + + + + + + + + + + + +

  '.get_lang('CourseName').'

#course#

  '.get_lang('TestAttempted').'#exercise#
  '.get_lang('StudentName').'#firstName# #lastName#
  '.get_lang('StudentEmail').' #mail#
+


'.get_lang('OpenQuestionsAttemptedAre').' :

+ '; + for($i=0;$i + + + + + + '; + + $msg1= str_replace("#exercise#",$exerciseTitle,$msg); + $msg= str_replace("#firstName#",$firstName,$msg1); + $msg1= str_replace("#lastName#",$lastName,$msg); + $msg= str_replace("#mail#",$mail,$msg1); + $msg1= str_replace("#questionName#",$arrques[$i],$msg); + $msg= str_replace("#answer#",$arrans[$i],$msg1); + $msg1= str_replace("#i#",$i,$msg); + $msg= str_replace("#course#",$courseName,$msg1); } + $msg.='
#questionName#
  '.get_lang('Answer').' #answer#

+ '.get_lang('ClickToCommentAndGiveFeedback').',
+ #url#
'; + $msg1= str_replace("#url#",$url,$msg); + $mail_content = stripslashes($msg1); + $student_name = $_SESSION['_user']['firstName'].' '.$_SESSION['_user']['lastName']; + $subject = get_lang('OpenQuestionsAttempted'); + + $from = api_get_setting('noreply_email_address'); + if($from == '') { + if(isset($_SESSION['id_session']) && $_SESSION['id_session'] != ''){ + $sql = 'SELECT user.email,user.lastname,user.firstname FROM '.TABLE_MAIN_SESSION.' as session, '.TABLE_MAIN_USER.' as user + WHERE session.id_coach = user.user_id + AND session.id = "'.Database::escape_string($_SESSION['id_session']).'" + '; + $result=api_sql_query($sql,__FILE__,__LINE__); + $from = Database::result($result,0,'email'); + $from_name = Database::result($result,0,'firstname').' '.Database::result($result,0,'lastname'); + } else { + $array = explode(' ',$_SESSION['_course']['titular']); + $firstname = $array[1]; + $lastname = $array[0]; + $sql = 'SELECT email,lastname,firstname FROM '.TABLE_MAIN_USER.' + WHERE firstname = "'.Database::escape_string($firstname).'" + AND lastname = "'.Database::escape_string($lastname).'" + '; + $result=api_sql_query($sql,__FILE__,__LINE__); + $from = Database::result($result,0,'email'); + $from_name = Database::result($result,0,'firstname').' '.Database::result($result,0,'lastname'); + } + } api_mail_html($student_name, $to, $subject, $mail_content, $from_name, $from, array('encoding'=>$mycharset,'charset'=>$mycharset)); } -?> - +?> \ No newline at end of file diff --git a/main/exercice/question.class.php b/main/exercice/question.class.php index d8965161e9..6b56825afb 100644 --- a/main/exercice/question.class.php +++ b/main/exercice/question.class.php @@ -1,4 +1,4 @@ -addElement('hidden','answerType',$_REQUEST['answerType']); // question level - $form->addElement('text','questionLevel',get_lang('Level')); + $select_level = array (0,1,2,3,4,5,6); + $form->addElement('select','questionLevel',get_lang('Level'),$select_level); $renderer->setElementTemplate('
{label}
{element}
','questionLevel'); // html editor diff --git a/main/exercice/question_list_admin.inc.php b/main/exercice/question_list_admin.inc.php index 84368d212b..c6267550e0 100644 --- a/main/exercice/question_list_admin.inc.php +++ b/main/exercice/question_list_admin.inc.php @@ -1,4 +1,4 @@ -'; selectQuestionList(); - $i=1; - foreach($questionList as $id) - { - - $objQuestionTmp = Question :: read($id); - //showQuestion($id); - -?> - -> - selectTitle(); ?> - - selectLevel(); ?> - IMS/QTI - <?php echo get_lang('Modify'); ?> <?php echo get_lang('Delete'); ?> - - - - <?php echo get_lang('MoveUp'); ?> - - '; - - } - - if($i != $nbrQuestions) - { - if($i == 1) echo ''; - ?> - - <?php echo get_lang('MoveDown'); ?> - - + + > + selectTitle(); ?> + + selectLevel(); ?> + IMS/QTI + <?php echo get_lang('Modify'); ?> <?php echo get_lang('Delete'); ?> + + <?php echo get_lang('MoveUp'); ?> + '; + } + + if($i != $nbrQuestions) { + if($i == 1) + echo ''; + ?> + <?php echo get_lang('MoveDown'); ?> + + + + + + - - - - - - diff --git a/main/inc/lib/events.lib.inc.php b/main/inc/lib/events.lib.inc.php index 47b756319e..e5343edbb2 100644 --- a/main/inc/lib/events.lib.inc.php +++ b/main/inc/lib/events.lib.inc.php @@ -1,4 +1,4 @@ - - * @author Julio Montoya + * @author Julio Montoya Armas * @desc Record result of user when an exercice was done */ -function update_event_exercice($exeid,$exo_id, $score, $weighting,$session_id,$learnpath_id=0,$learnpath_item_id=0) +function update_event_exercice($exeid,$exo_id, $score, $weighting,$session_id,$learnpath_id=0,$learnpath_item_id=0, $duration) { if ($exeid!='') { @@ -436,7 +437,8 @@ function update_event_exercice($exeid,$exo_id, $score, $weighting,$session_id,$l exe_weighting = '".$weighting."', session_id = '".$session_id."', orig_lp_id = '".$learnpath_id."', - orig_lp_item_id = '".$learnpath_item_id."', + orig_lp_item_id = '".$learnpath_item_id."', + exe_duration = '".$duration."', exe_date= FROM_UNIXTIME(".$reallyNow."),status = '', data_tracking='',start_date ='".$_SESSION['exercice_start_date']."' WHERE exe_id = '".$exeid."'"; $res = @api_sql_query($sql,__FILE__,__LINE__); @@ -475,7 +477,7 @@ function create_event_exercice($exo_id) 'status = '."'incomplete'".' AND '. 'session_id = '."'".api_get_session_id()."'"; $sql = api_sql_query('SELECT exe_id FROM '.$TABLETRACK_EXERCICES.$condition,__FILE__,__LINE__); - $row = mysql_fetch_array($sql); + $row = Database::fetch_array($sql); return $row['exe_id']; } diff --git a/main/newscorm/learnpath.class.php b/main/newscorm/learnpath.class.php index 03b417370d..75e6a4fe37 100644 --- a/main/newscorm/learnpath.class.php +++ b/main/newscorm/learnpath.class.php @@ -357,7 +357,7 @@ class learnpath { * @param string $description * @return int */ - function add_item($parent, $previous, $type = 'dokeos_chapter', $id, $title, $description, $prerequisites=0) + function add_item($parent, $previous, $type = 'dokeos_chapter', $id, $title, $description, $prerequisites=0, $maxTimeAllowed=0) { global $charset; @@ -367,7 +367,8 @@ class learnpath { $parent = intval($parent); $previous = intval($previous); $type = $this->escape_string($type); - $id = intval($id); + $id = intval($id); + $maxTimeAllowed= $this->escape_string(htmlentities($maxTimeAllowed)); $title = $this->escape_string(mb_convert_encoding($title,$this->encoding,$charset)); $description = $this->escape_string(mb_convert_encoding($description,$this->encoding,$charset)); @@ -384,10 +385,8 @@ class learnpath { $num = $row['num']; - if($num > 0) - { - if($previous == 0) - { + if($num > 0) { + if($previous == 0) { $sql = " SELECT id, @@ -405,11 +404,8 @@ class learnpath { $tmp_previous = 0; $next = $row['id']; $display_order = 0; - } - else - { - $previous = (int) $previous; - + } else { + $previous = (int) $previous; $sql = " SELECT id, @@ -429,9 +425,7 @@ class learnpath { $display_order = $row['display_order']; } - } - else - { + } else { $tmp_previous = 0; $next = 0; $display_order = 0; @@ -440,8 +434,7 @@ class learnpath { $new_item_id = -1; $id = $this->escape_string($id); - if($type == 'quiz') - { + if($type == 'quiz') { $sql = 'SELECT SUM(ponderation) FROM '.Database :: get_course_table(TABLE_QUIZ_QUESTION).' as quiz_question INNER JOIN '.Database :: get_course_table(TABLE_QUIZ_TEST_QUESTION).' as quiz_rel_question @@ -449,14 +442,11 @@ class learnpath { AND quiz_rel_question.exercice_id = '.$id; $rsQuiz = api_sql_query($sql, __FILE__, __LINE__); $max_score = Database::result($rsQuiz, 0, 0); - } - else - { + } else { $max_score = 100; } - if($prerequisites!=0) - { + if($prerequisites!=0) { $sql_ins = " INSERT INTO " . $tbl_lp_item . " ( lp_id, @@ -470,7 +460,8 @@ class learnpath { previous_item_id, next_item_id, display_order, - prerequisite + prerequisite, + max_time_allowed ) VALUES ( " . $this->get_id() . ", @@ -484,11 +475,10 @@ class learnpath { " . $previous . ", " . $next . ", " . ($display_order + 1) . ", - " . $prerequisites . " + " . $prerequisites . ", + " . $maxTimeAllowed . " )"; - } - else - { + } else { //insert new item $sql_ins = " INSERT INTO " . $tbl_lp_item . " ( @@ -502,7 +492,8 @@ class learnpath { parent_item_id, previous_item_id, next_item_id, - display_order + display_order, + max_time_allowed ) VALUES ( " . $this->get_id() . ", '" . $type . "', @@ -514,7 +505,8 @@ class learnpath { " . $parent . ", " . $previous . ", " . $next . ", - " . ($display_order + 1) . " + " . ($display_order + 1) . ", + " . $maxTimeAllowed . " )"; } @@ -565,14 +557,12 @@ class learnpath { } // upload audio - if (!empty($_FILES['mp3']['name'])) - { + if (!empty($_FILES['mp3']['name'])) { // create the audio folder if it does not exist yet global $_course; $filepath = api_get_path('SYS_COURSE_PATH').$_course['path'].'/document/'; - if(!is_dir($filepath.'audio')) - { + if(!is_dir($filepath.'audio')) { $perm = api_get_setting('permissions_for_new_directories'); $perm = octdec(!empty($perm)?$perm:'0770'); mkdir($filepath.'audio',$perm); @@ -592,8 +582,7 @@ class learnpath { // store the mp3 file in the lp_item table $sql_insert_audio = "UPDATE $tbl_lp_item SET audio = '".Database::escape_string($file)."' WHERE id = '".Database::escape_string($new_item_id)."'"; api_sql_query($sql_insert_audio, __FILE__, __LINE__); - } - + } return $new_item_id; } @@ -962,7 +951,7 @@ class learnpath { * @param array The array resulting of the $_FILES[mp3] element * @return boolean True on success, false on error */ - function edit_item($id, $parent, $previous, $title, $description, $prerequisites=0, $audio=NULL) { + function edit_item($id, $parent, $previous, $title, $description, $prerequisites=0, $audio=NULL, $maxTimeAllowed=0) { if($this->debug > 0){error_log('New LP - In learnpath::edit_item()', 0);} if(empty($id) or ($id != strval(intval($id))) or empty($title)){ return false; } @@ -996,23 +985,25 @@ class learnpath { if($same_parent && $same_previous) { //only update title and description - $sql_update = " - UPDATE " . $tbl_lp_item . " - SET + echo $sql_update = " + UPDATE " . $tbl_lp_item . " + SET title = '" . $this->escape_string(htmlentities($title)) . "', prerequisite = '".$prerequisites."', description = '" . $this->escape_string(htmlentities($description)) . "' - ". $audio_update_sql . " + ". $audio_update_sql . ", + max_time_allowed = '" . $this->escape_string(htmlentities($maxTimeAllowed)) . "' WHERE id = " . $id; $res_update = api_sql_query($sql_update, __FILE__, __LINE__); } else { - $old_parent = $row_select['parent_item_id']; - $old_previous = $row_select['previous_item_id']; - $old_next = $row_select['next_item_id']; - $old_order = $row_select['display_order']; - $old_prerequisite= $row_select['prerequisite']; + $old_parent = $row_select['parent_item_id']; + $old_previous = $row_select['previous_item_id']; + $old_next = $row_select['next_item_id']; + $old_order = $row_select['display_order']; + $old_prerequisite = $row_select['prerequisite']; + $old_maxTimeAllowed = $row_select['max_time_allowed']; /* BEGIN -- virtually remove the current item id */ /* for the next and previous item it is like the current item doesn't exist anymore */ @@ -1085,8 +1076,7 @@ class learnpath { //echo 'New next_item_id of current item: ' . $new_next . '
'; //echo 'New previous_item_id of current item: ' . $previous . '
'; //echo 'New display_order of current item: ' . $new_order . '
'; - - + } else { @@ -1155,6 +1145,15 @@ class learnpath { $res_update_next = api_sql_query($sql_update_next, __FILE__, __LINE__); } + if($old_maxTimeAllowed!=$maxTimeAllowed){ + $sql_update_maxTimeAllowed = " + UPDATE " . $tbl_lp_item . " + SET max_time_allowed = " . $maxTimeAllowed . " + WHERE id = " . $id; + $res_update_maxTimeAllowed = api_sql_query($sql_update_maxTimeAllowed, __FILE__, __LINE__); + } + + //update all the items with the same or a bigger display_order than //the current item $sql_update_order = " @@ -5098,7 +5097,8 @@ class learnpath { 'max_score' => $row['max_score'], 'min_score' => $row['min_score'], 'mastery_score' => $row['mastery_score'], - 'prerequisite' => $row['prerequisite']); + 'prerequisite' => $row['prerequisite'], + 'max_time_allowed' => $row['max_time_allowed']); } $this->tree_array($arrLP); @@ -5257,10 +5257,13 @@ class learnpath { } $return .= ""; - + $return .= "\t\t" . '' . "\n"; $return .= "\t\t" . '' . "\n"; + + $return .= "\t\t\t" . '' . "\n"; + $return .= "\t\t\t" . ''; //Remove temporaly the test description //$return .= "\t\t\t" . '' . "\n"; @@ -5376,7 +5379,8 @@ class learnpath { 'max_score' => $row['max_score'], 'min_score' => $row['min_score'], 'mastery_score' => $row['mastery_score'], - 'prerequisite' => $row['prerequisite']); + 'prerequisite' => $row['prerequisite'], + 'max_time_allowed' => $row['max_time_allowed']); } $this->tree_array($arrLP); diff --git a/main/newscorm/lp_controller.php b/main/newscorm/lp_controller.php index 43ec24f88c..4ad2a9e59b 100644 --- a/main/newscorm/lp_controller.php +++ b/main/newscorm/lp_controller.php @@ -192,41 +192,31 @@ switch($action) if($debug > 0) error_log('New LP - add item action triggered', 0); - if(!$lp_found) - { //check if the learnpath ID was defined, otherwise send back to list + if(!$lp_found){ + //check if the learnpath ID was defined, otherwise send back to list error_log('New LP - No learnpath given for add item', 0); require('lp_list.php'); - } - else - { + } else { $_SESSION['refresh'] = 1; - if(isset($_POST['submit_button']) && !empty($_POST['title'])) - { //if a title was sumbitted - if(isset($_SESSION['post_time']) && $_SESSION['post_time'] == $_POST['post_time']) - { //check post_time to ensure ??? (counter-hacking measure?) + if(isset($_POST['submit_button']) && !empty($_POST['title'])) { + //if a title was sumbitted + if(isset($_SESSION['post_time']) && $_SESSION['post_time'] == $_POST['post_time']) { + //check post_time to ensure ??? (counter-hacking measure?) require('lp_add_item.php'); - } - else - { + } else { $_SESSION['post_time'] = $_POST['post_time']; - if($_POST['type'] == TOOL_DOCUMENT) - { - if(isset($_POST['path']) && $_GET['edit'] != 'true') - { + if($_POST['type'] == TOOL_DOCUMENT) { + if(isset($_POST['path']) && $_GET['edit'] != 'true') { $document_id = $_POST['path']; - } - else - { + } else { $document_id = $_SESSION['oLP']->create_document($_course); - } - + } $new_item_id = $_SESSION['oLP']->add_item($_POST['parent'], $_POST['previous'], $_POST['type'], $document_id, $_POST['title'], $_POST['description'], $_POST['prerequisites']); - } - else - { //for all other item types than documents, load the item using the item type and path rather than its ID - $new_item_id = $_SESSION['oLP']->add_item($_POST['parent'], $_POST['previous'], $_POST['type'], $_POST['path'], $_POST['title'], $_POST['description'], $_POST['prerequisites']); + } else { + //for all other item types than documents, load the item using the item type and path rather than its ID + $new_item_id = $_SESSION['oLP']->add_item($_POST['parent'], $_POST['previous'], $_POST['type'], $_POST['path'], $_POST['title'], $_POST['description'], $_POST['prerequisites'],$_POST['maxTimeAllowed']); } //display require('lp_add_item.php'); @@ -364,15 +354,14 @@ switch($action) { $_SESSION['refresh'] = 1; - if(isset($_POST['submit_button']) && !empty($_POST['title'])) - { - $_SESSION['oLP']->edit_item($_GET['id'], $_POST['parent'], $_POST['previous'], $_POST['title'], $_POST['description'], $_POST['prerequisites']); + if(isset($_POST['submit_button']) && !empty($_POST['title'])) { + //$_SESSION['oLP']->edit_item($_GET['id'], $_POST['parent'], $_POST['previous'], $_POST['title'], $_POST['description'], $_POST['prerequisites']); + //todo mp3 edit + $_SESSION['oLP']->edit_item($_GET['id'], $_POST['parent'], $_POST['previous'], $_POST['title'], $_POST['description'], $_POST['prerequisites'],'', $_POST['maxTimeAllowed']); - if(isset($_POST['content_lp'])) - { + if(isset($_POST['content_lp'])) { $_SESSION['oLP']->edit_document($_course); - } - + } $is_success = true; }