Juan Carlos Raña 14 years ago
parent
commit
bd5dc35011

+ 1 - 3
main/admin/resume_session.php

@@ -92,14 +92,12 @@ if($_GET['action'] == 'delete') {
 	}
 }
 
-
 Display::display_header($tool_name);
 if (!empty($_GET['warn'])) {
     Display::display_warning_message(urldecode($_GET['warn']));
 }
 
-
-echo Display::tag('h1', $session['name']);
+echo Display::tag('h1', Display::return_icon('session.png', get_lang('Session')).' '.$session['name']);
 echo Display::tag('h3', $tool_name);
 ?>
 <!-- General properties -->

+ 13 - 4
main/attendance/attendance_controller.php

@@ -225,7 +225,7 @@
 			$data['user_id'] = $user_id;			
 		}
 				
-		$data['next_attendance_calendar_id'] = $attendance->get_next_attendance_calendar_id($attendance_id);
+		$data['next_attendance_calendar_id']       = $attendance->get_next_attendance_calendar_id($attendance_id);
 		$data['next_attendance_calendar_datetime'] = $attendance->get_next_attendance_calendar_datetime($attendance_id);
 		
 		if (strtoupper($_SERVER['REQUEST_METHOD']) == "POST") {	
@@ -241,11 +241,20 @@
 			}
 
 			$data['users_in_course'] 			 = $attendance->get_users_rel_course($attendance_id);
-			$data['attendant_calendar'] 		 = $attendance->get_attendance_calendar($attendance_id, $filter_type);
-			$data['users_presence'] 			 = $attendance->get_users_attendance_sheet($attendance_id);
-			$data['next_attendance_calendar_id'] = $attendance->get_next_attendance_calendar_id($attendance_id);			
+			$my_calendar_id = null;
+			
+			if (is_numeric($filter_type)) {			    
+			    $my_calendar_id = $filter_type;
+			    $filter_type = 'calendar_id';
+			}
+			$data['attendant_calendar'] 		       = $attendance->get_attendance_calendar($attendance_id, $filter_type, $my_calendar_id);
+			$data['attendant_calendar_all']            = $attendance->get_attendance_calendar($attendance_id);
+			$data['users_presence'] 			       = $attendance->get_users_attendance_sheet($attendance_id);
+			$data['next_attendance_calendar_id']       = $attendance->get_next_attendance_calendar_id($attendance_id);			
 			$data['next_attendance_calendar_datetime'] = $attendance->get_next_attendance_calendar_datetime($attendance_id);			
 		} else {
+		    $data['attendant_calendar_all']       = $attendance->get_attendance_calendar($attendance_id);
+		    
 			$data['attendant_calendar'] = $attendance->get_attendance_calendar($attendance_id,$filter_type);
 		}
 		$data['is_locked_attendance'] = $attendance->is_locked_attendance($attendance_id);

+ 18 - 6
main/attendance/attendance_sheet.php

@@ -34,13 +34,26 @@ if (api_is_allowed_to_edit(null, true)) {
     
     $form = new FormValidator('filter', 'post', 'index.php?action=attendance_sheet_add&'.api_get_cidreq().$param_gradebook.'&attendance_id='.$attendance_id);
     
-    $values = array('all'=>get_lang('All'), 'today'=>get_lang('Today'),'all_done'=>get_lang('AllDone'), 'all_not_done'=>get_lang('AllNotDone'));
-    $form->addElement('select', 'filter', 'Filter', $values);   
+    $values = array('all'           => get_lang('All'), 
+                    'today'         => get_lang('Today'),
+                    'all_done'      => get_lang('AllDone'), 
+                    'all_not_done'  => get_lang('AllNotDone')
+                    );
+                    
+    
+    
+    if (!empty($attendant_calendar_all)) {
+        $values[''] = '---------------';
+        foreach($attendant_calendar_all as $attendance_date) {            
+            $values[$attendance_date['id']] = $attendance_date['date_time'];
+        }
+    }
+    
+    $form->addElement('select', 'filter', get_lang('Filter'), $values);   
     $form->addElement('style_submit_button', null, get_lang('Filter'), 'class="filter"');
     
-    if (isset($_REQUEST['filter'])) {
-        
-        if (in_array($_REQUEST['filter'],array_keys($values))) {
+    if (isset($_REQUEST['filter'])) {        
+        if (in_array($_REQUEST['filter'], array_keys($values))) {
             $default_filter = $_REQUEST['filter'];
         }       
     } else {
@@ -102,7 +115,6 @@ if (api_is_allowed_to_edit(null, true)) {
     });
 </script>
 
-
     <form method="post" action="index.php?action=attendance_sheet_add&<?php echo api_get_cidreq().$param_gradebook.$param_filter ?>&attendance_id=<?php echo $attendance_id?>" >
     
     <div class="attendance-sheet-content" style="width:100%;background-color:#E1E1E1;margin-top:20px;">

+ 12 - 12
main/calendar/agenda.inc.php

@@ -834,8 +834,7 @@ function user_group_filter_javascript() {
 * @return array: associative array where the key is the id of the user and the value is an array containing
 			the first name, the last name, the user id
 */
-function get_course_users()
-{
+function get_course_users() {
 	global $_cid;
 
 	$tbl_user       		= Database::get_main_table(TABLE_MAIN_USER);
@@ -849,20 +848,21 @@ function get_course_users()
 	$order_clause = api_sort_by_first_name() ? ' ORDER BY u.firstname, u.lastname' : ' ORDER BY u.lastname, u.firstname';
 	$sql = "SELECT u.user_id uid, u.lastname lastName, u.firstname firstName
 			FROM $tbl_user as u, $tbl_courseUser as cu
-			WHERE cu.course_code = '".$_cid."'
+			WHERE cu.course_code = '".api_get_course_id()."'
 			AND cu.user_id = u.user_id $courseadmin_filter".$order_clause;
 	$result = Database::query($sql);
 	while($user=Database::fetch_array($result)){
 		$users[$user[0]] = $user;
 	}
-
-	if(!empty($_SESSION['id_session'])){
+	
+    $session_id = api_get_session_id();
+	if (!empty($session_id)) {
+	    $users = array();
 		$sql = "SELECT u.user_id uid, u.lastname lastName, u.firstName firstName
 				FROM $tbl_session_course_user AS session_course_user
-				INNER JOIN $tbl_user u
-					ON u.user_id = session_course_user.id_user
-				WHERE id_session='".intval($_SESSION['id_session'])."'
-				AND course_code='$_cid'";
+				INNER JOIN $tbl_user u ON u.user_id = session_course_user.id_user
+				WHERE id_session = ".$session_id."
+				AND course_code  = '".api_get_course_id()."'";
 
 		$result = Database::query($sql);
 		while($user=Database::fetch_array($result)){
@@ -894,15 +894,15 @@ function get_course_groups()
 */
 function show_to_form($to_already_selected)
 {
-	$user_list=get_course_users();
-	$group_list=get_course_groups();
+	$user_list     = get_course_users();
+	$group_list    = get_course_groups();
 
 	echo "<table id=\"recipient_list\" style=\"display: none;\">";
 		echo "<tr>";
 		// the form containing all the groups and all the users of the course
 		echo "<td>";
 		echo "<strong>".get_lang('Users')."</strong><br />";
-			construct_not_selected_select_form($group_list,$user_list,$to_already_selected);
+			construct_not_selected_select_form($group_list, $user_list, $to_already_selected);
 		echo "</td>";
 		// the buttons for adding or removing groups/users
 		echo "<td valign=\"middle\">";

+ 4 - 0
main/css/base.css

@@ -695,4 +695,8 @@ button:hover {
 
 div.system_announcement {
 	background-color: #EEEEEE;
+}
+
+.RequirementHeading, .RequirementText, .RequirementContent  {
+    margin-top:12px;
 }

+ 26 - 21
main/document/document.php

@@ -119,7 +119,6 @@ $curdirpathurl = urlencode($curdirpath);
 // If the path is not found (no document id), set the path to /
 $document_id = DocumentManager::get_document_id($_course, $curdirpath);
 
-
 if (!$document_id) {    
     $document_id = DocumentManager::get_document_id(api_get_course_info(), $curdirpath);
 }
@@ -170,7 +169,6 @@ if ($tool_visibility == '0' && $to_group_id == '0' && !($is_allowed_to_edit || $
     api_not_allowed(true);
 }
 
-
 $htmlHeadXtra[] =
 "<script type=\"text/javascript\">
 function confirmation (name) {
@@ -361,7 +359,7 @@ $image_files_only = '';
 if ($is_certificate_mode) {
     $interbreadcrumb[]= array('url' => '../gradebook/index.php', 'name' => get_lang('Gradebook'));
 } else {
-    if ( (isset($_GET['id']) && $_GET['id'] != 0) || isset($_GET['curdirpath'])) {
+    if ((isset($_GET['id']) && $_GET['id'] != 0) || isset($_GET['curdirpath'])) {
         $interbreadcrumb[]= array('url' => 'document.php', 'name' => get_lang('Documents'));
     } else {
         $interbreadcrumb[]= array('url' => '#', 'name' => get_lang('Documents'));
@@ -714,7 +712,7 @@ if ($is_allowed_to_edit) {
 
 /*	TEMPLATE ACTION */
 //Only teacher and all users into their group
-if($is_allowed_to_edit || $group_member_with_upload_rights || is_my_shared_folder(api_get_user_id(), $curdirpath, $current_session_id)){
+if ($is_allowed_to_edit || $group_member_with_upload_rights || is_my_shared_folder(api_get_user_id(), $curdirpath, $current_session_id)){
     if (isset($_GET['add_as_template']) && !isset($_POST['create_template'])) {
 
         $document_id_for_template = intval($_GET['add_as_template']);
@@ -816,13 +814,13 @@ if (isset($_GET['curdirpath']) && $_GET['curdirpath'] == '/certificates' && isse
     }
 }
 
-
 /*	GET ALL DOCUMENT DATA FOR CURDIRPATH */
 if(isset($_GET['keyword']) && !empty($_GET['keyword'])) {
-    $docs_and_folders = DocumentManager::get_all_document_data($_course, $curdirpath, $to_group_id, null, $is_allowed_to_edit || $group_member_with_upload_rights, $search=true);    
+    $docs_and_folders = DocumentManager::get_all_document_data($_course, $curdirpath, $to_group_id, null, $is_allowed_to_edit || $group_member_with_upload_rights, true);    
 } else {
-    $docs_and_folders = DocumentManager::get_all_document_data($_course, $curdirpath, $to_group_id, null, $is_allowed_to_edit || $group_member_with_upload_rights, $search=false);
+    $docs_and_folders = DocumentManager::get_all_document_data($_course, $curdirpath, $to_group_id, null, $is_allowed_to_edit || $group_member_with_upload_rights, false);
 }
+
 $folders = DocumentManager::get_all_document_folders($_course, $to_group_id, $is_allowed_to_edit || $group_member_with_upload_rights);
 if ($folders === false) {
     $folders = array();
@@ -869,7 +867,9 @@ if (isset($docs_and_folders) && is_array($docs_and_folders)) {
 
     //while (list($key, $id) = each($docs_and_folders)) {
     foreach ($docs_and_folders as $key => $document_data) {
-        $row = array();
+        $row = array();        
+        $row['id']   = $document_data['id'];
+        $row['type'] = $document_data['filetype'];        
 
         // If the item is invisible, wrap it in a span with class invisible
         $invisibility_span_open  = ($document_data['visibility'] == 0) ? '<span class="invisible">' : '';
@@ -883,6 +883,7 @@ if (isset($docs_and_folders) && is_array($docs_and_folders)) {
         } else {
             $document_name = basename($document_data['path']);
         }
+        $row['name'] = $document_name;
         // Data for checkbox
         if (($is_allowed_to_edit || $group_member_with_upload_rights) && count($docs_and_folders) > 1) {
             $row[] = $document_data['path'];
@@ -951,6 +952,7 @@ if (isset($docs_and_folders) && is_array($docs_and_folders)) {
         }
         $row[] = $last_edit_date;
         $row[] = $size;
+        $row[] = $document_name;
         $total_size = $total_size + $size;
 
         if ((isset($_GET['keyword']) && search_keyword($document_name, $_GET['keyword'])) || !isset($_GET['keyword']) || empty($_GET['keyword'])) {            
@@ -1074,22 +1076,29 @@ if ($is_allowed_to_edit || $group_member_with_upload_rights || is_my_shared_fold
     $column_show[] = 1;
 }
 $column_show[] = 0;
+$column_show[] = 0;
 
 $column_order = array();
 
-if (count($row) == 8) {
+if (count($row) == 12) {
+    //teacher
+    $column_order[2] = 8; //name
     $column_order[3] = 7;
     $column_order[4] = 6;
-} elseif (count($row) == 6) {
+} elseif (count($row) == 10) {
+    //student
+    $column_order[1] = 6;
     $column_order[2] = 5;
     $column_order[3] = 4;
 }
 
 $default_column = $is_allowed_to_edit ? 2 : 1;
 $tablename = $is_allowed_to_edit ? 'teacher_table' : 'student_table';
-$table = new SortableTableFromArrayConfig($sortable_data, $default_column, 20, $tablename, $column_show, $column_order, 'ASC');
 
-if(isset($_GET['keyword'])){
+//var_dump($column_show,$column_order);
+$table = new SortableTableFromArrayConfig($sortable_data, $default_column, 20, $tablename, $column_show, $column_order, 'ASC', true);
+
+if(isset($_GET['keyword'])) {
     $query_vars['keyword'] = Security::remove_XSS($_GET['keyword']);
 }else{
     $query_vars['curdirpath'] = $curdirpath;
@@ -1104,17 +1113,15 @@ $table->set_additional_parameters($query_vars);
 $column = 0;
 
 if (($is_allowed_to_edit || $group_member_with_upload_rights) && count($docs_and_folders) > 1) {
-    $table->set_header($column++, '', false,array ('style' => 'width:30px;'));
+    $table->set_header($column++, '', false, array('style' => 'width:30px;'));
 }
-$table->set_header($column++, get_lang('Type'),true,array ('style' => 'width:30px;'));
+$table->set_header($column++, get_lang('Type'),true, array('style' => 'width:30px;'));
 $table->set_header($column++, get_lang('Name'));
-
-//$column_header[] = array(get_lang('Comment'), true); // Display comment under the document name
-$table->set_header($column++, get_lang('Size'),true,array ('style' => 'width:50px;'));
-$table->set_header($column++, get_lang('Date'),true,array ('style' => 'width:150px;'));
+$table->set_header($column++, get_lang('Size'),true, array('style' => 'width:50px;'));
+$table->set_header($column++, get_lang('Date'),true, array('style' => 'width:150px;'));
 // Admins get an edit column
 if ($is_allowed_to_edit || $group_member_with_upload_rights || is_my_shared_folder(api_get_user_id(), $curdirpath, $current_session_id)) {
-    $table->set_header($column++, get_lang('Actions'), false,array ('style' => 'width:180px;'));
+    $table->set_header($column++, get_lang('Actions'), false, array ('style' => 'width:180px;'));
 }
 
 // Actions on multiple selected documents
@@ -1127,9 +1134,7 @@ if (count($docs_and_folders) > 1) {
         $table->set_form_actions($form_action, 'path');        
     }    
 }
-//echo '<div class="thumbnails yoxview">';
 $table->display();
-//echo '</div>';
 
 if (count($docs_and_folders) > 1) {
     if ($is_allowed_to_edit || $group_member_with_upload_rights) {

+ 20 - 6
main/inc/global_error_message.inc.php

@@ -52,7 +52,9 @@ if (is_int($global_error_code) && $global_error_code > 0) {
 	$theme = 'chamilo/';
 	$css_path = 'main/css/';
 	$css_file = $css_path.$theme.'default.css';
-		
+	
+	$css_base_file         = $css_path.'base.css';
+	$css_base_chamilo_file = $css_path.'base_chamilo.css';		
 
 	$root_sys = str_replace('\\', '/', realpath(dirname(__FILE__).'/../../')).'/';
 	$root_rel = htmlentities($_SERVER['PHP_SELF']);
@@ -83,6 +85,17 @@ if (is_int($global_error_code) && $global_error_code > 0) {
 	} else {
 		$css_def = '';
 	}
+	
+	$css_base_chamilo_file = $root_sys.$css_base_chamilo_file;
+    if (file_exists($css_base_chamilo_file)) {
+        $css_def .= @file_get_contents($css_base_chamilo_file);
+    }    
+	$css_base_file = $root_sys.$css_base_file;
+    if (file_exists($css_base_file)) {
+        $css_def .= @file_get_contents($css_base_file);
+    }
+    
+
 
 	$css_def = str_replace('behavior:url("/main/css/csshover3.htc");', '', $css_def);
 	$css_def = str_replace('main/', $root_rel.'main/', $css_def);
@@ -92,7 +105,6 @@ if (is_int($global_error_code) && $global_error_code > 0) {
 	$global_error_message = array();
 
 	switch ($global_error_code) {
-
 		case 1:
 			$global_error_message['section'] = $SectionSystemRequirementsProblem;
 			$global_error_message['title'] = $IncorrectPhpVersionTitle;
@@ -109,7 +121,6 @@ if (is_int($global_error_code) && $global_error_code > 0) {
 			}
 			$global_error_message['description'] = $IncorrectPhpVersionDescription;
 			break;
-
 		case 2:
 			$global_error_message['section'] = $SectionInstallation;
 			$global_error_message['title'] = $InstallationTitle;
@@ -122,7 +133,6 @@ if (is_int($global_error_code) && $global_error_code > 0) {
 					<a href="'.$installation_guide_url.'" target="_blank">'.$read_installation_guide.'</a>';
 			$global_error_message['description'] = $InstallationDescription;
 			break;
-
 		case 3:
 		case 4:
 		case 5:
@@ -153,7 +163,8 @@ if (is_int($global_error_code) && $global_error_code > 0) {
 
 	$global_error_message['encoding'] = 'UTF-8';
 	$global_error_message['css'] = $css_def;
-	
+	$global_error_message['chamilo_logo'] = $root_rel.$css_path.$theme.'images/header-logo.png';
+		
 
 // {ORGANISATION}	moved from the header
 	$global_error_message_page =
@@ -173,6 +184,9 @@ if (is_int($global_error_code) && $global_error_code > 0) {
 		<div id="wrapper">
 			<div id="header">
 				<div id="header1">	
+				    <div id="logo">    
+                        <img vspace="10" hspace="10" alt="Chamilo" src="{CHAMILO_LOGO}">        
+                    </div>
 				</div>
 				<div class="clear"></div>
 				<div id="header2"></div>
@@ -188,7 +202,7 @@ if (is_int($global_error_code) && $global_error_code > 0) {
 
 			<div id="main">
 				<div style="text-align: center;">
-						<div class="warning-message">{DESCRIPTION}</div>
+						{DESCRIPTION}
 						{CODE}
 				</div>
 			</div>

+ 10 - 3
main/inc/lib/attendance.lib.php

@@ -833,16 +833,23 @@ class Attendance
 	 * @param	int	attendance id
 	 * @return	array attendance calendar data
 	 */
-	public function get_attendance_calendar($attendance_id, $type = 'all') {
+	public function get_attendance_calendar($attendance_id, $type = 'all', $calendar_id = null) {
 		global $dateFormatShort, $timeNoSecFormat;
 		$tbl_attendance_calendar = Database::get_course_table(TABLE_ATTENDANCE_CALENDAR);
 		$attendance_id = intval($attendance_id);		
 		$sql = "SELECT * FROM $tbl_attendance_calendar WHERE attendance_id = '$attendance_id' ";		
 		$filter_where = '';
-		if (!in_array($type, array('today', 'all', 'all_done', 'all_not_done'))) {
+		if (!in_array($type, array('today', 'all', 'all_done', 'all_not_done','calendar_id'))) {
 			$type = 'all';
 		}		
-		switch ($type ) {
+		
+		switch ($type) {
+		    case 'calendar_id':
+		        $calendar_id = intval($calendar_id);		        
+		        if (!empty($calendar_id)) {
+		            $sql.= " AND id = $calendar_id";
+		        }
+		        break;
 			case 'today':
 				//$sql .= ' AND DATE_FORMAT(date_time,"%d-%m-%Y") = DATE_FORMAT("'.api_get_utc_datetime().'", "%d-%m-%Y" )';
 				break;				

+ 3 - 1
main/inc/lib/group_portal_manager.lib.php

@@ -24,6 +24,8 @@ define('GROUP_IMAGE_SIZE_BIG', 		2);
 define('GROUP_IMAGE_SIZE_MEDIUM', 	3);
 define('GROUP_IMAGE_SIZE_SMALL', 	4);
 
+define('GROUP_TITLE_LENGTH',       50);
+
 class GroupPortalManager
 {
 	/**
@@ -958,7 +960,7 @@ class GroupPortalManager
 		}
 
 		if (!empty($links)) {
-			echo '<div align="center" class="social-menu-title"><span class="social-menu-text1">'.cut($group_info['name'],40,true).'</span></div>';
+			echo '<div align="center" class="social-menu-title"><span class="social-menu-text1">'.cut($group_info['name'], GROUP_TITLE_LENGTH, true).'</span></div>';
 			echo '<ul class="social-menu-groups">';
 			echo $links;
 			echo '</ul>';

+ 8 - 4
main/inc/lib/sortabletable.class.php

@@ -901,6 +901,8 @@ class SortableTableFromArrayConfig extends SortableTable {
 	 * The array containing all data for this table
 	 */
 	private $table_data;
+	
+	private $doc_filter;
 
 	/**
 	 * Constructor
@@ -910,10 +912,12 @@ class SortableTableFromArrayConfig extends SortableTable {
 	 * @param int $tablename Name of the table
 	 * @param array $column_show An array with binary values 1: we show the column 2: we don't show it
 	 * @param array $column_order An array of integers that let us decide how the columns are going to be sort.
+	 * @param bool special modification to fix the document name order 
 	 */
-	public function __construct ($table_data, $default_column = 1, $default_items_per_page = 20, $tablename = 'tablename', $column_show = null, $column_order = null, $direction = 'ASC') {
-		$this->column_show = $column_show;
+	public function __construct ($table_data, $default_column = 1, $default_items_per_page = 20, $tablename = 'tablename', $column_show = null, $column_order = null, $direction = 'ASC', $doc_filter = false) {
+		$this->column_show  = $column_show;
 		$this->column_order = $column_order;
+		$this->doc_filter   = $doc_filter;
 		parent :: __construct ($tablename, null, null, $default_column, $default_items_per_page, $direction);
 		$this->table_data = $table_data;
 	}
@@ -923,7 +927,7 @@ class SortableTableFromArrayConfig extends SortableTable {
 	 * @see SortableTable#get_table_data
 	 */
 	public function get_table_data($from = 1) {
-		$content = TableSort :: sort_table_config($this->table_data, $this->column, $this->direction == 'ASC' ? SORT_ASC : SORT_DESC, $this->column_show, $this->column_order);
+		$content = TableSort :: sort_table_config($this->table_data, $this->column, $this->direction == 'ASC' ? SORT_ASC : SORT_DESC, $this->column_show, $this->column_order, SORT_REGULAR, $this->doc_filter);
 		return array_slice($content, $from, $this->per_page);
 	}
 
@@ -931,7 +935,7 @@ class SortableTableFromArrayConfig extends SortableTable {
 	 * Get total number of items
 	 * @see SortableTable#get_total_number_of_items
 	 */
-	public function get_total_number_of_items () {
+	public function get_total_number_of_items() {
 		return count($this->table_data);
 	}
 }

+ 51 - 21
main/inc/lib/tablesort.lib.php

@@ -81,7 +81,7 @@ class TableSort {
 	 * @return array The sorted dataset
 	 * @author bart.mollet@hogent.be
 	 */
-	public function sort_table_config($data, $column = 0, $direction = SORT_ASC, $column_show = null, $column_order = null, $type = SORT_REGULAR) {
+	public function sort_table_config($data, $column = 0, $direction = SORT_ASC, $column_show = null, $column_order = null, $type = SORT_REGULAR, $doc_filter = false) {
 
 		if (!is_array($data) || empty($data)) {
 			return array();
@@ -111,27 +111,57 @@ class TableSort {
 			} else {
 				$type = SORT_STRING;
 			}
-		}
-
-		$compare_operator = $direction == SORT_ASC ? '>' : '<=';
-		switch ($type) {
-			case SORT_NUMERIC:
-				$compare_function = 'return strip_tags($a['.$column.']) '.$compare_operator.' strip_tags($b['.$column.']);';
-				break;
-			case SORT_IMAGE:
-				$compare_function = 'return api_strnatcmp(api_strtolower(strip_tags($a['.$column.'], "<img>")), api_strtolower(strip_tags($b['.$column.'], "<img>"))) '.$compare_operator.' 0;';
-				break;
-			case SORT_DATE:
-				$compare_function = 'return strtotime(strip_tags($a['.$column.'])) '.$compare_operator.' strtotime(strip_tags($b['.$column.']));';
-				break;
-			case SORT_STRING:
-			default:
-				$compare_function = 'return api_strnatcmp(api_strtolower(strip_tags($a['.$column.'])), api_strtolower(strip_tags($b['.$column.']))) '.$compare_operator.' 0;';
-				break;
 		}
-
-		// Sort the content
-		usort($data, create_function('$a, $b', $compare_function));
+		
+		//This fixs only works in the document tool when ordering by name
+		if ($doc_filter && in_array($type, array(SORT_STRING))) {
+    		$data_to_sort = $folder_to_sort = array();
+    		$new_data = array();
+    		if (!empty($data)) {
+        		foreach ($data as $document) {
+        		    if ($document['type'] == 'folder') {
+        		      $docs_to_sort[$document['id']]   = api_strtolower($document['name']);
+        		    } else {
+        		      $folder_to_sort[$document['id']] = api_strtolower($document['name']);  
+        		    }
+        		    $new_data[$document['id']] = $document;    		        		     
+        		}   
+                if ($direction == SORT_ASC) {
+                    api_natrsort($docs_to_sort);
+                    api_natrsort($folder_to_sort);                
+                } else {
+                    api_natsort($docs_to_sort);
+                    api_natsort($folder_to_sort);
+                }
+                $new_data_order = array();
+                foreach($docs_to_sort as $id => $document) {
+                    $new_data_order[] = $new_data[$id];
+                }            
+                foreach($folder_to_sort as $id => $document) {
+                    $new_data_order[] = $new_data[$id];
+                }
+                $data = $new_data_order; 		
+    		}              
+		} else {		
+    		$compare_operator = $direction == SORT_ASC ? '>' : '<=';    		
+    		switch ($type) {
+    			case SORT_NUMERIC:
+    				$compare_function = 'return strip_tags($a['.$column.']) '.$compare_operator.' strip_tags($b['.$column.']);';
+    				break;
+    			case SORT_IMAGE:
+    				$compare_function = 'return api_strnatcmp(api_strtolower(strip_tags($a['.$column.'], "<img>")), api_strtolower(strip_tags($b['.$column.'], "<img>"))) '.$compare_operator.' 0;';
+    				break;
+    			case SORT_DATE:
+    				$compare_function = 'return strtotime(strip_tags($a['.$column.'])) '.$compare_operator.' strtotime(strip_tags($b['.$column.']));';
+    				break;
+    			case SORT_STRING:
+    			default:
+    			    $compare_function = 'return api_strnatcmp(api_strtolower(strip_tags($a['.$column.'])), api_strtolower(strip_tags($b['.$column.']))) '.$compare_operator.' 0;';
+    				break;
+    		}		
+        	// Sort the content
+    		usort($data, create_function('$a, $b', $compare_function));
+		}
 
 		if (is_array($column_show)) {
 			// We show only the columns data that were set up on the $column_show array

+ 6 - 4
main/install/index.php

@@ -605,11 +605,12 @@ if ($_POST['step2']) {
 
 	//STEP 6 : LAST CHECK BEFORE INSTALL
 ?>
-
+    <div class="RequirementHeading">
 	<h2><?php echo display_step_sequence().get_lang('LastCheck'); ?></h2>
-
+	</div>
+    <div class="RequirementContent">
 	<?php echo get_lang('HereAreTheValuesYouEntered'); ?>
-	<br />
+	</div>
 	<strong><?php echo get_lang('PrintThisPageToRememberPassAndOthers'); ?></strong>
 
 	<blockquote>
@@ -620,7 +621,8 @@ if ($_POST['step2']) {
 	<?php echo get_lang('DBLogin').' : '.$dbUsernameForm; ?><br />
 	<?php echo get_lang('DBPassword').' : '.str_repeat('*', api_strlen($dbPassForm)); ?><br />
 	<?php if (!empty($dbPrefixForm)) echo get_lang('DbPrefixForm').' : '.$dbPrefixForm.'<br />'; ?>
-	<?php echo get_lang('MainDB').' : <strong>'.$dbNameForm; ?></strong><?php if ($installType == 'new') echo ' (<font color="#cc0033">'.get_lang('ReadWarningBelow').'</font>)'; ?><br />
+	<?php echo get_lang('MainDB').' : <strong>'.$dbNameForm; ?></strong>
+	<?php if ($installType == 'new') echo ' (<font color="#cc0033">'.get_lang('ReadWarningBelow').'</font>)'; ?><br />
 	<?php
 	if (!$singleDbForm) {
 		echo get_lang('StatDB').' : <strong>'.$dbStatsForm.'</strong>';

+ 26 - 15
main/install/install.lib.php

@@ -993,13 +993,15 @@ function display_language_selection_box($name = 'language_list', $default_langua
  */
 function display_language_selection() { ?>
     <h2><?php get_lang('WelcomeToTheDokeosInstaller'); ?></h2>
-    <h2><?php echo display_step_sequence(); ?><?php echo get_lang('InstallationLanguage'); ?></h2>
-    <p><?php echo get_lang('PleaseSelectInstallationProcessLanguage'); ?>:</p>
+    <div class="RequirementHeading">
+        <h2><?php echo display_step_sequence(); ?><?php echo get_lang('InstallationLanguage'); ?></h2>
+        <p><?php echo get_lang('PleaseSelectInstallationProcessLanguage'); ?>:</p>
     <form id="lang_form" method="post" action="<?php echo api_get_self(); ?>">
 <?php display_language_selection_box('language_list', api_get_interface_language()); ?>
     <button type="submit" name="step1" class="next" value="<?php get_lang('Next'); ?> &gt;"><?php echo get_lang('Next'); ?></button>
     <input type="hidden" name="is_executable" id="is_executable" value="-" />
     </form>
+    </div>
 <?php
 }
 
@@ -1016,14 +1018,16 @@ function display_language_selection() { ?>
  * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
  */
 function display_requirements($installType, $badUpdatePath, $updatePath = '', $update_from_version_8 = array(), $update_from_version_6 = array()) {
-    echo '<h2>'.display_step_sequence().get_lang('Requirements')."</h2>\n";
+    echo '<div class="RequirementHeading"><h2>'.display_step_sequence().get_lang('Requirements')."</h2></div>";
 
+    echo '<div class="RequirementText">';
     echo '<strong>'.get_lang('ReadThoroughly').'</strong><br />';
     echo get_lang('MoreDetails').' <a href="../../documentation/installation_guide.html" target="_blank">'.get_lang('ReadTheInstallGuide').'</a>.<br />'."\n";
     
     if ($installType == 'update')  {
         echo get_lang('IfYouPlanToUpgradeFromOlderVersionYouMightWantToHaveAlookAtTheChangelog').'<br />'."\n";
     }
+    echo '</div>';
 
     //	SERVER REQUIREMENTS
     echo '<div class="RequirementHeading"><h2>'.get_lang('ServerRequirements').'</h2>';
@@ -1347,9 +1351,10 @@ function display_requirements($installType, $badUpdatePath, $updatePath = '', $u
  */
 
 function display_license_agreement() {
-    echo '<h2>'.display_step_sequence().get_lang('Licence').'</h2>';
+    echo '<div class="RequirementHeading"><h2>'.display_step_sequence().get_lang('Licence').'</h2>';
     echo '<p>'.get_lang('DokeosLicenseInfo').'</p>';
     echo '<p><a href="../../documentation/license.html" target="_blank">'.get_lang('PrintVers').'</a></p>';
+    echo '</div>';
     ?>
     <table>
         <tr><td>
@@ -1593,20 +1598,21 @@ function display_database_settings_form($installType, $dbHostForm, $dbUsernameFo
         if (empty($dbUserForm)) {
             $dbUserForm = $singleDbForm ? $dbNameForm : $dbPrefixForm.'chamilo_user';
         }
-        echo '<h2>' . display_step_sequence() .get_lang('DBSetting') . '</h2>';
+        echo '<div class="RequirementHeading"><h2>' . display_step_sequence() .get_lang('DBSetting') . '</h2></div>';
+        echo '<div class="RequirementContent">';
         echo get_lang('DBSettingUpgradeIntro');
-
+        echo '</div>';
     } else {
-
         if (empty($dbPrefixForm)) { //make sure there is a default value for db prefix
             $dbPrefixForm = 'chamilo_';
         }
-        echo '<h2>' . display_step_sequence() .get_lang('DBSetting') . '</h2>';
+        echo '<div class="RequirementHeading"><h2>' . display_step_sequence() .get_lang('DBSetting') . '</h2>';
+        echo '</div>';
+        echo '<div class="RequirementContent">';
         echo get_lang('DBSettingIntro');
+        echo '</div>';                
     }
-
-    ?>
-    <br /><br />
+    ?>    
     </td>
     </tr>
     <tr>
@@ -1744,9 +1750,12 @@ function display_configuration_settings_form($installType, $urlForm, $languageFo
     if ($installType != 'update' && empty($languageForm)) {
         $languageForm = $_SESSION['install_language'];
     }
-
+    echo '<div class="RequirementHeading">';
     echo "<h2>" . display_step_sequence() . get_lang("CfgSetting") . "</h2>";
+    echo '</div>';
+    echo '<div class="RequirementContent">';
     echo '<p>'.get_lang('ConfigSettingsInfo').' <strong>main/inc/conf/configuration.php</strong></p>';
+    echo '</div>';
 
     echo "</td></tr>\n<tr><td>";
     echo "<table width=\"100%\">";
@@ -1884,14 +1893,16 @@ function display_configuration_settings_form($installType, $urlForm, $languageFo
  */
 function display_after_install_message($installType, $nbr_courses) {
     ?>
+    <div class="RequirementHeading">
     <h2><?php echo display_step_sequence() . get_lang('CfgSetting'); ?></h2>
-
+    </div>
+    
+    <div class="RequirementContent">
     <?php echo get_lang('FirstUseTip'); ?>
+    </div>
 
-    <br /><br />
     <?php
     echo '<div class="warning-message">';
-    //echo '<img src="../img/message_warning.png" style="float:left; margin-right:10px;" alt="'.get_lang('Warning').'"/>';
     echo '<strong>'.get_lang('SecurityAdvice').'</strong>';
     echo ': ';
     printf(get_lang('ToProtectYourSiteMakeXAndYReadOnly'), 'main/inc/conf/configuration.php', 'main/install/index.php');

+ 3 - 3
main/social/groups.php

@@ -337,7 +337,7 @@ if ($group_id != 0 ) {
 				$url_open  = '<a href="groups.php?id='.$id.'">';
 				$url_close = '</a>';
 
-				$name = cut($result['name'],140,true);
+				$name = cut($result['name'], GROUP_TITLE_LENGTH, true);
 				if ($result['relation_type'] == GROUP_USER_PERMISSION_ADMIN) {
 					$name .= ' '.Display::return_icon('social_group_admin.png', get_lang('Admin'), array('style'=>'vertical-align:middle'));
 				} elseif ($result['relation_type'] == GROUP_USER_PERMISSION_MODERATOR) {
@@ -388,7 +388,7 @@ if ($group_id != 0 ) {
 				$count_users_group = $count_users_group.' '.get_lang('Members');
 			}
 
-			$name = cut($result['name'],30,true);
+			$name = cut($result['name'],GROUP_TITLE_LENGTH,true);
 			$picture = GroupPortalManager::get_picture_group($result['id'], $result['picture_uri'],80);
 			$result['picture_uri'] = '<img class="social-groups-image" src="'.$picture['file'].'" hspace="4" height="50" border="2" align="left" width="50" />';
 			
@@ -432,7 +432,7 @@ if ($group_id != 0 ) {
 					$count_users_group = $count_users_group.' '.get_lang('Members');
 				}
 
-				$name = cut($result['name'],30,true);
+				$name = cut($result['name'],GROUP_TITLE_LENGTH,true);
 				$picture = GroupPortalManager::get_picture_group($result['id'], $result['picture_uri'],80);
 				$result['picture_uri'] = '<img class="social-groups-image" src="'.$picture['file'].'" hspace="4" height="50" border="2" align="left" width="50" />';
 				

+ 18 - 10
main/work/work.lib.php

@@ -1590,22 +1590,30 @@ function send_reminder_users_without_publication($task_id) {
  * @param string course_id
  *
  * @author Guillaume Viguier <guillaume.viguier@beeznest.com>
+ * @author Julio Montoya <gugli100@gmail.com> Adding session support - 2011 
  */
 function send_email_on_homework_creation($course_id) {
 	require_once api_get_path(LIBRARY_PATH).'course.lib.php';
 	// Get the students of the course
-	$students = CourseManager::get_student_list_from_course_code($course_id);
+	$session_id = api_get_session_id();
+	if (empty($session_id)) {
+	   $students = CourseManager::get_student_list_from_course_code($course_id);
+	} else {
+	   $students = CourseManager::get_student_list_from_course_code($course_id, true, $session_id); 
+	}
 	$emailsubject = '[' . api_get_setting('siteName') . '] '.get_lang('HomeworkCreated');
 	$currentUser = api_get_user_info(api_get_user_id());
-	foreach($students as $student) {
-		$user_info = api_get_user_info($student["user_id"]);
-		if(!empty($user_info["mail"])) {
-			$name_user = api_get_person_name($user_info["firstname"], $user_info["lastname"], null, PERSON_NAME_EMAIL_ADDRESS);
-			$emailbody = get_lang('Dear')." ".$name_user.",\n\n";
-			$emailbody .= get_lang('HomeworkHasBeenCreatedForTheCourse')." ".$course_id.". "."\n\n".get_lang('PleaseCheckHomeworkPage');
-			$emailbody .= "\n\n".api_get_person_name($currentUser["firstname"], $currentUser["lastname"]);
-			@api_mail($name_user, $user_info["mail"], $emailsubject, $emailbody, api_get_person_name($currentUser["firstname"], $currentUser["lastname"], null, PERSON_NAME_EMAIL_ADDRESS), $currentUser["mail"]);
-		}
+	if (!empty($students)) {
+    	foreach($students as $student) {
+    		$user_info = api_get_user_info($student["user_id"]);
+    		if(!empty($user_info["mail"])) {
+    			$name_user = api_get_person_name($user_info["firstname"], $user_info["lastname"], null, PERSON_NAME_EMAIL_ADDRESS);
+    			$emailbody = get_lang('Dear')." ".$name_user.",\n\n";
+    			$emailbody .= get_lang('HomeworkHasBeenCreatedForTheCourse')." ".$course_id.". "."\n\n".get_lang('PleaseCheckHomeworkPage');
+    			$emailbody .= "\n\n".api_get_person_name($currentUser["firstname"], $currentUser["lastname"]);
+    			@api_mail($name_user, $user_info["mail"], $emailsubject, $emailbody, api_get_person_name($currentUser["firstname"], $currentUser["lastname"], null, PERSON_NAME_EMAIL_ADDRESS), $currentUser["mail"]);
+    		}
+    	}
 	}
 }
 

+ 1 - 0
main/work/work.php

@@ -608,6 +608,7 @@ if (!empty($_REQUEST['new_dir'])) {
 	}
 }
 
+
 /*	Delete dir command */
 
 if (!empty($_REQUEST['delete_dir'])) {