Yannick Warnier 13 yıl önce
ebeveyn
işleme
c235f4545a

+ 14 - 17
main/exercice/exercice.php

@@ -768,23 +768,11 @@ if (!empty($exercise_list)) {
             $count++;
         } // end foreach()
     } 
-} else {
-    if ($is_allowedToEdit && $origin != 'learnpath') {  
-        echo '<div id="no-data-view">';
-        echo '<h2>'.get_lang('Quiz').'</h2>';
-        echo Display::return_icon('quiz.png', '', array(), 64);
-        echo '<div class="controls">';    
-        echo Display::url(get_lang('NewEx'), 'exercise_admin.php?' . api_get_cidreq(), array('class' => 'btn'));
-        echo '</div>';
-        echo '</div>';
-    }
 }
 // end exercise list
-
-
-   
+  
 //Hotpotatoes results            
-
+$hotpotatoes_exist = false;
 
 if ($is_allowedToEdit) {
     $sql = "SELECT d.path as path, d.comment as comment, ip.visibility as visibility
@@ -816,6 +804,7 @@ while ($row = Database :: fetch_array($result, 'ASSOC')) {
 
 $nbrActiveTests = 0;
 if (isset($attribute['path']) && is_array($attribute['path'])) {
+    $hotpotatoes_exist = true;
     while (list($key, $path) = each($attribute['path'])) {
         $item = '';
         list ($a, $vis) = each($attribute['visibility']);
@@ -868,10 +857,18 @@ if (isset($attribute['path']) && is_array($attribute['path'])) {
     }
 }    
 echo '</table>';    
-Display :: display_footer();    
-exit;
-
 
+if (empty($exercise_list) && $hotpotatoes_exist == false) {
+     if ($is_allowedToEdit && $origin != 'learnpath') {  
+        echo '<div id="no-data-view">';
+        echo '<h2>'.get_lang('Quiz').'</h2>';
+        echo Display::return_icon('quiz.png', '', array(), 64);
+        echo '<div class="controls">';    
+        echo Display::url(get_lang('NewEx'), 'exercise_admin.php?' . api_get_cidreq(), array('class' => 'btn'));
+        echo '</div>';
+        echo '</div>';
+    }   
+}
 if ($origin != 'learnpath') { //so we are not in learnpath tool
 	Display :: display_footer();
 }

+ 6 - 4
main/exercice/exercise.lib.php

@@ -996,12 +996,14 @@ function get_exam_results_data($from, $number_of_items, $column, $direction, $ex
     	$teacher_id_list[] = $teacher['user_id'];
     }    
     
-    if (empty($hotpotatoe_where)) {
-        
-        $column             = empty($column) ? : Database::escape_string($column);
+    if (empty($hotpotatoe_where)) {        
+        $column             = !empty($column) ? Database::escape_string($column) : null;
         $from               = intval($from);
         $number_of_items    = intval($number_of_items);
-        $sql               .= " ORDER BY $column $direction ";
+        
+        if (!empty($column)) {
+            $sql               .= " ORDER BY $column $direction ";
+        }
         $sql               .= " LIMIT $from, $number_of_items";
 			
 		//var_dump($sql);

+ 2 - 8
main/exercice/hotpotatoes.php

@@ -203,17 +203,11 @@ if ((api_is_allowed_to_edit(null, true)) && (($finish == 0) || ($finish == 2)))
             "<input type=\"hidden\" name=\"fld\" value=\"$fld\">\n",
             "<input type=\"hidden\" name=\"imgcount\" value=\"$imgcount\">\n",
             "<input type=\"hidden\" name=\"finish\" value=\"$finish\">\n";
-    echo GenerateHiddenList($imgparams);
-    /*if ($finish==0){ echo get_lang('DownloadFile');}
-    else {echo get_lang('DownloadImg');}
-    echo     " : ",
-            "<input type=\"file\" name=\"userFile\">\n",
-            "<input type=\"submit\" name=\"submit\" value=\"".get_lang('Send')."\"><br/>\n";*/
-    //Display::display_icon('hotpotatoes.jpg','',array('align'=> 'right', 'style' => 'position: absolute; padding-top: 30px; margin-left: 500px;'));
+    echo GenerateHiddenList($imgparams);    
 
     echo '<legend>'.$nameTools.'</legend>';
     echo '<div class="row">';
-    echo '<div class="label" style="padding:10px">';
+    echo '<div style="padding:10px">';
     echo '<span class="form_required">*</span>';
     if ($finish == 0) {
         echo get_lang('DownloadFile').' : ';