diff --git a/main/exercice/exercice_submit.php b/main/exercice/exercice_submit.php index 18d1b1effc..6d66748e41 100644 --- a/main/exercice/exercice_submit.php +++ b/main/exercice/exercice_submit.php @@ -1,4 +1,4 @@ -'; echo Display::return_icon('quiz.gif', get_lang('GoBackToEx')).''.get_lang('GoBackToEx').''; echo Display::return_icon('edit.gif', get_lang('ModifyExercise')).''.get_lang('ModifyExercise').''; diff --git a/main/newscorm/learnpath.class.php b/main/newscorm/learnpath.class.php index 64b7aba326..27f0371cd6 100644 --- a/main/newscorm/learnpath.class.php +++ b/main/newscorm/learnpath.class.php @@ -2850,6 +2850,7 @@ class learnpath { $file = ''; $lp_table = Database::get_course_table(TABLE_LP_MAIN); $lp_item_table = Database::get_course_table(TABLE_LP_ITEM); + $lp_item_view_table = Database::get_course_table(TABLE_LP_ITEM_VIEW); $sel = "SELECT l.lp_type as ltype, l.path as lpath, li.item_type as litype, li.path as lipath, li.parameters as liparams " . "FROM $lp_table l, $lp_item_table li WHERE li.id = $item_id AND li.lp_id = l.id"; if($this->debug>2){error_log('New LP - In learnpath::get_link() - selecting item '.$sel,0);} @@ -2887,6 +2888,34 @@ class learnpath { }else{ require_once('resourcelinker.inc.php'); $file = rl_get_resource_link_for_learnpath(api_get_course_id(),$this->get_id(),$item_id); + + // check how much attempts of a exercise exits in lp + $lp_item_id = $this->get_current_item_id(); + $lp_view_id = $this->get_view_id(); + $prevent_reinit = $this->items[$this->current]->prevent_reinit; + $list = $this->get_toc(); + $type_quiz = false; + + foreach($list as $toc) { + if ($toc['id'] == $lp_item_id && ($toc['type']=='quiz') ) { + $type_quiz = true; + } + } + + if ($type_quiz) { + $lp_item_id = Database::escape_string($lp_item_id); + $lp_view_id = Database::escape_string($lp_view_id); + $sql = "SELECT count(*) FROM $lp_item_view_table WHERE lp_item_id='".(int)$lp_item_id."' AND lp_view_id ='".(int)$lp_view_id."' AND status='completed'"; + $result = api_sql_query($sql,__FILE__,__LINE__); + $row_count = Database::fetch_row($result); + $count_item_view = (int)$row_count[0]; + $not_multiple_attempt = 0; + if ($prevent_reinit === 1 && $count_item_view > 0) { + $not_multiple_attempt = 1; + } + $file .= '¬_multiple_attempt='.$not_multiple_attempt; + } + $tmp_array=explode("/",$file); $document_name=$tmp_array[count($tmp_array)-1]; if(strpos($document_name,'_DELETED_')){ diff --git a/main/newscorm/lp_view.php b/main/newscorm/lp_view.php index 1f5d359fa6..974ffd1fea 100644 --- a/main/newscorm/lp_view.php +++ b/main/newscorm/lp_view.php @@ -147,7 +147,7 @@ if (!isset($src)) if (!empty($_REQUEST['exeId']) && isset($_GET['lp_id']) && isset($_GET['lp_item_id'])) { $_SESSION['oLP']->items[$_SESSION['oLP']->current]->write_to_db(); - + global $src; $TBL_TRACK_EXERCICES = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $TBL_LP_ITEM_VIEW = Database::get_course_table(TABLE_LP_ITEM_VIEW); $TBL_LP_VIEW = Database::get_course_table(TABLE_LP_VIEW); @@ -184,6 +184,7 @@ if (!empty($_REQUEST['exeId']) && isset($_GET['lp_id']) && isset($_GET['lp_item_ api_sql_query($sql_upd_score,__FILE__,__LINE__); } } + $src = $_SESSION['oLP']->get_link('http',$safe_item_id); } $_SESSION['oLP']->set_previous_item($lp_item_id);