Browse Source

added evaluations graph for dashboard interface

Cristian Fasanando 15 years ago
parent
commit
467036ba88

+ 4 - 2
main/gradebook/lib/be/exerciselink.class.php

@@ -118,8 +118,10 @@ class ExerciseLink extends AbstractLink
 		$sql = 'SELECT * FROM '.$tbl_stats.' WHERE exe_exo_id = '.(int)$this->get_ref_id().' AND orig_lp_id = 0 AND orig_lp_item_id = 0';
 
 		if (isset($stud_id)){
-			$currect_course=api_get_course_id();
-			$course_code_exe=(strlen($currect_course)===0) ? $this->get_course_code() : api_get_course_id();
+			
+			//$currect_course=api_get_course_id();			
+			//$course_code_exe = (strlen($currect_course)===0) ? $this->get_course_code() : api_get_course_id();    		
+    		$course_code_exe = $this->get_course_code();    		
     		$sql .= ' AND exe_cours_id="'.$course_code_exe.'" AND exe_user_id = '."'".$stud_id."'";
     	}
 

+ 1 - 1
main/gradebook/lib/be/forumthreadlink.class.php

@@ -127,7 +127,7 @@ class ForumThreadLink extends AbstractLink
 			if ($database_name!="") {
 			$thread_qualify = Database :: get_course_table(TABLE_FORUM_THREAD_QUALIFY, $database_name);
 
-	  		$sql = 'SELECT thread_qualify_max FROM '.Database :: get_course_table(TABLE_FORUM_THREAD, $database_name)." WHERE thread_id = '".$this->get_ref_id()."' AND session_id=".api_get_session_id()."";
+	  		$sql = 'SELECT thread_qualify_max FROM '.Database :: get_course_table(TABLE_FORUM_THREAD, $database_name)." WHERE thread_id = '".$this->get_ref_id()."'";
 			$query = Database::query($sql);
 			$assignment = Database::fetch_array($query);
 

+ 30 - 63
main/gradebook/lib/flatview_data_generator.class.php

@@ -188,86 +188,53 @@ class FlatViewDataGenerator
 	/**
 	 * Get actual array data evaluation/link scores
 	 */
-	public function get_evaluation_sumary_results ($users_sorting = 0,
-							  $users_start = 0, $users_count = null,
-							  $items_start = 0, $items_count = null,
-							  $ignore_score_color = false) {
-							  	
-		// do some checks on users/items counts, redefine if invalid values
-		if (!isset($users_count)) {
-			$users_count = count ($this->users) - $users_start;
-		}
-		if ($users_count < 0) {
-			$users_count = 0;
-		}
-		if (!isset($items_count)) {
-			$items_count = count ($this->evals) + count ($this->links) - $items_start;
-		}
-		if ($items_count < 0) {
-			$items_count = 0;
-		}
-		// copy users to a new array that we will sort
-		// TODO - needed ?
+	public function get_evaluation_sumary_results ($session_id = null) {
+								
 		$usertable = array ();
-		foreach ($this->users as $user) {
-			$usertable[] = $user;
-		}
-		// sort users array
-		if ($users_sorting & self :: FVDG_SORT_LASTNAME) {
-			usort($usertable, array ('FlatViewDataGenerator','sort_by_last_name'));
-		} elseif ($users_sorting & self :: FVDG_SORT_FIRSTNAME) {
-			usort($usertable, array ('FlatViewDataGenerator','sort_by_first_name'));
-		}
-		if ($users_sorting & self :: FVDG_SORT_DESC) {
-			$usertable = array_reverse($usertable);
-		}
-		// select the requested users
-		$selected_users = array_slice($usertable, $users_start, $users_count);
-		// generate actual data array
-
-
-		$scoredisplay = ScoreDisplay :: instance();
-
-		$data= array ();
-		$displaytype = SCORE_DIV;
-		if ($ignore_score_color) {
-			$displaytype |= SCORE_IGNORE_SPLIT;
-		}
-
+		foreach ($this->users as $user) { $usertable[] = $user; }
+		$selected_users = $usertable; 
+				
+		// generate actual data array for all selected users
+		$data = array();
 
 		foreach ($selected_users as $user) {
 			$row = array ();
 			$item_value=0;
 			$item_total=0;
-
-			for ($count=0;($count < $items_count ) && ($items_start + $count < count($this->evals_links));$count++) {
-				
-				$item = $this->evals_links [$count + $items_start];
-				$score = $item->calc_score($user[0]);
+			for ($count=0;$count < count($this->evals_links); $count++) {								
+				$item = $this->evals_links [$count];
+				$score = $item->calc_score($user[0]);				
 				$porcent_score = $score[1] ?round(($score[0]*100)/$score[1]):0;
-				$row[$item->get_name()] = $porcent_score;  
-
+				$row[$item->get_name()] = $porcent_score;												
 			}
-			unset($score);
-			$data[$user[0]] = $row;
+			$data[$user[0]] = $row;			
 		}
-		
 
+		// get evaluations for every user by item
 		$data_by_item = array();
-		foreach ($data as $key => $value) {
-			
+		foreach ($data as $uid => $items) {			
 			$tmp = array();	
-			foreach ($value as $item => $val) {
+			foreach ($items as $item => $value) {
 				$tmp[] = $item;
 				if (in_array($item,$tmp)) {
-					$data_by_item[$item][] = $val;		
+					$data_by_item[$item][$uid] = $value;		
 				}				
 			}			
 		}
-		
-		var_dump($data_by_item);
-				
-		return $data;
+
+		// get evaluation sumary results (maximum, minimum and average of evaluations for all students)
+		$result = array();
+		$maximum = $minimum = $average = 0;
+		foreach ($data_by_item as $k => $v) {			
+			$average = round(array_sum($v)/count($v));					
+			arsort($v);
+			$maximum = array_shift($v);
+			$minimum = array_pop($v);			
+			$sumary_item = array('max'=>$maximum, 'min'=>$minimum, 'avg'=>$average); 			
+			$result[$k] = $sumary_item;			
+		}
+
+		return $result;
 	}
 	
 

+ 0 - 23
main/gradebook/lib/gradebook_functions.inc.php

@@ -339,29 +339,6 @@ function get_printable_data($users,$alleval, $alllinks) {
 	return array ($header_names, $newarray);
 }
 
-function get_evaluation_sumary_result($users,$alleval, $alllinks) {
-	
-	$datagen = new FlatViewDataGenerator ($users, $alleval, $alllinks);
-	
-	$offset = isset($_GET['offset']) ? $_GET['offset'] : '0';
-	
-	$count = (($offset + 10) > $datagen->get_total_items_count()) ? ($datagen->get_total_items_count() - $offset) : 10;
-	
-	$header_names = $datagen->get_evaluation_items($offset, $count);
-
-	$data_array = $datagen->get_evaluation_sumary_results(FlatViewDataGenerator :: FVDG_SORT_LASTNAME, 0, null, $offset, $count, true);
-	
-	$newarray = array();	
-	foreach ($data_array as $data) {
-		$newarray[] = array_slice($data, 1);
-	}
-	
-	return array ($header_names, $newarray);
-		
-	
-
-}
-
 
 /**
  * XML-parser: handle character data

+ 2 - 14
main/inc/lib/pchart/pChart.class.php

@@ -2015,18 +2015,8 @@
               }
 
              if ( $Shadow && $Alpha == 100 )
-                          	
-              $X1 = $YZero;
-			  $Y1 = $XPos+1;
-			  $X2 = $YPos;
-			  $Y2 =	$XPos+$SeriesWidth-1;
-             
-             //$this->drawRectangle($XPos+1,$YZero,$XPos+$SeriesWidth-1,$YPos,25,25,25,TRUE,$Alpha);
-             //$this->drawFilledRectangle($XPos+1,$YZero,$XPos+$SeriesWidth-1,$YPos,$this->Palette[$ColorID]["R"],$this->Palette[$ColorID]["G"],$this->Palette[$ColorID]["B"],TRUE,$Alpha);
-             $this->drawRectangle($X1,$Y1,$X2,$Y2,$YPos,25,25,25,TRUE,$Alpha);
-             $this->drawFilledRectangle($X1,$Y1,$X2,$Y2,$this->Palette[$ColorID]["R"],$this->Palette[$ColorID]["G"],$this->Palette[$ColorID]["B"],TRUE,$Alpha);
-             
-             
+              $this->drawRectangle($XPos+1,$YZero,$XPos+$SeriesWidth-1,$YPos,25,25,25,TRUE,$Alpha);
+             $this->drawFilledRectangle($XPos+1,$YZero,$XPos+$SeriesWidth-1,$YPos,$this->Palette[$ColorID]["R"],$this->Palette[$ColorID]["G"],$this->Palette[$ColorID]["B"],TRUE,$Alpha);
             }
           }
          $XPos = $XPos + $this->DivisionWidth;
@@ -2098,8 +2088,6 @@
       }
     }
 
-
-
    /* This function draw a limits bar graphs */
    function drawLimitsGraph($Data,$DataDescription,$R=0,$G=0,$B=0)
     {

+ 233 - 128
plugin/dashboard/block_evaluation_graph/block_evaluation_graph.class.php

@@ -11,21 +11,13 @@
  */
 require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
 require_once api_get_path(LIBRARY_PATH).'course.lib.php';
-require_once api_get_path(LIBRARY_PATH).'tracking.lib.php';
-require_once api_get_path(LIBRARY_PATH).'attendance.lib.php';
 require_once api_get_path(LIBRARY_PATH).'sessionmanager.lib.php';
+require_once api_get_path(LIBRARY_PATH).'tracking.lib.php';
 require_once api_get_path(LIBRARY_PATH).'pchart/pData.class.php';
 require_once api_get_path(LIBRARY_PATH).'pchart/pChart.class.php';
 require_once api_get_path(LIBRARY_PATH).'pchart/pCache.class.php';
-
-require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/gradebookitem.class.php';
-require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/evaluation.class.php';
-require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/result.class.php';
-require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/linkfactory.class.php';
 require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/flatview_data_generator.class.php';
-require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/scoredisplay.class.php';
 require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/gradebook_functions.inc.php';
-
 require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/category.class.php';
 
 
@@ -37,23 +29,23 @@ require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/category.class.php';
 class BlockEvaluationGraph extends Block {
 
     private $user_id;
+	private $courses;
 	private $sessions;
 	private $path;
 
 	/**
 	 * Constructor
 	 */
-    public function __construct ($user_id) {
-    	
-    	/*
-    	$this->user_id 	= $user_id;
+    public function __construct ($user_id) {    	
+    	$this->path = 'block_evaluation_graph';
+    	$this->user_id 	= $user_id;    	
     	if (api_is_platform_admin()) {
+    		$this->courses  = CourseManager::get_real_course_list();
     		$this->sessions = SessionManager::get_sessions_list();
     	} else if (api_is_drh()) {
-    		$this->sessions = SessionManager::get_sessions_followed_by_drh($user_id);	
-    	}    	
-    	$this->path = 'block_evaluation_graph';
-    	*/
+    		$this->courses  = CourseManager::get_courses_followed_by_drh($user_id);	
+    		$this->sessions = SessionManager::get_sessions_followed_by_drh($user_id);
+    	}
     }
 
     /**
@@ -67,23 +59,40 @@ class BlockEvaluationGraph extends Block {
     	    	
     	$column = 1;
     	$data   = array();
-
-		/*
-		if (api_is_platform_admin()) {
-			$student_content_html = $this->get_students_content_html_for_platform_admin();
-		} else if (api_is_drh()) {*/
-			$evaluations_graph = $this->get_evaluations_graph();
-		//}
 		
+		$evaluations_base_courses_graph = $this->get_evaluations_base_courses_graph();
+		$evaluations_courses_in_sessions_graph = $this->get_evaluations_courses_in_sessions_graph();
+
 		$html = '        		
 			            <li class="widget color-orange" id="intro">
 			                <div class="widget-head">
-			                    <h3>'.get_lang('EvaluatiosGraph').'</h3>
+			                    <h3>'.get_lang('EvaluationsGraph').'</h3>
 			                    <div class="widget-actions"><a onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES,$charset)).'\')) return false;" href="index.php?action=disable_block&path='.$this->path.'">'.Display::return_icon('close.gif',get_lang('Close')).'</a></div>
 			                </div>			
-			                <div class="widget-content" align="center">			                	
-								'.$evaluations_graph.'
-			                </div>
+			                <div class="widget-content" align="center">';			                	
+			                	if (empty($evaluations_base_courses_graph) && empty($evaluations_courses_in_sessions_graph)) {
+			                		$html .= '<p>'.api_convert_encoding(get_lang('GraphicNotAvailable'),'UTF-8').'</p>';
+			                	} else {			                		
+			                		// display evaluations base courses graph
+				                	if (!empty($evaluations_base_courses_graph)) {
+										foreach ($evaluations_base_courses_graph as $course_code => $img_html) {
+											$html .= '<div><strong>'.$course_code.'</strong></div>';
+											$html .= $img_html;
+										}
+				                	}
+				                	// display evaluations base courses graph
+				                	if (!empty($evaluations_courses_in_sessions_graph)) {
+										foreach ($evaluations_courses_in_sessions_graph as $session_id => $courses) {
+											$session_name = api_get_session_name($session_id);
+											$html .= '<div><strong>'.$session_name.':'.get_lang('Evaluations').'</strong></div>';										
+											foreach ($courses as $course_code => $img_html) {
+												$html .= '<div><strong>'.$course_code.'</strong></div>';
+												$html .= $img_html;		
+											}										
+										}
+				                	}			                		
+			                	}
+		$html .=        	'</div>
 			            </li>			                        			    
 				'; 
     	
@@ -95,115 +104,211 @@ class BlockEvaluationGraph extends Block {
 	}
 
     /**
- 	 * This method return a graph containing informations about evaluations, it's used inside get_block method for showing it inside dashboard interface
+ 	 * This method return a graph containing informations about evaluations inside base courses, it's used inside get_block method for showing it inside dashboard interface
  	 * @return string  img html
  	 */
-    public function get_evaluations_graph() {
-		
+    public function get_evaluations_base_courses_graph() {
 		
 		
-		/*
-		$graph = '';
+		$graphs = array();
+		$courses_code = array_keys($this->courses);		
+		foreach ($courses_code as $course_code) {
+					
+			$cats = Category::load(null, null, $course_code, null, null, null, false);	
+			if (isset($cats)) {
+				$alleval = $cats[0]->get_evaluations(null, true, $course_code);
+				$alllinks = $cats[0]->get_links(null, true);
+				$users = get_all_users($alleval, $alllinks);				
+				$datagen = new FlatViewDataGenerator ($users, $alleval, $alllinks);
 
-		$course_code = 'CURSO1';
-		$cats = Category::load(null, null, $course_code, null, null, null, false);		
-		
-		$alleval = $cats[0]->get_evaluations(null, true, 'CURSO1');
-		$alllinks = $cats[0]->get_links(null, true);
-		$users = get_all_users($alleval, $alllinks);		
-		$printable_data = get_evaluation_sumary_result($users, $alleval, $alllinks);
-		
-		//var_dump($printable_data);
-		
-		/*
-		$links = array();
-		$i = 1;
-		foreach ($printable_data[0] as $link) {			
-			if ($i>2) $links[$i] = $link;
-			$i++;
-		}
-		
-		
-		foreach ($printable_data[1] as $score) {			
-			$x = 1;
-			$scores = array();	
-			foreach($score as $sc) {
-				if ($x>2) $scores[][$i][] = $sc;
-				$x++;	
+				$evaluation_sumary = $datagen->get_evaluation_sumary_results();
 				
-			}
+				if (!empty($evaluation_sumary)) {
+					$items = array_keys($evaluation_sumary);
+					$max = $min = $avg = array();
+					foreach ($evaluation_sumary as $evaluation) {
+						$max[] = $evaluation['max'];
+						$min[] = $evaluation['min'];
+						$avg[] = $evaluation['avg'];
+					}
+					
+					// Dataset definition   
+				    $data_set = new pData;  
+				    $data_set->AddPoint($max, "Max");  
+				    $data_set->AddPoint($avg, "Avg");
+				    $data_set->AddPoint($min, "Min");  	    
+				    $data_set->AddPoint($items, "Items");
+				    
+				    $data_set->SetXAxisName(get_lang('Step'));
+					$data_set->SetYAxisName(get_lang('Percentage'));
 			
-		}
-		*/
-		
-		
-		// Dataset definition   
-	    $data_set = new pData;  
-	    $data_set->AddPoint(array(3,15,15,8,15),"Serie1");  
-	    $data_set->AddPoint(array(7,8.5,8.5,5,10),"Serie2");  
-	    $data_set->AddPoint(array(2,2,2,2,5),"Serie3");
-	    $data_set->AddPoint(array('eje1','eje2','forito','tareita','leccion'),"Serie4");
-	    
-	    //$data_set->AddAllSeries();  
-	    //$data_set->SetAbsciseLabelSerie();  
-	    
-		$data_set->AddAllSeries();  
-	   	$data_set->RemoveSerie("Serie4");  
-	   	$data_set->SetAbsciseLabelSerie("Serie4");  
-	    
-	    
-	    $data_set->SetSerieName("Maximum","Serie1");  
-	    $data_set->SetSerieName("Average","Serie2");  
-	    $data_set->SetSerieName("Minimum","Serie3");  
-	     
-	    
-	    $graph_id = $this->user_id.'StudentEvaluationGraph';			 
-		$cache = new pCache();
-		// the graph id
-		$data = $data_set->GetData();
-	
-		if ($cache->IsInCache($graph_id, $data)) {			
-			//if we already created the img
-			$img_file = $cache->GetHash($graph_id, $data);
-		} else {
-			// Initialise the graph  
-		    $test = new pChart(450,230);  
-		    $test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',8);  
-		    $test->setGraphArea(50,30,330,200);  
-		    $test->drawFilledRoundedRectangle(7,7,343,223,5,240,240,240);  
-		    $test->drawRoundedRectangle(5,5,345,225,5,230,230,230);  
-		    $test->drawGraphArea(255,255,255,TRUE);  
-		    $test->drawScale($data_set->GetData(),$data_set->GetDataDescription(),SCALE_ADDALL,150,150,150,TRUE,0,2,TRUE);  
-		    $test->drawGrid(4,TRUE,230,230,230,50);  
-		     
-		    // Draw the 0 line  
-		    $test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',6);  
-		    $test->drawTreshold(0,143,55,72,TRUE,TRUE);  
-		     
-		    // Draw the bar graph  
-		    $test->drawStackedBarGraph($data_set->GetData(),$data_set->GetDataDescription(),TRUE);  
-		     
-		    // Finish the graph  
-		    $test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',8);  
-		    $test->drawLegend(596,150,$data_set->GetDataDescription(),255,255,255);  
-		    $test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',10);  
-		    $test->drawTitle(50,22,"Example 20",50,50,50,185);  
-		    
-		    $cache->WriteToCache($graph_id, $data_set->GetData(), $test);
-			ob_start();
-			$test->Stroke();
-			ob_end_clean();
-			$img_file = $cache->GetHash($graph_id, $data_set->GetData());	
-		}
-		
-		if (!empty($img_file)) {
-			$graph = '<img src="'.api_get_path(WEB_ARCHIVE_PATH).$img_file.'">';
-		}  
-		 
-    	return $graph;
-		
+					$data_set->AddAllSeries();  
+				   	$data_set->RemoveSerie("Items");  
+				   	$data_set->SetAbsciseLabelSerie("Items");  
+			
+				    $graph_id = $this->user_id.'StudentEvaluationGraph';			 
+					$cache = new pCache();
+					// the graph id
+					$data = $data_set->GetData();
+				
+					if ($cache->IsInCache($graph_id, $data)) {			
+						//if we already created the img
+						$img_file = $cache->GetHash($graph_id, $data);
+					} else {
+						// Initialise the graph  
+					    $test = new pChart(450,260);  
+					    $test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',8);  
+					    $test->setGraphArea(50,30,375,200);  
+					    $test->drawFilledRoundedRectangle(7,7,373,223,5,240,240,240);  
+					    $test->drawRoundedRectangle(5,5,375,225,5,230,230,230);  
+					    $test->drawGraphArea(255,255,255,TRUE);  
+					    
+					    $test->setFixedScale(0,100,5);	
+					    
+					    $test->drawScale($data_set->GetData(),$data_set->GetDataDescription(),SCALE_ADDALL,150,150,150,TRUE,0,2,TRUE);  
+					    
+					    $test->setColorPalette(0,125,201,44);
+						$test->setColorPalette(1,255,138,0);
+						$test->setColorPalette(2,255,0,0);
+					    
+					    $test->drawGrid(4,TRUE,230,230,230,50);  
+					     
+					    // Draw the 0 line  
+					    $test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',6);  
+					    $test->drawTreshold(0,143,55,72,TRUE,TRUE);  
+					     
+					    // Draw the bar graph  
+					    $test->drawOverlayBarGraph($data_set->GetData(),$data_set->GetDataDescription(), 100);
+					     
+					    // Finish the graph  
+					    $test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',8);  
+					    $test->drawLegend(370,20,$data_set->GetDataDescription(),255,255,255);  
+					    $test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',10);  
+					    //$test->drawTitle(50,22,$course_code,50,50,50,185);  					    
+					    $test->writeValues($data_set->GetData(),$data_set->GetDataDescription(),array("Min", "Max", "Avg"));					    		   		    
+					    $cache->WriteToCache($graph_id, $data_set->GetData(), $test);
+						ob_start();
+						$test->Stroke();
+						ob_end_clean();
+						$img_file = $cache->GetHash($graph_id, $data_set->GetData());	
+					}
+					
+					if (!empty($img_file)) {
+						$graphs[$course_code] = '<img src="'.api_get_path(WEB_ARCHIVE_PATH).$img_file.'">';
+					} 					
+				}
+			}				
+		} // end for
+
+    	return $graphs;		
  	}
 
 
+	/**
+ 	 * This method return a graph containing informations about evaluations inside courses in sessions, it's used inside get_block method for showing it inside dashboard interface
+ 	 * @return string  img html
+ 	 */
+    public function get_evaluations_courses_in_sessions_graph() {
+				
+		$graphs = array();				
+		$session_ids = array_keys($this->sessions);				
+		foreach ($session_ids as $session_id) {			
+			$courses_code = array_keys(Tracking::get_courses_list_from_session($session_id));
+			$courses_graph = array();	
+			foreach ($courses_code as $course_code) {
+				
+				$cats = Category::load(null, null, $course_code, null, null, $session_id);
+				if (isset($cats)) {
+
+						$alleval = $cats[0]->get_evaluations(null, true, $course_code);
+						$alllinks = $cats[0]->get_links(null, true);						
+						$users = get_all_users($alleval, $alllinks);			
+						
+						$datagen = new FlatViewDataGenerator ($users, $alleval, $alllinks);
+						$evaluation_sumary = $datagen->get_evaluation_sumary_results();
+
+						if (!empty($evaluation_sumary)) {
+							$items = array_keys($evaluation_sumary);
+							$max = $min = $avg = array();
+							foreach ($evaluation_sumary as $evaluation) {
+								$max[] = $evaluation['max'];
+								$min[] = $evaluation['min'];
+								$avg[] = $evaluation['avg'];
+							}
+							
+							// Dataset definition   
+						    $data_set = new pData;  
+						    $data_set->AddPoint($max, "Max");  
+						    $data_set->AddPoint($avg, "Avg");
+						    $data_set->AddPoint($min, "Min");  	    
+						    $data_set->AddPoint($items, "Items");
+						    
+						    $data_set->SetXAxisName(get_lang('Step'));
+							$data_set->SetYAxisName(get_lang('Percentage'));
+					
+							$data_set->AddAllSeries();  
+						   	$data_set->RemoveSerie("Items");  
+						   	$data_set->SetAbsciseLabelSerie("Items");  
+					
+						    $graph_id = $this->user_id.'StudentEvaluationGraph';			 
+							$cache = new pCache();
+							// the graph id
+							$data = $data_set->GetData();
+						
+							if ($cache->IsInCache($graph_id, $data)) {			
+								//if we already created the img
+								$img_file = $cache->GetHash($graph_id, $data);
+							} else {
+								// Initialise the graph  
+							    $test = new pChart(450,260);  
+							    $test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',8);  
+							    $test->setGraphArea(50,30,375,200);  
+							    $test->drawFilledRoundedRectangle(7,7,373,230,5,240,240,240);  
+							    $test->drawRoundedRectangle(5,5,375,225,5,230,230,230);  
+							    $test->drawGraphArea(255,255,255,TRUE);  
+							    
+							    $test->setFixedScale(0,100,5);	
+							    
+							    $test->drawScale($data_set->GetData(),$data_set->GetDataDescription(),SCALE_ADDALL,150,150,150,TRUE,0,2,TRUE);  
+							    
+							    $test->setColorPalette(0,125,201,44);
+								$test->setColorPalette(1,255,138,0);
+								$test->setColorPalette(2,255,0,0);
+							    
+							    $test->drawGrid(4,TRUE,230,230,230,50);  
+							     
+							    // Draw the 0 line  
+							    $test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',6);  
+							    $test->drawTreshold(0,143,55,72,TRUE,TRUE);  
+							     
+							    // Draw the bar graph  
+							    $test->drawOverlayBarGraph($data_set->GetData(),$data_set->GetDataDescription(), 100);
+							     
+							    // Finish the graph  
+							    $test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',8);  
+							    $test->drawLegend(370,20,$data_set->GetDataDescription(),255,255,255);  
+							    $test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',10);  
+							    //$test->drawTitle(50,22,$course_code,50,50,50,185);  					    
+							    $test->writeValues($data_set->GetData(),$data_set->GetDataDescription(),array("Min", "Max", "Avg"));					    		   		    
+							    $cache->WriteToCache($graph_id, $data_set->GetData(), $test);
+								ob_start();
+								$test->Stroke();
+								ob_end_clean();
+								$img_file = $cache->GetHash($graph_id, $data_set->GetData());	
+							}
+							
+							if (!empty($img_file)) {
+								$courses_graph[$course_code] = '<img src="'.api_get_path(WEB_ARCHIVE_PATH).$img_file.'">';
+							} 					
+						}
+					}									
+				}				
+				if (!empty($courses_graph)) {
+					$graphs[$session_id] = $courses_graph;	
+				}												
+			} 								
+    	return $graphs;		
+ 	}
+
 }
 ?>