@@ -15,15 +15,15 @@ |
||
15 | 15 | Display::display_header($tool_name); |
16 | 16 | //api_display_tool_title($tool_name); |
17 | 17 | if (api_get_setting('server_type') != 'test') { |
18 | - echo get_lang('DummyCourseOnlyOnTestServer'); |
|
18 | + echo get_lang('DummyCourseOnlyOnTestServer'); |
|
19 | 19 | } elseif( isset($_POST['action'])) { |
20 | - require_once('../coursecopy/classes/DummyCourseCreator.class.php'); |
|
21 | - $dcc = new DummyCourseCreator(); |
|
22 | - $dcc->create_dummy_course($_POST['course_code']); |
|
23 | - echo get_lang('Done'); |
|
20 | + require_once('../coursecopy/classes/DummyCourseCreator.class.php'); |
|
21 | + $dcc = new DummyCourseCreator(); |
|
22 | + $dcc->create_dummy_course($_POST['course_code']); |
|
23 | + echo get_lang('Done'); |
|
24 | 24 | } else { |
25 | - echo get_lang('DummyCourseDescription'); |
|
26 | - echo '<form method="post"><input type="hidden" name="course_code" value="'.Security::remove_XSS($_GET['course_code']).'"/><input type="submit" name="action" value="'.get_lang('Ok').'"/></form>'; |
|
25 | + echo get_lang('DummyCourseDescription'); |
|
26 | + echo '<form method="post"><input type="hidden" name="course_code" value="'.Security::remove_XSS($_GET['course_code']).'"/><input type="submit" name="action" value="'.get_lang('Ok').'"/></form>'; |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | Display::display_footer(); |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | $filename = 'reporting.xls'; |
13 | 13 | |
14 | 14 | if (!api_is_allowed_to_create_course()) { |
15 | - api_not_allowed(true); |
|
15 | + api_not_allowed(true); |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | $user_id = api_get_user_id(); |
@@ -23,222 +23,222 @@ discard block |
||
23 | 23 | $session_id = 0; |
24 | 24 | |
25 | 25 | if (!empty($my_courses)) { |
26 | - foreach ($my_courses as $course) { |
|
27 | - $course_code = $course['code']; |
|
28 | - $course_id = $course['real_id']; |
|
29 | - $course_info = api_get_course_info($course_code); |
|
30 | - |
|
31 | - //Only show open courses |
|
32 | - if ($course_info['visibility'] == 0) { |
|
33 | - continue; |
|
34 | - } |
|
35 | - |
|
36 | - $teachers = CourseManager::get_teacher_list_from_course_code($course_code); |
|
37 | - $teacher_list = array(); |
|
38 | - |
|
39 | - if (!empty($teachers)) { |
|
40 | - foreach($teachers as $teacher) { |
|
41 | - $teacher_list[]= $teacher['firstname'].' '.$teacher['lastname']; |
|
42 | - } |
|
43 | - } |
|
44 | - |
|
45 | - $tmp_students = CourseManager :: get_student_list_from_course_code($course_code, false); |
|
46 | - |
|
47 | - //Cleaning students only REAL students |
|
48 | - $students = array(); |
|
49 | - foreach ($tmp_students as $student) { |
|
50 | - $user_info = api_get_user_info($student['user_id']); |
|
51 | - if ($user_info['status'] != STUDENT) { |
|
52 | - continue; |
|
53 | - } |
|
54 | - $students[] = $student['user_id']; |
|
55 | - } |
|
56 | - |
|
57 | - $t_lp = Database :: get_course_table(TABLE_LP_MAIN); |
|
58 | - $sql_lp = "SELECT lp.name, lp.id FROM $t_lp lp |
|
26 | + foreach ($my_courses as $course) { |
|
27 | + $course_code = $course['code']; |
|
28 | + $course_id = $course['real_id']; |
|
29 | + $course_info = api_get_course_info($course_code); |
|
30 | + |
|
31 | + //Only show open courses |
|
32 | + if ($course_info['visibility'] == 0) { |
|
33 | + continue; |
|
34 | + } |
|
35 | + |
|
36 | + $teachers = CourseManager::get_teacher_list_from_course_code($course_code); |
|
37 | + $teacher_list = array(); |
|
38 | + |
|
39 | + if (!empty($teachers)) { |
|
40 | + foreach($teachers as $teacher) { |
|
41 | + $teacher_list[]= $teacher['firstname'].' '.$teacher['lastname']; |
|
42 | + } |
|
43 | + } |
|
44 | + |
|
45 | + $tmp_students = CourseManager :: get_student_list_from_course_code($course_code, false); |
|
46 | + |
|
47 | + //Cleaning students only REAL students |
|
48 | + $students = array(); |
|
49 | + foreach ($tmp_students as $student) { |
|
50 | + $user_info = api_get_user_info($student['user_id']); |
|
51 | + if ($user_info['status'] != STUDENT) { |
|
52 | + continue; |
|
53 | + } |
|
54 | + $students[] = $student['user_id']; |
|
55 | + } |
|
56 | + |
|
57 | + $t_lp = Database :: get_course_table(TABLE_LP_MAIN); |
|
58 | + $sql_lp = "SELECT lp.name, lp.id FROM $t_lp lp |
|
59 | 59 | WHERE c_id = $course_id AND lp.session_id = 0"; |
60 | - $rs_lp = Database::query($sql_lp); |
|
61 | - $t_lpi = Database :: get_course_table(TABLE_LP_ITEM); |
|
62 | - $t_news = Database :: get_course_table(TABLE_ANNOUNCEMENT); |
|
63 | - |
|
64 | - $total_tools_list = Tracking::get_tools_most_used_by_course( |
|
65 | - $course_id, |
|
66 | - $session_id |
|
67 | - ); |
|
68 | - |
|
69 | - $total_tools = 0; |
|
70 | - foreach($total_tools_list as $tool) { |
|
71 | - $total_tools += $tool['count_access_tool']; |
|
72 | - } |
|
73 | - |
|
74 | - if (Database :: num_rows($rs_lp) > 0) { |
|
75 | - while ($learnpath = Database :: fetch_array($rs_lp)) { |
|
76 | - $lp_id = $learnpath['id']; |
|
77 | - |
|
78 | - $lp_items = |
|
79 | - $array[$i]['lp'] = '<a href="'.api_get_path(WEB_CODE_PATH).'newscorm/lp_controller.php?cidReq='.$course_code.'&action=view&lp_id='.$lp_id.'" target="_blank">'.$learnpath['name'].'</a>'; |
|
80 | - |
|
81 | - $array[$i]['teachers'] = ''; |
|
82 | - if (!empty($teacher_list)) { |
|
83 | - $array[$i]['teachers'] = implode(', ', $teacher_list); |
|
84 | - } |
|
85 | - |
|
86 | - $array[$i]['course_name'] = $course['title']; |
|
87 | - $count_students_accessing = 0; |
|
88 | - $count_students_complete_all_activities = 0; |
|
89 | - $count_students_complete_all_activities_at_50 = 0; |
|
90 | - $total_time_spent = 0; |
|
91 | - $total_average_progress = 0; |
|
92 | - |
|
93 | - if (!empty($students)) { |
|
94 | - foreach ($students as $student_id) { |
|
95 | - $avg_student_progress = Tracking::get_avg_student_progress($student_id, $course_code, array($lp_id), $session_id); |
|
96 | - $myavg_temp = Tracking::get_avg_student_score($student_id, $course_code, array($lp_id), $session_id); |
|
97 | - $avg_progress_in_course = Tracking::get_avg_student_progress($student_id, $course_code, array($lp_id), $session_id); |
|
98 | - |
|
99 | - if (intval($avg_progress_in_course) == 100) { |
|
100 | - $count_students_complete_all_activities++; |
|
101 | - } |
|
102 | - if (intval($avg_progress_in_course) > 0 && intval($avg_progress_in_course) <= 50) { |
|
103 | - $count_students_complete_all_activities_at_50 ++; |
|
104 | - } |
|
105 | - $total_average_progress +=$avg_progress_in_course; |
|
106 | - |
|
107 | - $time_spent = Tracking::get_time_spent_on_the_course($student_id, $course_id, $session_id); |
|
108 | - $total_time_spent += $time_spent; |
|
109 | - if (!empty($time_spent)) { |
|
110 | - $count_students_accessing++; |
|
111 | - } |
|
112 | - } |
|
113 | - //$total_tools += $nb_assignments + $messages + $links + $chat_last_connection + $documents; |
|
114 | - } |
|
115 | - |
|
116 | - $student_count = count($students); |
|
117 | - |
|
118 | - $array[$i]['count_students'] = $student_count; |
|
119 | - $array[$i]['count_students_accessing'] = 0; |
|
120 | - $array[$i]['count_students_accessing_percentage'] = 0; |
|
121 | - $array[$i]['count_students_complete_all_activities_at_50'] = 0; |
|
122 | - $array[$i]['count_students_complete_all_activities'] = 0; |
|
123 | - $array[$i]['average_percentage_activities_completed_per_student'] = 0; |
|
124 | - $array[$i]['total_time_spent'] = 0; |
|
125 | - $array[$i]['average_time_spent_per_student'] = 0; |
|
126 | - $array[$i]['total_time_spent'] = 0; |
|
127 | - $array[$i]['average_time_spent_per_student'] = 0; |
|
128 | - //$array[$i]['tools_used'] = 0; |
|
129 | - $array[$i]['learnpath_docs'] = 0; |
|
130 | - $array[$i]['learnpath_exercises'] = 0; |
|
131 | - $array[$i]['learnpath_links'] = 0; |
|
132 | - $array[$i]['learnpath_forums'] = 0; |
|
133 | - $array[$i]['learnpath_assignments'] = 0; |
|
134 | - |
|
135 | - //registering the number of each category of |
|
136 | - //items in learning path |
|
137 | - $sql_lpi = "SELECT lpi.item_type FROM $t_lpi lpi |
|
60 | + $rs_lp = Database::query($sql_lp); |
|
61 | + $t_lpi = Database :: get_course_table(TABLE_LP_ITEM); |
|
62 | + $t_news = Database :: get_course_table(TABLE_ANNOUNCEMENT); |
|
63 | + |
|
64 | + $total_tools_list = Tracking::get_tools_most_used_by_course( |
|
65 | + $course_id, |
|
66 | + $session_id |
|
67 | + ); |
|
68 | + |
|
69 | + $total_tools = 0; |
|
70 | + foreach($total_tools_list as $tool) { |
|
71 | + $total_tools += $tool['count_access_tool']; |
|
72 | + } |
|
73 | + |
|
74 | + if (Database :: num_rows($rs_lp) > 0) { |
|
75 | + while ($learnpath = Database :: fetch_array($rs_lp)) { |
|
76 | + $lp_id = $learnpath['id']; |
|
77 | + |
|
78 | + $lp_items = |
|
79 | + $array[$i]['lp'] = '<a href="'.api_get_path(WEB_CODE_PATH).'newscorm/lp_controller.php?cidReq='.$course_code.'&action=view&lp_id='.$lp_id.'" target="_blank">'.$learnpath['name'].'</a>'; |
|
80 | + |
|
81 | + $array[$i]['teachers'] = ''; |
|
82 | + if (!empty($teacher_list)) { |
|
83 | + $array[$i]['teachers'] = implode(', ', $teacher_list); |
|
84 | + } |
|
85 | + |
|
86 | + $array[$i]['course_name'] = $course['title']; |
|
87 | + $count_students_accessing = 0; |
|
88 | + $count_students_complete_all_activities = 0; |
|
89 | + $count_students_complete_all_activities_at_50 = 0; |
|
90 | + $total_time_spent = 0; |
|
91 | + $total_average_progress = 0; |
|
92 | + |
|
93 | + if (!empty($students)) { |
|
94 | + foreach ($students as $student_id) { |
|
95 | + $avg_student_progress = Tracking::get_avg_student_progress($student_id, $course_code, array($lp_id), $session_id); |
|
96 | + $myavg_temp = Tracking::get_avg_student_score($student_id, $course_code, array($lp_id), $session_id); |
|
97 | + $avg_progress_in_course = Tracking::get_avg_student_progress($student_id, $course_code, array($lp_id), $session_id); |
|
98 | + |
|
99 | + if (intval($avg_progress_in_course) == 100) { |
|
100 | + $count_students_complete_all_activities++; |
|
101 | + } |
|
102 | + if (intval($avg_progress_in_course) > 0 && intval($avg_progress_in_course) <= 50) { |
|
103 | + $count_students_complete_all_activities_at_50 ++; |
|
104 | + } |
|
105 | + $total_average_progress +=$avg_progress_in_course; |
|
106 | + |
|
107 | + $time_spent = Tracking::get_time_spent_on_the_course($student_id, $course_id, $session_id); |
|
108 | + $total_time_spent += $time_spent; |
|
109 | + if (!empty($time_spent)) { |
|
110 | + $count_students_accessing++; |
|
111 | + } |
|
112 | + } |
|
113 | + //$total_tools += $nb_assignments + $messages + $links + $chat_last_connection + $documents; |
|
114 | + } |
|
115 | + |
|
116 | + $student_count = count($students); |
|
117 | + |
|
118 | + $array[$i]['count_students'] = $student_count; |
|
119 | + $array[$i]['count_students_accessing'] = 0; |
|
120 | + $array[$i]['count_students_accessing_percentage'] = 0; |
|
121 | + $array[$i]['count_students_complete_all_activities_at_50'] = 0; |
|
122 | + $array[$i]['count_students_complete_all_activities'] = 0; |
|
123 | + $array[$i]['average_percentage_activities_completed_per_student'] = 0; |
|
124 | + $array[$i]['total_time_spent'] = 0; |
|
125 | + $array[$i]['average_time_spent_per_student'] = 0; |
|
126 | + $array[$i]['total_time_spent'] = 0; |
|
127 | + $array[$i]['average_time_spent_per_student'] = 0; |
|
128 | + //$array[$i]['tools_used'] = 0; |
|
129 | + $array[$i]['learnpath_docs'] = 0; |
|
130 | + $array[$i]['learnpath_exercises'] = 0; |
|
131 | + $array[$i]['learnpath_links'] = 0; |
|
132 | + $array[$i]['learnpath_forums'] = 0; |
|
133 | + $array[$i]['learnpath_assignments'] = 0; |
|
134 | + |
|
135 | + //registering the number of each category of |
|
136 | + //items in learning path |
|
137 | + $sql_lpi = "SELECT lpi.item_type FROM $t_lpi lpi |
|
138 | 138 | WHERE c_id = $course_id AND lpi.lp_id = $lp_id |
139 | 139 | ORDER BY item_type"; |
140 | - $res_lpi = Database::query($sql_lpi); |
|
141 | - while ($row_lpi = Database::fetch_array($res_lpi)) { |
|
142 | - switch($row_lpi['item_type']) { |
|
143 | - case 'document': |
|
144 | - $array[$i]['learnpath_docs']++; |
|
145 | - break; |
|
146 | - case 'quiz': |
|
147 | - $array[$i]['learnpath_exercises']++; |
|
148 | - break; |
|
149 | - case 'link': |
|
150 | - $array[$i]['learnpath_links']++; |
|
151 | - break; |
|
152 | - case 'forum': |
|
153 | - case 'thread': |
|
154 | - $array[$i]['learnpath_forums']++; |
|
155 | - break; |
|
156 | - case 'student_publication': |
|
157 | - $array[$i]['learnpath_assignments']++; |
|
158 | - break; |
|
159 | - } |
|
160 | - } |
|
161 | - // Count announcements |
|
162 | - $array[$i]['total_announcements'] = 0; |
|
163 | - $sql_news = "SELECT count(id) FROM $t_news WHERE c_id = $course_id "; |
|
164 | - $res_news = Database::query($sql_news); |
|
165 | - while ($row_news = Database::fetch_array($res_news)) { |
|
166 | - $array[$i]['total_announcements'] = $row_news[0]; |
|
167 | - } |
|
168 | - |
|
169 | - //@todo don't know what means this value |
|
170 | - $count_students_complete_all_activities_at_50 = 0; |
|
171 | - |
|
172 | - if (!empty($student_count)) { |
|
173 | - $array[$i]['count_students_accessing'] = $count_students_accessing; |
|
174 | - $array[$i]['count_students_accessing_percentage'] = round($count_students_accessing / $student_count *100 , 0); |
|
175 | - $array[$i]['count_students_complete_all_activities_at_50'] = $count_students_complete_all_activities; |
|
176 | - $array[$i]['count_students_complete_all_activities'] = round($count_students_complete_all_activities / $student_count *100 , 0);; |
|
177 | - $array[$i]['average_percentage_activities_completed_per_student'] = round($count_students_complete_all_activities/$student_count*100,2); |
|
178 | - $array[$i]['total_time_spent'] = 0; |
|
179 | - $array[$i]['average_time_spent_per_student'] = 0; |
|
180 | - |
|
181 | - if (!empty($total_time_spent)) { |
|
182 | - $array[$i]['total_time_spent'] = api_time_to_hms($total_time_spent); |
|
183 | - $array[$i]['average_time_spent_per_student'] = api_time_to_hms($total_time_spent / $student_count); |
|
184 | - } |
|
185 | - //$array[$i]['tools_used'] = $total_tools; |
|
186 | - } |
|
187 | - $i++; |
|
188 | - } |
|
189 | - } |
|
190 | - } |
|
140 | + $res_lpi = Database::query($sql_lpi); |
|
141 | + while ($row_lpi = Database::fetch_array($res_lpi)) { |
|
142 | + switch($row_lpi['item_type']) { |
|
143 | + case 'document': |
|
144 | + $array[$i]['learnpath_docs']++; |
|
145 | + break; |
|
146 | + case 'quiz': |
|
147 | + $array[$i]['learnpath_exercises']++; |
|
148 | + break; |
|
149 | + case 'link': |
|
150 | + $array[$i]['learnpath_links']++; |
|
151 | + break; |
|
152 | + case 'forum': |
|
153 | + case 'thread': |
|
154 | + $array[$i]['learnpath_forums']++; |
|
155 | + break; |
|
156 | + case 'student_publication': |
|
157 | + $array[$i]['learnpath_assignments']++; |
|
158 | + break; |
|
159 | + } |
|
160 | + } |
|
161 | + // Count announcements |
|
162 | + $array[$i]['total_announcements'] = 0; |
|
163 | + $sql_news = "SELECT count(id) FROM $t_news WHERE c_id = $course_id "; |
|
164 | + $res_news = Database::query($sql_news); |
|
165 | + while ($row_news = Database::fetch_array($res_news)) { |
|
166 | + $array[$i]['total_announcements'] = $row_news[0]; |
|
167 | + } |
|
168 | + |
|
169 | + //@todo don't know what means this value |
|
170 | + $count_students_complete_all_activities_at_50 = 0; |
|
171 | + |
|
172 | + if (!empty($student_count)) { |
|
173 | + $array[$i]['count_students_accessing'] = $count_students_accessing; |
|
174 | + $array[$i]['count_students_accessing_percentage'] = round($count_students_accessing / $student_count *100 , 0); |
|
175 | + $array[$i]['count_students_complete_all_activities_at_50'] = $count_students_complete_all_activities; |
|
176 | + $array[$i]['count_students_complete_all_activities'] = round($count_students_complete_all_activities / $student_count *100 , 0);; |
|
177 | + $array[$i]['average_percentage_activities_completed_per_student'] = round($count_students_complete_all_activities/$student_count*100,2); |
|
178 | + $array[$i]['total_time_spent'] = 0; |
|
179 | + $array[$i]['average_time_spent_per_student'] = 0; |
|
180 | + |
|
181 | + if (!empty($total_time_spent)) { |
|
182 | + $array[$i]['total_time_spent'] = api_time_to_hms($total_time_spent); |
|
183 | + $array[$i]['average_time_spent_per_student'] = api_time_to_hms($total_time_spent / $student_count); |
|
184 | + } |
|
185 | + //$array[$i]['tools_used'] = $total_tools; |
|
186 | + } |
|
187 | + $i++; |
|
188 | + } |
|
189 | + } |
|
190 | + } |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | $headers = array( |
194 | - get_lang('LearningPath'), |
|
195 | - get_lang('Teachers'), |
|
196 | - get_lang('Courses'), |
|
197 | - get_lang('NumberOfStudents'), |
|
198 | - get_lang('NumberStudentsAccessingCourse'), |
|
199 | - get_lang('PercentageStudentsAccessingCourse'), |
|
200 | - get_lang('NumberStudentsCompleteAllActivities'), |
|
201 | - get_lang('PercentageStudentsCompleteAllActivities'), |
|
202 | - get_lang('AverageOfActivitiesCompletedPerStudent'), |
|
203 | - get_lang('TotalTimeSpentInTheCourse'), |
|
204 | - get_lang('AverageTimePerStudentInCourse'), |
|
205 | - get_lang('NumberOfDocumentsInLearnpath'), |
|
206 | - get_lang('NumberOfExercisesInLearnpath'), |
|
207 | - get_lang('NumberOfLinksInLearnpath'), |
|
208 | - get_lang('NumberOfForumsInLearnpath'), |
|
209 | - get_lang('NumberOfAssignmentsInLearnpath'), |
|
210 | - get_lang('NumberOfAnnouncementsInCourse'), |
|
194 | + get_lang('LearningPath'), |
|
195 | + get_lang('Teachers'), |
|
196 | + get_lang('Courses'), |
|
197 | + get_lang('NumberOfStudents'), |
|
198 | + get_lang('NumberStudentsAccessingCourse'), |
|
199 | + get_lang('PercentageStudentsAccessingCourse'), |
|
200 | + get_lang('NumberStudentsCompleteAllActivities'), |
|
201 | + get_lang('PercentageStudentsCompleteAllActivities'), |
|
202 | + get_lang('AverageOfActivitiesCompletedPerStudent'), |
|
203 | + get_lang('TotalTimeSpentInTheCourse'), |
|
204 | + get_lang('AverageTimePerStudentInCourse'), |
|
205 | + get_lang('NumberOfDocumentsInLearnpath'), |
|
206 | + get_lang('NumberOfExercisesInLearnpath'), |
|
207 | + get_lang('NumberOfLinksInLearnpath'), |
|
208 | + get_lang('NumberOfForumsInLearnpath'), |
|
209 | + get_lang('NumberOfAssignmentsInLearnpath'), |
|
210 | + get_lang('NumberOfAnnouncementsInCourse'), |
|
211 | 211 | ); |
212 | 212 | |
213 | 213 | if (isset($_GET['export'])) { |
214 | - global $charset; |
|
214 | + global $charset; |
|
215 | 215 | $spreadsheet = new PHPExcel(); |
216 | 216 | $spreadsheet->setActiveSheetIndex(0); |
217 | 217 | $worksheet = $spreadsheet->getActiveSheet(); |
218 | 218 | |
219 | - $line = 0; |
|
220 | - $column = 0; //skip the first column (row titles) |
|
221 | - |
|
222 | - foreach ($headers as $header) { |
|
223 | - $worksheet->SetCellValueByColumnAndRow($line, $column, $header); |
|
224 | - $column++; |
|
225 | - } |
|
226 | - $line++; |
|
227 | - foreach ($array as $row) { |
|
228 | - $column = 0; |
|
229 | - foreach ($row as $item) { |
|
230 | - $worksheet->SetCellValueByColumnAndRow($line, $column, html_entity_decode(strip_tags($item))); |
|
231 | - $column++; |
|
232 | - } |
|
233 | - $line++; |
|
234 | - } |
|
235 | - $line++; |
|
219 | + $line = 0; |
|
220 | + $column = 0; //skip the first column (row titles) |
|
221 | + |
|
222 | + foreach ($headers as $header) { |
|
223 | + $worksheet->SetCellValueByColumnAndRow($line, $column, $header); |
|
224 | + $column++; |
|
225 | + } |
|
226 | + $line++; |
|
227 | + foreach ($array as $row) { |
|
228 | + $column = 0; |
|
229 | + foreach ($row as $item) { |
|
230 | + $worksheet->SetCellValueByColumnAndRow($line, $column, html_entity_decode(strip_tags($item))); |
|
231 | + $column++; |
|
232 | + } |
|
233 | + $line++; |
|
234 | + } |
|
235 | + $line++; |
|
236 | 236 | |
237 | 237 | $file = api_get_path(SYS_ARCHIVE_PATH).api_replace_dangerous_char($filename); |
238 | 238 | $writer = new PHPExcel_Writer_Excel2007($spreadsheet); |
239 | 239 | $writer->save($file); |
240 | 240 | DocumentManager::file_send_for_download($file, true, $filename); |
241 | - exit; |
|
241 | + exit; |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | $interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('MySpace')); |
@@ -249,20 +249,20 @@ discard block |
||
249 | 249 | $row = 0; |
250 | 250 | $column = 0; |
251 | 251 | foreach ($headers as $header) { |
252 | - $table->setHeaderContents($row, $column, $header); |
|
253 | - $column++; |
|
252 | + $table->setHeaderContents($row, $column, $header); |
|
253 | + $column++; |
|
254 | 254 | } |
255 | 255 | $row++; |
256 | 256 | |
257 | 257 | foreach ($array as $row_table) { |
258 | - $column = 0; |
|
259 | - foreach ($row_table as $cell) { |
|
260 | - $table->setCellContents($row, $column, $cell); |
|
261 | - //$table->updateCellAttributes($row, $column, 'align="center"'); |
|
262 | - $column++; |
|
263 | - } |
|
264 | - $table->updateRowAttributes($row, $row % 2 ? 'class="row_even"' : 'class="row_odd"', true); |
|
265 | - $row++; |
|
258 | + $column = 0; |
|
259 | + foreach ($row_table as $cell) { |
|
260 | + $table->setCellContents($row, $column, $cell); |
|
261 | + //$table->updateCellAttributes($row, $column, 'align="center"'); |
|
262 | + $column++; |
|
263 | + } |
|
264 | + $table->updateRowAttributes($row, $row % 2 ? 'class="row_even"' : 'class="row_odd"', true); |
|
265 | + $row++; |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | echo '<div class="actions">'; |
@@ -33,36 +33,36 @@ |
||
33 | 33 | $result_course = Database::query($sql_course); |
34 | 34 | |
35 | 35 | if (Database::num_rows($result_course) > 0) { |
36 | - if (isset($_POST['export'])) { |
|
37 | - $export_result = export_csv($header, $data, 'test.csv'); // TODO: There is no data for exporting yet. |
|
38 | - Display :: display_error_message($export_result); |
|
39 | - } |
|
40 | - echo '<table class="data_table"><tr><th>'.get_lang('Course').'</th><th>'.get_lang('TempsFrequentation').'</th><th>'.get_lang('Progression').'</th><th>'.get_lang('MoyenneTest').'</th></tr>'; |
|
41 | - $header = array(get_lang('Course', ''), get_lang('TempsFrequentation', ''), get_lang('Progression', ''), get_lang('MoyenneTest', '')); |
|
42 | - while ($a_course = Database::fetch_array($result_course)) { |
|
43 | - // TODO: This query is to be checked, there are no HotPotatoes tests results. |
|
44 | - $sql_moy_test = "SELECT exe_result,exe_weighting |
|
36 | + if (isset($_POST['export'])) { |
|
37 | + $export_result = export_csv($header, $data, 'test.csv'); // TODO: There is no data for exporting yet. |
|
38 | + Display :: display_error_message($export_result); |
|
39 | + } |
|
40 | + echo '<table class="data_table"><tr><th>'.get_lang('Course').'</th><th>'.get_lang('TempsFrequentation').'</th><th>'.get_lang('Progression').'</th><th>'.get_lang('MoyenneTest').'</th></tr>'; |
|
41 | + $header = array(get_lang('Course', ''), get_lang('TempsFrequentation', ''), get_lang('Progression', ''), get_lang('MoyenneTest', '')); |
|
42 | + while ($a_course = Database::fetch_array($result_course)) { |
|
43 | + // TODO: This query is to be checked, there are no HotPotatoes tests results. |
|
44 | + $sql_moy_test = "SELECT exe_result,exe_weighting |
|
45 | 45 | FROM $tbl_track_exercice |
46 | 46 | WHERE c_id = ".$a_course['id']; |
47 | - $result_moy_test = Database::query($sql_moy_test); |
|
48 | - $result = 0; |
|
49 | - $weighting = 0; |
|
50 | - while ($moy_test = Database::fetch_array($result_moy_test)) { |
|
51 | - $result = $result + $moy_test['exe_result']; |
|
52 | - $weighting = $weighting + $moy_test['exe_weighting']; |
|
53 | - } |
|
54 | - if ($weighting != 0) { |
|
55 | - $moyenne_test = round(($result * 100) / $weighting); |
|
56 | - } else { |
|
57 | - $moyenne_test = null; |
|
58 | - } |
|
59 | - echo '<tr><td>'.$a_course['title'].'</td><td> </td><td> </td><td>'.(is_null($moyenne_test) ? '' : $moyenne_test.'%').'</td> </tr>'; |
|
60 | - } |
|
61 | - echo '</table>'; |
|
62 | - echo "<br /><br />"; |
|
63 | - echo "<form method='post'><input type='submit' name='export' value='".get_lang('ExportExcel')."'/><form>"; |
|
47 | + $result_moy_test = Database::query($sql_moy_test); |
|
48 | + $result = 0; |
|
49 | + $weighting = 0; |
|
50 | + while ($moy_test = Database::fetch_array($result_moy_test)) { |
|
51 | + $result = $result + $moy_test['exe_result']; |
|
52 | + $weighting = $weighting + $moy_test['exe_weighting']; |
|
53 | + } |
|
54 | + if ($weighting != 0) { |
|
55 | + $moyenne_test = round(($result * 100) / $weighting); |
|
56 | + } else { |
|
57 | + $moyenne_test = null; |
|
58 | + } |
|
59 | + echo '<tr><td>'.$a_course['title'].'</td><td> </td><td> </td><td>'.(is_null($moyenne_test) ? '' : $moyenne_test.'%').'</td> </tr>'; |
|
60 | + } |
|
61 | + echo '</table>'; |
|
62 | + echo "<br /><br />"; |
|
63 | + echo "<form method='post'><input type='submit' name='export' value='".get_lang('ExportExcel')."'/><form>"; |
|
64 | 64 | } else { |
65 | - echo get_lang('NoCourse'); |
|
65 | + echo get_lang('NoCourse'); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | Display :: display_footer(); |
@@ -16,7 +16,6 @@ |
||
16 | 16 | * @author Patrick Cool |
17 | 17 | * @author René Haentjens, added CSV file import (October 2004) |
18 | 18 | * @package chamilo.link |
19 | - |
|
20 | 19 | */ |
21 | 20 | |
22 | 21 | // Including libraries |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | function _getTempDir() |
228 | 228 | { |
229 | 229 | $tmp_locations = array('/tmp', '/var/tmp', 'c:\WUTemp', 'c:\temp', |
230 | - 'c:\windows\temp', 'c:\winnt\temp'); |
|
230 | + 'c:\windows\temp', 'c:\winnt\temp'); |
|
231 | 231 | |
232 | 232 | /* Try PHP's upload_tmp_dir directive. */ |
233 | 233 | $tmp = ini_get('upload_tmp_dir'); |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | * of elements as $to_lines. |
310 | 310 | */ |
311 | 311 | function Text_MappedDiff($from_lines, $to_lines, |
312 | - $mapped_from_lines, $mapped_to_lines) |
|
312 | + $mapped_from_lines, $mapped_to_lines) |
|
313 | 313 | { |
314 | 314 | assert(count($from_lines) == count($mapped_from_lines)); |
315 | 315 | assert(count($to_lines) == count($mapped_to_lines)); |
@@ -6,15 +6,15 @@ |
||
6 | 6 | */ |
7 | 7 | class Html_Quickform_Rule_Date extends HTML_QuickForm_Rule |
8 | 8 | { |
9 | - /** |
|
10 | - * Function to check a date |
|
11 | - * @see HTML_QuickForm_Rule |
|
12 | - * @param array $date An array with keys F (month), d (day) and Y (year) |
|
13 | - * @return boolean True if date is valid |
|
14 | - */ |
|
15 | - function validate($date, $options) |
|
16 | - { |
|
17 | - $compareDate = create_function('$a', 'return checkdate($a[\'M\'],$a[\'d\'],$a[\'Y\']);'); |
|
9 | + /** |
|
10 | + * Function to check a date |
|
11 | + * @see HTML_QuickForm_Rule |
|
12 | + * @param array $date An array with keys F (month), d (day) and Y (year) |
|
13 | + * @return boolean True if date is valid |
|
14 | + */ |
|
15 | + function validate($date, $options) |
|
16 | + { |
|
17 | + $compareDate = create_function('$a', 'return checkdate($a[\'M\'],$a[\'d\'],$a[\'Y\']);'); |
|
18 | 18 | return $compareDate($date); |
19 | - } |
|
19 | + } |
|
20 | 20 | } |
@@ -56,522 +56,522 @@ |
||
56 | 56 | const VIDEO_VP6 = 4; |
57 | 57 | |
58 | 58 | |
59 | - public function Analyze() |
|
60 | - { |
|
61 | - $info = &$this->getid3->info; |
|
62 | - |
|
63 | - $info['flv'] = array (); |
|
64 | - $info_flv = &$info['flv']; |
|
65 | - |
|
66 | - fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET); |
|
67 | - |
|
68 | - $flv_data_length = $info['avdataend'] - $info['avdataoffset']; |
|
69 | - $flv_header = fread($this->getid3->fp, 5); |
|
70 | - |
|
71 | - $info['fileformat'] = 'flv'; |
|
72 | - $info_flv['header']['signature'] = substr($flv_header, 0, 3); |
|
73 | - $info_flv['header']['version'] = getid3_lib::BigEndian2Int(substr($flv_header, 3, 1)); |
|
74 | - $type_flags = getid3_lib::BigEndian2Int(substr($flv_header, 4, 1)); |
|
75 | - |
|
76 | - $info_flv['header']['hasAudio'] = (bool) ($type_flags & 0x04); |
|
77 | - $info_flv['header']['hasVideo'] = (bool) ($type_flags & 0x01); |
|
78 | - |
|
79 | - $frame_size_data_length = getid3_lib::BigEndian2Int(fread($this->getid3->fp, 4)); |
|
80 | - $flv_header_frame_length = 9; |
|
81 | - if ($frame_size_data_length > $flv_header_frame_length) { |
|
82 | - fseek($this->getid3->fp, $frame_size_data_length - $flv_header_frame_length, SEEK_CUR); |
|
83 | - } |
|
84 | - |
|
85 | - $duration = 0; |
|
86 | - while ((ftell($this->getid3->fp) + 1) < $info['avdataend']) { |
|
87 | - |
|
88 | - $this_tag_header = fread($this->getid3->fp, 16); |
|
89 | - |
|
90 | - $previous_tag_length = getid3_lib::BigEndian2Int(substr($this_tag_header, 0, 4)); |
|
91 | - $tag_type = getid3_lib::BigEndian2Int(substr($this_tag_header, 4, 1)); |
|
92 | - $data_length = getid3_lib::BigEndian2Int(substr($this_tag_header, 5, 3)); |
|
93 | - $timestamp = getid3_lib::BigEndian2Int(substr($this_tag_header, 8, 3)); |
|
94 | - $last_header_byte = getid3_lib::BigEndian2Int(substr($this_tag_header, 15, 1)); |
|
95 | - $next_offset = ftell($this->getid3->fp) - 1 + $data_length; |
|
96 | - |
|
97 | - switch ($tag_type) { |
|
98 | - |
|
99 | - case getid3_flv::TAG_AUDIO: |
|
100 | - if (!isset($info_flv['audio']['audioFormat'])) { |
|
101 | - $info_flv['audio']['audioFormat'] = $last_header_byte & 0x07; |
|
102 | - $info_flv['audio']['audioRate'] = ($last_header_byte & 0x30) / 0x10; |
|
103 | - $info_flv['audio']['audioSampleSize'] = ($last_header_byte & 0x40) / 0x40; |
|
104 | - $info_flv['audio']['audioType'] = ($last_header_byte & 0x80) / 0x80; |
|
105 | - } |
|
106 | - break; |
|
107 | - |
|
108 | - |
|
109 | - case getid3_flv::TAG_VIDEO: |
|
110 | - if (!isset($info_flv['video']['videoCodec'])) { |
|
111 | - $info_flv['video']['videoCodec'] = $last_header_byte & 0x07; |
|
112 | - |
|
113 | - $flv_video_header = fread($this->getid3->fp, 11); |
|
114 | - |
|
115 | - if ($info_flv['video']['videoCodec'] != getid3_flv::VIDEO_VP6) { |
|
116 | - |
|
117 | - $picture_size_type = (getid3_lib::BigEndian2Int(substr($flv_video_header, 3, 2))) >> 7; |
|
118 | - $picture_size_type = $picture_size_type & 0x0007; |
|
119 | - $info_flv['header']['videoSizeType'] = $picture_size_type; |
|
120 | - |
|
121 | - switch ($picture_size_type) { |
|
122 | - case 0: |
|
123 | - $picture_size_enc = getid3_lib::BigEndian2Int(substr($flv_video_header, 5, 2)); |
|
124 | - $picture_size_enc <<= 1; |
|
125 | - $info['video']['resolution_x'] = ($picture_size_enc & 0xFF00) >> 8; |
|
126 | - $picture_size_enc = getid3_lib::BigEndian2Int(substr($flv_video_header, 6, 2)); |
|
127 | - $picture_size_enc <<= 1; |
|
128 | - $info['video']['resolution_y'] = ($picture_size_enc & 0xFF00) >> 8; |
|
129 | - break; |
|
130 | - |
|
131 | - case 1: |
|
132 | - $picture_size_enc = getid3_lib::BigEndian2Int(substr($flv_video_header, 5, 4)); |
|
133 | - $picture_size_enc <<= 1; |
|
134 | - $info['video']['resolution_x'] = ($picture_size_enc & 0xFFFF0000) >> 16; |
|
135 | - |
|
136 | - $picture_size_enc = getid3_lib::BigEndian2Int(substr($flv_video_header, 7, 4)); |
|
137 | - $picture_size_enc <<= 1; |
|
138 | - $info['video']['resolution_y'] = ($picture_size_enc & 0xFFFF0000) >> 16; |
|
139 | - break; |
|
140 | - |
|
141 | - case 2: |
|
142 | - $info['video']['resolution_x'] = 352; |
|
143 | - $info['video']['resolution_y'] = 288; |
|
144 | - break; |
|
145 | - |
|
146 | - case 3: |
|
147 | - $info['video']['resolution_x'] = 176; |
|
148 | - $info['video']['resolution_y'] = 144; |
|
149 | - break; |
|
150 | - |
|
151 | - case 4: |
|
152 | - $info['video']['resolution_x'] = 128; |
|
153 | - $info['video']['resolution_y'] = 96; |
|
154 | - break; |
|
155 | - |
|
156 | - case 5: |
|
157 | - $info['video']['resolution_x'] = 320; |
|
158 | - $info['video']['resolution_y'] = 240; |
|
159 | - break; |
|
160 | - |
|
161 | - case 6: |
|
162 | - $info['video']['resolution_x'] = 160; |
|
163 | - $info['video']['resolution_y'] = 120; |
|
164 | - break; |
|
165 | - |
|
166 | - default: |
|
167 | - $info['video']['resolution_x'] = 0; |
|
168 | - $info['video']['resolution_y'] = 0; |
|
169 | - break; |
|
170 | - } |
|
171 | - } |
|
172 | - } |
|
173 | - break; |
|
174 | - |
|
175 | - |
|
176 | - // Meta tag |
|
177 | - case getid3_flv::TAG_META: |
|
178 | - |
|
179 | - fseek($this->getid3->fp, -1, SEEK_CUR); |
|
180 | - $reader = new AMFReader(new AMFStream(fread($this->getid3->fp, $data_length))); |
|
181 | - $event_name = $reader->readData(); |
|
182 | - $info['meta'][$event_name] = $reader->readData(); |
|
183 | - unset($reader); |
|
184 | - |
|
185 | - $info['video']['frame_rate'] = @$info['meta']['onMetaData']['framerate']; |
|
186 | - $info['video']['resolution_x'] = @$info['meta']['onMetaData']['width']; |
|
187 | - $info['video']['resolution_y'] = @$info['meta']['onMetaData']['height']; |
|
188 | - break; |
|
189 | - |
|
190 | - default: |
|
191 | - // noop |
|
192 | - break; |
|
193 | - } |
|
194 | - |
|
195 | - if ($timestamp > $duration) { |
|
196 | - $duration = $timestamp; |
|
197 | - } |
|
198 | - |
|
199 | - fseek($this->getid3->fp, $next_offset, SEEK_SET); |
|
200 | - } |
|
201 | - |
|
202 | - if ($info['playtime_seconds'] = $duration / 1000) { |
|
203 | - $info['bitrate'] = ($info['avdataend'] - $info['avdataoffset']) / $info['playtime_seconds']; |
|
204 | - } |
|
205 | - |
|
206 | - if ($info_flv['header']['hasAudio']) { |
|
207 | - $info['audio']['codec'] = $this->FLVaudioFormat($info_flv['audio']['audioFormat']); |
|
208 | - $info['audio']['sample_rate'] = $this->FLVaudioRate($info_flv['audio']['audioRate']); |
|
209 | - $info['audio']['bits_per_sample'] = $this->FLVaudioBitDepth($info_flv['audio']['audioSampleSize']); |
|
210 | - |
|
211 | - $info['audio']['channels'] = $info_flv['audio']['audioType'] + 1; // 0=mono,1=stereo |
|
212 | - $info['audio']['lossless'] = ($info_flv['audio']['audioFormat'] ? false : true); // 0=uncompressed |
|
213 | - $info['audio']['dataformat'] = 'flv'; |
|
214 | - } |
|
215 | - if (@$info_flv['header']['hasVideo']) { |
|
216 | - $info['video']['codec'] = $this->FLVvideoCodec($info_flv['video']['videoCodec']); |
|
217 | - $info['video']['dataformat'] = 'flv'; |
|
218 | - $info['video']['lossless'] = false; |
|
219 | - } |
|
220 | - |
|
221 | - return true; |
|
222 | - } |
|
223 | - |
|
224 | - |
|
225 | - public static function FLVaudioFormat($id) { |
|
226 | - |
|
227 | - static $lookup = array( |
|
228 | - 0 => 'uncompressed', |
|
229 | - 1 => 'ADPCM', |
|
230 | - 2 => 'mp3', |
|
231 | - 5 => 'Nellymoser 8kHz mono', |
|
232 | - 6 => 'Nellymoser', |
|
233 | - ); |
|
234 | - return (@$lookup[$id] ? @$lookup[$id] : false); |
|
235 | - } |
|
236 | - |
|
237 | - |
|
238 | - public static function FLVaudioRate($id) { |
|
239 | - |
|
240 | - static $lookup = array( |
|
241 | - 0 => 5500, |
|
242 | - 1 => 11025, |
|
243 | - 2 => 22050, |
|
244 | - 3 => 44100, |
|
245 | - ); |
|
246 | - return (@$lookup[$id] ? @$lookup[$id] : false); |
|
247 | - } |
|
248 | - |
|
249 | - |
|
250 | - public static function FLVaudioBitDepth($id) { |
|
251 | - |
|
252 | - static $lookup = array( |
|
253 | - 0 => 8, |
|
254 | - 1 => 16, |
|
255 | - ); |
|
256 | - return (@$lookup[$id] ? @$lookup[$id] : false); |
|
257 | - } |
|
258 | - |
|
259 | - |
|
260 | - public static function FLVvideoCodec($id) { |
|
261 | - |
|
262 | - static $lookup = array( |
|
263 | - getid3_flv::VIDEO_H263 => 'Sorenson H.263', |
|
264 | - getid3_flv::VIDEO_SCREEN => 'Screen video', |
|
265 | - getid3_flv::VIDEO_VP6 => 'On2 VP6', |
|
266 | - ); |
|
267 | - return (@$lookup[$id] ? @$lookup[$id] : false); |
|
268 | - } |
|
59 | + public function Analyze() |
|
60 | + { |
|
61 | + $info = &$this->getid3->info; |
|
62 | + |
|
63 | + $info['flv'] = array (); |
|
64 | + $info_flv = &$info['flv']; |
|
65 | + |
|
66 | + fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET); |
|
67 | + |
|
68 | + $flv_data_length = $info['avdataend'] - $info['avdataoffset']; |
|
69 | + $flv_header = fread($this->getid3->fp, 5); |
|
70 | + |
|
71 | + $info['fileformat'] = 'flv'; |
|
72 | + $info_flv['header']['signature'] = substr($flv_header, 0, 3); |
|
73 | + $info_flv['header']['version'] = getid3_lib::BigEndian2Int(substr($flv_header, 3, 1)); |
|
74 | + $type_flags = getid3_lib::BigEndian2Int(substr($flv_header, 4, 1)); |
|
75 | + |
|
76 | + $info_flv['header']['hasAudio'] = (bool) ($type_flags & 0x04); |
|
77 | + $info_flv['header']['hasVideo'] = (bool) ($type_flags & 0x01); |
|
78 | + |
|
79 | + $frame_size_data_length = getid3_lib::BigEndian2Int(fread($this->getid3->fp, 4)); |
|
80 | + $flv_header_frame_length = 9; |
|
81 | + if ($frame_size_data_length > $flv_header_frame_length) { |
|
82 | + fseek($this->getid3->fp, $frame_size_data_length - $flv_header_frame_length, SEEK_CUR); |
|
83 | + } |
|
84 | + |
|
85 | + $duration = 0; |
|
86 | + while ((ftell($this->getid3->fp) + 1) < $info['avdataend']) { |
|
87 | + |
|
88 | + $this_tag_header = fread($this->getid3->fp, 16); |
|
89 | + |
|
90 | + $previous_tag_length = getid3_lib::BigEndian2Int(substr($this_tag_header, 0, 4)); |
|
91 | + $tag_type = getid3_lib::BigEndian2Int(substr($this_tag_header, 4, 1)); |
|
92 | + $data_length = getid3_lib::BigEndian2Int(substr($this_tag_header, 5, 3)); |
|
93 | + $timestamp = getid3_lib::BigEndian2Int(substr($this_tag_header, 8, 3)); |
|
94 | + $last_header_byte = getid3_lib::BigEndian2Int(substr($this_tag_header, 15, 1)); |
|
95 | + $next_offset = ftell($this->getid3->fp) - 1 + $data_length; |
|
96 | + |
|
97 | + switch ($tag_type) { |
|
98 | + |
|
99 | + case getid3_flv::TAG_AUDIO: |
|
100 | + if (!isset($info_flv['audio']['audioFormat'])) { |
|
101 | + $info_flv['audio']['audioFormat'] = $last_header_byte & 0x07; |
|
102 | + $info_flv['audio']['audioRate'] = ($last_header_byte & 0x30) / 0x10; |
|
103 | + $info_flv['audio']['audioSampleSize'] = ($last_header_byte & 0x40) / 0x40; |
|
104 | + $info_flv['audio']['audioType'] = ($last_header_byte & 0x80) / 0x80; |
|
105 | + } |
|
106 | + break; |
|
107 | + |
|
108 | + |
|
109 | + case getid3_flv::TAG_VIDEO: |
|
110 | + if (!isset($info_flv['video']['videoCodec'])) { |
|
111 | + $info_flv['video']['videoCodec'] = $last_header_byte & 0x07; |
|
112 | + |
|
113 | + $flv_video_header = fread($this->getid3->fp, 11); |
|
114 | + |
|
115 | + if ($info_flv['video']['videoCodec'] != getid3_flv::VIDEO_VP6) { |
|
116 | + |
|
117 | + $picture_size_type = (getid3_lib::BigEndian2Int(substr($flv_video_header, 3, 2))) >> 7; |
|
118 | + $picture_size_type = $picture_size_type & 0x0007; |
|
119 | + $info_flv['header']['videoSizeType'] = $picture_size_type; |
|
120 | + |
|
121 | + switch ($picture_size_type) { |
|
122 | + case 0: |
|
123 | + $picture_size_enc = getid3_lib::BigEndian2Int(substr($flv_video_header, 5, 2)); |
|
124 | + $picture_size_enc <<= 1; |
|
125 | + $info['video']['resolution_x'] = ($picture_size_enc & 0xFF00) >> 8; |
|
126 | + $picture_size_enc = getid3_lib::BigEndian2Int(substr($flv_video_header, 6, 2)); |
|
127 | + $picture_size_enc <<= 1; |
|
128 | + $info['video']['resolution_y'] = ($picture_size_enc & 0xFF00) >> 8; |
|
129 | + break; |
|
130 | + |
|
131 | + case 1: |
|
132 | + $picture_size_enc = getid3_lib::BigEndian2Int(substr($flv_video_header, 5, 4)); |
|
133 | + $picture_size_enc <<= 1; |
|
134 | + $info['video']['resolution_x'] = ($picture_size_enc & 0xFFFF0000) >> 16; |
|
135 | + |
|
136 | + $picture_size_enc = getid3_lib::BigEndian2Int(substr($flv_video_header, 7, 4)); |
|
137 | + $picture_size_enc <<= 1; |
|
138 | + $info['video']['resolution_y'] = ($picture_size_enc & 0xFFFF0000) >> 16; |
|
139 | + break; |
|
140 | + |
|
141 | + case 2: |
|
142 | + $info['video']['resolution_x'] = 352; |
|
143 | + $info['video']['resolution_y'] = 288; |
|
144 | + break; |
|
145 | + |
|
146 | + case 3: |
|
147 | + $info['video']['resolution_x'] = 176; |
|
148 | + $info['video']['resolution_y'] = 144; |
|
149 | + break; |
|
150 | + |
|
151 | + case 4: |
|
152 | + $info['video']['resolution_x'] = 128; |
|
153 | + $info['video']['resolution_y'] = 96; |
|
154 | + break; |
|
155 | + |
|
156 | + case 5: |
|
157 | + $info['video']['resolution_x'] = 320; |
|
158 | + $info['video']['resolution_y'] = 240; |
|
159 | + break; |
|
160 | + |
|
161 | + case 6: |
|
162 | + $info['video']['resolution_x'] = 160; |
|
163 | + $info['video']['resolution_y'] = 120; |
|
164 | + break; |
|
165 | + |
|
166 | + default: |
|
167 | + $info['video']['resolution_x'] = 0; |
|
168 | + $info['video']['resolution_y'] = 0; |
|
169 | + break; |
|
170 | + } |
|
171 | + } |
|
172 | + } |
|
173 | + break; |
|
174 | + |
|
175 | + |
|
176 | + // Meta tag |
|
177 | + case getid3_flv::TAG_META: |
|
178 | + |
|
179 | + fseek($this->getid3->fp, -1, SEEK_CUR); |
|
180 | + $reader = new AMFReader(new AMFStream(fread($this->getid3->fp, $data_length))); |
|
181 | + $event_name = $reader->readData(); |
|
182 | + $info['meta'][$event_name] = $reader->readData(); |
|
183 | + unset($reader); |
|
184 | + |
|
185 | + $info['video']['frame_rate'] = @$info['meta']['onMetaData']['framerate']; |
|
186 | + $info['video']['resolution_x'] = @$info['meta']['onMetaData']['width']; |
|
187 | + $info['video']['resolution_y'] = @$info['meta']['onMetaData']['height']; |
|
188 | + break; |
|
189 | + |
|
190 | + default: |
|
191 | + // noop |
|
192 | + break; |
|
193 | + } |
|
194 | + |
|
195 | + if ($timestamp > $duration) { |
|
196 | + $duration = $timestamp; |
|
197 | + } |
|
198 | + |
|
199 | + fseek($this->getid3->fp, $next_offset, SEEK_SET); |
|
200 | + } |
|
201 | + |
|
202 | + if ($info['playtime_seconds'] = $duration / 1000) { |
|
203 | + $info['bitrate'] = ($info['avdataend'] - $info['avdataoffset']) / $info['playtime_seconds']; |
|
204 | + } |
|
205 | + |
|
206 | + if ($info_flv['header']['hasAudio']) { |
|
207 | + $info['audio']['codec'] = $this->FLVaudioFormat($info_flv['audio']['audioFormat']); |
|
208 | + $info['audio']['sample_rate'] = $this->FLVaudioRate($info_flv['audio']['audioRate']); |
|
209 | + $info['audio']['bits_per_sample'] = $this->FLVaudioBitDepth($info_flv['audio']['audioSampleSize']); |
|
210 | + |
|
211 | + $info['audio']['channels'] = $info_flv['audio']['audioType'] + 1; // 0=mono,1=stereo |
|
212 | + $info['audio']['lossless'] = ($info_flv['audio']['audioFormat'] ? false : true); // 0=uncompressed |
|
213 | + $info['audio']['dataformat'] = 'flv'; |
|
214 | + } |
|
215 | + if (@$info_flv['header']['hasVideo']) { |
|
216 | + $info['video']['codec'] = $this->FLVvideoCodec($info_flv['video']['videoCodec']); |
|
217 | + $info['video']['dataformat'] = 'flv'; |
|
218 | + $info['video']['lossless'] = false; |
|
219 | + } |
|
220 | + |
|
221 | + return true; |
|
222 | + } |
|
223 | + |
|
224 | + |
|
225 | + public static function FLVaudioFormat($id) { |
|
226 | + |
|
227 | + static $lookup = array( |
|
228 | + 0 => 'uncompressed', |
|
229 | + 1 => 'ADPCM', |
|
230 | + 2 => 'mp3', |
|
231 | + 5 => 'Nellymoser 8kHz mono', |
|
232 | + 6 => 'Nellymoser', |
|
233 | + ); |
|
234 | + return (@$lookup[$id] ? @$lookup[$id] : false); |
|
235 | + } |
|
236 | + |
|
237 | + |
|
238 | + public static function FLVaudioRate($id) { |
|
239 | + |
|
240 | + static $lookup = array( |
|
241 | + 0 => 5500, |
|
242 | + 1 => 11025, |
|
243 | + 2 => 22050, |
|
244 | + 3 => 44100, |
|
245 | + ); |
|
246 | + return (@$lookup[$id] ? @$lookup[$id] : false); |
|
247 | + } |
|
248 | + |
|
249 | + |
|
250 | + public static function FLVaudioBitDepth($id) { |
|
251 | + |
|
252 | + static $lookup = array( |
|
253 | + 0 => 8, |
|
254 | + 1 => 16, |
|
255 | + ); |
|
256 | + return (@$lookup[$id] ? @$lookup[$id] : false); |
|
257 | + } |
|
258 | + |
|
259 | + |
|
260 | + public static function FLVvideoCodec($id) { |
|
261 | + |
|
262 | + static $lookup = array( |
|
263 | + getid3_flv::VIDEO_H263 => 'Sorenson H.263', |
|
264 | + getid3_flv::VIDEO_SCREEN => 'Screen video', |
|
265 | + getid3_flv::VIDEO_VP6 => 'On2 VP6', |
|
266 | + ); |
|
267 | + return (@$lookup[$id] ? @$lookup[$id] : false); |
|
268 | + } |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | |
272 | 272 | |
273 | 273 | class AMFStream |
274 | 274 | { |
275 | - public $bytes; |
|
276 | - public $pos; |
|
275 | + public $bytes; |
|
276 | + public $pos; |
|
277 | 277 | |
278 | 278 | |
279 | - public function AMFStream($bytes) { |
|
279 | + public function AMFStream($bytes) { |
|
280 | 280 | |
281 | - $this->bytes = $bytes; |
|
282 | - $this->pos = 0; |
|
283 | - } |
|
281 | + $this->bytes = $bytes; |
|
282 | + $this->pos = 0; |
|
283 | + } |
|
284 | 284 | |
285 | 285 | |
286 | - public function readByte() { |
|
286 | + public function readByte() { |
|
287 | 287 | |
288 | - return getid3_lib::BigEndian2Int(substr($this->bytes, $this->pos++, 1)); |
|
289 | - } |
|
288 | + return getid3_lib::BigEndian2Int(substr($this->bytes, $this->pos++, 1)); |
|
289 | + } |
|
290 | 290 | |
291 | 291 | |
292 | - public function readInt() { |
|
292 | + public function readInt() { |
|
293 | 293 | |
294 | - return ($this->readByte() << 8) + $this->readByte(); |
|
295 | - } |
|
294 | + return ($this->readByte() << 8) + $this->readByte(); |
|
295 | + } |
|
296 | 296 | |
297 | 297 | |
298 | - public function readLong() { |
|
298 | + public function readLong() { |
|
299 | 299 | |
300 | - return ($this->readByte() << 24) + ($this->readByte() << 16) + ($this->readByte() << 8) + $this->readByte(); |
|
301 | - } |
|
300 | + return ($this->readByte() << 24) + ($this->readByte() << 16) + ($this->readByte() << 8) + $this->readByte(); |
|
301 | + } |
|
302 | 302 | |
303 | 303 | |
304 | - public function readDouble() { |
|
304 | + public function readDouble() { |
|
305 | 305 | |
306 | - return getid3_lib::BigEndian2Float($this->read(8)); |
|
307 | - } |
|
306 | + return getid3_lib::BigEndian2Float($this->read(8)); |
|
307 | + } |
|
308 | 308 | |
309 | 309 | |
310 | - public function readUTF() { |
|
310 | + public function readUTF() { |
|
311 | 311 | |
312 | - $length = $this->readInt(); |
|
313 | - return $this->read($length); |
|
314 | - } |
|
312 | + $length = $this->readInt(); |
|
313 | + return $this->read($length); |
|
314 | + } |
|
315 | 315 | |
316 | 316 | |
317 | - public function readLongUTF() { |
|
317 | + public function readLongUTF() { |
|
318 | 318 | |
319 | - $length = $this->readLong(); |
|
320 | - return $this->read($length); |
|
321 | - } |
|
319 | + $length = $this->readLong(); |
|
320 | + return $this->read($length); |
|
321 | + } |
|
322 | 322 | |
323 | 323 | |
324 | - public function read($length) { |
|
324 | + public function read($length) { |
|
325 | 325 | |
326 | - $val = substr($this->bytes, $this->pos, $length); |
|
327 | - $this->pos += $length; |
|
328 | - return $val; |
|
329 | - } |
|
326 | + $val = substr($this->bytes, $this->pos, $length); |
|
327 | + $this->pos += $length; |
|
328 | + return $val; |
|
329 | + } |
|
330 | 330 | |
331 | 331 | |
332 | - public function peekByte() { |
|
332 | + public function peekByte() { |
|
333 | 333 | |
334 | - $pos = $this->pos; |
|
335 | - $val = $this->readByte(); |
|
336 | - $this->pos = $pos; |
|
337 | - return $val; |
|
338 | - } |
|
334 | + $pos = $this->pos; |
|
335 | + $val = $this->readByte(); |
|
336 | + $this->pos = $pos; |
|
337 | + return $val; |
|
338 | + } |
|
339 | 339 | |
340 | 340 | |
341 | - public function peekInt() { |
|
341 | + public function peekInt() { |
|
342 | 342 | |
343 | - $pos = $this->pos; |
|
344 | - $val = $this->readInt(); |
|
345 | - $this->pos = $pos; |
|
346 | - return $val; |
|
347 | - } |
|
343 | + $pos = $this->pos; |
|
344 | + $val = $this->readInt(); |
|
345 | + $this->pos = $pos; |
|
346 | + return $val; |
|
347 | + } |
|
348 | 348 | |
349 | 349 | |
350 | - public function peekLong() { |
|
350 | + public function peekLong() { |
|
351 | 351 | |
352 | - $pos = $this->pos; |
|
353 | - $val = $this->readLong(); |
|
354 | - $this->pos = $pos; |
|
355 | - return $val; |
|
356 | - } |
|
352 | + $pos = $this->pos; |
|
353 | + $val = $this->readLong(); |
|
354 | + $this->pos = $pos; |
|
355 | + return $val; |
|
356 | + } |
|
357 | 357 | |
358 | 358 | |
359 | - public function peekDouble() { |
|
359 | + public function peekDouble() { |
|
360 | 360 | |
361 | - $pos = $this->pos; |
|
362 | - $val = $this->readDouble(); |
|
363 | - $this->pos = $pos; |
|
364 | - return $val; |
|
365 | - } |
|
361 | + $pos = $this->pos; |
|
362 | + $val = $this->readDouble(); |
|
363 | + $this->pos = $pos; |
|
364 | + return $val; |
|
365 | + } |
|
366 | 366 | |
367 | 367 | |
368 | - public function peekUTF() { |
|
368 | + public function peekUTF() { |
|
369 | 369 | |
370 | - $pos = $this->pos; |
|
371 | - $val = $this->readUTF(); |
|
372 | - $this->pos = $pos; |
|
373 | - return $val; |
|
374 | - } |
|
370 | + $pos = $this->pos; |
|
371 | + $val = $this->readUTF(); |
|
372 | + $this->pos = $pos; |
|
373 | + return $val; |
|
374 | + } |
|
375 | 375 | |
376 | 376 | |
377 | - public function peekLongUTF() { |
|
377 | + public function peekLongUTF() { |
|
378 | 378 | |
379 | - $pos = $this->pos; |
|
380 | - $val = $this->readLongUTF(); |
|
381 | - $this->pos = $pos; |
|
382 | - return $val; |
|
383 | - } |
|
379 | + $pos = $this->pos; |
|
380 | + $val = $this->readLongUTF(); |
|
381 | + $this->pos = $pos; |
|
382 | + return $val; |
|
383 | + } |
|
384 | 384 | } |
385 | 385 | |
386 | 386 | |
387 | 387 | |
388 | 388 | class AMFReader |
389 | 389 | { |
390 | - public $stream; |
|
390 | + public $stream; |
|
391 | 391 | |
392 | - public function __construct($stream) { |
|
392 | + public function __construct($stream) { |
|
393 | 393 | |
394 | - $this->stream = $stream; |
|
395 | - } |
|
394 | + $this->stream = $stream; |
|
395 | + } |
|
396 | 396 | |
397 | 397 | |
398 | - public function readData() { |
|
398 | + public function readData() { |
|
399 | 399 | |
400 | - $value = null; |
|
400 | + $value = null; |
|
401 | 401 | |
402 | - $type = $this->stream->readByte(); |
|
402 | + $type = $this->stream->readByte(); |
|
403 | 403 | |
404 | - switch($type) { |
|
405 | - // Double |
|
406 | - case 0: |
|
407 | - $value = $this->readDouble(); |
|
408 | - break; |
|
404 | + switch($type) { |
|
405 | + // Double |
|
406 | + case 0: |
|
407 | + $value = $this->readDouble(); |
|
408 | + break; |
|
409 | 409 | |
410 | - // Boolean |
|
411 | - case 1: |
|
412 | - $value = $this->readBoolean(); |
|
413 | - break; |
|
410 | + // Boolean |
|
411 | + case 1: |
|
412 | + $value = $this->readBoolean(); |
|
413 | + break; |
|
414 | 414 | |
415 | - // String |
|
416 | - case 2: |
|
417 | - $value = $this->readString(); |
|
418 | - break; |
|
415 | + // String |
|
416 | + case 2: |
|
417 | + $value = $this->readString(); |
|
418 | + break; |
|
419 | 419 | |
420 | - // Object |
|
421 | - case 3: |
|
422 | - $value = $this->readObject(); |
|
423 | - break; |
|
420 | + // Object |
|
421 | + case 3: |
|
422 | + $value = $this->readObject(); |
|
423 | + break; |
|
424 | 424 | |
425 | - // null |
|
426 | - case 6: |
|
427 | - return null; |
|
428 | - break; |
|
425 | + // null |
|
426 | + case 6: |
|
427 | + return null; |
|
428 | + break; |
|
429 | 429 | |
430 | - // Mixed array |
|
431 | - case 8: |
|
432 | - $value = $this->readMixedArray(); |
|
433 | - break; |
|
430 | + // Mixed array |
|
431 | + case 8: |
|
432 | + $value = $this->readMixedArray(); |
|
433 | + break; |
|
434 | 434 | |
435 | - // Array |
|
436 | - case 10: |
|
437 | - $value = $this->readArray(); |
|
438 | - break; |
|
435 | + // Array |
|
436 | + case 10: |
|
437 | + $value = $this->readArray(); |
|
438 | + break; |
|
439 | 439 | |
440 | - // Date |
|
441 | - case 11: |
|
442 | - $value = $this->readDate(); |
|
443 | - break; |
|
440 | + // Date |
|
441 | + case 11: |
|
442 | + $value = $this->readDate(); |
|
443 | + break; |
|
444 | 444 | |
445 | - // Long string |
|
446 | - case 13: |
|
447 | - $value = $this->readLongString(); |
|
448 | - break; |
|
445 | + // Long string |
|
446 | + case 13: |
|
447 | + $value = $this->readLongString(); |
|
448 | + break; |
|
449 | 449 | |
450 | - // XML (handled as string) |
|
451 | - case 15: |
|
452 | - $value = $this->readXML(); |
|
453 | - break; |
|
450 | + // XML (handled as string) |
|
451 | + case 15: |
|
452 | + $value = $this->readXML(); |
|
453 | + break; |
|
454 | 454 | |
455 | - // Typed object (handled as object) |
|
456 | - case 16: |
|
457 | - $value = $this->readTypedObject(); |
|
458 | - break; |
|
455 | + // Typed object (handled as object) |
|
456 | + case 16: |
|
457 | + $value = $this->readTypedObject(); |
|
458 | + break; |
|
459 | 459 | |
460 | - // Long string |
|
461 | - default: |
|
462 | - $value = '(unknown or unsupported data type)'; |
|
463 | - break; |
|
464 | - } |
|
460 | + // Long string |
|
461 | + default: |
|
462 | + $value = '(unknown or unsupported data type)'; |
|
463 | + break; |
|
464 | + } |
|
465 | 465 | |
466 | - return $value; |
|
467 | - } |
|
466 | + return $value; |
|
467 | + } |
|
468 | 468 | |
469 | 469 | |
470 | - public function readDouble() { |
|
470 | + public function readDouble() { |
|
471 | 471 | |
472 | - return $this->stream->readDouble(); |
|
473 | - } |
|
472 | + return $this->stream->readDouble(); |
|
473 | + } |
|
474 | 474 | |
475 | 475 | |
476 | - public function readBoolean() { |
|
476 | + public function readBoolean() { |
|
477 | 477 | |
478 | - return $this->stream->readByte() == 1; |
|
479 | - } |
|
478 | + return $this->stream->readByte() == 1; |
|
479 | + } |
|
480 | 480 | |
481 | 481 | |
482 | - public function readString() { |
|
482 | + public function readString() { |
|
483 | 483 | |
484 | - return $this->stream->readUTF(); |
|
485 | - } |
|
484 | + return $this->stream->readUTF(); |
|
485 | + } |
|
486 | 486 | |
487 | 487 | |
488 | - public function readObject() { |
|
488 | + public function readObject() { |
|
489 | 489 | |
490 | - // Get highest numerical index - ignored |
|
491 | - $highestIndex = $this->stream->readLong(); |
|
490 | + // Get highest numerical index - ignored |
|
491 | + $highestIndex = $this->stream->readLong(); |
|
492 | 492 | |
493 | - $data = array(); |
|
493 | + $data = array(); |
|
494 | 494 | |
495 | - while ($key = $this->stream->readUTF()) { |
|
496 | - // Mixed array record ends with empty string (0x00 0x00) and 0x09 |
|
497 | - if (($key == '') && ($this->stream->peekByte() == 0x09)) { |
|
498 | - // Consume byte |
|
499 | - $this->stream->readByte(); |
|
500 | - break; |
|
501 | - } |
|
495 | + while ($key = $this->stream->readUTF()) { |
|
496 | + // Mixed array record ends with empty string (0x00 0x00) and 0x09 |
|
497 | + if (($key == '') && ($this->stream->peekByte() == 0x09)) { |
|
498 | + // Consume byte |
|
499 | + $this->stream->readByte(); |
|
500 | + break; |
|
501 | + } |
|
502 | 502 | |
503 | - $data[$key] = $this->readData(); |
|
504 | - } |
|
503 | + $data[$key] = $this->readData(); |
|
504 | + } |
|
505 | 505 | |
506 | - return $data; |
|
507 | - } |
|
506 | + return $data; |
|
507 | + } |
|
508 | 508 | |
509 | 509 | |
510 | - public function readMixedArray() { |
|
510 | + public function readMixedArray() { |
|
511 | 511 | |
512 | - // Get highest numerical index - ignored |
|
513 | - $highestIndex = $this->stream->readLong(); |
|
512 | + // Get highest numerical index - ignored |
|
513 | + $highestIndex = $this->stream->readLong(); |
|
514 | 514 | |
515 | - $data = array(); |
|
515 | + $data = array(); |
|
516 | 516 | |
517 | - while ($key = $this->stream->readUTF()) { |
|
518 | - // Mixed array record ends with empty string (0x00 0x00) and 0x09 |
|
519 | - if (($key == '') && ($this->stream->peekByte() == 0x09)) { |
|
520 | - // Consume byte |
|
521 | - $this->stream->readByte(); |
|
522 | - break; |
|
523 | - } |
|
517 | + while ($key = $this->stream->readUTF()) { |
|
518 | + // Mixed array record ends with empty string (0x00 0x00) and 0x09 |
|
519 | + if (($key == '') && ($this->stream->peekByte() == 0x09)) { |
|
520 | + // Consume byte |
|
521 | + $this->stream->readByte(); |
|
522 | + break; |
|
523 | + } |
|
524 | 524 | |
525 | - if (is_numeric($key)) { |
|
526 | - $key = (float) $key; |
|
527 | - } |
|
525 | + if (is_numeric($key)) { |
|
526 | + $key = (float) $key; |
|
527 | + } |
|
528 | 528 | |
529 | - $data[$key] = $this->readData(); |
|
530 | - } |
|
529 | + $data[$key] = $this->readData(); |
|
530 | + } |
|
531 | 531 | |
532 | - return $data; |
|
533 | - } |
|
532 | + return $data; |
|
533 | + } |
|
534 | 534 | |
535 | 535 | |
536 | - public function readArray() { |
|
536 | + public function readArray() { |
|
537 | 537 | |
538 | - $length = $this->stream->readLong(); |
|
538 | + $length = $this->stream->readLong(); |
|
539 | 539 | |
540 | - $data = array(); |
|
540 | + $data = array(); |
|
541 | 541 | |
542 | - for ($i = 0; $i < count($length); $i++) { |
|
543 | - $data[] = $this->readData(); |
|
544 | - } |
|
542 | + for ($i = 0; $i < count($length); $i++) { |
|
543 | + $data[] = $this->readData(); |
|
544 | + } |
|
545 | 545 | |
546 | - return $data; |
|
547 | - } |
|
546 | + return $data; |
|
547 | + } |
|
548 | 548 | |
549 | 549 | |
550 | - public function readDate() { |
|
550 | + public function readDate() { |
|
551 | 551 | |
552 | - $timestamp = $this->stream->readDouble(); |
|
553 | - $timezone = $this->stream->readInt(); |
|
554 | - return $timestamp; |
|
555 | - } |
|
552 | + $timestamp = $this->stream->readDouble(); |
|
553 | + $timezone = $this->stream->readInt(); |
|
554 | + return $timestamp; |
|
555 | + } |
|
556 | 556 | |
557 | 557 | |
558 | - public function readLongString() { |
|
558 | + public function readLongString() { |
|
559 | 559 | |
560 | - return $this->stream->readLongUTF(); |
|
561 | - } |
|
560 | + return $this->stream->readLongUTF(); |
|
561 | + } |
|
562 | 562 | |
563 | 563 | |
564 | - public function readXML() { |
|
564 | + public function readXML() { |
|
565 | 565 | |
566 | - return $this->stream->readLongUTF(); |
|
567 | - } |
|
566 | + return $this->stream->readLongUTF(); |
|
567 | + } |
|
568 | 568 | |
569 | 569 | |
570 | - public function readTypedObject() { |
|
570 | + public function readTypedObject() { |
|
571 | 571 | |
572 | - $className = $this->stream->readUTF(); |
|
573 | - return $this->readObject(); |
|
574 | - } |
|
572 | + $className = $this->stream->readUTF(); |
|
573 | + return $this->readObject(); |
|
574 | + } |
|
575 | 575 | } |
576 | 576 | |
577 | 577 | ?> |
@@ -693,8 +693,8 @@ discard block |
||
693 | 693 | */ |
694 | 694 | function get_week_from_day($date) { |
695 | 695 | if (!empty($date)) { |
696 | - $time = api_strtotime($date,'UTC'); |
|
697 | - return date('W', $time); |
|
696 | + $time = api_strtotime($date,'UTC'); |
|
697 | + return date('W', $time); |
|
698 | 698 | } else { |
699 | 699 | return date('W'); |
700 | 700 | } |
@@ -712,31 +712,31 @@ discard block |
||
712 | 712 | |
713 | 713 | function substrwords($text,$maxchar,$end='...') |
714 | 714 | { |
715 | - if(strlen($text)>$maxchar) |
|
716 | - { |
|
717 | - $words=explode(" ",$text); |
|
718 | - $output = ''; |
|
719 | - $i=0; |
|
720 | - while(1) |
|
721 | - { |
|
722 | - $length = (strlen($output)+strlen($words[$i])); |
|
723 | - if($length>$maxchar) |
|
724 | - { |
|
725 | - break; |
|
726 | - } |
|
727 | - else |
|
728 | - { |
|
729 | - $output = $output." ".$words[$i]; |
|
730 | - $i++; |
|
731 | - }; |
|
732 | - }; |
|
733 | - } |
|
734 | - else |
|
735 | - { |
|
736 | - $output = $text; |
|
737 | - return $output; |
|
738 | - } |
|
739 | - return $output.$end; |
|
715 | + if(strlen($text)>$maxchar) |
|
716 | + { |
|
717 | + $words=explode(" ",$text); |
|
718 | + $output = ''; |
|
719 | + $i=0; |
|
720 | + while(1) |
|
721 | + { |
|
722 | + $length = (strlen($output)+strlen($words[$i])); |
|
723 | + if($length>$maxchar) |
|
724 | + { |
|
725 | + break; |
|
726 | + } |
|
727 | + else |
|
728 | + { |
|
729 | + $output = $output." ".$words[$i]; |
|
730 | + $i++; |
|
731 | + }; |
|
732 | + }; |
|
733 | + } |
|
734 | + else |
|
735 | + { |
|
736 | + $output = $text; |
|
737 | + return $output; |
|
738 | + } |
|
739 | + return $output.$end; |
|
740 | 740 | } |
741 | 741 | |
742 | 742 | function implode_with_key($glue, $array) { |
@@ -16,7 +16,6 @@ |
||
16 | 16 | * @author Patrick Cool |
17 | 17 | * @author René Haentjens, added CSV file import (October 2004) |
18 | 18 | * @package chamilo.link |
19 | - |
|
20 | 19 | */ |
21 | 20 | |
22 | 21 | // Including libraries |