@@ -28,7 +28,7 @@ |
||
28 | 28 | ->add('users', 'sonata_type_collection', array( |
29 | 29 | 'cascade_validation' => true, |
30 | 30 | ), array( |
31 | - // 'allow_delete' => true, |
|
31 | + // 'allow_delete' => true, |
|
32 | 32 | 'by_reference' => false, |
33 | 33 | 'edit' => 'inline', |
34 | 34 | 'inline' => 'table', |
@@ -25,10 +25,10 @@ |
||
25 | 25 | { |
26 | 26 | |
27 | 27 | /** |
28 | - * @param string $keyword |
|
28 | + * @param string $keyword |
|
29 | 29 | * |
30 | - * @return mixed |
|
31 | - */ |
|
30 | + * @return mixed |
|
31 | + */ |
|
32 | 32 | public function searchUserByKeyword($keyword) |
33 | 33 | { |
34 | 34 | $qb = $this->createQueryBuilder('a'); |
@@ -47,15 +47,15 @@ |
||
47 | 47 | $form->addElement('hidden', 'description_type['.$id.']', $id); |
48 | 48 | $form->addText('title['.$id.']', get_lang('Title'), false, array('size'=>'50')); |
49 | 49 | $form->addHtmlEditor( |
50 | - 'description['.$id.']', |
|
51 | - get_lang('Description'), |
|
52 | - false, |
|
53 | - false, |
|
54 | - array( |
|
55 | - 'ToolbarStartExpanded' => 'false', |
|
56 | - 'ToolbarSet' => 'TrainingDescription', |
|
57 | - 'Height' => '150' |
|
58 | - ) |
|
50 | + 'description['.$id.']', |
|
51 | + get_lang('Description'), |
|
52 | + false, |
|
53 | + false, |
|
54 | + array( |
|
55 | + 'ToolbarStartExpanded' => 'false', |
|
56 | + 'ToolbarSet' => 'TrainingDescription', |
|
57 | + 'Height' => '150' |
|
58 | + ) |
|
59 | 59 | ); |
60 | 60 | |
61 | 61 | if (!empty($thematic_simple_list) && in_array($id, $thematic_simple_list)) { |
@@ -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 | } |
@@ -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 | } |
@@ -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; |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | $action = $_GET['a']; |
10 | 10 | |
11 | 11 | switch ($action) { |
12 | - case 'send_contact_information': |
|
12 | + case 'send_contact_information': |
|
13 | 13 | if (!empty($_POST)) { |
14 | 14 | // get params from contact form |
15 | 15 | $person_name = $_POST['person_name']; |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | } |
62 | 62 | break; |
63 | - default: |
|
64 | - echo ''; |
|
63 | + default: |
|
64 | + echo ''; |
|
65 | 65 | } |
66 | 66 | exit; |