jmontoya 15 gadi atpakaļ
vecāks
revīzija
0f60316b8d

+ 20 - 24
main/admin/session_course_list.php

@@ -1,9 +1,16 @@
 <?php
+<?php
+/* For licensing terms, see /dokeos_license.txt */
+/**
+==============================================================================
+*	@package dokeos.admin
+==============================================================================
+*/
+
+
 // name of the language file that needs to be included
 $language_file='admin';
-
 $cidReset=true;
-
 include('../inc/global.inc.php');
 
 // setting the section (for the tabs)
@@ -30,17 +37,17 @@ if(!list($session_name)=mysql_fetch_row($result))
 	exit();
 }
 
-if($action == 'delete')
-{
+if($action == 'delete') {
 	$idChecked = $_POST['idChecked'];
-	if(is_array($idChecked))
-	{
+	if(is_array($idChecked) && count($idChecked)>0) {		
+		$my_temp = array(); 
+		foreach ($idChecked as $id){
+			$my_temp[]= Database::escape_string($id);// forcing the escape_string
+		}
+		$idChecked = $my_temp;		
 		$idChecked="'".implode("','",$idChecked)."'";
-
 		api_sql_query("DELETE FROM $tbl_session_rel_course WHERE id_session='$id_session' AND course_code IN($idChecked)",__FILE__,__LINE__);
-
 		$nbr_affected_rows=mysql_affected_rows();
-
 		api_sql_query("DELETE FROM $tbl_session_rel_course_rel_user WHERE id_session='$id_session' AND course_code IN($idChecked)",__FILE__,__LINE__);
 
 		api_sql_query("UPDATE $tbl_session SET nbr_courses=nbr_courses-$nbr_affected_rows WHERE id='$id_session'",__FILE__,__LINE__);
@@ -54,18 +61,14 @@ $limit=20;
 $from=$page * $limit;
 
 $result=api_sql_query("SELECT code,title,nbr_users FROM $tbl_session_rel_course,$tbl_course WHERE course_code=code AND id_session='$id_session' ORDER BY $sort LIMIT $from,".($limit+1),__FILE__,__LINE__);
-
 $Courses=api_store_result($result);
-
 $nbr_results=sizeof($Sessions);
-
 $tool_name = api_htmlentities($session_name,ENT_QUOTES,$charset).' : '.get_lang('CourseListInSession');
 
 $interbreadcrumb[]=array('url' => 'index.php',"name" => get_lang('PlatformAdmin'));
 $interbreadcrumb[]=array('url' => "session_list.php","name" => get_lang('SessionList'));
 
 Display::display_header($tool_name);
-
 api_display_tool_title($tool_name);
 ?>
 
@@ -83,10 +86,8 @@ $tableHeader[] = array(get_lang('CourseTitle'));
 $tableHeader[] = array(get_lang('NbUsers'));
 $tableHeader[] = array(get_lang('Actions'));
 
-
 $tableCourses = array();
-foreach($Courses as $key=>$enreg)
-{
+foreach($Courses as $key=>$enreg) {
 	$course = array();
 	$course[] = '<input type="checkbox" name="idChecked[]" value="'.$enreg['code'].'">';
 	$course[] = api_htmlentities($enreg['title'],ENT_QUOTES,$charset);
@@ -97,15 +98,10 @@ foreach($Courses as $key=>$enreg)
 }
 echo '<form method="post" action="'.api_get_self().'">';
 Display :: display_sortable_table($tableHeader, $tableCourses, array (), array ());
-echo '
-	<select name="action">
+echo '<select name="action">
 	<option value="delete">'.get_lang('UnsubscribeCoursesFromSession').'</option>
 	</select>
-	<input type="submit" value="'.get_lang('Ok').'">
+	<button class="save" type="submit">'.get_lang('Ok').'</button>
 	</form>';
-?>
-
-
-<?php
 Display::display_footer();
-?>
+?>

+ 33 - 48
main/admin/session_course_user_list.php

@@ -1,12 +1,15 @@
 <?php
-$language_file='admin';
+/* For licensing terms, see /dokeos_license.txt */
+/**
+==============================================================================
+*	@package dokeos.admin
+==============================================================================
+*/
 
+$language_file='admin';
 $cidReset=true;
-
 include('../inc/global.inc.php');
-
 api_protect_admin_script();
-
 $tbl_user=Database::get_main_table(TABLE_MAIN_USER);
 $tbl_course=Database::get_main_table(TABLE_MAIN_COURSE);
 $tbl_session=Database::get_main_table(TABLE_MAIN_SESSION);
@@ -19,7 +22,13 @@ $page=intval($_GET['page']);
 $action=$_REQUEST['action'];
 $sort=in_array($_GET['sort'],array('lastname','firstname','username'))?$_GET['sort']:'lastname';
 $idChecked = (is_array($_GET['idChecked']) ? $_GET['idChecked'] : (is_array($_POST['idChecked']) ? $_POST['idChecked'] : null));
-
+if (is_array($idChecked)) {
+	$my_temp = array(); 
+	foreach ($idChecked as $id){
+		$my_temp[]= intval($id);// forcing the intval
+	}
+	$idChecked = $my_temp;
+}
 $result=api_sql_query("SELECT name,title FROM $tbl_session,$tbl_course WHERE id='$id_session' AND code='".addslashes($course_code)."'",__FILE__,__LINE__);
 
 if(!list($session_name,$course_title)=mysql_fetch_row($result))
@@ -28,19 +37,13 @@ if(!list($session_name,$course_title)=mysql_fetch_row($result))
 	exit();
 }
 
-if($action == 'delete')
-{
-	if(is_array($idChecked))
-	{
+if($action == 'delete') {	
+	if(is_array($idChecked) && count($idChecked)>0 ) {
 		$idChecked=implode(',',$idChecked);
-
-		api_sql_query("DELETE FROM $tbl_session_rel_course_rel_user WHERE id_session='$id_session' AND course_code='".addslashes($course_code)."' AND id_user IN($idChecked)",__FILE__,__LINE__);
-		
+		api_sql_query("DELETE FROM $tbl_session_rel_course_rel_user WHERE id_session='$id_session' AND course_code='".addslashes($course_code)."' AND id_user IN($idChecked)",__FILE__,__LINE__);		
 		$nbr_affected_rows=mysql_affected_rows();
-
 		api_sql_query("UPDATE $tbl_session_rel_course SET nbr_users=nbr_users-$nbr_affected_rows WHERE id_session='$id_session' AND course_code='".addslashes($course_code)."'",__FILE__,__LINE__);
 	}
-
 	header('Location: '.api_get_self().'?id_session='.$id_session.'&course_code='.urlencode($course_code).'&sort='.$sort);
 	exit();
 }
@@ -49,16 +52,15 @@ $limit=20;
 $from=$page * $limit;
 
 $result=api_sql_query("SELECT user_id,lastname,firstname,username FROM $tbl_session_rel_course_rel_user,$tbl_user WHERE user_id=id_user AND id_session='$id_session' AND course_code='".addslashes($course_code)."' ORDER BY $sort LIMIT $from,".($limit+1),__FILE__,__LINE__);
-
 $Users=api_store_result($result);
 
 $nbr_results=sizeof($Users);
 
 $tool_name = get_lang('ListOfUsersSubscribedToCourse').' &quot;'.api_htmlentities($course_title,ENT_QUOTES,$charset).'&quot; '.get_lang('ForTheSession').' &quot;'.api_htmlentities($session_name,ENT_QUOTES,$charset).'&quot;';
 
-$interbredcrump[]=array("url" => "index.php","name" => get_lang('AdministrationTools'));
-$interbredcrump[]=array("url" => "session_list.php","name" => get_lang('SessionList'));
-$interbredcrump[]=array("url" => "session_course_list.php?id_session=$id_session","name" => get_lang('ListOfCoursesOfSession')." &quot;".api_htmlentities($session_name,ENT_QUOTES,$charset)."&quot;");
+$interbreadcrumb[]=array("url" => "index.php","name" => get_lang('AdministrationTools'));
+$interbreadcrumb[]=array("url" => "session_list.php","name" => get_lang('SessionList'));
+$interbreadcrumb[]=array("url" => "session_course_list.php?id_session=$id_session","name" => get_lang('ListOfCoursesOfSession')." &quot;".api_htmlentities($session_name,ENT_QUOTES,$charset)."&quot;");
 
 Display::display_header($tool_name);
 
@@ -110,19 +112,17 @@ else
 <table class="data_table" width="100%">
 <tr>
   <th>&nbsp;</th>
-  <th><a href="<?php echo api_get_self(); ?>?id_session=<?php echo $id_session; ?>&course_code=<?php echo urlencode($course_code); ?>&sort=lastname">Nom</a></th>
-  <th><a href="<?php echo api_get_self(); ?>?id_session=<?php echo $id_session; ?>&course_code=<?php echo urlencode($course_code); ?>&sort=firstname">Prénom</a></th>
-  <th><a href="<?php echo api_get_self(); ?>?id_session=<?php echo $id_session; ?>&course_code=<?php echo urlencode($course_code); ?>&sort=username">Identifiant</a></th>
-  <th>Actions</th>
+  <th><a href="<?php echo api_get_self(); ?>?id_session=<?php echo $id_session; ?>&course_code=<?php echo urlencode($course_code); ?>&sort=lastname"><?php echo get_lang('LastName');?></a></th>
+  <th><a href="<?php echo api_get_self(); ?>?id_session=<?php echo $id_session; ?>&course_code=<?php echo urlencode($course_code); ?>&sort=firstname"><?php echo get_lang('FirstName');?></a></th>
+  <th><a href="<?php echo api_get_self(); ?>?id_session=<?php echo $id_session; ?>&course_code=<?php echo urlencode($course_code); ?>&sort=username"><?php echo get_lang('Login');?></a></th>
+  <th><?php echo get_lang('Actions');?></th>
 </tr>
 
 <?php
 $i=0;
 
-foreach($Users as $key=>$enreg)
-{
-	if($key == $limit)
-	{
+foreach($Users as $key=>$enreg) {
+	if($key == $limit) {
 		break;
 	}
 ?>
@@ -145,35 +145,22 @@ unset($Users);
 ?>
 
 </table>
-
-<br>
-
+<br />
 <div align="left">
-
 <?php
-if($page)
-{
+if($page) {
 ?>
-
 <a href="<?php echo api_get_self(); ?>?id_session=<?php echo $id_session; ?>&course_code=<?php echo urlencode($course_code); ?>&page=<?php echo $page-1; ?>&sort=<?php echo $sort; ?>"><?php echo get_lang('Previous'); ?></a>
-
 <?php
-}
-else
-{
+} else {
 	echo get_lang('Previous');
 }
 ?>
-
 |
-
 <?php
-if($nbr_results > $limit)
-{
+if($nbr_results > $limit) {
 ?>
-
 <a href="<?php echo api_get_self(); ?>?id_session=<?php echo $id_session; ?>&course_code=<?php echo urlencode($course_code); ?>&page=<?php echo $page+1; ?>&sort=<?php echo $sort; ?>"><?php echo get_lang('Next'); ?></a>
-
 <?php
 }
 else
@@ -187,14 +174,12 @@ else
 <br>
 
 <select name="action">
-<option value="delete"><?php get_lang('UnsubscribeSelectedUsersFromSession');?></option>
+<option value="delete"><?php echo get_lang('UnsubscribeSelectedUsersFromSession');?></option>
 </select>
-<input type="submit" value="<?php echo get_lang('Ok'); ?>">
-
+<button class="save" type="submit"> <?php echo get_lang('Ok'); ?></button>
 </table>
-
 </div>
-
+</form>
 <?php
 Display::display_footer();
 ?>

+ 5 - 5
main/mySpace/course.php

@@ -100,10 +100,10 @@ $table -> set_header(1, get_lang('NbStudents'), false);
 $table -> set_header(2, get_lang('TimeSpentInTheCourse'), false);
 $table -> set_header(3, get_lang('AvgStudentsProgress'), false);
 $table -> set_header(4, get_lang('AvgCourseScore'), false);
-$table -> set_header(5, get_lang('AvgExercisesScore'), false);
-$table -> set_header(6, get_lang('AvgMessages'), false);
-$table -> set_header(7, get_lang('AvgAssignments'), false);
-$table -> set_header(8, get_lang('Details'), false);
+//$table -> set_header(5, get_lang('AvgExercisesScore'), false);// no code for this?
+$table -> set_header(5, get_lang('AvgMessages'), false);
+$table -> set_header(6, get_lang('AvgAssignments'), false);
+$table -> set_header(7, get_lang('Details'), false);
 
 $csv_content[] = array(
 				get_lang('CourseTitle'),
@@ -111,7 +111,7 @@ $csv_content[] = array(
 				get_lang('TimeSpentInTheCourse'),
 				get_lang('AvgStudentsProgress'),
 				get_lang('AvgCourseScore'),
-				get_lang('AvgExercisesScore'),
+				//get_lang('AvgExercisesScore'),
 				get_lang('AvgMessages'),
 				get_lang('AvgAssignments')
 				);

+ 4 - 8
main/tracking/courseLog.php

@@ -525,11 +525,7 @@ if($_GET['studentlist'] == 'false') {
 		$table -> set_header(7, get_lang('Messages'),false);
 		$table -> set_header(8, get_lang('FirstLogin'), false, 'align="center"');
 		$table -> set_header(9, get_lang('LatestLogin'), false, 'align="center"');
-		$table -> set_header(10, get_lang('Details'),false);
-	     
-	    if ($export_csv) {
-			$csv_content[] = array ();
-		}
+		$table -> set_header(10, get_lang('Details'),false);     
 	    
 	    $all_datas = array();
 	    $course_code = $_course['id'];
@@ -593,9 +589,8 @@ if($_GET['studentlist'] == 'false') {
 	}
 	
 	// send the csv file if asked
-	if ($export_csv) {
-		
-		$csv_content[] = array ( 
+	if ($export_csv) {		
+		$csv_headers = array ( 
 									get_lang('OfficialCode'),
 									get_lang('LastName'),
 									get_lang('FirstName'),
@@ -608,6 +603,7 @@ if($_GET['studentlist'] == 'false') {
 									get_lang('LatestLogin')
 								   );
 		ob_end_clean();
+		array_unshift($csv_content,$csv_headers); // adding headers before the content
 		Export :: export_table_csv($csv_content, 'reporting_student_list');
 	}