@@ -17,25 +17,25 @@ |
||
17 | 17 | $list = SubLanguageManager::get_lang_folder_files_list($path); |
18 | 18 | $langs = scandir(api_get_path(SYS_LANG_PATH)); |
19 | 19 | foreach ($langs as $lang) { |
20 | - $dir = api_get_path(SYS_LANG_PATH).$lang; |
|
21 | - if (is_dir($dir) && substr($lang,0,1) != '.' && !empty($lang)) { |
|
20 | + $dir = api_get_path(SYS_LANG_PATH).$lang; |
|
21 | + if (is_dir($dir) && substr($lang,0,1) != '.' && !empty($lang)) { |
|
22 | 22 | echo "$lang..."; |
23 | 23 | $ok = true; |
24 | 24 | foreach ($list as $entry) { |
25 | - $file = $dir.'/'.$entry; |
|
26 | - $out = array(); |
|
27 | - if (is_file($file)) { |
|
25 | + $file = $dir.'/'.$entry; |
|
26 | + $out = array(); |
|
27 | + if (is_file($file)) { |
|
28 | 28 | //$terms = array_merge($terms,SubLanguageManager::get_all_language_variable_in_file($file,true)); |
29 | 29 | @exec('php5 -l '.$file,$out); |
30 | 30 | if (substr($out[0],0,2)!='No') { |
31 | - echo $out[0]."\n"; |
|
32 | - $ok = false; |
|
31 | + echo $out[0]."\n"; |
|
32 | + $ok = false; |
|
33 | + } |
|
33 | 34 | } |
34 | - } |
|
35 | 35 | } |
36 | 36 | if ($ok) { |
37 | - echo "OK\n"; |
|
37 | + echo "OK\n"; |
|
38 | + } |
|
38 | 39 | } |
39 | - } |
|
40 | 40 | } |
41 | 41 | echo "Done\n"; |
@@ -237,10 +237,10 @@ |
||
237 | 237 | * @param int Internal ID used in specific tool table |
238 | 238 | */ |
239 | 239 | function delete_all_values_for_item($course_id, $tool_id, $ref_id) { |
240 | - $table_sf_values = Database :: get_main_table(TABLE_MAIN_SPECIFIC_FIELD_VALUES); |
|
241 | - $sql = 'DELETE FROM %s WHERE course_code = \'%s\' AND tool_id = \'%s\' AND ref_id = %s'; |
|
242 | - $sql = sprintf($sql, $table_sf_values, $course_id, $tool_id, $ref_id); |
|
243 | - Database::query($sql); |
|
240 | + $table_sf_values = Database :: get_main_table(TABLE_MAIN_SPECIFIC_FIELD_VALUES); |
|
241 | + $sql = 'DELETE FROM %s WHERE course_code = \'%s\' AND tool_id = \'%s\' AND ref_id = %s'; |
|
242 | + $sql = sprintf($sql, $table_sf_values, $course_id, $tool_id, $ref_id); |
|
243 | + Database::query($sql); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | /** |
@@ -38,17 +38,17 @@ |
||
38 | 38 | $needle = Database::escape_string($needle); |
39 | 39 | // search courses where username or firstname or lastname begins likes $needle |
40 | 40 | $sql = 'SELECT code, title FROM '.$tbl_course.' u '. |
41 | - ' WHERE (title LIKE "'.$needle.'%" '. |
|
42 | - ' OR code LIKE "'.$needle.'%" '. |
|
43 | - ' ) '. |
|
44 | - ' ORDER BY title, code '. |
|
45 | - ' LIMIT 11'; |
|
41 | + ' WHERE (title LIKE "'.$needle.'%" '. |
|
42 | + ' OR code LIKE "'.$needle.'%" '. |
|
43 | + ' ) '. |
|
44 | + ' ORDER BY title, code '. |
|
45 | + ' LIMIT 11'; |
|
46 | 46 | $rs = Database::query($sql); |
47 | 47 | $i=0; |
48 | 48 | while ($course = Database :: fetch_array($rs)) { |
49 | 49 | $i++; |
50 | 50 | if ($i<=10) { |
51 | - $return .= '<a href="javascript: void(0);" onclick="javascript: add_user_to_url(\''.addslashes($course['code']).'\',\''.addslashes($course['title']).' ('.addslashes($course['code']).')'.'\')">'.$course['title'].' ('.$course['code'].')</a><br />'; |
|
51 | + $return .= '<a href="javascript: void(0);" onclick="javascript: add_user_to_url(\''.addslashes($course['code']).'\',\''.addslashes($course['title']).' ('.addslashes($course['code']).')'.'\')">'.$course['title'].' ('.$course['code'].')</a><br />'; |
|
52 | 52 | } else { |
53 | 53 | $return .= '...<br />'; |
54 | 54 | } |
@@ -61,134 +61,134 @@ |
||
61 | 61 | |
62 | 62 | if (isset($bundles['AsseticBundle']) && 0) { |
63 | 63 | $container->prependExtensionConfig( |
64 | - 'assetic', |
|
65 | - array( |
|
66 | - 'bundles' => array( |
|
64 | + 'assetic', |
|
65 | + array( |
|
66 | + 'bundles' => array( |
|
67 | 67 | 'ChamiloThemeBundle' |
68 | 68 | ), |
69 | - 'assets' => array( |
|
70 | - 'common_js' => array( |
|
71 | - 'inputs' => array( |
|
72 | - $jsAssets . 'public/vendor/jquery/dist/jquery.js', |
|
73 | - $jsAssets . 'public/vendor/jquery-ui/jquery-ui.js', |
|
74 | - $jsAssets . 'public/vendor/underscore/underscore.js', |
|
75 | - $jsAssets . 'public/vendor/backbone/backbone.js', |
|
76 | - $jsAssets . 'public/vendor/marionette/lib/backbone.marionette.js', |
|
77 | - $jsAssets . 'public/vendor/bootstrap/dist/js/bootstrap.min.js', |
|
78 | - $jsAssets . 'public/vendor/bootbox/bootbox.js', |
|
79 | - $jsAssets . 'public/js/dialogs.js', |
|
80 | - $jsAssets . 'public/js/namespace.js', |
|
81 | - ), |
|
82 | - ), |
|
83 | - 'tools_js' => array( |
|
84 | - 'inputs' => array( |
|
85 | - '@common_js', |
|
86 | - $jsAssets . 'public/vendor/momentjs/moment.js', |
|
87 | - $jsAssets . 'public/vendor/holderjs/holder.js', |
|
88 | - $jsAssets . 'public/vendor/spinjs/spin.js', |
|
89 | - ), |
|
90 | - ), |
|
91 | - 'admin_lte_js' => array( |
|
92 | - 'inputs' => array( |
|
93 | - $lteJs . 'plugins/bootstrap-slider/bootstrap-slider.js', |
|
94 | - $lteJs . 'plugins/datatables/jquery.dataTables.js', |
|
95 | - $lteJs . 'plugins/datatables/dataTables.bootstrap.js', |
|
96 | - $lteJs . 'plugins/slimScroll/jquery.slimscroll.js', |
|
97 | - $jsAssets . 'public/js/adminLTE.js', |
|
98 | - ) |
|
99 | - ), |
|
100 | - 'admin_lte_css' => array( |
|
101 | - 'inputs' => array( |
|
69 | + 'assets' => array( |
|
70 | + 'common_js' => array( |
|
71 | + 'inputs' => array( |
|
72 | + $jsAssets . 'public/vendor/jquery/dist/jquery.js', |
|
73 | + $jsAssets . 'public/vendor/jquery-ui/jquery-ui.js', |
|
74 | + $jsAssets . 'public/vendor/underscore/underscore.js', |
|
75 | + $jsAssets . 'public/vendor/backbone/backbone.js', |
|
76 | + $jsAssets . 'public/vendor/marionette/lib/backbone.marionette.js', |
|
77 | + $jsAssets . 'public/vendor/bootstrap/dist/js/bootstrap.min.js', |
|
78 | + $jsAssets . 'public/vendor/bootbox/bootbox.js', |
|
79 | + $jsAssets . 'public/js/dialogs.js', |
|
80 | + $jsAssets . 'public/js/namespace.js', |
|
81 | + ), |
|
82 | + ), |
|
83 | + 'tools_js' => array( |
|
84 | + 'inputs' => array( |
|
85 | + '@common_js', |
|
86 | + $jsAssets . 'public/vendor/momentjs/moment.js', |
|
87 | + $jsAssets . 'public/vendor/holderjs/holder.js', |
|
88 | + $jsAssets . 'public/vendor/spinjs/spin.js', |
|
89 | + ), |
|
90 | + ), |
|
91 | + 'admin_lte_js' => array( |
|
92 | + 'inputs' => array( |
|
93 | + $lteJs . 'plugins/bootstrap-slider/bootstrap-slider.js', |
|
94 | + $lteJs . 'plugins/datatables/jquery.dataTables.js', |
|
95 | + $lteJs . 'plugins/datatables/dataTables.bootstrap.js', |
|
96 | + $lteJs . 'plugins/slimScroll/jquery.slimscroll.js', |
|
97 | + $jsAssets . 'public/js/adminLTE.js', |
|
98 | + ) |
|
99 | + ), |
|
100 | + 'admin_lte_css' => array( |
|
101 | + 'inputs' => array( |
|
102 | 102 | |
103 | 103 | // $lteCss . 'jQueryUI/jquery-ui-1.10.3.custom.css', |
104 | - $cssAssets . 'vendor/bootstrap/dist/css/bootstrap.min.css', |
|
105 | - $lteCss . 'bootstrap-slider/slider.css', |
|
106 | - $lteCss . 'datatables/dataTables.bootstrap.css', |
|
107 | - $cssAssets . 'vendor/fontawesome/css/font-awesome.min.css', |
|
108 | - $cssAssets . 'vendor/ionicons/css/ionicons.min.css', |
|
109 | - $lteCss . 'AdminLTE.css', |
|
110 | - //$lteFont . 'fontawesome-webfont.eot', |
|
111 | - // $lteFont . 'ionicons.eot', |
|
112 | - ) |
|
113 | - ), |
|
114 | - 'admin_lte_forms_js' => array( |
|
115 | - 'inputs' => array( |
|
116 | - $lteJs . 'plugins/colorpicker/bootstrap-colorpicker.js', |
|
117 | - $lteJs . 'plugins/daterangepicker/daterangepicker.js', |
|
118 | - $lteJs . 'plugins/timepicker/bootstrap-timepicker.js', |
|
119 | - $lteJs . 'plugins/input-mask/jquery.inputmask.js', |
|
120 | - // $lteJs.'plugins/input-mask/*', |
|
121 | - ) |
|
122 | - ), |
|
123 | - 'admin_lte_forms_css' => array( |
|
124 | - 'inputs' => array( |
|
125 | - $lteCss . 'colorpicker/bootstrap-colorpicker.css', |
|
126 | - $lteCss . 'daterangepicker/daterangepicker-bs3.css', |
|
127 | - $lteCss . 'timepicker/bootstrap-timepicker.css', |
|
128 | - ) |
|
129 | - ), |
|
130 | - 'admin_lte_wysiwyg' => array( |
|
131 | - 'inputs' => array( |
|
132 | - $lteJs . 'plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.js', |
|
133 | - ) |
|
134 | - ), |
|
135 | - 'admin_lte_wysiwyg_css' => array( |
|
136 | - 'inputs' => array( |
|
137 | - $lteCss . 'bootstrap-wysihtml5/bootstrap3-wysihtml5.css', |
|
138 | - ) |
|
139 | - ), |
|
140 | - 'admin_lte_morris' => array( |
|
141 | - 'inputs' => array( |
|
142 | - $lteJs . 'plugins/morris/morris.js', |
|
143 | - ) |
|
144 | - ), |
|
145 | - 'admin_lte_morris_css' => array( |
|
146 | - 'inputs' => array( |
|
147 | - $lteCss . 'morris/morris.css', |
|
148 | - ) |
|
149 | - ), |
|
150 | - 'admin_lte_flot' => array( |
|
151 | - 'inputs' => array( |
|
152 | - $lteJs . 'plugins/flot/*', |
|
153 | - ) |
|
154 | - ), |
|
155 | - 'admin_lte_calendar' => array( |
|
156 | - 'inputs' => array( |
|
157 | - $jsAssets . 'public/vendor/fullcalendar/dist/fullcalendar.min.js', |
|
158 | - ) |
|
159 | - ), |
|
160 | - 'admin_lte_calendar_css' => array( |
|
161 | - 'inputs' => array( |
|
162 | - $lteCss . 'fullcalendar/fullcalendar.css', |
|
163 | - ) |
|
164 | - ), |
|
165 | - 'avatar_img' => array( |
|
166 | - 'inputs' => array( |
|
167 | - '@ChamiloThemeBundle/Resources/public/img/avatar.png' |
|
168 | - ) |
|
169 | - ), |
|
170 | - 'admin_lte_all' => array( |
|
171 | - 'inputs' => array( |
|
172 | - '@tools_js', |
|
173 | - '@admin_lte_forms_js', |
|
174 | - '@admin_lte_wysiwyg', |
|
175 | - '@admin_lte_morris', |
|
176 | - '@admin_lte_calendar', |
|
177 | - '@admin_lte_js', |
|
178 | - // '@admin_lte_flot', |
|
179 | - ) |
|
180 | - ), |
|
181 | - 'admin_lte_all_css' => array( |
|
182 | - 'inputs' => array( |
|
183 | - '@admin_lte_calendar_css', |
|
184 | - '@admin_lte_morris_css', |
|
185 | - '@admin_lte_wysiwyg_css', |
|
186 | - '@admin_lte_forms_css', |
|
187 | - '@admin_lte_css' |
|
188 | - ) |
|
189 | - ), |
|
190 | - ) |
|
191 | - ) |
|
104 | + $cssAssets . 'vendor/bootstrap/dist/css/bootstrap.min.css', |
|
105 | + $lteCss . 'bootstrap-slider/slider.css', |
|
106 | + $lteCss . 'datatables/dataTables.bootstrap.css', |
|
107 | + $cssAssets . 'vendor/fontawesome/css/font-awesome.min.css', |
|
108 | + $cssAssets . 'vendor/ionicons/css/ionicons.min.css', |
|
109 | + $lteCss . 'AdminLTE.css', |
|
110 | + //$lteFont . 'fontawesome-webfont.eot', |
|
111 | + // $lteFont . 'ionicons.eot', |
|
112 | + ) |
|
113 | + ), |
|
114 | + 'admin_lte_forms_js' => array( |
|
115 | + 'inputs' => array( |
|
116 | + $lteJs . 'plugins/colorpicker/bootstrap-colorpicker.js', |
|
117 | + $lteJs . 'plugins/daterangepicker/daterangepicker.js', |
|
118 | + $lteJs . 'plugins/timepicker/bootstrap-timepicker.js', |
|
119 | + $lteJs . 'plugins/input-mask/jquery.inputmask.js', |
|
120 | + // $lteJs.'plugins/input-mask/*', |
|
121 | + ) |
|
122 | + ), |
|
123 | + 'admin_lte_forms_css' => array( |
|
124 | + 'inputs' => array( |
|
125 | + $lteCss . 'colorpicker/bootstrap-colorpicker.css', |
|
126 | + $lteCss . 'daterangepicker/daterangepicker-bs3.css', |
|
127 | + $lteCss . 'timepicker/bootstrap-timepicker.css', |
|
128 | + ) |
|
129 | + ), |
|
130 | + 'admin_lte_wysiwyg' => array( |
|
131 | + 'inputs' => array( |
|
132 | + $lteJs . 'plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.js', |
|
133 | + ) |
|
134 | + ), |
|
135 | + 'admin_lte_wysiwyg_css' => array( |
|
136 | + 'inputs' => array( |
|
137 | + $lteCss . 'bootstrap-wysihtml5/bootstrap3-wysihtml5.css', |
|
138 | + ) |
|
139 | + ), |
|
140 | + 'admin_lte_morris' => array( |
|
141 | + 'inputs' => array( |
|
142 | + $lteJs . 'plugins/morris/morris.js', |
|
143 | + ) |
|
144 | + ), |
|
145 | + 'admin_lte_morris_css' => array( |
|
146 | + 'inputs' => array( |
|
147 | + $lteCss . 'morris/morris.css', |
|
148 | + ) |
|
149 | + ), |
|
150 | + 'admin_lte_flot' => array( |
|
151 | + 'inputs' => array( |
|
152 | + $lteJs . 'plugins/flot/*', |
|
153 | + ) |
|
154 | + ), |
|
155 | + 'admin_lte_calendar' => array( |
|
156 | + 'inputs' => array( |
|
157 | + $jsAssets . 'public/vendor/fullcalendar/dist/fullcalendar.min.js', |
|
158 | + ) |
|
159 | + ), |
|
160 | + 'admin_lte_calendar_css' => array( |
|
161 | + 'inputs' => array( |
|
162 | + $lteCss . 'fullcalendar/fullcalendar.css', |
|
163 | + ) |
|
164 | + ), |
|
165 | + 'avatar_img' => array( |
|
166 | + 'inputs' => array( |
|
167 | + '@ChamiloThemeBundle/Resources/public/img/avatar.png' |
|
168 | + ) |
|
169 | + ), |
|
170 | + 'admin_lte_all' => array( |
|
171 | + 'inputs' => array( |
|
172 | + '@tools_js', |
|
173 | + '@admin_lte_forms_js', |
|
174 | + '@admin_lte_wysiwyg', |
|
175 | + '@admin_lte_morris', |
|
176 | + '@admin_lte_calendar', |
|
177 | + '@admin_lte_js', |
|
178 | + // '@admin_lte_flot', |
|
179 | + ) |
|
180 | + ), |
|
181 | + 'admin_lte_all_css' => array( |
|
182 | + 'inputs' => array( |
|
183 | + '@admin_lte_calendar_css', |
|
184 | + '@admin_lte_morris_css', |
|
185 | + '@admin_lte_wysiwyg_css', |
|
186 | + '@admin_lte_forms_css', |
|
187 | + '@admin_lte_css' |
|
188 | + ) |
|
189 | + ), |
|
190 | + ) |
|
191 | + ) |
|
192 | 192 | ); |
193 | 193 | |
194 | 194 | } |
@@ -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', |
@@ -29,29 +29,29 @@ discard block |
||
29 | 29 | $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION); |
30 | 30 | |
31 | 31 | if (isset($_POST['formSent']) && $_POST['formSent']) { |
32 | - $formSent = 1; |
|
33 | - $name = $_POST['name']; |
|
34 | - $year_start = $_POST['year_start']; |
|
35 | - $month_start = $_POST['month_start']; |
|
36 | - $day_start = $_POST['day_start']; |
|
37 | - $year_end = $_POST['year_end']; |
|
38 | - $month_end = $_POST['month_end']; |
|
39 | - $day_end = $_POST['day_end']; |
|
40 | - $return = SessionManager::create_category_session( |
|
41 | - $name, |
|
42 | - $year_start, |
|
43 | - $month_start, |
|
44 | - $day_start, |
|
45 | - $year_end, |
|
46 | - $month_end, |
|
47 | - $day_end |
|
48 | - ); |
|
49 | - |
|
50 | - if ($return == strval(intval($return))) { |
|
51 | - Display::addFlash(Display::return_message(get_lang('SessionCategoryAdded'))); |
|
52 | - header('Location: session_category_list.php'); |
|
53 | - exit(); |
|
54 | - } |
|
32 | + $formSent = 1; |
|
33 | + $name = $_POST['name']; |
|
34 | + $year_start = $_POST['year_start']; |
|
35 | + $month_start = $_POST['month_start']; |
|
36 | + $day_start = $_POST['day_start']; |
|
37 | + $year_end = $_POST['year_end']; |
|
38 | + $month_end = $_POST['month_end']; |
|
39 | + $day_end = $_POST['day_end']; |
|
40 | + $return = SessionManager::create_category_session( |
|
41 | + $name, |
|
42 | + $year_start, |
|
43 | + $month_start, |
|
44 | + $day_start, |
|
45 | + $year_end, |
|
46 | + $month_end, |
|
47 | + $day_end |
|
48 | + ); |
|
49 | + |
|
50 | + if ($return == strval(intval($return))) { |
|
51 | + Display::addFlash(Display::return_message(get_lang('SessionCategoryAdded'))); |
|
52 | + header('Location: session_category_list.php'); |
|
53 | + exit(); |
|
54 | + } |
|
55 | 55 | } |
56 | 56 | $thisYear = date('Y'); |
57 | 57 | $thisMonth = date('m'); |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | //display the header |
62 | 62 | Display::display_header($tool_name); |
63 | 63 | if (!empty($return)) { |
64 | - Display::display_error_message($return,false); |
|
64 | + Display::display_error_message($return,false); |
|
65 | 65 | } |
66 | 66 | ?> |
67 | 67 | <div class="row"> |
@@ -139,12 +139,12 @@ discard block |
||
139 | 139 | / |
140 | 140 | <select name="year_start"> |
141 | 141 | <?php |
142 | - for ($i=$thisYear-5;$i <= ($thisYear+5);$i++) { |
|
143 | - ?> |
|
142 | + for ($i=$thisYear-5;$i <= ($thisYear+5);$i++) { |
|
143 | + ?> |
|
144 | 144 | <option value="<?php echo $i; ?>" <?php if((!$formSent && $thisYear == $i) || ($formSent && $year_start == $i)) echo 'selected="selected"'; ?> ><?php echo $i; ?></option> |
145 | 145 | <?php |
146 | - } |
|
147 | - ?> |
|
146 | + } |
|
147 | + ?> |
|
148 | 148 | </select> |
149 | 149 | </div> |
150 | 150 | <div class="col-md-3"></div> |
@@ -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)) { |
@@ -14,9 +14,9 @@ discard block |
||
14 | 14 | |
15 | 15 | // load templates |
16 | 16 | function reports_loadTemplates() { |
17 | - global $reports_enabled_templates, $reports_template; |
|
18 | - foreach ($reports_enabled_templates as $t) |
|
19 | - require_once 'templates/'.$t.'.reports.php'; |
|
17 | + global $reports_enabled_templates, $reports_template; |
|
18 | + foreach ($reports_enabled_templates as $t) |
|
19 | + require_once 'templates/'.$t.'.reports.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | |
@@ -149,18 +149,18 @@ discard block |
||
149 | 149 | */ |
150 | 150 | // return tools ID (parametre is a constant from main_api |
151 | 151 | function reports_getToolId($tool) { |
152 | - $tools = array_flip(api_get_tools_lists()); |
|
153 | - if (array_key_exists($tool, $tools)) |
|
154 | - return $tools[$tool]; |
|
155 | - else |
|
156 | - return null; |
|
152 | + $tools = array_flip(api_get_tools_lists()); |
|
153 | + if (array_key_exists($tool, $tools)) |
|
154 | + return $tools[$tool]; |
|
155 | + else |
|
156 | + return null; |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | // return a sql clause returning triplet of (course, $session, $uid) the |
160 | 160 | // current user is authorized to reed |
161 | 161 | function reports_getVisibilitySQL () { |
162 | - return "select cru.user_id from ".Database::get_main_table(TABLE_MAIN_COURSE_USER).' cru'; |
|
163 | - // fixme sessions |
|
162 | + return "select cru.user_id from ".Database::get_main_table(TABLE_MAIN_COURSE_USER).' cru'; |
|
163 | + // fixme sessions |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | // this function execute keys_query (SQL statement) |
@@ -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 | } |