diff --git a/main/document/document.php b/main/document/document.php
index 469300a824..c67a6be04d 100755
--- a/main/document/document.php
+++ b/main/document/document.php
@@ -690,7 +690,7 @@ if (isset($docs_and_folders) && is_array($docs_and_folders)) {
$last_edit_date = $id['lastedit_date'];
$last_edit_date = api_get_local_time($last_edit_date, null, date_default_timezone_get());
$display_date = date_to_str_ago($last_edit_date).'
'.api_format_date($last_edit_date).'';
- $row[] = $invisibility_span_open.$display_date.$invisibility_span_close.'';
+ $row[] = $invisibility_span_open.$display_date.$invisibility_span_close;
// Admins get an edit column
if ($is_allowed_to_edit || $group_member_with_upload_rights) {
@@ -794,16 +794,11 @@ $column_show[] = 0;
$column_order = array();
if (count($row) == 8) {
- $column_order[] = 1;
- $column_order[] = 2;
- $column_order[] = 7;
- $column_order[] = 6;
- $column_order[] = 5;
+ $column_order[3] = 7;
+ $column_order[4] = 6;
} elseif (count($row) == 6) {
- $column_order[] = 1;
- $column_order[] = 2;
- $column_order[] = 7;
- $column_order[] = 4;
+ $column_order[2] = 5;
+ $column_order[3] = 4;
}
$default_column = $is_allowed_to_edit ? 2 : 1;
diff --git a/main/dropbox/index.php b/main/dropbox/index.php
index ec3f930361..831f03dac4 100755
--- a/main/dropbox/index.php
+++ b/main/dropbox/index.php
@@ -250,13 +250,12 @@ if ($_GET['action'] != 'add') {
}
}
-
// ACTIONS
if ($_GET['view'] == 'received' OR !$dropbox_cnf['sent_received_tabs']) {
//echo '
'.get_lang('ReceivedFiles').'
';
// This is for the categories
- if (isset($_GET['view_received_category']) AND $_GET['view_received_category']<>'') {
+ if (isset($_GET['view_received_category']) AND $_GET['view_received_category'] != '') {
$view_dropbox_category_received = Security::remove_XSS($_GET['view_received_category']);
} else {
$view_dropbox_category_received = 0;
@@ -381,6 +380,7 @@ if ($_GET['action'] != 'add') {
}
$column_header[] = array('RealDate', true);
+ $column_header[] = array('RealSize', true);
// An array with the setting of the columns -> 1: columns that we will show, 0:columns that will be hide
$column_show[] = 1;
@@ -401,14 +401,9 @@ if ($_GET['action'] != 'add') {
// in this case the the column of LastResent ( 4th element in $column_header) we will be order like the column RealDate
// because in the column RealDate we have the days in a correct format "2008-03-12 10:35:48"
- $column_order[] = 1;
- $column_order[] = 2;
- $column_order[] = 3;
- $column_order[] = 4;
- $column_order[] = 7;
- $column_order[] = 6;
- $column_order[] = 7;
- $column_order[] = 8;
+ $column_order[3] = 8;
+ $column_order[5] = 7;
+
// The content of the sortable table = the received files
foreach ($dropbox_person -> receivedWork as $dropbox_file) {
@@ -429,7 +424,8 @@ if ($_GET['action'] != 'add') {
$link_open = '';
$dropbox_file_data[] = $link_open.build_document_icon_tag('file', $dropbox_file->title).'';
$dropbox_file_data[] = ''.Display::return_icon('filesave.gif', get_lang('Download'), array('style' => 'float:right;')).''.$link_open.$dropbox_file->title.''.$new_icon.'
'.$dropbox_file->description;
- $dropbox_file_data[] = ceil(($dropbox_file->filesize) / 1024).' '.get_lang('kB');
+ $file_size = $dropbox_file->filesize;
+ $dropbox_file_data[] = format_file_size($file_size);
$dropbox_file_data[] = $dropbox_file->author;
//$dropbox_file_data[] = $dropbox_file->description;
@@ -454,7 +450,8 @@ if ($_GET['action'] != 'add') {
$dropbox_file_data[] = $action_icons;
}
$action_icons = '';
- $dropbox_file_data[] = $dropbox_file->last_upload_date; //date
+ $dropbox_file_data[] = $last_upload_date;
+ $dropbox_file_data[] = $file_size;
$dropbox_data_recieved[] = $dropbox_file_data;
}
}
@@ -535,7 +532,8 @@ if ($_GET['action'] != 'add') {
$column_header[] = array(get_lang('Modify'), false, '', 'nowrap style="text-align: right"');
}
- $column_header[] = array('RealDate', false);
+ $column_header[] = array('RealDate', true);
+ $column_header[] = array('RealSize', true);
$column_show = array();
$column_order = array();
@@ -558,14 +556,8 @@ if ($_GET['action'] != 'add') {
// in this case the the column of LastResent ( 4th element in $column_header) we will be order like the column RealDate
// because in the column RealDate we have the days in a correct format "2008-03-12 10:35:48"
- $column_order[] = 1;
- $column_order[] = 2;
- $column_order[] = 3;
- $column_order[] = 4;
- $column_order[] = 7;
- $column_order[] = 6;
- $column_order[] = 7;
- $column_order[] = 8;
+ $column_order[3] = 8;
+ $column_order[5] = 7;
// The content of the sortable table = the received files
foreach ($dropbox_person -> sentWork as $dropbox_file) {
@@ -576,7 +568,8 @@ if ($_GET['action'] != 'add') {
$link_open = '';
$dropbox_file_data[] = $link_open.build_document_icon_tag('file', $dropbox_file->title).'';
$dropbox_file_data[] = ''.Display::return_icon('filesave.gif', get_lang('Save'), array('style' => 'float:right;')).''.$link_open.$dropbox_file->title.'
'.$dropbox_file->description;
- $dropbox_file_data[] = ceil(($dropbox_file->filesize)/1024).' '.get_lang('kB');
+ $file_size = $dropbox_file->filesize;
+ $dropbox_file_data[] = format_file_size($file_size);
foreach ($dropbox_file->recipients as $recipient) {
$receivers_celldata = display_user_link_work($recipient['user_id'], $recipient['name']).', '.$receivers_celldata;
}
@@ -592,12 +585,13 @@ if ($_GET['action'] != 'add') {
'.Display::return_icon('deplacer_fichier.gif', get_lang('Move')).'
'.Display::return_icon('delete.gif', get_lang('Delete')).'';
// This is a hack to have an additional row in a sortable table
- if ($_GET['action'] == 'viewfeedback' AND isset($_GET['id']) and is_numeric($_GET['id']) AND $dropbox_file->id==$_GET['id']) {
+ if ($_GET['action'] == 'viewfeedback' && isset($_GET['id']) && is_numeric($_GET['id']) && $dropbox_file->id == $_GET['id']) {
$action_icons .= "\n"; // ending the normal row of the sortable table
$action_icons .= "\n\t| ".get_lang('CloseFeedback')." | ".feedback($dropbox_file->feedback2)." | \n
\n";
}
$dropbox_file_data[] = $action_icons;
- $dropbox_file_data[] = $dropbox_file->last_upload_date;
+ $dropbox_file_data[] = $last_upload_date;
+ $dropbox_file_data[] = $file_size;
$action_icons = '';
$dropbox_data_sent[] = $dropbox_file_data;
}
diff --git a/main/inc/lib/tablesort.lib.php b/main/inc/lib/tablesort.lib.php
index 44bc0bb4be..eab11babb0 100755
--- a/main/inc/lib/tablesort.lib.php
+++ b/main/inc/lib/tablesort.lib.php
@@ -9,40 +9,9 @@
define('SORT_DATE', 3);
define('SORT_IMAGE', 4);
-define('SORT_CUSTOM', 5);
class TableSort {
- /**
- * This is a method for date comparison, using hidden raw values if they are given.
- * Date formats vary a lot, alse they have localized values. For avoiding using
- * unreliable in this case date parsing routine, this method checks first whether raw
- * date walues have been intentionaly passed in order precise sorting to be achieved.
- * Here is the format of the date value, hidden in a comment:
- * @param string $el1 The first element provided from the table.
- * @param string $el2 The second element provided from the table.
- * @result bool Tre comparison result.
- * @author Ivan Tcholakov, 2010.
- */
- public function date_compare($el1, $el2) {
- if (($pos1 = strpos($el1, '', $pos1)) !== false) {
- $el1 = intval(substr($el1, $pos1 + 8, $pos2 - $pos1 - 8));
- } else {
- $el1 = strtotime(strip_tags($el1));
- }
- if (($pos1 = strpos($el2, '', $pos1)) !== false) {
- $el2 = intval(substr($el2, $pos1 + 8, $pos2 - $pos1 - 8));
- } else {
- $el2 = strtotime(strip_tags($el2));
- }
- if ($el1 > $el2) {
- return 1;
- } elseif ($el1 < $el2) {
- return -1;
- }
- return 0;
- }
-
/**
* Sorts 2-dimensional table.
* @param array $data The data to be sorted.
@@ -68,9 +37,7 @@ class TableSort {
$compare_function = '';
if ($type == SORT_REGULAR) {
- if (TableSort::is_custom_sortable_column($data, $column)) {
- $type = SORT_CUSTOM;
- } elseif (TableSort::is_image_column($data, $column)) {
+ if (TableSort::is_image_column($data, $column)) {
$type = SORT_IMAGE;
} elseif (TableSort::is_date_column($data, $column)) {
$type = SORT_DATE;
@@ -82,9 +49,6 @@ class TableSort {
}
switch ($type) {
- case SORT_CUSTOM:
- $compare_function = 'TableSort::custom_compare($el1, $el2) > 0';
- break;
case SORT_NUMERIC:
$compare_function = 'strip_tags($el1) > strip_tags($el2)';
break;
@@ -92,7 +56,7 @@ class TableSort {
$compare_function = 'api_strnatcmp(api_strtolower(strip_tags($el1,"
")),api_strtolower(strip_tags($el2,"
"))) > 0';
break;
case SORT_DATE:
- $compare_function = 'TableSort::date_compare($el1, $el2) > 0';
+ $compare_function = 'strtotime(strip_tags($el1)) > strtotime(strip_tags($el2))';
break;
case SORT_STRING:
default:
@@ -113,13 +77,14 @@ class TableSort {
* @param array $data The data to be sorted.
* @param int $column The column on which the data should be sorted (default = 0)
* @param string $direction The direction to sort (SORT_ASC (default) orSORT_DESC)
- * @param array $column_show The columns that we will show in the table i.e: $column_show=array('1','0','1') we will show the 1st and the 3th column.
- * @param array $column_order Changes how the columns will be sorted ie. $column_order=array('1','4','3','4') The 2nd column will be sorted like the 4 column
- * @param constant $type How should data be sorted (SORT_REGULAR, SORT_NUMERIC,SORT_STRING,SORT_DATE,SORT_IMAGE) *
+ * @param array $column_show The columns that we will show in the table i.e: $column_show = array('1','0','1') we will show the 1st and the 3th column.
+ * @param array $column_order Changes how the columns will be sorted ie. $column_order = array('0','3','2','3') The column [1] will be sorted like the column [3]
+ * @param constant $type How should data be sorted (SORT_REGULAR, SORT_NUMERIC, SORT_STRING, SORT_DATE, SORT_IMAGE)
* @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) {
+
if (!is_array($data) or count($data) == 0) {
return array();
}
@@ -136,17 +101,11 @@ class TableSort {
// Change columns sort
// Here we say that the real way of how the columns are going to be order is manage by the $column_order array
if (is_array($column_order)) {
- for ($i = 0; $i < count($column_order); $i++) {
- if ($column == $i + 1) {
- $column = $column_order[$i];
- }
- }
+ $column = isset($column_order[$column]) ? $column_order[$column] : $column;
}
if ($type == SORT_REGULAR) {
- if (TableSort::is_custom_sortable_column($data, $column)) {
- $type = SORT_CUSTOM;
- } elseif (TableSort::is_image_column($data, $column)) {
+ if (TableSort::is_image_column($data, $column)) {
$type = SORT_IMAGE;
} elseif (TableSort::is_date_column($data, $column)) {
$type = SORT_DATE;
@@ -158,9 +117,6 @@ class TableSort {
}
switch ($type) {
- case SORT_CUSTOM:
- $compare_function = 'TableSort::custom_compare($el1, $el2) > 0';
- break;
case SORT_NUMERIC:
$compare_function = 'strip_tags($el1) > strip_tags($el2)';
break;
@@ -168,7 +124,7 @@ class TableSort {
$compare_function = 'api_strnatcmp(api_strtolower(strip_tags($el1,"
")),api_strtolower(strip_tags($el2,"
"))) > 0';
break;
case SORT_DATE:
- $compare_function = 'TableSort::date_compare($el1, $el2) > 0';
+ $compare_function = 'strtotime(strip_tags($el1)) > strtotime(strip_tags($el2))';
break;
case SORT_STRING:
default:
@@ -231,10 +187,7 @@ class TableSort {
private function is_date_column(& $data, $column) {
$is_date = true;
foreach ($data as $index => & $row) {
- if (strpos($row[$column], '
- * @param array $data The data-array
- * @param int $column The index of the column to check
- * @return bool TRUE if the whole column contains hidden sortable values, FALSE otherwise
- * @author Ivan Tcholakov, 2010.
- */
- private function is_custom_sortable_column(& $data, $column) {
- $is_custom_sortable = true;
- foreach ($data as $index => & $row) {
- $cell = &$row[$column];
- $is_custom_sortable &= ($pos = strpos($cell, '', $pos) !== false;
- if (!$is_custom_sortable) {
- break;
- }
- }
- return $is_custom_sortable;
- }
-
- /**
- * This is a method for custom comparison, using provided hidden values.
- * Here is the format of a sortable value, hidden within a comment:
- * @param string $el1 The first element provided from the table.
- * @param string $el2 The second element provided from the table.
- * @result bool Tre comparison result.
- * @author Ivan Tcholakov, 2010.
- */
- public function custom_compare($el1, $el2) {
- $pos = strpos($el1, '', $pos) - $pos - 13));
- $pos = strpos($el2, '', $pos) - $pos - 13));
- return $el1 > $el2 ? 1 : ($el1 < $el2 ? -1 : 0);
- }
-
}
diff --git a/main/work/work.lib.php b/main/work/work.lib.php
index 473f098e09..179ea9b428 100755
--- a/main/work/work.lib.php
+++ b/main/work/work.lib.php
@@ -370,7 +370,7 @@ function display_student_publications_list($work_dir, $sub_course_dir, $currentC
if ($origin != 'learnpath') {
$table_header[] = array(get_lang('Modify'), true);
- $table_header[] = array('RealDate', false);
+ $table_header[] = array('RealDate', true);
}
// An array with the setting of the columns -> 1: columns that we will show, 0:columns that will be hide
@@ -385,26 +385,16 @@ function display_student_publications_list($work_dir, $sub_course_dir, $currentC
$column_show[] = 1; // modify
$column_show[] = 0; //real date in correct format
-
// Here we change the way how the colums are going to be sort
// in this case the the column of LastResent ( 4th element in $column_header) we will be order like the column RealDate
// because in the column RealDate we have the days in a correct format "2008-03-12 10:35:48"
- $column_order[] = 1; //type
- $column_order[] = 2; // title
-
if ($count_files != 0) {
- $column_order[] = 3; //authors
- }
-
- $column_order[] = 6; // date
-
- if ($is_allowed_to_edit) {
- $column_order[] = 5;
+ $column_order[3] = 5;
+ } else {
+ $column_order[2] = 4;
}
- $column_order[] = 6;
-
$table_data = array();
$dirs_list = get_subdirs_list($work_dir);
@@ -456,10 +446,10 @@ function display_student_publications_list($work_dir, $sub_course_dir, $currentC
$form_folder -> addGroup($group_name, 'my_group', get_lang('Title'));
$form_folder -> addGroupRule('my_group', get_lang('ThisFieldIsRequired'), 'required');
$defaults = array('my_group[dir_name]' => html_entity_decode($dir), 'description' => api_html_entity_decode($row['description']));
-
+
//$form_folder-> addElement('textarea', 'description', get_lang('Description'), array('rows' => 5, 'cols' => 50));
$form_folder->add_html_editor('description', get_lang('Description'), false, false, array('ToolbarSet' => 'profile', 'Width' => '100%', 'Height' => '200'));
-
+
$qualification_input[] = FormValidator :: createElement('text','qualification');
$form_folder -> addGroup($qualification_input, 'qualification', get_lang('QualificationNumeric'), 'size="10"');
@@ -534,7 +524,7 @@ function display_student_publications_list($work_dir, $sub_course_dir, $currentC
}
if ($there_is_a_expire_date) {
$defaults = array_merge($defaults, convert_date_to_array($homework['expires_on'], 'expires'));
- }
+ }
if (!empty($row['qualification'])) {
$defaults = array_merge($defaults, array('qualification[qualification]' => $row['qualification']));
}
@@ -694,8 +684,9 @@ function display_student_publications_list($work_dir, $sub_course_dir, $currentC
if ($direc_date != '' && $direc_date != '0000-00-00 00:00:00') {
$direc_date_local = api_get_local_time($direc_date, null, date_default_timezone_get());
- $row[] = date_to_str_ago($direc_date_local).'
'.api_format_date($direc_date_local).''.'';
+ $row[] = date_to_str_ago($direc_date_local).'
'.api_format_date($direc_date_local).'';
} else {
+ $direc_date_local = '0000-00-00 00:00:00';
$row[] = '';
}
@@ -709,6 +700,7 @@ function display_student_publications_list($work_dir, $sub_course_dir, $currentC
$row[] = '';
}
}
+ $row[] = $direc_date_local;
$table_data[] = $row;
}
}
@@ -755,7 +747,7 @@ function display_student_publications_list($work_dir, $sub_course_dir, $currentC
$row[] = display_user_link_work($row2['insert_user_id'], $work->author).$qualification_string; // $work->author;
$work_sent_date_local = api_get_local_time($work->sent_date, null, date_default_timezone_get());
- $row[] = date_to_str_ago($work_sent_date_local).$add_string.'
'.api_format_date($work_sent_date_local).''.'';
+ $row[] = date_to_str_ago($work_sent_date_local).$add_string.'
'.api_format_date($work_sent_date_local).'';
if ($is_allowed_to_edit) {
@@ -782,6 +774,7 @@ function display_student_publications_list($work_dir, $sub_course_dir, $currentC
} else {
$row[] = ' ';
}
+ $row[] = $work_sent_date_local;
$table_data[] = $row;
}
}
@@ -1136,7 +1129,7 @@ function get_parent_directories($my_cur_dir_path) {
$list_id = array();
if (!empty($my_cur_dir_path)) {
$list_parents = explode('/', $my_cur_dir_path);
- $dir_acum = '';
+ $dir_acum = '';
$work_table = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
for ($i = 0; $i < count($list_parents) - 1; $i++) {
$item = Database::escape_string($list_parents[$i]);
@@ -1431,7 +1424,7 @@ function get_list_users_without_publication($task_id) {
if (!empty($session_id)){
$sql = "SELECT user_id as id FROM $work_table WHERE parent_id='$task_id' and session_id='".$session_id."'";
-
+
} else {
$sql = "SELECT user_id as id FROM $work_table WHERE parent_id='$task_id'";
}
@@ -1446,7 +1439,7 @@ function get_list_users_without_publication($task_id) {
} else {
$sql_users = "SELECT cu.user_id, u.lastname, u.firstname, u.email FROM $table_course_user AS cu, $table_user AS u WHERE u.status!=1 and cu.course_code='".api_get_course_id()."' AND u.user_id=cu.user_id";
}
-
+
$result_users = Database::query($sql_users);
$users_without_tasks = array();
while ($row_users = Database::fetch_row($result_users)) {