@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | } |
47 | 47 | |
48 | 48 | $this->_edits = $this->_diff3($engine->diff($orig, $final1), |
49 | - $engine->diff($orig, $final2)); |
|
49 | + $engine->diff($orig, $final2)); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
@@ -58,11 +58,11 @@ discard block |
||
58 | 58 | if ($edit->isConflict()) { |
59 | 59 | /* FIXME: this should probably be moved somewhere else. */ |
60 | 60 | $lines = array_merge($lines, |
61 | - array('<<<<<<<' . ($label1 ? ' ' . $label1 : '')), |
|
62 | - $edit->final1, |
|
63 | - array("======="), |
|
64 | - $edit->final2, |
|
65 | - array('>>>>>>>' . ($label2 ? ' ' . $label2 : ''))); |
|
61 | + array('<<<<<<<' . ($label1 ? ' ' . $label1 : '')), |
|
62 | + $edit->final1, |
|
63 | + array("======="), |
|
64 | + $edit->final2, |
|
65 | + array('>>>>>>>' . ($label2 ? ' ' . $label2 : ''))); |
|
66 | 66 | $this->_conflictingBlocks++; |
67 | 67 | } else { |
68 | 68 | $lines = array_merge($lines, $edit->merged()); |
@@ -35,7 +35,7 @@ |
||
35 | 35 | |
36 | 36 | // Using the resource linker as a tool for adding resources to the learning path. |
37 | 37 | if ($action=="add" and $type=="learnpathitem") { |
38 | - $htmlHeadXtra[] = "<script language='JavaScript' type='text/javascript'> window.location=\"../resourcelinker/resourcelinker.php?source_id=5&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no\"; </script>"; |
|
38 | + $htmlHeadXtra[] = "<script language='JavaScript' type='text/javascript'> window.location=\"../resourcelinker/resourcelinker.php?source_id=5&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no\"; </script>"; |
|
39 | 39 | } |
40 | 40 | if ((!$is_allowed_to_edit) || ($isStudentView)) { |
41 | 41 | error_log('New LP - User not authorized in lp_build.php'); |
@@ -26,32 +26,32 @@ discard block |
||
26 | 26 | private $path; |
27 | 27 | private $permission = array(DRH); |
28 | 28 | |
29 | - /** |
|
30 | - * Controller |
|
31 | - */ |
|
29 | + /** |
|
30 | + * Controller |
|
31 | + */ |
|
32 | 32 | public function __construct ($user_id) |
33 | 33 | { |
34 | - $this->user_id = $user_id; |
|
35 | - $this->path = 'block_teacher_graph'; |
|
36 | - if ($this->is_block_visible_for_user($user_id)) { |
|
34 | + $this->user_id = $user_id; |
|
35 | + $this->path = 'block_teacher_graph'; |
|
36 | + if ($this->is_block_visible_for_user($user_id)) { |
|
37 | 37 | $this->teachers = UserManager::get_users_followed_by_drh($user_id, COURSEMANAGER); |
38 | - } |
|
38 | + } |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
42 | - * This method check if a user is allowed to see the block inside dashboard interface |
|
43 | - * @param int User id |
|
44 | - * @return bool Is block visible for user |
|
45 | - */ |
|
42 | + * This method check if a user is allowed to see the block inside dashboard interface |
|
43 | + * @param int User id |
|
44 | + * @return bool Is block visible for user |
|
45 | + */ |
|
46 | 46 | public function is_block_visible_for_user($user_id) |
47 | 47 | { |
48 | - $user_info = api_get_user_info($user_id); |
|
49 | - $user_status = $user_info['status']; |
|
50 | - $is_block_visible_for_user = false; |
|
51 | - if (UserManager::is_admin($user_id) || in_array($user_status, $this->permission)) { |
|
52 | - $is_block_visible_for_user = true; |
|
53 | - } |
|
54 | - return $is_block_visible_for_user; |
|
48 | + $user_info = api_get_user_info($user_id); |
|
49 | + $user_status = $user_info['status']; |
|
50 | + $is_block_visible_for_user = false; |
|
51 | + if (UserManager::is_admin($user_id) || in_array($user_status, $this->permission)) { |
|
52 | + $is_block_visible_for_user = true; |
|
53 | + } |
|
54 | + return $is_block_visible_for_user; |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
@@ -61,11 +61,11 @@ discard block |
||
61 | 61 | */ |
62 | 62 | public function get_block() |
63 | 63 | { |
64 | - global $charset; |
|
65 | - $column = 1; |
|
66 | - $data = array(); |
|
67 | - $teacher_information_graph = $this->get_teachers_information_graph(); |
|
68 | - $html = ' |
|
64 | + global $charset; |
|
65 | + $column = 1; |
|
66 | + $data = array(); |
|
67 | + $teacher_information_graph = $this->get_teachers_information_graph(); |
|
68 | + $html = ' |
|
69 | 69 | <div class="panel panel-default" id="intro"> |
70 | 70 | <div class="panel-heading">'.get_lang('TeachersInformationsGraph').' |
71 | 71 | <div class="pull-right"><a class="btn btn-danger btn-xs" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES,$charset)).'\')) return false;" href="index.php?action=disable_block&path='.$this->path.'"> |
@@ -79,53 +79,53 @@ discard block |
||
79 | 79 | </div> |
80 | 80 | '; |
81 | 81 | |
82 | - $data['column'] = $column; |
|
83 | - $data['content_html'] = $html; |
|
82 | + $data['column'] = $column; |
|
83 | + $data['content_html'] = $html; |
|
84 | 84 | |
85 | - return $data; |
|
85 | + return $data; |
|
86 | 86 | |
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
90 | - * This method return a content html, it's used inside get_block method for showing it inside dashboard interface |
|
91 | - * @return string content html |
|
92 | - */ |
|
90 | + * This method return a content html, it's used inside get_block method for showing it inside dashboard interface |
|
91 | + * @return string content html |
|
92 | + */ |
|
93 | 93 | public function get_teachers_information_graph() |
94 | 94 | { |
95 | - $teachers = $this->teachers; |
|
96 | - $graph = ''; |
|
97 | - |
|
98 | - $user_ids = array_keys($teachers); |
|
99 | - $a_last_week = get_last_week(); |
|
100 | - |
|
101 | - if (is_array($user_ids) && count($user_ids) > 0) { |
|
102 | - $dataSet = new pData; |
|
103 | - foreach ($user_ids as $user_id) { |
|
104 | - $teacher_info = api_get_user_info($user_id); |
|
105 | - $username = $teacher_info['username']; |
|
106 | - $time_by_days = array(); |
|
107 | - foreach ($a_last_week as $day) { |
|
108 | - // day is received as y-m-d 12:00:00 |
|
109 | - $start_date = api_get_utc_datetime($day); |
|
110 | - $end_date = api_get_utc_datetime($day+(3600*24-1)); |
|
111 | - |
|
112 | - $time_on_platform_by_day = Tracking::get_time_spent_on_the_platform($user_id, 'custom', $start_date, $end_date); |
|
113 | - $hours = floor($time_on_platform_by_day / 3600); |
|
114 | - $min = floor(($time_on_platform_by_day - ($hours * 3600)) / 60); |
|
115 | - $time_by_days[] = $min; |
|
116 | - } |
|
117 | - $dataSet->addPoints($time_by_days, $username); |
|
118 | - } |
|
119 | - |
|
120 | - $last_week = date('Y-m-d',$a_last_week[0]).' '.get_lang('To').' '.date('Y-m-d', $a_last_week[6]); |
|
121 | - $days_on_week = array(); |
|
122 | - foreach ($a_last_week as $weekday) { |
|
123 | - $days_on_week[] = date('d/m',$weekday); |
|
124 | - } |
|
125 | - |
|
126 | - $dataSet->addPoints($days_on_week, 'Days'); |
|
127 | - $dataSet->setAbscissaName($last_week); |
|
128 | - $dataSet->setAxisName(0, get_lang('Minutes')); |
|
95 | + $teachers = $this->teachers; |
|
96 | + $graph = ''; |
|
97 | + |
|
98 | + $user_ids = array_keys($teachers); |
|
99 | + $a_last_week = get_last_week(); |
|
100 | + |
|
101 | + if (is_array($user_ids) && count($user_ids) > 0) { |
|
102 | + $dataSet = new pData; |
|
103 | + foreach ($user_ids as $user_id) { |
|
104 | + $teacher_info = api_get_user_info($user_id); |
|
105 | + $username = $teacher_info['username']; |
|
106 | + $time_by_days = array(); |
|
107 | + foreach ($a_last_week as $day) { |
|
108 | + // day is received as y-m-d 12:00:00 |
|
109 | + $start_date = api_get_utc_datetime($day); |
|
110 | + $end_date = api_get_utc_datetime($day+(3600*24-1)); |
|
111 | + |
|
112 | + $time_on_platform_by_day = Tracking::get_time_spent_on_the_platform($user_id, 'custom', $start_date, $end_date); |
|
113 | + $hours = floor($time_on_platform_by_day / 3600); |
|
114 | + $min = floor(($time_on_platform_by_day - ($hours * 3600)) / 60); |
|
115 | + $time_by_days[] = $min; |
|
116 | + } |
|
117 | + $dataSet->addPoints($time_by_days, $username); |
|
118 | + } |
|
119 | + |
|
120 | + $last_week = date('Y-m-d',$a_last_week[0]).' '.get_lang('To').' '.date('Y-m-d', $a_last_week[6]); |
|
121 | + $days_on_week = array(); |
|
122 | + foreach ($a_last_week as $weekday) { |
|
123 | + $days_on_week[] = date('d/m',$weekday); |
|
124 | + } |
|
125 | + |
|
126 | + $dataSet->addPoints($days_on_week, 'Days'); |
|
127 | + $dataSet->setAbscissaName($last_week); |
|
128 | + $dataSet->setAxisName(0, get_lang('Minutes')); |
|
129 | 129 | $dataSet->setAbscissa('Days'); |
130 | 130 | $dataSet->loadPalette(api_get_path(SYS_CODE_PATH) . 'palettes/pchart/default.color', true); |
131 | 131 | |
@@ -194,20 +194,20 @@ discard block |
||
194 | 194 | $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash; |
195 | 195 | } |
196 | 196 | $graph = '<img src="' . $imgPath . '" >'; |
197 | - } else { |
|
198 | - $graph = '<p>'.api_convert_encoding(get_lang('GraphicNotAvailable'), 'UTF-8').'</p>'; |
|
199 | - } |
|
197 | + } else { |
|
198 | + $graph = '<p>'.api_convert_encoding(get_lang('GraphicNotAvailable'), 'UTF-8').'</p>'; |
|
199 | + } |
|
200 | 200 | |
201 | - return $graph; |
|
202 | - } |
|
201 | + return $graph; |
|
202 | + } |
|
203 | 203 | |
204 | 204 | /** |
205 | - * Get number of teachers |
|
206 | - * @return int |
|
207 | - */ |
|
208 | - function get_number_of_teachers() |
|
205 | + * Get number of teachers |
|
206 | + * @return int |
|
207 | + */ |
|
208 | + function get_number_of_teachers() |
|
209 | 209 | { |
210 | - return count($this->teachers); |
|
211 | - } |
|
210 | + return count($this->teachers); |
|
211 | + } |
|
212 | 212 | |
213 | 213 | } |
@@ -8,19 +8,19 @@ |
||
8 | 8 | die(); |
9 | 9 | require '../../inc/global.inc.php'; |
10 | 10 | if (empty($_GET['doc'])) { |
11 | - echo "To add a document name to search, add ?doc=abc to the URL"; |
|
11 | + echo "To add a document name to search, add ?doc=abc to the URL"; |
|
12 | 12 | } else { |
13 | - echo "Received param ".Security::remove_XSS($_GET['doc'])."<br />"; |
|
13 | + echo "Received param ".Security::remove_XSS($_GET['doc'])."<br />"; |
|
14 | 14 | } |
15 | 15 | $courses_list = CourseManager::get_courses_list(); |
16 | 16 | foreach ($courses_list as $course) { |
17 | - $title = Database::escape_string($_GET['doc']); |
|
18 | - $td = Database::get_course_table(TABLE_DOCUMENT); |
|
19 | - $sql = "SELECT id, path FROM $td WHERE c_id = ".$course['id']." AND path LIKE '%$title%' OR title LIKE '%$title%'"; |
|
20 | - $res = Database::query($sql); |
|
21 | - if (Database::num_rows($res)>0) { |
|
17 | + $title = Database::escape_string($_GET['doc']); |
|
18 | + $td = Database::get_course_table(TABLE_DOCUMENT); |
|
19 | + $sql = "SELECT id, path FROM $td WHERE c_id = ".$course['id']." AND path LIKE '%$title%' OR title LIKE '%$title%'"; |
|
20 | + $res = Database::query($sql); |
|
21 | + if (Database::num_rows($res)>0) { |
|
22 | 22 | while ($row = Database::fetch_array($res)) { |
23 | - echo "Found doc ".$row['id']."-> ".$row['path']." in course ".$course['code']."<br />"; |
|
23 | + echo "Found doc ".$row['id']."-> ".$row['path']." in course ".$course['code']."<br />"; |
|
24 | + } |
|
24 | 25 | } |
25 | - } |
|
26 | 26 | } |
@@ -15,16 +15,16 @@ discard block |
||
15 | 15 | class TableSort |
16 | 16 | { |
17 | 17 | /** |
18 | - * Sorts 2-dimensional table. |
|
19 | - * @param array $data The data to be sorted. |
|
20 | - * @param int $column The column on which the data should be sorted (default = 0) |
|
21 | - * @param int $direction The direction to sort (SORT_ASC (default) or SORT_DESC) |
|
22 | - * @param int $type How should data be sorted (SORT_REGULAR, SORT_NUMERIC, |
|
23 | - * SORT_STRING,SORT_DATE,SORT_IMAGE) |
|
24 | - * @return array The sorted dataset |
|
25 | - * @author [email protected] |
|
26 | - */ |
|
27 | - public static function sort_table($data, $column = 0, $direction = SORT_ASC, $type = SORT_REGULAR) |
|
18 | + * Sorts 2-dimensional table. |
|
19 | + * @param array $data The data to be sorted. |
|
20 | + * @param int $column The column on which the data should be sorted (default = 0) |
|
21 | + * @param int $direction The direction to sort (SORT_ASC (default) or SORT_DESC) |
|
22 | + * @param int $type How should data be sorted (SORT_REGULAR, SORT_NUMERIC, |
|
23 | + * SORT_STRING,SORT_DATE,SORT_IMAGE) |
|
24 | + * @return array The sorted dataset |
|
25 | + * @author [email protected] |
|
26 | + */ |
|
27 | + public static function sort_table($data, $column = 0, $direction = SORT_ASC, $type = SORT_REGULAR) |
|
28 | 28 | { |
29 | 29 | if (!is_array($data) || empty($data)) { |
30 | 30 | return array(); |
@@ -71,20 +71,20 @@ discard block |
||
71 | 71 | usort($data, create_function('$a, $b', $compare_function)); |
72 | 72 | |
73 | 73 | return $data; |
74 | - } |
|
74 | + } |
|
75 | 75 | |
76 | - /** |
|
77 | - * Sorts 2-dimensional table. It is possile changing the columns that will be shown and the way that the columns are to be sorted. |
|
78 | - * @param array $data The data to be sorted. |
|
79 | - * @param int $column The column on which the data should be sorted (default = 0) |
|
80 | - * @param string $direction The direction to sort (SORT_ASC (default) orSORT_DESC) |
|
81 | - * @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. |
|
82 | - * @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] |
|
83 | - * @param constant $type How should data be sorted (SORT_REGULAR, SORT_NUMERIC, SORT_STRING, SORT_DATE, SORT_IMAGE) |
|
84 | - * @return array The sorted dataset |
|
85 | - * @author [email protected] |
|
86 | - */ |
|
87 | - public static function sort_table_config( |
|
76 | + /** |
|
77 | + * Sorts 2-dimensional table. It is possile changing the columns that will be shown and the way that the columns are to be sorted. |
|
78 | + * @param array $data The data to be sorted. |
|
79 | + * @param int $column The column on which the data should be sorted (default = 0) |
|
80 | + * @param string $direction The direction to sort (SORT_ASC (default) orSORT_DESC) |
|
81 | + * @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. |
|
82 | + * @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] |
|
83 | + * @param constant $type How should data be sorted (SORT_REGULAR, SORT_NUMERIC, SORT_STRING, SORT_DATE, SORT_IMAGE) |
|
84 | + * @return array The sorted dataset |
|
85 | + * @author [email protected] |
|
86 | + */ |
|
87 | + public static function sort_table_config( |
|
88 | 88 | $data, |
89 | 89 | $column = 0, |
90 | 90 | $direction = SORT_ASC, |
@@ -132,9 +132,9 @@ discard block |
||
132 | 132 | if (!empty($data)) { |
133 | 133 | foreach ($data as $document) { |
134 | 134 | if ($document['type'] == 'folder') { |
135 | - $docs_to_sort[$document['id']] = api_strtolower($document['name']); |
|
135 | + $docs_to_sort[$document['id']] = api_strtolower($document['name']); |
|
136 | 136 | } else { |
137 | - $folder_to_sort[$document['id']] = api_strtolower($document['name']); |
|
137 | + $folder_to_sort[$document['id']] = api_strtolower($document['name']); |
|
138 | 138 | } |
139 | 139 | $new_data[$document['id']] = $document; |
140 | 140 | } |
@@ -196,91 +196,91 @@ discard block |
||
196 | 196 | usort($data, create_function('$a, $b', $compare_function)); |
197 | 197 | } |
198 | 198 | |
199 | - if (is_array($column_show) && !empty($column_show)) { |
|
199 | + if (is_array($column_show) && !empty($column_show)) { |
|
200 | 200 | |
201 | - // We show only the columns data that were set up on the $column_show array |
|
202 | - $new_order_data = array(); |
|
203 | - $count_data = count($data); |
|
204 | - $count_column_show = count($column_show); |
|
205 | - for ($j = 0; $j < $count_data; $j++) { |
|
206 | - $k = 0; |
|
207 | - for ($i = 0; $i < $count_column_show; $i++) { |
|
208 | - if ($column_show[$i]) { |
|
209 | - $new_order_data[$j][$k] = $data[$j][$i]; |
|
210 | - } |
|
211 | - $k++; |
|
212 | - } |
|
213 | - } |
|
214 | - // Replace the multi-arrays |
|
215 | - $data = $new_order_data; |
|
216 | - } |
|
201 | + // We show only the columns data that were set up on the $column_show array |
|
202 | + $new_order_data = array(); |
|
203 | + $count_data = count($data); |
|
204 | + $count_column_show = count($column_show); |
|
205 | + for ($j = 0; $j < $count_data; $j++) { |
|
206 | + $k = 0; |
|
207 | + for ($i = 0; $i < $count_column_show; $i++) { |
|
208 | + if ($column_show[$i]) { |
|
209 | + $new_order_data[$j][$k] = $data[$j][$i]; |
|
210 | + } |
|
211 | + $k++; |
|
212 | + } |
|
213 | + } |
|
214 | + // Replace the multi-arrays |
|
215 | + $data = $new_order_data; |
|
216 | + } |
|
217 | 217 | |
218 | - return $data; |
|
219 | - } |
|
218 | + return $data; |
|
219 | + } |
|
220 | 220 | |
221 | - /** |
|
222 | - * Checks whether a column of a 2D-array contains only numeric values |
|
223 | - * @param array $data The data-array |
|
224 | - * @param int $column The index of the column to check |
|
225 | - * @return bool TRUE if column contains only dates, FALSE otherwise |
|
226 | - * @todo Take locale into account (eg decimal point or comma ?) |
|
227 | - * @author [email protected] |
|
228 | - */ |
|
229 | - private static function is_numeric_column(& $data, $column) |
|
221 | + /** |
|
222 | + * Checks whether a column of a 2D-array contains only numeric values |
|
223 | + * @param array $data The data-array |
|
224 | + * @param int $column The index of the column to check |
|
225 | + * @return bool TRUE if column contains only dates, FALSE otherwise |
|
226 | + * @todo Take locale into account (eg decimal point or comma ?) |
|
227 | + * @author [email protected] |
|
228 | + */ |
|
229 | + private static function is_numeric_column(& $data, $column) |
|
230 | 230 | { |
231 | - $is_numeric = true; |
|
232 | - foreach ($data as $index => & $row) { |
|
233 | - $is_numeric &= is_numeric(strip_tags($row[$column])); |
|
234 | - if (!$is_numeric) { |
|
235 | - break; |
|
236 | - } |
|
237 | - } |
|
238 | - return $is_numeric; |
|
239 | - } |
|
231 | + $is_numeric = true; |
|
232 | + foreach ($data as $index => & $row) { |
|
233 | + $is_numeric &= is_numeric(strip_tags($row[$column])); |
|
234 | + if (!$is_numeric) { |
|
235 | + break; |
|
236 | + } |
|
237 | + } |
|
238 | + return $is_numeric; |
|
239 | + } |
|
240 | 240 | |
241 | - /** |
|
242 | - * Checks whether a column of a 2D-array contains only dates (GNU date syntax) |
|
243 | - * @param array $data The data-array |
|
244 | - * @param int $column The index of the column to check |
|
245 | - * @return bool TRUE if column contains only dates, FALSE otherwise |
|
246 | - * @author [email protected] |
|
247 | - */ |
|
248 | - private static function is_date_column(& $data, $column) |
|
241 | + /** |
|
242 | + * Checks whether a column of a 2D-array contains only dates (GNU date syntax) |
|
243 | + * @param array $data The data-array |
|
244 | + * @param int $column The index of the column to check |
|
245 | + * @return bool TRUE if column contains only dates, FALSE otherwise |
|
246 | + * @author [email protected] |
|
247 | + */ |
|
248 | + private static function is_date_column(& $data, $column) |
|
249 | 249 | { |
250 | - $is_date = true; |
|
251 | - foreach ($data as $index => & $row) { |
|
252 | - if (strlen(strip_tags($row[$column])) != 0) { |
|
253 | - $check_date = strtotime(strip_tags($row[$column])); |
|
254 | - // strtotime Returns a timestamp on success, FALSE otherwise. |
|
255 | - // Previous to PHP 5.1.0, this function would return -1 on failure. |
|
256 | - $is_date &= ($check_date != -1 && $check_date); |
|
257 | - } else { |
|
258 | - $is_date &= false; |
|
259 | - } |
|
260 | - if (!$is_date) { |
|
261 | - break; |
|
262 | - } |
|
263 | - } |
|
264 | - return $is_date; |
|
265 | - } |
|
250 | + $is_date = true; |
|
251 | + foreach ($data as $index => & $row) { |
|
252 | + if (strlen(strip_tags($row[$column])) != 0) { |
|
253 | + $check_date = strtotime(strip_tags($row[$column])); |
|
254 | + // strtotime Returns a timestamp on success, FALSE otherwise. |
|
255 | + // Previous to PHP 5.1.0, this function would return -1 on failure. |
|
256 | + $is_date &= ($check_date != -1 && $check_date); |
|
257 | + } else { |
|
258 | + $is_date &= false; |
|
259 | + } |
|
260 | + if (!$is_date) { |
|
261 | + break; |
|
262 | + } |
|
263 | + } |
|
264 | + return $is_date; |
|
265 | + } |
|
266 | 266 | |
267 | - /** |
|
268 | - * Checks whether a column of a 2D-array contains only images (<img src="path/file.ext" alt=".."/>) |
|
269 | - * @param array $data The data-array |
|
270 | - * @param int $column The index of the column to check |
|
271 | - * @return bool TRUE if column contains only images, FALSE otherwise |
|
272 | - * @author [email protected] |
|
273 | - */ |
|
274 | - private static function is_image_column(& $data, $column) |
|
267 | + /** |
|
268 | + * Checks whether a column of a 2D-array contains only images (<img src="path/file.ext" alt=".."/>) |
|
269 | + * @param array $data The data-array |
|
270 | + * @param int $column The index of the column to check |
|
271 | + * @return bool TRUE if column contains only images, FALSE otherwise |
|
272 | + * @author [email protected] |
|
273 | + */ |
|
274 | + private static function is_image_column(& $data, $column) |
|
275 | 275 | { |
276 | - $is_image = true; |
|
277 | - foreach ($data as $index => & $row) { |
|
278 | - $is_image &= strlen(trim(strip_tags($row[$column], '<img>'))) > 0; // at least one img-tag |
|
279 | - $is_image &= strlen(trim(strip_tags($row[$column]))) == 0; // and no text outside attribute-values |
|
280 | - if (!$is_image) { |
|
281 | - break; |
|
282 | - } |
|
283 | - } |
|
284 | - return $is_image; |
|
285 | - } |
|
276 | + $is_image = true; |
|
277 | + foreach ($data as $index => & $row) { |
|
278 | + $is_image &= strlen(trim(strip_tags($row[$column], '<img>'))) > 0; // at least one img-tag |
|
279 | + $is_image &= strlen(trim(strip_tags($row[$column]))) == 0; // and no text outside attribute-values |
|
280 | + if (!$is_image) { |
|
281 | + break; |
|
282 | + } |
|
283 | + } |
|
284 | + return $is_image; |
|
285 | + } |
|
286 | 286 | } |
@@ -205,17 +205,17 @@ discard block |
||
205 | 205 | // {{{ getStaticProperty() |
206 | 206 | |
207 | 207 | /** |
208 | - * If you have a class that's mostly/entirely static, and you need static |
|
209 | - * properties, you can use this method to simulate them. Eg. in your method(s) |
|
210 | - * do this: $myVar = &PEAR::getStaticProperty('myclass', 'myVar'); |
|
211 | - * You MUST use a reference, or they will not persist! |
|
212 | - * |
|
213 | - * @access public |
|
214 | - * @param string $class The calling classname, to prevent clashes |
|
215 | - * @param string $var The variable to retrieve. |
|
216 | - * @return mixed A reference to the variable. If not set it will be |
|
217 | - * auto initialised to NULL. |
|
218 | - */ |
|
208 | + * If you have a class that's mostly/entirely static, and you need static |
|
209 | + * properties, you can use this method to simulate them. Eg. in your method(s) |
|
210 | + * do this: $myVar = &PEAR::getStaticProperty('myclass', 'myVar'); |
|
211 | + * You MUST use a reference, or they will not persist! |
|
212 | + * |
|
213 | + * @access public |
|
214 | + * @param string $class The calling classname, to prevent clashes |
|
215 | + * @param string $var The variable to retrieve. |
|
216 | + * @return mixed A reference to the variable. If not set it will be |
|
217 | + * auto initialised to NULL. |
|
218 | + */ |
|
219 | 219 | function &getStaticProperty($class, $var) |
220 | 220 | { |
221 | 221 | static $properties; |
@@ -234,14 +234,14 @@ discard block |
||
234 | 234 | // {{{ registerShutdownFunc() |
235 | 235 | |
236 | 236 | /** |
237 | - * Use this function to register a shutdown method for static |
|
238 | - * classes. |
|
239 | - * |
|
240 | - * @access public |
|
241 | - * @param mixed $func The function name (or array of class/method) to call |
|
242 | - * @param mixed $args The arguments to pass to the function |
|
243 | - * @return void |
|
244 | - */ |
|
237 | + * Use this function to register a shutdown method for static |
|
238 | + * classes. |
|
239 | + * |
|
240 | + * @access public |
|
241 | + * @param mixed $func The function name (or array of class/method) to call |
|
242 | + * @param mixed $args The arguments to pass to the function |
|
243 | + * @return void |
|
244 | + */ |
|
245 | 245 | function registerShutdownFunc($func, $args = array()) |
246 | 246 | { |
247 | 247 | // if we are called statically, there is a potential |
@@ -513,12 +513,12 @@ discard block |
||
513 | 513 | * @since PHP 4.0.5 |
514 | 514 | */ |
515 | 515 | function &raiseError($message = null, |
516 | - $code = null, |
|
517 | - $mode = null, |
|
518 | - $options = null, |
|
519 | - $userinfo = null, |
|
520 | - $error_class = null, |
|
521 | - $skipmsg = false) |
|
516 | + $code = null, |
|
517 | + $mode = null, |
|
518 | + $options = null, |
|
519 | + $userinfo = null, |
|
520 | + $error_class = null, |
|
521 | + $skipmsg = false) |
|
522 | 522 | { |
523 | 523 | // The error is yet a PEAR error object |
524 | 524 | if (is_object($message)) { |
@@ -584,8 +584,8 @@ discard block |
||
584 | 584 | * |
585 | 585 | */ |
586 | 586 | function &throwError($message = null, |
587 | - $code = null, |
|
588 | - $userinfo = null) |
|
587 | + $code = null, |
|
588 | + $userinfo = null) |
|
589 | 589 | { |
590 | 590 | if (isset($this) && is_a($this, 'PEAR')) { |
591 | 591 | $a = &$this->raiseError($message, $code, null, null, $userinfo); |
@@ -707,12 +707,12 @@ discard block |
||
707 | 707 | // {{{ popErrorHandling() |
708 | 708 | |
709 | 709 | /** |
710 | - * Pop the last error handler used |
|
711 | - * |
|
712 | - * @return bool Always true |
|
713 | - * |
|
714 | - * @see PEAR::pushErrorHandling |
|
715 | - */ |
|
710 | + * Pop the last error handler used |
|
711 | + * |
|
712 | + * @return bool Always true |
|
713 | + * |
|
714 | + * @see PEAR::pushErrorHandling |
|
715 | + */ |
|
716 | 716 | function popErrorHandling() |
717 | 717 | { |
718 | 718 | $stack = &$GLOBALS['_PEAR_error_handler_stack']; |
@@ -731,12 +731,12 @@ discard block |
||
731 | 731 | // {{{ loadExtension() |
732 | 732 | |
733 | 733 | /** |
734 | - * OS independant PHP extension load. Remember to take care |
|
735 | - * on the correct extension name for case sensitive OSes. |
|
736 | - * |
|
737 | - * @param string $ext The extension name |
|
738 | - * @return bool Success or not on the dl() call |
|
739 | - */ |
|
734 | + * OS independant PHP extension load. Remember to take care |
|
735 | + * on the correct extension name for case sensitive OSes. |
|
736 | + * |
|
737 | + * @param string $ext The extension name |
|
738 | + * @return bool Success or not on the dl() call |
|
739 | + */ |
|
740 | 740 | function loadExtension($ext) |
741 | 741 | { |
742 | 742 | if (!extension_loaded($ext)) { |
@@ -999,10 +999,10 @@ discard block |
||
999 | 999 | * @return int error code |
1000 | 1000 | * @access public |
1001 | 1001 | */ |
1002 | - function getCode() |
|
1003 | - { |
|
1002 | + function getCode() |
|
1003 | + { |
|
1004 | 1004 | return $this->code; |
1005 | - } |
|
1005 | + } |
|
1006 | 1006 | |
1007 | 1007 | // }}} |
1008 | 1008 | // {{{ getType() |
@@ -1110,10 +1110,10 @@ discard block |
||
1110 | 1110 | $callback = $this->callback; |
1111 | 1111 | } |
1112 | 1112 | return sprintf('[%s: message="%s" code=%d mode=callback '. |
1113 | - 'callback=%s prefix="%s" info="%s"]', |
|
1114 | - strtolower(get_class($this)), $this->message, $this->code, |
|
1115 | - $callback, $this->error_message_prefix, |
|
1116 | - $this->userinfo); |
|
1113 | + 'callback=%s prefix="%s" info="%s"]', |
|
1114 | + strtolower(get_class($this)), $this->message, $this->code, |
|
1115 | + $callback, $this->error_message_prefix, |
|
1116 | + $this->userinfo); |
|
1117 | 1117 | } |
1118 | 1118 | if ($this->mode & PEAR_ERROR_PRINT) { |
1119 | 1119 | $modes[] = 'print'; |
@@ -1128,11 +1128,11 @@ discard block |
||
1128 | 1128 | $modes[] = 'return'; |
1129 | 1129 | } |
1130 | 1130 | return sprintf('[%s: message="%s" code=%d mode=%s level=%s '. |
1131 | - 'prefix="%s" info="%s"]', |
|
1132 | - strtolower(get_class($this)), $this->message, $this->code, |
|
1133 | - implode("|", $modes), $levels[$this->level], |
|
1134 | - $this->error_message_prefix, |
|
1135 | - $this->userinfo); |
|
1131 | + 'prefix="%s" info="%s"]', |
|
1132 | + strtolower(get_class($this)), $this->message, $this->code, |
|
1133 | + implode("|", $modes), $levels[$this->level], |
|
1134 | + $this->error_message_prefix, |
|
1135 | + $this->userinfo); |
|
1136 | 1136 | } |
1137 | 1137 | |
1138 | 1138 | // }}} |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | //sentArray keeps list of all files still available in the sent files list |
222 | 222 | //of the user. |
223 | 223 | //This is used to show or hide the overwrite file-radio button of the upload form |
224 | - $javascript .= " |
|
224 | + $javascript .= " |
|
225 | 225 | var sentArray = new Array("; |
226 | 226 | if (isset($dropbox_person)) { |
227 | 227 | for ($i = 0; $i < count($dropbox_person->sentWork); $i++) { |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | $javascript .= "'".$dropbox_person->sentWork[$i]->title."'"; |
232 | 232 | } |
233 | 233 | } |
234 | - $javascript .= "); |
|
234 | + $javascript .= "); |
|
235 | 235 | |
236 | 236 | function checkfile(str) |
237 | 237 | { |
@@ -296,12 +296,12 @@ discard block |
||
296 | 296 | |
297 | 297 | $checked_files = false; |
298 | 298 | if (!$view || $view == 'received') { |
299 | - $part = 'received'; |
|
299 | + $part = 'received'; |
|
300 | 300 | } elseif ($view = 'sent') { |
301 | - $part = 'sent'; |
|
301 | + $part = 'sent'; |
|
302 | 302 | } else { |
303 | - header('location: index.php?view='.$view.'&error=Error'); |
|
304 | - exit; |
|
303 | + header('location: index.php?view='.$view.'&error=Error'); |
|
304 | + exit; |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | if (($postAction == 'download_received' || $postAction == 'download_sent') and !$_POST['store_feedback']) { |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | } else { |
326 | 326 | api_not_allowed(); |
327 | 327 | } |
328 | - exit(); |
|
328 | + exit(); |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | /* BREADCRUMBS */ |
@@ -335,45 +335,45 @@ discard block |
||
335 | 335 | 'url' => api_get_path(WEB_CODE_PATH).'dropbox/index.php?'.api_get_cidreq(), |
336 | 336 | 'name' => get_lang('Dropbox', ''), |
337 | 337 | ); |
338 | - $nameTools = get_lang('ReceivedFiles'); |
|
338 | + $nameTools = get_lang('ReceivedFiles'); |
|
339 | 339 | |
340 | - if ($action == 'addreceivedcategory') { |
|
340 | + if ($action == 'addreceivedcategory') { |
|
341 | 341 | $interbreadcrumb[] = array( |
342 | 342 | 'url' => api_get_path(WEB_CODE_PATH).'dropbox/index.php?view=received&'.api_get_cidreq(), |
343 | 343 | 'name' => get_lang('ReceivedFiles'), |
344 | 344 | ); |
345 | - $nameTools = get_lang('AddNewCategory'); |
|
346 | - } |
|
345 | + $nameTools = get_lang('AddNewCategory'); |
|
346 | + } |
|
347 | 347 | } |
348 | 348 | |
349 | 349 | if ($view == 'sent' || empty($view)) { |
350 | 350 | $interbreadcrumb[] = array( |
351 | 351 | 'url' => api_get_path(WEB_CODE_PATH).'dropbox/index.php?'.api_get_cidreq(), |
352 | - 'name' => get_lang('Dropbox') |
|
352 | + 'name' => get_lang('Dropbox') |
|
353 | 353 | ); |
354 | - $nameTools = get_lang('SentFiles'); |
|
355 | - |
|
356 | - if ($action == 'addsentcategory') { |
|
357 | - $interbreadcrumb[] = array( |
|
358 | - 'url' => api_get_path(WEB_CODE_PATH).'dropbox/index.php?view=sent&'.api_get_cidreq(), |
|
359 | - 'name' => get_lang('SentFiles'), |
|
360 | - ); |
|
361 | - $nameTools = get_lang('AddNewCategory'); |
|
362 | - } |
|
363 | - if ($action == 'add') { |
|
364 | - $interbreadcrumb[] = array( |
|
365 | - 'url' => api_get_path(WEB_CODE_PATH).'dropbox/index.php?view=sent&'.api_get_cidreq(), |
|
366 | - 'name' => get_lang('SentFiles'), |
|
367 | - ); |
|
368 | - $nameTools = get_lang('UploadNewFile'); |
|
369 | - } |
|
354 | + $nameTools = get_lang('SentFiles'); |
|
355 | + |
|
356 | + if ($action == 'addsentcategory') { |
|
357 | + $interbreadcrumb[] = array( |
|
358 | + 'url' => api_get_path(WEB_CODE_PATH).'dropbox/index.php?view=sent&'.api_get_cidreq(), |
|
359 | + 'name' => get_lang('SentFiles'), |
|
360 | + ); |
|
361 | + $nameTools = get_lang('AddNewCategory'); |
|
362 | + } |
|
363 | + if ($action == 'add') { |
|
364 | + $interbreadcrumb[] = array( |
|
365 | + 'url' => api_get_path(WEB_CODE_PATH).'dropbox/index.php?view=sent&'.api_get_cidreq(), |
|
366 | + 'name' => get_lang('SentFiles'), |
|
367 | + ); |
|
368 | + $nameTools = get_lang('UploadNewFile'); |
|
369 | + } |
|
370 | 370 | } |
371 | 371 | |
372 | 372 | /* HEADER & TITLE */ |
373 | 373 | |
374 | 374 | if (isset($origin) && $origin == 'learnpath') { |
375 | 375 | $htmlHeadXtra[] = $javascript; |
376 | - Display::display_reduced_header($nameTools, 'Dropbox'); |
|
376 | + Display::display_reduced_header($nameTools, 'Dropbox'); |
|
377 | 377 | } else { |
378 | 378 | Display::display_header($nameTools, 'Dropbox'); |
379 | 379 | } |
@@ -7,12 +7,12 @@ discard block |
||
7 | 7 | $last_access = ''; |
8 | 8 | // get the last time the user accessed the tool |
9 | 9 | if (isset($_SESSION[$_course['id']]) && $_SESSION[$_course['id']]['last_access'][TOOL_DROPBOX] == '') { |
10 | - $last_access = get_last_tool_access(TOOL_DROPBOX); |
|
11 | - $_SESSION[$_course['id']]['last_access'][TOOL_DROPBOX] = $last_access; |
|
10 | + $last_access = get_last_tool_access(TOOL_DROPBOX); |
|
11 | + $_SESSION[$_course['id']]['last_access'][TOOL_DROPBOX] = $last_access; |
|
12 | 12 | } else { |
13 | - if (isset($_SESSION[$_course['id']])) { |
|
14 | - $last_access = $_SESSION[$_course['id']]['last_access'][TOOL_DROPBOX]; |
|
15 | - } |
|
13 | + if (isset($_SESSION[$_course['id']])) { |
|
14 | + $last_access = $_SESSION[$_course['id']]['last_access'][TOOL_DROPBOX]; |
|
15 | + } |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | $postAction = isset($_POST['action']) ? $_POST['action'] : null; |
@@ -49,9 +49,9 @@ discard block |
||
49 | 49 | |
50 | 50 | // Display the form for adding a new dropbox item. |
51 | 51 | if ($action == 'add') { |
52 | - if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
53 | - api_not_allowed(); |
|
54 | - } |
|
52 | + if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
53 | + api_not_allowed(); |
|
54 | + } |
|
55 | 55 | display_add_form( |
56 | 56 | $dropbox_unid, |
57 | 57 | $viewReceivedCategory, |
@@ -61,59 +61,59 @@ discard block |
||
61 | 61 | } |
62 | 62 | |
63 | 63 | if (isset($_POST['submitWork'])) { |
64 | - $check = Security::check_token(); |
|
65 | - if ($check) { |
|
64 | + $check = Security::check_token(); |
|
65 | + if ($check) { |
|
66 | 66 | $message = store_add_dropbox(); |
67 | 67 | if (!empty($message)) { |
68 | 68 | Display :: display_confirmation_message($message); |
69 | 69 | } |
70 | - } |
|
70 | + } |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | // Display the form for adding a category |
74 | 74 | if ($action == 'addreceivedcategory' || $action == 'addsentcategory') { |
75 | - if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
76 | - api_not_allowed(); |
|
77 | - } |
|
78 | - $categoryName = isset($_POST['category_name']) ? $_POST['category_name'] : ''; |
|
79 | - display_addcategory_form($categoryName, '', $_GET['action']); |
|
75 | + if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
76 | + api_not_allowed(); |
|
77 | + } |
|
78 | + $categoryName = isset($_POST['category_name']) ? $_POST['category_name'] : ''; |
|
79 | + display_addcategory_form($categoryName, '', $_GET['action']); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | // Editing a category: displaying the form |
83 | 83 | if ($action == 'editcategory' && isset($_GET['id'])) { |
84 | - if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
85 | - api_not_allowed(); |
|
86 | - } |
|
87 | - if (!$_POST) { |
|
88 | - if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
89 | - api_not_allowed(); |
|
90 | - } |
|
91 | - display_addcategory_form('', $_GET['id'], 'editcategory'); |
|
92 | - } |
|
84 | + if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
85 | + api_not_allowed(); |
|
86 | + } |
|
87 | + if (!$_POST) { |
|
88 | + if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
89 | + api_not_allowed(); |
|
90 | + } |
|
91 | + display_addcategory_form('', $_GET['id'], 'editcategory'); |
|
92 | + } |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | // Storing a new or edited category |
96 | 96 | if (isset($_POST['StoreCategory'])) { |
97 | - if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
98 | - api_not_allowed(); |
|
99 | - } |
|
100 | - $return_information = store_addcategory(); |
|
101 | - if ($return_information['type'] == 'confirmation') { |
|
102 | - Display :: display_confirmation_message($return_information['message']); |
|
103 | - } |
|
104 | - if ($return_information['type'] == 'error') { |
|
105 | - Display :: display_error_message(get_lang('FormHasErrorsPleaseComplete').'<br />'.$return_information['message']); |
|
106 | - display_addcategory_form($_POST['category_name'], $_POST['edit_id'], $postAction); |
|
107 | - } |
|
97 | + if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
98 | + api_not_allowed(); |
|
99 | + } |
|
100 | + $return_information = store_addcategory(); |
|
101 | + if ($return_information['type'] == 'confirmation') { |
|
102 | + Display :: display_confirmation_message($return_information['message']); |
|
103 | + } |
|
104 | + if ($return_information['type'] == 'error') { |
|
105 | + Display :: display_error_message(get_lang('FormHasErrorsPleaseComplete').'<br />'.$return_information['message']); |
|
106 | + display_addcategory_form($_POST['category_name'], $_POST['edit_id'], $postAction); |
|
107 | + } |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | |
111 | 111 | // Move a File |
112 | 112 | if (($action == 'movesent' || $action == 'movereceived') AND isset($_GET['move_id'])) { |
113 | - if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
114 | - api_not_allowed(); |
|
115 | - } |
|
116 | - display_move_form( |
|
113 | + if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
114 | + api_not_allowed(); |
|
115 | + } |
|
116 | + display_move_form( |
|
117 | 117 | str_replace('move', '', $action), |
118 | 118 | $_GET['move_id'], |
119 | 119 | get_dropbox_categories(str_replace('move', '', $action)), |
@@ -124,33 +124,33 @@ discard block |
||
124 | 124 | ); |
125 | 125 | } |
126 | 126 | if (isset($_POST['do_move'])) { |
127 | - Display :: display_confirmation_message(store_move($_POST['id'], $_POST['move_target'], $_POST['part'])); |
|
127 | + Display :: display_confirmation_message(store_move($_POST['id'], $_POST['move_target'], $_POST['part'])); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | // Delete a file |
131 | 131 | if (($action == 'deletereceivedfile' || $action == 'deletesentfile') AND isset($_GET['id']) AND is_numeric($_GET['id'])) { |
132 | - if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
133 | - api_not_allowed(); |
|
134 | - } |
|
135 | - $dropboxfile = new Dropbox_Person(api_get_user_id(), $is_courseAdmin, $is_courseTutor); |
|
136 | - if ($action == 'deletereceivedfile') { |
|
137 | - $dropboxfile->deleteReceivedWork($_GET['id']); |
|
138 | - $message = get_lang('ReceivedFileDeleted'); |
|
139 | - } |
|
140 | - if ($action == 'deletesentfile') { |
|
141 | - $dropboxfile->deleteSentWork($_GET['id']); |
|
142 | - $message = get_lang('SentFileDeleted'); |
|
143 | - } |
|
144 | - Display :: display_confirmation_message($message); |
|
132 | + if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
133 | + api_not_allowed(); |
|
134 | + } |
|
135 | + $dropboxfile = new Dropbox_Person(api_get_user_id(), $is_courseAdmin, $is_courseTutor); |
|
136 | + if ($action == 'deletereceivedfile') { |
|
137 | + $dropboxfile->deleteReceivedWork($_GET['id']); |
|
138 | + $message = get_lang('ReceivedFileDeleted'); |
|
139 | + } |
|
140 | + if ($action == 'deletesentfile') { |
|
141 | + $dropboxfile->deleteSentWork($_GET['id']); |
|
142 | + $message = get_lang('SentFileDeleted'); |
|
143 | + } |
|
144 | + Display :: display_confirmation_message($message); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | // Delete a category |
148 | 148 | if (($action == 'deletereceivedcategory' || $action == 'deletesentcategory') AND isset($_GET['id']) AND is_numeric($_GET['id'])) { |
149 | - if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
150 | - api_not_allowed(); |
|
151 | - } |
|
152 | - $message = delete_category($action, $_GET['id']); |
|
153 | - Display :: display_confirmation_message($message); |
|
149 | + if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
150 | + api_not_allowed(); |
|
151 | + } |
|
152 | + $message = delete_category($action, $_GET['id']); |
|
153 | + Display :: display_confirmation_message($message); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | // Do an action on multiple files |
@@ -165,27 +165,27 @@ discard block |
||
165 | 165 | $postAction == 'delete_sent' || |
166 | 166 | $postAction == 'download_sent') |
167 | 167 | ) { |
168 | - $display_message = handle_multiple_actions(); |
|
169 | - Display :: display_normal_message($display_message); |
|
168 | + $display_message = handle_multiple_actions(); |
|
169 | + Display :: display_normal_message($display_message); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | // Store Feedback |
173 | 173 | |
174 | 174 | if (isset($_POST['feedback'])) { |
175 | - if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
176 | - api_not_allowed(); |
|
177 | - } |
|
178 | - $check = Security::check_token(); |
|
179 | - if ($check) { |
|
180 | - $display_message = store_feedback(); |
|
181 | - Display :: display_normal_message($display_message); |
|
182 | - Security::check_token(); |
|
183 | - } |
|
175 | + if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
176 | + api_not_allowed(); |
|
177 | + } |
|
178 | + $check = Security::check_token(); |
|
179 | + if ($check) { |
|
180 | + $display_message = store_feedback(); |
|
181 | + Display :: display_normal_message($display_message); |
|
182 | + Security::check_token(); |
|
183 | + } |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | // Error Message |
187 | 187 | if (isset($_GET['error']) AND !empty($_GET['error'])) { |
188 | - Display :: display_normal_message(get_lang($_GET['error'])); |
|
188 | + Display :: display_normal_message(get_lang($_GET['error'])); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | $dropbox_data_sent = array(); |
@@ -193,96 +193,96 @@ discard block |
||
193 | 193 | $dropbox_data_recieved = array(); |
194 | 194 | |
195 | 195 | if ($action != 'add') { |
196 | - // Getting all the categories in the dropbox for the given user |
|
197 | - $dropbox_categories = get_dropbox_categories(); |
|
198 | - // Greating the arrays with the categories for the received files and for the sent files |
|
199 | - foreach ($dropbox_categories as $category) { |
|
200 | - if ($category['received'] == '1') { |
|
201 | - $dropbox_received_category[] = $category; |
|
202 | - } |
|
203 | - if ($category['sent'] == '1') { |
|
204 | - $dropbox_sent_category[] = $category; |
|
205 | - } |
|
206 | - } |
|
207 | - |
|
208 | - // ACTIONS |
|
209 | - if ($view == 'received' || !$dropbox_cnf['sent_received_tabs']) { |
|
210 | - //echo '<h3>'.get_lang('ReceivedFiles').'</h3>'; |
|
211 | - |
|
212 | - // This is for the categories |
|
213 | - if (isset($viewReceivedCategory) AND $viewReceivedCategory != '') { |
|
214 | - $view_dropbox_category_received = $viewReceivedCategory; |
|
215 | - } else { |
|
216 | - $view_dropbox_category_received = 0; |
|
217 | - } |
|
218 | - |
|
219 | - /* Menu Received */ |
|
220 | - |
|
221 | - if (api_get_session_id() == 0) { |
|
222 | - echo '<div class="actions">'; |
|
223 | - if ($view_dropbox_category_received != 0 && api_is_allowed_to_session_edit(false, true)) { |
|
224 | - echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category=0&view_sent_category='.$viewSentCategory.'&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
225 | - echo get_lang('Category').': <strong>'.Security::remove_XSS($dropbox_categories[$view_dropbox_category_received]['cat_name']).'</strong> '; |
|
226 | - $movelist[0] = 'Root'; // move_received selectbox content |
|
227 | - } else { |
|
228 | - echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=addreceivedcategory&view='.$view.'">'.Display::return_icon('new_folder.png', get_lang('AddNewCategory'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
229 | - } |
|
230 | - echo '</div>'; |
|
231 | - } else { |
|
232 | - if (api_is_allowed_to_session_edit(false, true)) { |
|
233 | - echo '<div class="actions">'; |
|
234 | - if ($view_dropbox_category_received != 0 && api_is_allowed_to_session_edit(false, true)) { |
|
235 | - echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category=0&view_sent_category='.$viewSentCategory.'&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
236 | - echo get_lang('Category').': <strong>'.Security::remove_XSS($dropbox_categories[$view_dropbox_category_received]['cat_name']).'</strong> '; |
|
237 | - $movelist[0] = 'Root'; // move_received selectbox content |
|
238 | - } else { |
|
239 | - echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=addreceivedcategory&view='.$view.'">'.Display::return_icon('new_folder.png', get_lang('AddNewCategory'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
240 | - } |
|
241 | - echo '</div>'; |
|
242 | - } |
|
243 | - } |
|
244 | - } |
|
245 | - |
|
246 | - if (!$view || $view == 'sent' || !$dropbox_cnf['sent_received_tabs']) { |
|
247 | - // This is for the categories |
|
248 | - if (isset($viewSentCategory) AND $viewSentCategory != '') { |
|
249 | - $view_dropbox_category_sent = $viewSentCategory; |
|
250 | - } else { |
|
251 | - $view_dropbox_category_sent = 0; |
|
252 | - } |
|
253 | - |
|
254 | - /* Menu Sent */ |
|
255 | - |
|
256 | - if (api_get_session_id() == 0) { |
|
257 | - echo '<div class="actions">'; |
|
258 | - if ($view_dropbox_category_sent != 0) { |
|
259 | - echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category=0&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
260 | - echo get_lang('Category').': <strong>'.Security::remove_XSS($dropbox_categories[$view_dropbox_category_sent]['cat_name']).'</strong> '; |
|
261 | - } else { |
|
262 | - echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=addsentcategory\">".Display::return_icon('new_folder.png', get_lang('AddNewCategory'),'',ICON_SIZE_MEDIUM)."</a>\n"; |
|
263 | - } |
|
264 | - if (empty($viewSentCategory)) { |
|
265 | - echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=add\">".Display::return_icon('upload_file.png', get_lang('UploadNewFile'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
266 | - } |
|
267 | - echo '</div>'; |
|
268 | - } else { |
|
269 | - if (api_is_allowed_to_session_edit(false, true)) { |
|
270 | - echo '<div class="actions">'; |
|
271 | - if ($view_dropbox_category_sent != 0) { |
|
272 | - echo get_lang('CurrentlySeeing').': <strong>'.Security::remove_XSS($dropbox_categories[$view_dropbox_category_sent]['cat_name']).'</strong> '; |
|
273 | - echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category=0&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
274 | - } else { |
|
275 | - echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=addsentcategory\">".Display::return_icon('new_folder.png', get_lang('AddNewCategory'),'',ICON_SIZE_MEDIUM)."</a>\n"; |
|
276 | - } |
|
277 | - if (empty($viewSentCategory)) { |
|
278 | - echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=add\">".Display::return_icon('upload_file.png', get_lang('UploadNewFile'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
279 | - } |
|
280 | - echo '</div>'; |
|
281 | - } |
|
282 | - } |
|
283 | - } |
|
284 | - /* THE MENU TABS */ |
|
285 | - if ($dropbox_cnf['sent_received_tabs']) { |
|
196 | + // Getting all the categories in the dropbox for the given user |
|
197 | + $dropbox_categories = get_dropbox_categories(); |
|
198 | + // Greating the arrays with the categories for the received files and for the sent files |
|
199 | + foreach ($dropbox_categories as $category) { |
|
200 | + if ($category['received'] == '1') { |
|
201 | + $dropbox_received_category[] = $category; |
|
202 | + } |
|
203 | + if ($category['sent'] == '1') { |
|
204 | + $dropbox_sent_category[] = $category; |
|
205 | + } |
|
206 | + } |
|
207 | + |
|
208 | + // ACTIONS |
|
209 | + if ($view == 'received' || !$dropbox_cnf['sent_received_tabs']) { |
|
210 | + //echo '<h3>'.get_lang('ReceivedFiles').'</h3>'; |
|
211 | + |
|
212 | + // This is for the categories |
|
213 | + if (isset($viewReceivedCategory) AND $viewReceivedCategory != '') { |
|
214 | + $view_dropbox_category_received = $viewReceivedCategory; |
|
215 | + } else { |
|
216 | + $view_dropbox_category_received = 0; |
|
217 | + } |
|
218 | + |
|
219 | + /* Menu Received */ |
|
220 | + |
|
221 | + if (api_get_session_id() == 0) { |
|
222 | + echo '<div class="actions">'; |
|
223 | + if ($view_dropbox_category_received != 0 && api_is_allowed_to_session_edit(false, true)) { |
|
224 | + echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category=0&view_sent_category='.$viewSentCategory.'&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
225 | + echo get_lang('Category').': <strong>'.Security::remove_XSS($dropbox_categories[$view_dropbox_category_received]['cat_name']).'</strong> '; |
|
226 | + $movelist[0] = 'Root'; // move_received selectbox content |
|
227 | + } else { |
|
228 | + echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=addreceivedcategory&view='.$view.'">'.Display::return_icon('new_folder.png', get_lang('AddNewCategory'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
229 | + } |
|
230 | + echo '</div>'; |
|
231 | + } else { |
|
232 | + if (api_is_allowed_to_session_edit(false, true)) { |
|
233 | + echo '<div class="actions">'; |
|
234 | + if ($view_dropbox_category_received != 0 && api_is_allowed_to_session_edit(false, true)) { |
|
235 | + echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category=0&view_sent_category='.$viewSentCategory.'&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
236 | + echo get_lang('Category').': <strong>'.Security::remove_XSS($dropbox_categories[$view_dropbox_category_received]['cat_name']).'</strong> '; |
|
237 | + $movelist[0] = 'Root'; // move_received selectbox content |
|
238 | + } else { |
|
239 | + echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=addreceivedcategory&view='.$view.'">'.Display::return_icon('new_folder.png', get_lang('AddNewCategory'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
240 | + } |
|
241 | + echo '</div>'; |
|
242 | + } |
|
243 | + } |
|
244 | + } |
|
245 | + |
|
246 | + if (!$view || $view == 'sent' || !$dropbox_cnf['sent_received_tabs']) { |
|
247 | + // This is for the categories |
|
248 | + if (isset($viewSentCategory) AND $viewSentCategory != '') { |
|
249 | + $view_dropbox_category_sent = $viewSentCategory; |
|
250 | + } else { |
|
251 | + $view_dropbox_category_sent = 0; |
|
252 | + } |
|
253 | + |
|
254 | + /* Menu Sent */ |
|
255 | + |
|
256 | + if (api_get_session_id() == 0) { |
|
257 | + echo '<div class="actions">'; |
|
258 | + if ($view_dropbox_category_sent != 0) { |
|
259 | + echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category=0&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
260 | + echo get_lang('Category').': <strong>'.Security::remove_XSS($dropbox_categories[$view_dropbox_category_sent]['cat_name']).'</strong> '; |
|
261 | + } else { |
|
262 | + echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=addsentcategory\">".Display::return_icon('new_folder.png', get_lang('AddNewCategory'),'',ICON_SIZE_MEDIUM)."</a>\n"; |
|
263 | + } |
|
264 | + if (empty($viewSentCategory)) { |
|
265 | + echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=add\">".Display::return_icon('upload_file.png', get_lang('UploadNewFile'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
266 | + } |
|
267 | + echo '</div>'; |
|
268 | + } else { |
|
269 | + if (api_is_allowed_to_session_edit(false, true)) { |
|
270 | + echo '<div class="actions">'; |
|
271 | + if ($view_dropbox_category_sent != 0) { |
|
272 | + echo get_lang('CurrentlySeeing').': <strong>'.Security::remove_XSS($dropbox_categories[$view_dropbox_category_sent]['cat_name']).'</strong> '; |
|
273 | + echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category=0&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
274 | + } else { |
|
275 | + echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=addsentcategory\">".Display::return_icon('new_folder.png', get_lang('AddNewCategory'),'',ICON_SIZE_MEDIUM)."</a>\n"; |
|
276 | + } |
|
277 | + if (empty($viewSentCategory)) { |
|
278 | + echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=add\">".Display::return_icon('upload_file.png', get_lang('UploadNewFile'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
279 | + } |
|
280 | + echo '</div>'; |
|
281 | + } |
|
282 | + } |
|
283 | + } |
|
284 | + /* THE MENU TABS */ |
|
285 | + if ($dropbox_cnf['sent_received_tabs']) { |
|
286 | 286 | ?> |
287 | 287 | <ul class="nav nav-tabs"> |
288 | 288 | <li <?php if (!$view || $view == 'sent') { echo 'class="active"'; } ?> > |
@@ -296,150 +296,150 @@ discard block |
||
296 | 296 | </li> |
297 | 297 | </ul> |
298 | 298 | <?php |
299 | - } |
|
299 | + } |
|
300 | 300 | /* RECEIVED FILES */ |
301 | - if ($view == 'received' || !$dropbox_cnf['sent_received_tabs']) { |
|
302 | - // This is for the categories |
|
303 | - if (isset($viewReceivedCategory) AND $viewReceivedCategory != '') { |
|
304 | - $view_dropbox_category_received = $viewReceivedCategory; |
|
305 | - } else { |
|
306 | - $view_dropbox_category_received = 0; |
|
307 | - } |
|
308 | - |
|
309 | - // Object initialisation |
|
310 | - $dropbox_person = new Dropbox_Person(api_get_user_id(), $is_courseAdmin, $is_courseTutor); |
|
311 | - // note: are the $is_courseAdmin and $is_courseTutor parameters needed???? |
|
312 | - |
|
313 | - // Constructing the array that contains the total number of feedback messages per document. |
|
314 | - $number_feedback = get_total_number_feedback(); |
|
315 | - |
|
316 | - // Sorting and paging options |
|
317 | - $sorting_options = array(); |
|
318 | - $paging_options = array(); |
|
319 | - |
|
320 | - // The headers of the sortable tables |
|
321 | - $column_header = array(); |
|
322 | - $column_header[] = array('', false, ''); |
|
323 | - $column_header[] = array(get_lang('Type'), true, 'style="width:40px"', 'style="text-align:center"'); |
|
324 | - $column_header[] = array(get_lang('ReceivedTitle'), true, ''); |
|
325 | - $column_header[] = array(get_lang('Size'), true, ''); |
|
326 | - $column_header[] = array(get_lang('Authors'), true, ''); |
|
327 | - $column_header[] = array(get_lang('LastResent'), true); |
|
328 | - |
|
329 | - if (api_get_session_id() == 0) { |
|
330 | - $column_header[] = array(get_lang('Modify'), false, '', 'nowrap style="text-align: right"'); |
|
331 | - } elseif (api_is_allowed_to_session_edit(false,true)) { |
|
332 | - $column_header[] = array(get_lang('Modify'), false, '', 'nowrap style="text-align: right"'); |
|
333 | - } |
|
334 | - |
|
335 | - $column_header[] = array('RealDate', true); |
|
336 | - $column_header[] = array('RealSize', true); |
|
337 | - |
|
338 | - // An array with the setting of the columns -> 1: columns that we will show, 0:columns that will be hide |
|
339 | - $column_show[] = 1; |
|
340 | - $column_show[] = 1; |
|
341 | - $column_show[] = 1; |
|
342 | - $column_show[] = 1; |
|
343 | - $column_show[] = 1; |
|
344 | - $column_show[] = 1; |
|
345 | - |
|
346 | - if (api_get_session_id() == 0) { |
|
347 | - $column_show[] = 1; |
|
348 | - } elseif (api_is_allowed_to_session_edit(false, true)) { |
|
349 | - $column_show[] = 1; |
|
350 | - } |
|
351 | - $column_show[] = 0; |
|
352 | - |
|
353 | - // Here we change the way how the columns are going to be sort |
|
354 | - // in this case the the column of LastResent ( 4th element in $column_header) we will be order like the column RealDate |
|
355 | - // because in the column RealDate we have the days in a correct format "2008-03-12 10:35:48" |
|
356 | - |
|
357 | - $column_order[3] = 8; |
|
358 | - $column_order[5] = 7; |
|
359 | - |
|
360 | - // The content of the sortable table = the received files |
|
361 | - foreach ($dropbox_person -> receivedWork as $dropbox_file) { |
|
362 | - $dropbox_file_data = array(); |
|
363 | - if ($view_dropbox_category_received == $dropbox_file->category) { |
|
301 | + if ($view == 'received' || !$dropbox_cnf['sent_received_tabs']) { |
|
302 | + // This is for the categories |
|
303 | + if (isset($viewReceivedCategory) AND $viewReceivedCategory != '') { |
|
304 | + $view_dropbox_category_received = $viewReceivedCategory; |
|
305 | + } else { |
|
306 | + $view_dropbox_category_received = 0; |
|
307 | + } |
|
308 | + |
|
309 | + // Object initialisation |
|
310 | + $dropbox_person = new Dropbox_Person(api_get_user_id(), $is_courseAdmin, $is_courseTutor); |
|
311 | + // note: are the $is_courseAdmin and $is_courseTutor parameters needed???? |
|
312 | + |
|
313 | + // Constructing the array that contains the total number of feedback messages per document. |
|
314 | + $number_feedback = get_total_number_feedback(); |
|
315 | + |
|
316 | + // Sorting and paging options |
|
317 | + $sorting_options = array(); |
|
318 | + $paging_options = array(); |
|
319 | + |
|
320 | + // The headers of the sortable tables |
|
321 | + $column_header = array(); |
|
322 | + $column_header[] = array('', false, ''); |
|
323 | + $column_header[] = array(get_lang('Type'), true, 'style="width:40px"', 'style="text-align:center"'); |
|
324 | + $column_header[] = array(get_lang('ReceivedTitle'), true, ''); |
|
325 | + $column_header[] = array(get_lang('Size'), true, ''); |
|
326 | + $column_header[] = array(get_lang('Authors'), true, ''); |
|
327 | + $column_header[] = array(get_lang('LastResent'), true); |
|
328 | + |
|
329 | + if (api_get_session_id() == 0) { |
|
330 | + $column_header[] = array(get_lang('Modify'), false, '', 'nowrap style="text-align: right"'); |
|
331 | + } elseif (api_is_allowed_to_session_edit(false,true)) { |
|
332 | + $column_header[] = array(get_lang('Modify'), false, '', 'nowrap style="text-align: right"'); |
|
333 | + } |
|
334 | + |
|
335 | + $column_header[] = array('RealDate', true); |
|
336 | + $column_header[] = array('RealSize', true); |
|
337 | + |
|
338 | + // An array with the setting of the columns -> 1: columns that we will show, 0:columns that will be hide |
|
339 | + $column_show[] = 1; |
|
340 | + $column_show[] = 1; |
|
341 | + $column_show[] = 1; |
|
342 | + $column_show[] = 1; |
|
343 | + $column_show[] = 1; |
|
344 | + $column_show[] = 1; |
|
345 | + |
|
346 | + if (api_get_session_id() == 0) { |
|
347 | + $column_show[] = 1; |
|
348 | + } elseif (api_is_allowed_to_session_edit(false, true)) { |
|
349 | + $column_show[] = 1; |
|
350 | + } |
|
351 | + $column_show[] = 0; |
|
352 | + |
|
353 | + // Here we change the way how the columns are going to be sort |
|
354 | + // in this case the the column of LastResent ( 4th element in $column_header) we will be order like the column RealDate |
|
355 | + // because in the column RealDate we have the days in a correct format "2008-03-12 10:35:48" |
|
356 | + |
|
357 | + $column_order[3] = 8; |
|
358 | + $column_order[5] = 7; |
|
359 | + |
|
360 | + // The content of the sortable table = the received files |
|
361 | + foreach ($dropbox_person -> receivedWork as $dropbox_file) { |
|
362 | + $dropbox_file_data = array(); |
|
363 | + if ($view_dropbox_category_received == $dropbox_file->category) { |
|
364 | 364 | // we only display the files that are in the category that we are in. |
365 | - $dropbox_file_data[] = $dropbox_file->id; |
|
365 | + $dropbox_file_data[] = $dropbox_file->id; |
|
366 | 366 | |
367 | - if (!is_array($_SESSION['_seen'][$_course['id']][TOOL_DROPBOX])) { |
|
368 | - $_SESSION['_seen'][$_course['id']][TOOL_DROPBOX] = array(); |
|
369 | - } |
|
367 | + if (!is_array($_SESSION['_seen'][$_course['id']][TOOL_DROPBOX])) { |
|
368 | + $_SESSION['_seen'][$_course['id']][TOOL_DROPBOX] = array(); |
|
369 | + } |
|
370 | 370 | |
371 | - // New icon |
|
372 | - $new_icon = ''; |
|
373 | - if ($dropbox_file->last_upload_date > $last_access && |
|
371 | + // New icon |
|
372 | + $new_icon = ''; |
|
373 | + if ($dropbox_file->last_upload_date > $last_access && |
|
374 | 374 | !in_array($dropbox_file->id, $_SESSION['_seen'][$_course['id']][TOOL_DROPBOX]) |
375 | 375 | ) { |
376 | - $new_icon = ' '.Display::return_icon('new_dropbox_message.png', get_lang('New'),'',ICON_SIZE_SMALL); |
|
377 | - } |
|
376 | + $new_icon = ' '.Display::return_icon('new_dropbox_message.png', get_lang('New'),'',ICON_SIZE_SMALL); |
|
377 | + } |
|
378 | 378 | |
379 | - $link_open = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'">'; |
|
380 | - $dropbox_file_data[] = $link_open.DocumentManager::build_document_icon_tag('file', $dropbox_file->title).'</a>'; |
|
381 | - $dropbox_file_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'&action=download">'. |
|
379 | + $link_open = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'">'; |
|
380 | + $dropbox_file_data[] = $link_open.DocumentManager::build_document_icon_tag('file', $dropbox_file->title).'</a>'; |
|
381 | + $dropbox_file_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'&action=download">'. |
|
382 | 382 | Display::return_icon('save.png', get_lang('Download'), array('style' => 'float:right;'),ICON_SIZE_SMALL).'</a>'.$link_open.$dropbox_file->title.'</a>'.$new_icon.'<br />'.$dropbox_file->description; |
383 | - $file_size = $dropbox_file->filesize; |
|
384 | - $dropbox_file_data[] = format_file_size($file_size); |
|
385 | - $dropbox_file_data[] = $dropbox_file->author; |
|
383 | + $file_size = $dropbox_file->filesize; |
|
384 | + $dropbox_file_data[] = format_file_size($file_size); |
|
385 | + $dropbox_file_data[] = $dropbox_file->author; |
|
386 | 386 | |
387 | - $last_upload_date = api_get_local_time($dropbox_file->last_upload_date); |
|
388 | - $dropbox_file_data[] = date_to_str_ago($last_upload_date).'<br /><span class="dropbox_date">'. |
|
387 | + $last_upload_date = api_get_local_time($dropbox_file->last_upload_date); |
|
388 | + $dropbox_file_data[] = date_to_str_ago($last_upload_date).'<br /><span class="dropbox_date">'. |
|
389 | 389 | api_format_date($last_upload_date).'</span>'; |
390 | 390 | |
391 | - $action_icons = check_number_feedback($dropbox_file->id, $number_feedback).' '.get_lang('Feedback').' |
|
391 | + $action_icons = check_number_feedback($dropbox_file->id, $number_feedback).' '.get_lang('Feedback').' |
|
392 | 392 | <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=viewfeedback&id='.$dropbox_file->id.'&'.$sort_params.'">'.Display::return_icon('discuss.png', get_lang('Comment'),'',ICON_SIZE_SMALL).'</a> |
393 | 393 | <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=movereceived&move_id='.$dropbox_file->id.'&'.$sort_params.'">'.Display::return_icon('move.png', get_lang('Move'),'',ICON_SIZE_SMALL).'</a> |
394 | 394 | <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=deletereceivedfile&id='.$dropbox_file->id.'&'.$sort_params.'" onclick="javascript: return confirmation(\''.$dropbox_file->title.'\');">'. |
395 | 395 | Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'; |
396 | 396 | |
397 | - // This is a hack to have an additional row in a sortable table |
|
398 | - |
|
399 | - if ($action == 'viewfeedback' AND isset($_GET['id']) and is_numeric($_GET['id']) AND $dropbox_file->id == $_GET['id']) { |
|
400 | - $action_icons .= "</td></tr>"; // Ending the normal row of the sortable table |
|
401 | - $action_icons .= '<tr><td colspan="2"><a href="'.api_get_path(WEB_CODE_PATH).'dropbox/index.php?"'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory."&view_sent_category=".$viewSentCategory."&view=".$view.'&'.$sort_params."\">".get_lang('CloseFeedback')."</a></td><td colspan=\"7\">".feedback($dropbox_file->feedback2)."</td></tr>"; |
|
402 | - } |
|
403 | - if (api_get_session_id() == 0) { |
|
404 | - $dropbox_file_data[] = $action_icons; |
|
405 | - } elseif (api_is_allowed_to_session_edit(false, true)) { |
|
406 | - $dropbox_file_data[] = $action_icons; |
|
407 | - } |
|
408 | - $action_icons = ''; |
|
409 | - $dropbox_file_data[] = $last_upload_date; |
|
410 | - $dropbox_file_data[] = $file_size; |
|
411 | - $dropbox_data_recieved[] = $dropbox_file_data; |
|
412 | - } |
|
413 | - } |
|
414 | - |
|
415 | - // The content of the sortable table = the categories (if we are not in the root) |
|
416 | - if ($view_dropbox_category_received == 0) { |
|
417 | - foreach ($dropbox_categories as $category) { |
|
418 | - /* Note: This can probably be shortened since the categories |
|
397 | + // This is a hack to have an additional row in a sortable table |
|
398 | + |
|
399 | + if ($action == 'viewfeedback' AND isset($_GET['id']) and is_numeric($_GET['id']) AND $dropbox_file->id == $_GET['id']) { |
|
400 | + $action_icons .= "</td></tr>"; // Ending the normal row of the sortable table |
|
401 | + $action_icons .= '<tr><td colspan="2"><a href="'.api_get_path(WEB_CODE_PATH).'dropbox/index.php?"'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory."&view_sent_category=".$viewSentCategory."&view=".$view.'&'.$sort_params."\">".get_lang('CloseFeedback')."</a></td><td colspan=\"7\">".feedback($dropbox_file->feedback2)."</td></tr>"; |
|
402 | + } |
|
403 | + if (api_get_session_id() == 0) { |
|
404 | + $dropbox_file_data[] = $action_icons; |
|
405 | + } elseif (api_is_allowed_to_session_edit(false, true)) { |
|
406 | + $dropbox_file_data[] = $action_icons; |
|
407 | + } |
|
408 | + $action_icons = ''; |
|
409 | + $dropbox_file_data[] = $last_upload_date; |
|
410 | + $dropbox_file_data[] = $file_size; |
|
411 | + $dropbox_data_recieved[] = $dropbox_file_data; |
|
412 | + } |
|
413 | + } |
|
414 | + |
|
415 | + // The content of the sortable table = the categories (if we are not in the root) |
|
416 | + if ($view_dropbox_category_received == 0) { |
|
417 | + foreach ($dropbox_categories as $category) { |
|
418 | + /* Note: This can probably be shortened since the categories |
|
419 | 419 | for the received files are already in the |
420 | 420 | $dropbox_received_category array;*/ |
421 | - $dropbox_category_data = array(); |
|
422 | - if ($category['received'] == '1') { |
|
423 | - $movelist[$category['cat_id']] = $category['cat_name']; |
|
421 | + $dropbox_category_data = array(); |
|
422 | + if ($category['received'] == '1') { |
|
423 | + $movelist[$category['cat_id']] = $category['cat_name']; |
|
424 | 424 | // This is where the checkbox icon for the files appear |
425 | - $dropbox_category_data[] = $category['cat_id']; |
|
426 | - // The icon of the category |
|
427 | - $link_open = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$category['cat_id'].'&view_sent_category='.$viewSentCategory.'&view='.$view.'">'; |
|
428 | - $dropbox_category_data[] = $link_open.DocumentManager::build_document_icon_tag('folder', $category['cat_name']).'</a>'; |
|
429 | - $dropbox_category_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&cat_id='.$category['cat_id'].'&action=downloadcategory&sent_received=received">'.Display::return_icon('save_pack.png', get_lang('Save'), array('style' => 'float:right;'),ICON_SIZE_SMALL).'</a>'.$link_open.$category['cat_name'].'</a>'; |
|
430 | - $dropbox_category_data[] = ''; |
|
431 | - $dropbox_category_data[] = ''; |
|
432 | - $dropbox_category_data[] = ''; |
|
433 | - $dropbox_category_data[] = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=editcategory&id='.$category['cat_id'].'">'.Display::return_icon('edit.png',get_lang('Edit'),'',ICON_SIZE_SMALL).'</a> |
|
425 | + $dropbox_category_data[] = $category['cat_id']; |
|
426 | + // The icon of the category |
|
427 | + $link_open = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$category['cat_id'].'&view_sent_category='.$viewSentCategory.'&view='.$view.'">'; |
|
428 | + $dropbox_category_data[] = $link_open.DocumentManager::build_document_icon_tag('folder', $category['cat_name']).'</a>'; |
|
429 | + $dropbox_category_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&cat_id='.$category['cat_id'].'&action=downloadcategory&sent_received=received">'.Display::return_icon('save_pack.png', get_lang('Save'), array('style' => 'float:right;'),ICON_SIZE_SMALL).'</a>'.$link_open.$category['cat_name'].'</a>'; |
|
430 | + $dropbox_category_data[] = ''; |
|
431 | + $dropbox_category_data[] = ''; |
|
432 | + $dropbox_category_data[] = ''; |
|
433 | + $dropbox_category_data[] = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=editcategory&id='.$category['cat_id'].'">'.Display::return_icon('edit.png',get_lang('Edit'),'',ICON_SIZE_SMALL).'</a> |
|
434 | 434 | <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=deletereceivedcategory&id='.$category['cat_id'].'" onclick="javascript: return confirmation(\''.Security::remove_XSS($category['cat_name']).'\');">'.Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'; |
435 | - } |
|
436 | - if (is_array($dropbox_category_data) && count($dropbox_category_data) > 0) { |
|
437 | - $dropbox_data_recieved[] = $dropbox_category_data; |
|
438 | - } |
|
439 | - } |
|
440 | - } |
|
441 | - |
|
442 | - // Displaying the table |
|
435 | + } |
|
436 | + if (is_array($dropbox_category_data) && count($dropbox_category_data) > 0) { |
|
437 | + $dropbox_data_recieved[] = $dropbox_category_data; |
|
438 | + } |
|
439 | + } |
|
440 | + } |
|
441 | + |
|
442 | + // Displaying the table |
|
443 | 443 | $additional_get_parameters = array( |
444 | 444 | 'view' => $view, |
445 | 445 | 'view_received_category' => $viewReceivedCategory, |
@@ -450,15 +450,15 @@ discard block |
||
450 | 450 | 'download_received' => get_lang('Download') |
451 | 451 | ); |
452 | 452 | |
453 | - if (is_array($movelist)) { |
|
454 | - foreach ($movelist as $catid => $catname){ |
|
455 | - $selectlist['move_received_'.$catid] = get_lang('Move') . '->'. Security::remove_XSS($catname); |
|
456 | - } |
|
457 | - } |
|
453 | + if (is_array($movelist)) { |
|
454 | + foreach ($movelist as $catid => $catname){ |
|
455 | + $selectlist['move_received_'.$catid] = get_lang('Move') . '->'. Security::remove_XSS($catname); |
|
456 | + } |
|
457 | + } |
|
458 | 458 | |
459 | - if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
460 | - $selectlist = array(); |
|
461 | - } |
|
459 | + if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
460 | + $selectlist = array(); |
|
461 | + } |
|
462 | 462 | echo '<div class="files-table">'; |
463 | 463 | Display::display_sortable_config_table( |
464 | 464 | 'dropbox', |
@@ -472,153 +472,153 @@ discard block |
||
472 | 472 | $selectlist |
473 | 473 | ); |
474 | 474 | echo '</div>'; |
475 | - } |
|
476 | - |
|
477 | - /* SENT FILES */ |
|
478 | - |
|
479 | - if (!$view || $view == 'sent' || !$dropbox_cnf['sent_received_tabs']) { |
|
480 | - // This is for the categories |
|
481 | - if (isset($viewSentCategory) AND $viewSentCategory != '') { |
|
482 | - $view_dropbox_category_sent = $viewSentCategory; |
|
483 | - } else { |
|
484 | - $view_dropbox_category_sent = 0; |
|
485 | - } |
|
486 | - |
|
487 | - // Object initialisation |
|
488 | - $dropbox_person = new Dropbox_Person(api_get_user_id(), $is_courseAdmin, $is_courseTutor); |
|
489 | - |
|
490 | - // Constructing the array that contains the total number of feedback messages per document. |
|
491 | - $number_feedback = get_total_number_feedback(); |
|
492 | - |
|
493 | - // Sorting and paging options |
|
494 | - $sorting_options = array(); |
|
495 | - $paging_options = array(); |
|
496 | - |
|
497 | - // The headers of the sortable tables |
|
498 | - $column_header = array(); |
|
499 | - |
|
500 | - $column_header[] = array('', false, ''); |
|
501 | - $column_header[] = array(get_lang('Type'), true, 'style="width:40px"', 'style="text-align:center"'); |
|
502 | - $column_header[] = array(get_lang('SentTitle'), true, ''); |
|
503 | - $column_header[] = array(get_lang('Size'), true, ''); |
|
504 | - $column_header[] = array(get_lang('SentTo'), true, ''); |
|
505 | - $column_header[] = array(get_lang('LastResent'), true, ''); |
|
506 | - |
|
507 | - if (api_get_session_id() == 0) { |
|
508 | - $column_header[] = array(get_lang('Modify'), false, '', 'nowrap style="text-align: right"'); |
|
509 | - } elseif (api_is_allowed_to_session_edit(false, true)) { |
|
510 | - $column_header[] = array(get_lang('Modify'), false, '', 'nowrap style="text-align: right"'); |
|
511 | - } |
|
512 | - |
|
513 | - $column_header[] = array('RealDate', true); |
|
514 | - $column_header[] = array('RealSize', true); |
|
515 | - |
|
516 | - $column_show = array(); |
|
517 | - $column_order = array(); |
|
518 | - |
|
519 | - // An array with the setting of the columns -> 1: columns that we will show, 0:columns that will be hide |
|
520 | - $column_show[] = 1; |
|
521 | - $column_show[] = 1; |
|
522 | - $column_show[] = 1; |
|
523 | - $column_show[] = 1; |
|
524 | - $column_show[] = 1; |
|
525 | - $column_show[] = 1; |
|
526 | - if (api_get_session_id() == 0) { |
|
527 | - $column_show[] = 1; |
|
528 | - } elseif (api_is_allowed_to_session_edit(false, true)) { |
|
529 | - $column_show[] = 1; |
|
530 | - } |
|
531 | - $column_show[] = 0; |
|
532 | - |
|
533 | - // Here we change the way how the colums are going to be sort |
|
534 | - // in this case the the column of LastResent ( 4th element in $column_header) we will be order like the column RealDate |
|
535 | - // because in the column RealDate we have the days in a correct format "2008-03-12 10:35:48" |
|
536 | - |
|
537 | - $column_order[3] = 8; |
|
538 | - $column_order[5] = 7; |
|
539 | - |
|
540 | - // The content of the sortable table = the received files |
|
541 | - foreach ($dropbox_person->sentWork as $dropbox_file) { |
|
542 | - $dropbox_file_data = array(); |
|
543 | - |
|
544 | - if ($view_dropbox_category_sent == $dropbox_file->category) { |
|
545 | - $dropbox_file_data[] = $dropbox_file->id; |
|
546 | - $link_open = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'">'; |
|
547 | - $dropbox_file_data[] = $link_open.DocumentManager::build_document_icon_tag('file', $dropbox_file->title).'</a>'; |
|
548 | - $dropbox_file_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'&action=download">'. |
|
475 | + } |
|
476 | + |
|
477 | + /* SENT FILES */ |
|
478 | + |
|
479 | + if (!$view || $view == 'sent' || !$dropbox_cnf['sent_received_tabs']) { |
|
480 | + // This is for the categories |
|
481 | + if (isset($viewSentCategory) AND $viewSentCategory != '') { |
|
482 | + $view_dropbox_category_sent = $viewSentCategory; |
|
483 | + } else { |
|
484 | + $view_dropbox_category_sent = 0; |
|
485 | + } |
|
486 | + |
|
487 | + // Object initialisation |
|
488 | + $dropbox_person = new Dropbox_Person(api_get_user_id(), $is_courseAdmin, $is_courseTutor); |
|
489 | + |
|
490 | + // Constructing the array that contains the total number of feedback messages per document. |
|
491 | + $number_feedback = get_total_number_feedback(); |
|
492 | + |
|
493 | + // Sorting and paging options |
|
494 | + $sorting_options = array(); |
|
495 | + $paging_options = array(); |
|
496 | + |
|
497 | + // The headers of the sortable tables |
|
498 | + $column_header = array(); |
|
499 | + |
|
500 | + $column_header[] = array('', false, ''); |
|
501 | + $column_header[] = array(get_lang('Type'), true, 'style="width:40px"', 'style="text-align:center"'); |
|
502 | + $column_header[] = array(get_lang('SentTitle'), true, ''); |
|
503 | + $column_header[] = array(get_lang('Size'), true, ''); |
|
504 | + $column_header[] = array(get_lang('SentTo'), true, ''); |
|
505 | + $column_header[] = array(get_lang('LastResent'), true, ''); |
|
506 | + |
|
507 | + if (api_get_session_id() == 0) { |
|
508 | + $column_header[] = array(get_lang('Modify'), false, '', 'nowrap style="text-align: right"'); |
|
509 | + } elseif (api_is_allowed_to_session_edit(false, true)) { |
|
510 | + $column_header[] = array(get_lang('Modify'), false, '', 'nowrap style="text-align: right"'); |
|
511 | + } |
|
512 | + |
|
513 | + $column_header[] = array('RealDate', true); |
|
514 | + $column_header[] = array('RealSize', true); |
|
515 | + |
|
516 | + $column_show = array(); |
|
517 | + $column_order = array(); |
|
518 | + |
|
519 | + // An array with the setting of the columns -> 1: columns that we will show, 0:columns that will be hide |
|
520 | + $column_show[] = 1; |
|
521 | + $column_show[] = 1; |
|
522 | + $column_show[] = 1; |
|
523 | + $column_show[] = 1; |
|
524 | + $column_show[] = 1; |
|
525 | + $column_show[] = 1; |
|
526 | + if (api_get_session_id() == 0) { |
|
527 | + $column_show[] = 1; |
|
528 | + } elseif (api_is_allowed_to_session_edit(false, true)) { |
|
529 | + $column_show[] = 1; |
|
530 | + } |
|
531 | + $column_show[] = 0; |
|
532 | + |
|
533 | + // Here we change the way how the colums are going to be sort |
|
534 | + // in this case the the column of LastResent ( 4th element in $column_header) we will be order like the column RealDate |
|
535 | + // because in the column RealDate we have the days in a correct format "2008-03-12 10:35:48" |
|
536 | + |
|
537 | + $column_order[3] = 8; |
|
538 | + $column_order[5] = 7; |
|
539 | + |
|
540 | + // The content of the sortable table = the received files |
|
541 | + foreach ($dropbox_person->sentWork as $dropbox_file) { |
|
542 | + $dropbox_file_data = array(); |
|
543 | + |
|
544 | + if ($view_dropbox_category_sent == $dropbox_file->category) { |
|
545 | + $dropbox_file_data[] = $dropbox_file->id; |
|
546 | + $link_open = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'">'; |
|
547 | + $dropbox_file_data[] = $link_open.DocumentManager::build_document_icon_tag('file', $dropbox_file->title).'</a>'; |
|
548 | + $dropbox_file_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'&action=download">'. |
|
549 | 549 | Display::return_icon('save.png', get_lang('Save'), array('style' => 'float:right;'),ICON_SIZE_SMALL).'</a>'.$link_open.$dropbox_file->title.'</a><br />'.$dropbox_file->description; |
550 | - $file_size = $dropbox_file->filesize; |
|
551 | - $dropbox_file_data[] = format_file_size($file_size); |
|
550 | + $file_size = $dropbox_file->filesize; |
|
551 | + $dropbox_file_data[] = format_file_size($file_size); |
|
552 | 552 | $receivers_celldata = null; |
553 | - foreach ($dropbox_file->recipients as $recipient) { |
|
554 | - $userInfo = api_get_user_info($recipient['user_id']); |
|
555 | - $receivers_celldata = UserManager::getUserProfileLink($userInfo).', '.$receivers_celldata; |
|
556 | - } |
|
557 | - $receivers_celldata = trim(trim($receivers_celldata), ','); // Removing the trailing comma. |
|
558 | - $dropbox_file_data[] = $receivers_celldata; |
|
559 | - $last_upload_date = api_get_local_time($dropbox_file->last_upload_date); |
|
560 | - $dropbox_file_data[] = date_to_str_ago($last_upload_date).'<br /><span class="dropbox_date">'.api_format_date($last_upload_date).'</span>'; |
|
561 | - |
|
562 | - //$dropbox_file_data[] = $dropbox_file->author; |
|
563 | - $receivers_celldata = ''; |
|
564 | - |
|
565 | - $action_icons = check_number_feedback($dropbox_file->id, $number_feedback).' '.get_lang('Feedback').' |
|
553 | + foreach ($dropbox_file->recipients as $recipient) { |
|
554 | + $userInfo = api_get_user_info($recipient['user_id']); |
|
555 | + $receivers_celldata = UserManager::getUserProfileLink($userInfo).', '.$receivers_celldata; |
|
556 | + } |
|
557 | + $receivers_celldata = trim(trim($receivers_celldata), ','); // Removing the trailing comma. |
|
558 | + $dropbox_file_data[] = $receivers_celldata; |
|
559 | + $last_upload_date = api_get_local_time($dropbox_file->last_upload_date); |
|
560 | + $dropbox_file_data[] = date_to_str_ago($last_upload_date).'<br /><span class="dropbox_date">'.api_format_date($last_upload_date).'</span>'; |
|
561 | + |
|
562 | + //$dropbox_file_data[] = $dropbox_file->author; |
|
563 | + $receivers_celldata = ''; |
|
564 | + |
|
565 | + $action_icons = check_number_feedback($dropbox_file->id, $number_feedback).' '.get_lang('Feedback').' |
|
566 | 566 | <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=viewfeedback&id='.$dropbox_file->id.'&'.$sort_params.'">'.Display::return_icon('discuss.png', get_lang('Comment'),'',ICON_SIZE_SMALL).'</a> |
567 | 567 | <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=movesent&move_id='.$dropbox_file->id.'&'.$sort_params.'">'.Display::return_icon('move.png', get_lang('Move'),'',ICON_SIZE_SMALL).'</a> |
568 | 568 | <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=deletesentfile&id='.$dropbox_file->id.'&'.$sort_params.'" onclick="javascript: return confirmation(\''.$dropbox_file->title.'\');">'.Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'; |
569 | - // This is a hack to have an additional row in a sortable table |
|
570 | - if ($action == 'viewfeedback' && isset($_GET['id']) && is_numeric($_GET['id']) && $dropbox_file->id == $_GET['id']) { |
|
571 | - $action_icons .= "</td></tr>\n"; // ending the normal row of the sortable table |
|
572 | - $action_icons .= "<tr><td colspan=\"2\">"; |
|
573 | - $action_icons .= "<a href=\"".api_get_path(WEB_CODE_PATH)."dropbox/index.php?".api_get_cidreq()."&view_received_category=".$viewReceivedCategory."&view_sent_category=".$viewSentCategory."&view=".$view.'&'.$sort_params."\">".get_lang('CloseFeedback')."</a>"; |
|
574 | - $action_icons .= "</td><td colspan=\"7\">".feedback($dropbox_file->feedback2)."</td></tr>"; |
|
575 | - } |
|
576 | - $dropbox_file_data[] = $action_icons; |
|
577 | - $dropbox_file_data[] = $last_upload_date; |
|
578 | - $dropbox_file_data[] = $file_size; |
|
579 | - $action_icons = ''; |
|
580 | - $dropbox_data_sent[] = $dropbox_file_data; |
|
581 | - } |
|
582 | - } |
|
569 | + // This is a hack to have an additional row in a sortable table |
|
570 | + if ($action == 'viewfeedback' && isset($_GET['id']) && is_numeric($_GET['id']) && $dropbox_file->id == $_GET['id']) { |
|
571 | + $action_icons .= "</td></tr>\n"; // ending the normal row of the sortable table |
|
572 | + $action_icons .= "<tr><td colspan=\"2\">"; |
|
573 | + $action_icons .= "<a href=\"".api_get_path(WEB_CODE_PATH)."dropbox/index.php?".api_get_cidreq()."&view_received_category=".$viewReceivedCategory."&view_sent_category=".$viewSentCategory."&view=".$view.'&'.$sort_params."\">".get_lang('CloseFeedback')."</a>"; |
|
574 | + $action_icons .= "</td><td colspan=\"7\">".feedback($dropbox_file->feedback2)."</td></tr>"; |
|
575 | + } |
|
576 | + $dropbox_file_data[] = $action_icons; |
|
577 | + $dropbox_file_data[] = $last_upload_date; |
|
578 | + $dropbox_file_data[] = $file_size; |
|
579 | + $action_icons = ''; |
|
580 | + $dropbox_data_sent[] = $dropbox_file_data; |
|
581 | + } |
|
582 | + } |
|
583 | 583 | |
584 | 584 | $moveList = array(); |
585 | - // The content of the sortable table = the categories (if we are not in the root) |
|
586 | - if ($view_dropbox_category_sent == 0) { |
|
587 | - foreach ($dropbox_categories as $category) { |
|
588 | - $dropbox_category_data = array(); |
|
585 | + // The content of the sortable table = the categories (if we are not in the root) |
|
586 | + if ($view_dropbox_category_sent == 0) { |
|
587 | + foreach ($dropbox_categories as $category) { |
|
588 | + $dropbox_category_data = array(); |
|
589 | 589 | |
590 | - if ($category['sent'] == '1') { |
|
590 | + if ($category['sent'] == '1') { |
|
591 | 591 | |
592 | 592 | $moveList[$category['cat_id']] = $category['cat_name']; |
593 | - $dropbox_category_data[] = $category['cat_id']; |
|
594 | - // This is where the checkbox icon for the files appear. |
|
595 | - $link_open = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$category['cat_id'].'&view='.$view.'">'; |
|
596 | - $dropbox_category_data[] = $link_open.DocumentManager::build_document_icon_tag('folder', Security::remove_XSS($category['cat_name'])).'</a>'; |
|
597 | - $dropbox_category_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&cat_id='.$category['cat_id'].'&action=downloadcategory&sent_received=sent">'.Display::return_icon('save_pack.png', get_lang('Save'), array('style' => 'float:right;'),ICON_SIZE_SMALL).'</a>'.$link_open.Security::remove_XSS($category['cat_name']).'</a>'; |
|
598 | - //$dropbox_category_data[] = ''; |
|
599 | - $dropbox_category_data[] = ''; |
|
600 | - //$dropbox_category_data[] = ''; |
|
601 | - $dropbox_category_data[] = ''; |
|
602 | - $dropbox_category_data[] = ''; |
|
603 | - $dropbox_category_data[] = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=editcategory&id='.$category['cat_id'].'">'. |
|
593 | + $dropbox_category_data[] = $category['cat_id']; |
|
594 | + // This is where the checkbox icon for the files appear. |
|
595 | + $link_open = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$category['cat_id'].'&view='.$view.'">'; |
|
596 | + $dropbox_category_data[] = $link_open.DocumentManager::build_document_icon_tag('folder', Security::remove_XSS($category['cat_name'])).'</a>'; |
|
597 | + $dropbox_category_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&cat_id='.$category['cat_id'].'&action=downloadcategory&sent_received=sent">'.Display::return_icon('save_pack.png', get_lang('Save'), array('style' => 'float:right;'),ICON_SIZE_SMALL).'</a>'.$link_open.Security::remove_XSS($category['cat_name']).'</a>'; |
|
598 | + //$dropbox_category_data[] = ''; |
|
599 | + $dropbox_category_data[] = ''; |
|
600 | + //$dropbox_category_data[] = ''; |
|
601 | + $dropbox_category_data[] = ''; |
|
602 | + $dropbox_category_data[] = ''; |
|
603 | + $dropbox_category_data[] = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=editcategory&id='.$category['cat_id'].'">'. |
|
604 | 604 | Display::return_icon('edit.png', get_lang('Edit'),'',ICON_SIZE_SMALL).'</a> |
605 | 605 | <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=deletesentcategory&id='.$category['cat_id'].'" onclick="javascript: return confirmation(\''.Security::remove_XSS($category['cat_name']).'\');">'. |
606 | 606 | Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'; |
607 | - } |
|
608 | - if (is_array($dropbox_category_data) && count($dropbox_category_data) > 0) { |
|
609 | - $dropbox_data_sent[] = $dropbox_category_data; |
|
610 | - } |
|
611 | - } |
|
612 | - } |
|
613 | - |
|
614 | - // Displaying the table |
|
615 | - $additional_get_parameters = array( |
|
607 | + } |
|
608 | + if (is_array($dropbox_category_data) && count($dropbox_category_data) > 0) { |
|
609 | + $dropbox_data_sent[] = $dropbox_category_data; |
|
610 | + } |
|
611 | + } |
|
612 | + } |
|
613 | + |
|
614 | + // Displaying the table |
|
615 | + $additional_get_parameters = array( |
|
616 | 616 | 'view' => $view, |
617 | 617 | 'view_received_category' => $viewReceivedCategory, |
618 | 618 | 'view_sent_category' => $viewSentCategory |
619 | 619 | ); |
620 | 620 | |
621 | - $selectlist = array( |
|
621 | + $selectlist = array( |
|
622 | 622 | 'delete_received' => get_lang('Delete'), |
623 | 623 | 'download_received' => get_lang('Download') |
624 | 624 | ); |
@@ -629,12 +629,12 @@ discard block |
||
629 | 629 | } |
630 | 630 | } |
631 | 631 | |
632 | - if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
633 | - $selectlist = array('download_received' => get_lang('Download')); |
|
634 | - } |
|
632 | + if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
633 | + $selectlist = array('download_received' => get_lang('Download')); |
|
634 | + } |
|
635 | 635 | |
636 | 636 | echo '<div class="files-table">'; |
637 | - Display::display_sortable_config_table( |
|
637 | + Display::display_sortable_config_table( |
|
638 | 638 | 'dropbox', |
639 | 639 | $column_header, |
640 | 640 | $dropbox_data_sent, |
@@ -646,7 +646,7 @@ discard block |
||
646 | 646 | $selectlist |
647 | 647 | ); |
648 | 648 | echo '</div>'; |
649 | - } |
|
649 | + } |
|
650 | 650 | } |
651 | 651 | |
652 | 652 | Display::display_footer(); |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | $file = $path.'/'.$entry; |
20 | 20 | if (is_file($file)) { |
21 | 21 | $terms = array_merge($terms,SubLanguageManager::get_all_language_variable_in_file($file,true)); |
22 | - } |
|
22 | + } |
|
23 | 23 | } |
24 | 24 | // get only the array keys (the language variables defined in language files) |
25 | 25 | $defined_terms = array_flip(array_keys($terms)); |
@@ -32,14 +32,14 @@ discard block |
||
32 | 32 | foreach ($files as $file) { |
33 | 33 | //echo 'Analyzing '.$file."<br />"; |
34 | 34 | $shortfile = substr($file,$l); |
35 | - $lines = file($file); |
|
35 | + $lines = file($file); |
|
36 | 36 | foreach ($lines as $line) { |
37 | - $myterms = array(); |
|
37 | + $myterms = array(); |
|
38 | 38 | $res = preg_match_all('/get_lang\(\'(\\w*)\'\)/',$line,$myterms); |
39 | 39 | if ($res > 0) { |
40 | 40 | foreach($myterms[1] as $term) { |
41 | 41 | if (!isset($defined_terms[$term]) && !isset($defined_terms['lang'.$term])) { |
42 | - $undefined_terms[$term] = $shortfile; |
|
42 | + $undefined_terms[$term] = $shortfile; |
|
43 | 43 | //echo "Undefined: $term<br />"; |
44 | 44 | } |
45 | 45 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | if ($res > 0) { |
50 | 50 | foreach($myterms[1] as $term) { |
51 | 51 | if (!isset($defined_terms[$term]) && !isset($defined_terms['lang'.$term])) { |
52 | - $undefined_terms[$term] = $shortfile; |
|
52 | + $undefined_terms[$term] = $shortfile; |
|
53 | 53 | //echo "Undefined: $term<br />"; |
54 | 54 | } |
55 | 55 | } |
@@ -73,17 +73,17 @@ discard block |
||
73 | 73 | $list = scandir($base_path); |
74 | 74 | $files = array(); |
75 | 75 | foreach ($list as $item) { |
76 | - if (substr($item,0,1)=='.') {continue;} |
|
76 | + if (substr($item,0,1)=='.') {continue;} |
|
77 | 77 | $special_dirs = array(api_get_path(SYS_TEST_PATH),api_get_path(SYS_COURSE_PATH),api_get_path(SYS_LANG_PATH),api_get_path(SYS_ARCHIVE_PATH)); |
78 | 78 | if (in_array($base_path.$item.'/',$special_dirs)) {continue;} |
79 | 79 | if (is_dir($base_path.$item)) { |
80 | - $files = array_merge($files,get_all_php_files($base_path.$item.'/')); |
|
80 | + $files = array_merge($files,get_all_php_files($base_path.$item.'/')); |
|
81 | 81 | } else { |
82 | 82 | //only analyse php files |
83 | 83 | $sub = substr($item,-4); |
84 | - if ($sub == '.php' or $sub == '.tpl') { |
|
84 | + if ($sub == '.php' or $sub == '.tpl') { |
|
85 | 85 | $files[] = $base_path.$item; |
86 | - } |
|
86 | + } |
|
87 | 87 | } |
88 | 88 | } |
89 | 89 | $list = null; |