@@ -15,17 +15,12 @@ discard block |
||
15 | 15 | |
16 | 16 | $showCourses = CoursesAndSessionsCatalog::showCourses(); |
17 | 17 | $showSessions = CoursesAndSessionsCatalog::showSessions(); |
18 | -$pageCurrent = isset($pageCurrent) ? $pageCurrent : |
|
19 | - isset($_GET['pageCurrent']) ? intval($_GET['pageCurrent']) : |
|
20 | - 1; |
|
21 | -$pageLength = isset($pageLength) ? $pageLength : |
|
22 | - isset($_GET['pageLength']) ? intval($_GET['pageLength']) : |
|
23 | - 10; |
|
18 | +$pageCurrent = isset($pageCurrent) ? $pageCurrent : isset($_GET['pageCurrent']) ? intval($_GET['pageCurrent']) : 1; |
|
19 | +$pageLength = isset($pageLength) ? $pageLength : isset($_GET['pageLength']) ? intval($_GET['pageLength']) : 10; |
|
24 | 20 | $pageTotal = intval(ceil(intval($countCoursesInCategory) / $pageLength)); |
25 | 21 | $cataloguePagination = $pageTotal > 1 ? |
26 | - getCataloguePagination($pageCurrent, $pageLength, $pageTotal) : |
|
27 | - ''; |
|
28 | -$search_term = isset($search_term) ? $search_term :null; |
|
22 | + getCataloguePagination($pageCurrent, $pageLength, $pageTotal) : ''; |
|
23 | +$search_term = isset($search_term) ? $search_term : null; |
|
29 | 24 | |
30 | 25 | if ($showSessions && isset($_POST['date'])) { |
31 | 26 | $date = $_POST['date']; |
@@ -66,7 +61,7 @@ discard block |
||
66 | 61 | $el.prepend('<?php echo Display::display_icon('nolines_minus.gif'); ?>'); |
67 | 62 | |
68 | 63 | $.ajax({ |
69 | - url: '<?php echo api_get_path(WEB_AJAX_PATH) . 'course.ajax.php' ?>', |
|
64 | + url: '<?php echo api_get_path(WEB_AJAX_PATH).'course.ajax.php' ?>', |
|
70 | 65 | type: 'GET', |
71 | 66 | dataType: 'json', |
72 | 67 | data: { |
@@ -130,13 +125,13 @@ discard block |
||
130 | 125 | <?php |
131 | 126 | |
132 | 127 | $webAction = api_get_path(WEB_CODE_PATH).'auth/courses.php'; |
133 | - $action = (!empty($_REQUEST['action'])?Security::remove_XSS($_REQUEST['action']):'display_courses'); |
|
134 | - $pageLength = (!empty($_REQUEST['pageLength'])?intval($_REQUEST['pageLength']):10); |
|
135 | - $pageCurrent = (!empty($_REQUEST['pageCurrent'])?intval($_REQUEST['pageCurrent']):1); |
|
128 | + $action = (!empty($_REQUEST['action']) ? Security::remove_XSS($_REQUEST['action']) : 'display_courses'); |
|
129 | + $pageLength = (!empty($_REQUEST['pageLength']) ? intval($_REQUEST['pageLength']) : 10); |
|
130 | + $pageCurrent = (!empty($_REQUEST['pageCurrent']) ? intval($_REQUEST['pageCurrent']) : 1); |
|
136 | 131 | $form = '<form action="'.$webAction.'" method="GET" class="form-horizontal">'; |
137 | - $form .= '<input type="hidden" name="action" value="' . $action . '">'; |
|
138 | - $form .= '<input type="hidden" name="pageCurrent" value="' . $pageCurrent . '">'; |
|
139 | - $form .= '<input type="hidden" name="pageLength" value="' . $pageLength . '">'; |
|
132 | + $form .= '<input type="hidden" name="action" value="'.$action.'">'; |
|
133 | + $form .= '<input type="hidden" name="pageCurrent" value="'.$pageCurrent.'">'; |
|
134 | + $form .= '<input type="hidden" name="pageLength" value="'.$pageLength.'">'; |
|
140 | 135 | $form .= '<div class="form-group">'; |
141 | 136 | $form .= '<div class="col-sm-12">'; |
142 | 137 | $form .= '<select name="category_code" onchange="submit();" class="selectpicker show-tick form-control">'; |
@@ -145,11 +140,11 @@ discard block |
||
145 | 140 | $categoryCode = $category['code']; |
146 | 141 | $countCourse = $category['count_courses']; |
147 | 142 | |
148 | - $form .= '<option '. ($categoryCode == $codeType? 'selected="selected" ':'') .' value="' . $category['code'] . '">' . $category['name'] . ' ( '. $countCourse .' ) </option>'; |
|
143 | + $form .= '<option '.($categoryCode == $codeType ? 'selected="selected" ' : '').' value="'.$category['code'].'">'.$category['name'].' ( '.$countCourse.' ) </option>'; |
|
149 | 144 | if (!empty($browse_course_categories[$categoryCode])) { |
150 | - foreach ($browse_course_categories[$categoryCode] as $subCategory){ |
|
145 | + foreach ($browse_course_categories[$categoryCode] as $subCategory) { |
|
151 | 146 | $subCategoryCode = $subCategory['code']; |
152 | - $form .= '<option '. ($subCategoryCode == $codeType ? 'selected="selected" ':'') .' value="' . $subCategory['code'] . '"> ---' . $subCategory['name'] . ' ( '. $subCategory['count_courses'] .' ) </option>'; |
|
147 | + $form .= '<option '.($subCategoryCode == $codeType ? 'selected="selected" ' : '').' value="'.$subCategory['code'].'"> ---'.$subCategory['name'].' ( '.$subCategory['count_courses'].' ) </option>'; |
|
153 | 148 | } |
154 | 149 | } |
155 | 150 | } |
@@ -212,7 +207,7 @@ discard block |
||
212 | 207 | $course_subscribe_allowed = ($course['subscribe'] == 1); |
213 | 208 | $course_unsubscribe_allowed = ($course['unsubscribe'] == 1); |
214 | 209 | $count_connections = $course['count_connections']; |
215 | - $creation_date = substr($course['creation_date'],0,10); |
|
210 | + $creation_date = substr($course['creation_date'], 0, 10); |
|
216 | 211 | |
217 | 212 | $icon_title = null; |
218 | 213 | $html = null; |
@@ -328,9 +323,9 @@ discard block |
||
328 | 323 | $ajax_url = api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=add_course_vote'; |
329 | 324 | $teachers = CourseManager::get_teacher_list_from_course_code_to_string($course['code']); |
330 | 325 | $rating = Display::return_rating_system('star_'.$course['real_id'], $ajax_url.'&course_id='.$course['real_id'], $course['point_info']); |
331 | - $html .= '<h4 class="title"><a href="' . $linkCourse . '">' . cut($title, 60) . '</a></h4>'; |
|
326 | + $html .= '<h4 class="title"><a href="'.$linkCourse.'">'.cut($title, 60).'</a></h4>'; |
|
332 | 327 | $html .= '<div class="teachers">'.$teachers.'</div>'; |
333 | - $html .= '<div class="ranking">'. $rating . '</div>'; |
|
328 | + $html .= '<div class="ranking">'.$rating.'</div>'; |
|
334 | 329 | |
335 | 330 | return $html; |
336 | 331 | } |
@@ -345,8 +340,8 @@ discard block |
||
345 | 340 | $title = $course['title']; |
346 | 341 | $html = ''; |
347 | 342 | if (api_get_setting('show_courses_descriptions_in_catalog') == 'true') { |
348 | - $html = '<a data-title="' . $title . '" class="ajax btn btn-default btn-sm" href="'.api_get_path(WEB_CODE_PATH).'inc/ajax/course_home.ajax.php?a=show_course_information&code='.$course['code'].'" title="' . get_lang('Description') . '">' . |
|
349 | - Display::returnFontAwesomeIcon('info-circle') . '</a>'; |
|
343 | + $html = '<a data-title="'.$title.'" class="ajax btn btn-default btn-sm" href="'.api_get_path(WEB_CODE_PATH).'inc/ajax/course_home.ajax.php?a=show_course_information&code='.$course['code'].'" title="'.get_lang('Description').'">'. |
|
344 | + Display::returnFontAwesomeIcon('info-circle').'</a>'; |
|
350 | 345 | } |
351 | 346 | |
352 | 347 | return $html; |
@@ -358,7 +353,7 @@ discard block |
||
358 | 353 | */ |
359 | 354 | function return_goto_button($course) |
360 | 355 | { |
361 | - $html = ' <a class="btn btn-default btn-sm" title="' . get_lang('GoToCourse') . '" href="'.api_get_course_url($course['code']).'">'. |
|
356 | + $html = ' <a class="btn btn-default btn-sm" title="'.get_lang('GoToCourse').'" href="'.api_get_course_url($course['code']).'">'. |
|
362 | 357 | Display::returnFontAwesomeIcon('share').'</a>'; |
363 | 358 | |
364 | 359 | return $html; |
@@ -392,8 +387,8 @@ discard block |
||
392 | 387 | */ |
393 | 388 | function return_register_button($course, $stok, $code, $search_term) |
394 | 389 | { |
395 | - $html = ' <a class="btn btn-success btn-sm" title="' . get_lang('Subscribe') . '" href="'.api_get_self().'?action=subscribe_course&sec_token='.$stok.'&subscribe_course='.$course['code'].'&search_term='.$search_term.'&category_code='.$code.'">' . |
|
396 | - Display::returnFontAwesomeIcon('sign-in') . '</a>'; |
|
390 | + $html = ' <a class="btn btn-success btn-sm" title="'.get_lang('Subscribe').'" href="'.api_get_self().'?action=subscribe_course&sec_token='.$stok.'&subscribe_course='.$course['code'].'&search_term='.$search_term.'&category_code='.$code.'">'. |
|
391 | + Display::returnFontAwesomeIcon('sign-in').'</a>'; |
|
397 | 392 | return $html; |
398 | 393 | } |
399 | 394 | |
@@ -406,7 +401,7 @@ discard block |
||
406 | 401 | */ |
407 | 402 | function return_unregister_button($course, $stok, $search_term, $code) |
408 | 403 | { |
409 | - $html = ' <a class="btn btn-danger btn-sm" title="' . get_lang('Unsubscribe') . '" href="'. api_get_self().'?action=unsubscribe&sec_token='.$stok.'&unsubscribe='.$course['code'].'&search_term='.$search_term.'&category_code='.$code.'">' . |
|
410 | - Display::returnFontAwesomeIcon('sign-out') . '</a>'; |
|
404 | + $html = ' <a class="btn btn-danger btn-sm" title="'.get_lang('Unsubscribe').'" href="'.api_get_self().'?action=unsubscribe&sec_token='.$stok.'&unsubscribe='.$course['code'].'&search_term='.$search_term.'&category_code='.$code.'">'. |
|
405 | + Display::returnFontAwesomeIcon('sign-out').'</a>'; |
|
411 | 406 | return $html; |
412 | 407 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | if (in_array(strtolower(pathinfo($_FILES['user_file']['name'], PATHINFO_EXTENSION)), $allowed_extensions)) { |
22 | 22 | require_once api_get_path(SYS_CODE_PATH).'newscorm/lp_upload.php'; |
23 | 23 | if (isset($o_ppt) && $first_item_id != 0) { |
24 | - if (api_get_setting('search_enabled')=='true') { |
|
24 | + if (api_get_setting('search_enabled') == 'true') { |
|
25 | 25 | require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php'; |
26 | 26 | $specific_fields = get_specific_field_list(); |
27 | 27 | foreach ($specific_fields as $specific_field) { |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | api_not_allowed(true); |
61 | 61 | } |
62 | 62 | |
63 | -$interbreadcrumb[]= array ("url"=>"../newscorm/lp_controller.php?action=list", "name"=> get_lang("Doc")); |
|
63 | +$interbreadcrumb[] = array("url"=>"../newscorm/lp_controller.php?action=list", "name"=> get_lang("Doc")); |
|
64 | 64 | |
65 | 65 | $nameTools = get_lang("OogieConversionPowerPoint"); |
66 | 66 | Display :: display_header($nameTools); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | $form->addElement('file', 'user_file', array('<img src="../img/powerpoint_big.gif" />', $div_upload_limit)); |
79 | 79 | $form->addElement('checkbox', 'take_slide_name', '', get_lang('TakeSlideName')); |
80 | 80 | if (api_get_setting('search_enabled') == 'true') { |
81 | - require_once(api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php'); |
|
81 | + require_once(api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php'); |
|
82 | 82 | $specific_fields = get_specific_field_list(); |
83 | 83 | $form->addElement('checkbox', 'index_document', '', get_lang('SearchFeatureDoIndexDocument')); |
84 | 84 | $form->addElement('select_language', 'language', get_lang('SearchFeatureDocumentLanguage')); |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | $form->addButtonUpload(get_lang('ConvertToLP'), 'convert'); |
91 | 91 | $form->addElement('hidden', 'ppt2lp', 'true'); |
92 | 92 | $form->add_real_progress_bar(md5(rand(0, 10000)), 'user_file', 1, true); |
93 | -$defaults = array('take_slide_name'=>'checked="checked"','index_document'=>'checked="checked"'); |
|
93 | +$defaults = array('take_slide_name'=>'checked="checked"', 'index_document'=>'checked="checked"'); |
|
94 | 94 | $form->setDefaults($defaults); |
95 | 95 | |
96 | 96 | // display the form |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | include '../inc/global.inc.php'; |
12 | 12 | |
13 | -$form_style= '<style> |
|
13 | +$form_style = '<style> |
|
14 | 14 | .row { |
15 | 15 | width: 200px; |
16 | 16 | } |
@@ -28,20 +28,20 @@ discard block |
||
28 | 28 | </script>'; |
29 | 29 | $htmlHeadXtra[] = $form_style; |
30 | 30 | |
31 | -if (api_get_setting('search_enabled')=='true') { |
|
31 | +if (api_get_setting('search_enabled') == 'true') { |
|
32 | 32 | $specific_fields = get_specific_field_list(); |
33 | 33 | } |
34 | 34 | |
35 | 35 | if (isset($_POST['convert'])) { |
36 | 36 | $cwdir = getcwd(); |
37 | 37 | if (isset($_FILES['user_file'])) { |
38 | - $allowed_extensions = array('doc','docx','odt','txt','sxw','rtf'); |
|
39 | - if (in_array(strtolower(pathinfo($_FILES['user_file']['name'],PATHINFO_EXTENSION)),$allowed_extensions)) { |
|
38 | + $allowed_extensions = array('doc', 'docx', 'odt', 'txt', 'sxw', 'rtf'); |
|
39 | + if (in_array(strtolower(pathinfo($_FILES['user_file']['name'], PATHINFO_EXTENSION)), $allowed_extensions)) { |
|
40 | 40 | require('../newscorm/lp_upload.php'); |
41 | 41 | if (isset($o_doc) && $first_item_id != 0) { |
42 | 42 | // Search-related section |
43 | - if (api_get_setting('search_enabled')=='true') { |
|
44 | - require_once(api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php'); |
|
43 | + if (api_get_setting('search_enabled') == 'true') { |
|
44 | + require_once(api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php'); |
|
45 | 45 | $specific_fields = get_specific_field_list(); |
46 | 46 | |
47 | 47 | foreach ($specific_fields as $specific_field) { |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | api_not_allowed(true); |
78 | 78 | } |
79 | 79 | |
80 | -$interbreadcrumb[]= array ("url"=>"../newscorm/lp_controller.php?action=list", "name"=> get_lang("Doc")); |
|
80 | +$interbreadcrumb[] = array("url"=>"../newscorm/lp_controller.php?action=list", "name"=> get_lang("Doc")); |
|
81 | 81 | $nameTools = get_lang("WoogieConversionPowerPoint"); |
82 | 82 | Display :: display_header($nameTools); |
83 | 83 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | border-color: #4171B5; |
99 | 99 | color: #000;"; |
100 | 100 | |
101 | -$s_style_error="border-width: 1px; |
|
101 | +$s_style_error = "border-width: 1px; |
|
102 | 102 | border-style: solid; |
103 | 103 | margin-left: 0; |
104 | 104 | margin-top: 10px; |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | |
123 | 123 | // build the form |
124 | 124 | |
125 | -$form -> addElement ('html','<br>'); |
|
125 | +$form -> addElement('html', '<br>'); |
|
126 | 126 | |
127 | 127 | $div_upload_limit = ' '.get_lang('UploadMaxSize').' : '.ini_get('post_max_size'); |
128 | 128 | |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | <!-- BEGIN error --><br /><span class="form_error">{error}</span><!-- END error --> |
136 | 136 | </div> |
137 | 137 | EOT; |
138 | -$renderer->setElementTemplate($user_file_template,'user_file'); |
|
138 | +$renderer->setElementTemplate($user_file_template, 'user_file'); |
|
139 | 139 | |
140 | 140 | // set template for other elements |
141 | 141 | $user_file_template = |
@@ -147,16 +147,16 @@ discard block |
||
147 | 147 | EOT; |
148 | 148 | $renderer->setCustomElementTemplate($user_file_template); |
149 | 149 | |
150 | -$form -> addElement ('file', 'user_file','<img src="../img/word_big.gif" align="absbottom" />'); |
|
151 | -if (api_get_setting('search_enabled')=='true') { |
|
152 | - $form -> addElement ('checkbox', 'index_document','', get_lang('SearchFeatureDoIndexDocument')); |
|
153 | - $form -> addElement ('html','<br />'); |
|
154 | - $form -> addElement ('html', get_lang('SearchFeatureDocumentLanguage').': '. api_get_languages_combo()); |
|
155 | - $form -> addElement ('html','<div class="sub-form">'); |
|
150 | +$form -> addElement('file', 'user_file', '<img src="../img/word_big.gif" align="absbottom" />'); |
|
151 | +if (api_get_setting('search_enabled') == 'true') { |
|
152 | + $form -> addElement('checkbox', 'index_document', '', get_lang('SearchFeatureDoIndexDocument')); |
|
153 | + $form -> addElement('html', '<br />'); |
|
154 | + $form -> addElement('html', get_lang('SearchFeatureDocumentLanguage').': '.api_get_languages_combo()); |
|
155 | + $form -> addElement('html', '<div class="sub-form">'); |
|
156 | 156 | foreach ($specific_fields as $specific_field) { |
157 | - $form -> addElement ('text', $specific_field['code'], $specific_field['name'].' : '); |
|
157 | + $form -> addElement('text', $specific_field['code'], $specific_field['name'].' : '); |
|
158 | 158 | } |
159 | - $form -> addElement ('html','</div>'); |
|
159 | + $form -> addElement('html', '</div>'); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | /* |
@@ -164,11 +164,11 @@ discard block |
||
164 | 164 | * $form -> addElement ('radio', 'split_steps',null, get_lang('SplitStepsPerPage'),'per_page'); |
165 | 165 | * $form -> addElement ('radio', 'split_steps',null, get_lang('SplitStepsPerChapter'),'per_chapter'); |
166 | 166 | */ |
167 | -$form -> addElement ('hidden', 'split_steps','per_page'); |
|
168 | -$form -> addElement ('submit', 'convert', get_lang('ConvertToLP'), 'class="convert_button"'); |
|
169 | -$form -> addElement ('hidden', 'woogie', 'true'); |
|
170 | -$form -> add_real_progress_bar(md5(rand(0,10000)), 'user_file', 1, true); |
|
171 | -$defaults = array('split_steps'=>'per_page','index_document'=>'checked="checked"'); |
|
167 | +$form -> addElement('hidden', 'split_steps', 'per_page'); |
|
168 | +$form -> addElement('submit', 'convert', get_lang('ConvertToLP'), 'class="convert_button"'); |
|
169 | +$form -> addElement('hidden', 'woogie', 'true'); |
|
170 | +$form -> add_real_progress_bar(md5(rand(0, 10000)), 'user_file', 1, true); |
|
171 | +$defaults = array('split_steps'=>'per_page', 'index_document'=>'checked="checked"'); |
|
172 | 172 | $form -> setDefaults($defaults); |
173 | 173 | |
174 | 174 | // display the form |
@@ -1,12 +1,12 @@ |
||
1 | 1 | <?php |
2 | 2 | /* For licensing terms, see /license.txt */ |
3 | 3 | /** |
4 | - * Action controller for the upload process. The display scripts (web forms) |
|
5 | - * redirect |
|
6 | - * the process here to do what needs to be done with each file. |
|
7 | - * @package chamilo.upload |
|
8 | - * @author Yannick Warnier <[email protected]> |
|
9 | - */ |
|
4 | + * Action controller for the upload process. The display scripts (web forms) |
|
5 | + * redirect |
|
6 | + * the process here to do what needs to be done with each file. |
|
7 | + * @package chamilo.upload |
|
8 | + * @author Yannick Warnier <[email protected]> |
|
9 | + */ |
|
10 | 10 | |
11 | 11 | include '../inc/global.inc.php'; |
12 | 12 |
@@ -42,14 +42,14 @@ |
||
42 | 42 | |
43 | 43 | |
44 | 44 | //$is_allowed_to_edit = api_is_allowed_to_edit(); |
45 | -$is_allowed_to_edit = api_is_allowed_to_edit(null,true); |
|
46 | -if(!$is_allowed_to_edit){ |
|
45 | +$is_allowed_to_edit = api_is_allowed_to_edit(null, true); |
|
46 | +if (!$is_allowed_to_edit) { |
|
47 | 47 | api_not_allowed(true); |
48 | 48 | } |
49 | 49 | |
50 | -$courseDir = $_course['path'] . "/document"; |
|
50 | +$courseDir = $_course['path']."/document"; |
|
51 | 51 | $sys_course_path = api_get_path(SYS_COURSE_PATH); |
52 | -$base_work_dir = $sys_course_path . $courseDir; |
|
52 | +$base_work_dir = $sys_course_path.$courseDir; |
|
53 | 53 | $noPHP_SELF = true; |
54 | 54 | $max_filled_space = DocumentManager::get_course_quota(); |
55 | 55 |
@@ -17,7 +17,7 @@ |
||
17 | 17 | $result = $objExercise->read($exercise_id); |
18 | 18 | |
19 | 19 | if (!$result) { |
20 | - api_not_allowed(true); |
|
20 | + api_not_allowed(true); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | $interbreadcrumb[] = array( |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $dialogtype = 'error'; |
34 | 34 | } else { |
35 | 35 | if (api_get_setting('search_enabled') == 'true') { |
36 | - require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php'; |
|
36 | + require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php'; |
|
37 | 37 | $specific_fields = get_specific_field_list(); |
38 | 38 | |
39 | 39 | foreach ($specific_fields as $specific_field) { |
@@ -58,5 +58,5 @@ discard block |
||
58 | 58 | $dialogtype = 'confirmation'; |
59 | 59 | } |
60 | 60 | } |
61 | -header('location: ../newscorm/lp_controller.php?action=list&dialog_box=' . $msg . '&dialogtype=' . $dialogtype); |
|
61 | +header('location: ../newscorm/lp_controller.php?action=list&dialog_box='.$msg.'&dialogtype='.$dialogtype); |
|
62 | 62 | exit; |
@@ -9,9 +9,9 @@ discard block |
||
9 | 9 | * @author Yannick Warnier <[email protected]> |
10 | 10 | */ |
11 | 11 | |
12 | -$courseDir = $_course['path'] . "/document"; |
|
12 | +$courseDir = $_course['path']."/document"; |
|
13 | 13 | $sys_course_path = api_get_path(SYS_COURSE_PATH); |
14 | -$base_work_dir = $sys_course_path . $courseDir; |
|
14 | +$base_work_dir = $sys_course_path.$courseDir; |
|
15 | 15 | $noPHP_SELF = true; |
16 | 16 | $max_filled_space = DocumentManager::get_course_quota(); |
17 | 17 | |
@@ -34,14 +34,14 @@ discard block |
||
34 | 34 | |
35 | 35 | $nameTools = get_lang('UplUploadDocument'); |
36 | 36 | $interbreadcrumb[] = array( |
37 | - "url" => "./document.php?curdirpath=" . urlencode( |
|
37 | + "url" => "./document.php?curdirpath=".urlencode( |
|
38 | 38 | $path |
39 | - ) . $req_gid, |
|
39 | + ).$req_gid, |
|
40 | 40 | "name" => $langDocuments |
41 | 41 | ); |
42 | 42 | Display::display_header($nameTools, "Doc"); |
43 | 43 | //show the title |
44 | -api_display_tool_title($nameTools . $add_group_to_title); |
|
44 | +api_display_tool_title($nameTools.$add_group_to_title); |
|
45 | 45 | |
46 | 46 | /** |
47 | 47 | * Process |
@@ -71,11 +71,11 @@ discard block |
||
71 | 71 | $ct = ''; |
72 | 72 | if ($new_comment) $ct .= ", comment='$new_comment'"; |
73 | 73 | if ($new_title) $ct .= ", title='$new_title'"; |
74 | - Database::query("UPDATE $table_document SET" . substr($ct, 1) ." WHERE id = '$docid'"); |
|
74 | + Database::query("UPDATE $table_document SET".substr($ct, 1)." WHERE id = '$docid'"); |
|
75 | 75 | } |
76 | 76 | //check for missing images in html files |
77 | 77 | $missing_files = check_for_missing_files($base_work_dir.$_POST['curdirpath'].$new_path); |
78 | - if ($missing_files) { |
|
78 | + if ($missing_files) { |
|
79 | 79 | //show a form to upload the missing files |
80 | 80 | Display::display_normal_message( |
81 | 81 | build_missing_files_form( |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | if ($number_of_uploaded_images > 0) { |
95 | 95 | //we could also create a function for this, I'm not sure... |
96 | 96 | //create a directory for the missing files |
97 | - $img_directory = str_replace('.','_',$_POST['related_file']."_files"); |
|
97 | + $img_directory = str_replace('.', '_', $_POST['related_file']."_files"); |
|
98 | 98 | $folderData = create_unexisting_directory( |
99 | 99 | $_course, |
100 | 100 | $_user['user_id'], |
@@ -120,15 +120,15 @@ discard block |
||
120 | 120 | replace_img_path_in_html_file( |
121 | 121 | $_POST['img_file_path'], |
122 | 122 | $paths_to_replace_in_file, |
123 | - $base_work_dir . $_POST['related_file'] |
|
123 | + $base_work_dir.$_POST['related_file'] |
|
124 | 124 | ); |
125 | 125 | //update parent folders |
126 | - item_property_update_on_folder($_course,$_POST['curdirpath'],$_user['user_id']); |
|
126 | + item_property_update_on_folder($_course, $_POST['curdirpath'], $_user['user_id']); |
|
127 | 127 | } |
128 | 128 | } |
129 | 129 | //they want to create a directory |
130 | -if (isset($_POST['create_dir']) && $_POST['dirname']!='') { |
|
131 | - $added_slash = ($path=='/')?'':'/'; |
|
130 | +if (isset($_POST['create_dir']) && $_POST['dirname'] != '') { |
|
131 | + $added_slash = ($path == '/') ? '' : '/'; |
|
132 | 132 | $dir_name = $path.$added_slash.api_replace_dangerous_char($_POST['dirname']); |
133 | 133 | $created_dir = create_unexisting_directory( |
134 | 134 | $_course, |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | //create the form that asks for the directory name |
153 | 153 | $new_folder_text = '<form action="'.api_get_self().'" method="POST">'; |
154 | 154 | $new_folder_text .= '<input type="hidden" name="curdirpath" value="'.$path.'"/>'; |
155 | - $new_folder_text .= get_lang('NewDir') .' '; |
|
155 | + $new_folder_text .= get_lang('NewDir').' '; |
|
156 | 156 | $new_folder_text .= '<input type="text" name="dirname"/>'; |
157 | 157 | $new_folder_text .= '<input type="submit" name="create_dir" value="'.get_lang('Ok').'"/>'; |
158 | 158 | $new_folder_text .= '</form>'; |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | <p> |
164 | 164 | <a href="<?php echo api_get_self(); ?>?path=<?php echo $path; ?>&createdir=1"> |
165 | 165 | <img src="../img/new_folder.gif" border="0" align="absmiddle" alt ="" /> |
166 | - <?php echo(get_lang('CreateDir'));?> |
|
166 | + <?php echo(get_lang('CreateDir')); ?> |
|
167 | 167 | </a> |
168 | 168 | </p> |
169 | 169 | <?php |
@@ -186,11 +186,11 @@ discard block |
||
186 | 186 | </td> |
187 | 187 | </tr> |
188 | 188 | <tr> |
189 | - <td><?php echo get_lang('Title');?></td> |
|
189 | + <td><?php echo get_lang('Title'); ?></td> |
|
190 | 190 | <td><input type="text" size="20" name="title" style="width:300px;"></td> |
191 | 191 | </tr> |
192 | 192 | <tr> |
193 | - <td valign="top"><?php echo get_lang('Comment');?></td> |
|
193 | + <td valign="top"><?php echo get_lang('Comment'); ?></td> |
|
194 | 194 | <td><textarea rows="3" cols="20" name="comment" wrap="virtual" style="width:300px;"></textarea></td> |
195 | 195 | </tr> |
196 | 196 | <tr> |
@@ -198,22 +198,22 @@ discard block |
||
198 | 198 | <?php echo get_lang('Options'); ?> |
199 | 199 | </td> |
200 | 200 | <td> |
201 | -- <input type="checkbox" name="unzip" value="1" onclick="check_unzip()"/> <?php echo(get_lang('Uncompress'));?><br/> |
|
202 | -- <?php echo (get_lang('UplWhatIfFileExists'));?><br/> |
|
203 | - <input type="radio" name="if_exists" value="nothing" title="<?php echo (get_lang('UplDoNothingLong'));?>" checked="checked"/> <?php echo (get_lang('UplDoNothing'));?><br/> |
|
204 | - <input type="radio" name="if_exists" value="overwrite" title="<?php echo (get_lang('UplOverwriteLong'));?>"/> <?php echo (get_lang('UplOverwrite'));?><br/> |
|
205 | - <input type="radio" name="if_exists" value="rename" title="<?php echo (get_lang('UplRenameLong'));?>"/> <?php echo (get_lang('UplRename'));?> |
|
201 | +- <input type="checkbox" name="unzip" value="1" onclick="check_unzip()"/> <?php echo(get_lang('Uncompress')); ?><br/> |
|
202 | +- <?php echo (get_lang('UplWhatIfFileExists')); ?><br/> |
|
203 | + <input type="radio" name="if_exists" value="nothing" title="<?php echo (get_lang('UplDoNothingLong')); ?>" checked="checked"/> <?php echo (get_lang('UplDoNothing')); ?><br/> |
|
204 | + <input type="radio" name="if_exists" value="overwrite" title="<?php echo (get_lang('UplOverwriteLong')); ?>"/> <?php echo (get_lang('UplOverwrite')); ?><br/> |
|
205 | + <input type="radio" name="if_exists" value="rename" title="<?php echo (get_lang('UplRenameLong')); ?>"/> <?php echo (get_lang('UplRename')); ?> |
|
206 | 206 | |
207 | 207 | </td> |
208 | 208 | </tr> |
209 | 209 | </table> |
210 | 210 | |
211 | -<input type="submit" value="<?php echo(get_lang('Ok'));?>"> |
|
211 | +<input type="submit" value="<?php echo(get_lang('Ok')); ?>"> |
|
212 | 212 | </form> |
213 | 213 | <!-- end upload form --> |
214 | 214 | |
215 | 215 | <!-- so they can get back to the documents --> |
216 | - <p><?php echo (get_lang('Back'));?> <?php echo (get_lang('To'));?> <a href="document.php?curdirpath=<?php echo $path; ?>"><?php echo (get_lang('DocumentsOverview'));?></a></p> |
|
216 | + <p><?php echo (get_lang('Back')); ?> <?php echo (get_lang('To')); ?> <a href="document.php?curdirpath=<?php echo $path; ?>"><?php echo (get_lang('DocumentsOverview')); ?></a></p> |
|
217 | 217 | <?php |
218 | 218 | |
219 | 219 | Display::display_footer(); |
@@ -65,12 +65,17 @@ |
||
65 | 65 | $new_comment = isset($_POST['comment']) ? trim($_POST['comment']) : ''; |
66 | 66 | $new_title = isset($_POST['title']) ? trim($_POST['title']) : ''; |
67 | 67 | |
68 | - if ($new_path && ($new_comment || $new_title)) |
|
69 | - if (($docid = DocumentManager::get_document_id($_course, $new_path))) { |
|
68 | + if ($new_path && ($new_comment || $new_title)) { |
|
69 | + if (($docid = DocumentManager::get_document_id($_course, $new_path))) { |
|
70 | 70 | $table_document = Database::get_course_table(TABLE_DOCUMENT); |
71 | + } |
|
71 | 72 | $ct = ''; |
72 | - if ($new_comment) $ct .= ", comment='$new_comment'"; |
|
73 | - if ($new_title) $ct .= ", title='$new_title'"; |
|
73 | + if ($new_comment) { |
|
74 | + $ct .= ", comment='$new_comment'"; |
|
75 | + } |
|
76 | + if ($new_title) { |
|
77 | + $ct .= ", title='$new_title'"; |
|
78 | + } |
|
74 | 79 | Database::query("UPDATE $table_document SET" . substr($ct, 1) ." WHERE id = '$docid'"); |
75 | 80 | } |
76 | 81 | //check for missing images in html files |
@@ -48,9 +48,9 @@ discard block |
||
48 | 48 | */ |
49 | 49 | //user has submitted a file |
50 | 50 | if (isset($_FILES['user_upload'])) { |
51 | - $upload_ok = process_uploaded_file($_FILES['user_upload']); |
|
52 | - if ($upload_ok) { |
|
53 | - //file got on the server without problems, now process it |
|
51 | + $upload_ok = process_uploaded_file($_FILES['user_upload']); |
|
52 | + if ($upload_ok) { |
|
53 | + //file got on the server without problems, now process it |
|
54 | 54 | $new_path = handle_uploaded_document( |
55 | 55 | $_course, |
56 | 56 | $_FILES['user_upload'], |
@@ -62,17 +62,17 @@ discard block |
||
62 | 62 | $_POST['unzip'], |
63 | 63 | $_POST['if_exists'] |
64 | 64 | ); |
65 | - $new_comment = isset($_POST['comment']) ? trim($_POST['comment']) : ''; |
|
66 | - $new_title = isset($_POST['title']) ? trim($_POST['title']) : ''; |
|
65 | + $new_comment = isset($_POST['comment']) ? trim($_POST['comment']) : ''; |
|
66 | + $new_title = isset($_POST['title']) ? trim($_POST['title']) : ''; |
|
67 | 67 | |
68 | - if ($new_path && ($new_comment || $new_title)) |
|
69 | - if (($docid = DocumentManager::get_document_id($_course, $new_path))) { |
|
70 | - $table_document = Database::get_course_table(TABLE_DOCUMENT); |
|
71 | - $ct = ''; |
|
72 | - if ($new_comment) $ct .= ", comment='$new_comment'"; |
|
73 | - if ($new_title) $ct .= ", title='$new_title'"; |
|
74 | - Database::query("UPDATE $table_document SET" . substr($ct, 1) ." WHERE id = '$docid'"); |
|
75 | - } |
|
68 | + if ($new_path && ($new_comment || $new_title)) |
|
69 | + if (($docid = DocumentManager::get_document_id($_course, $new_path))) { |
|
70 | + $table_document = Database::get_course_table(TABLE_DOCUMENT); |
|
71 | + $ct = ''; |
|
72 | + if ($new_comment) $ct .= ", comment='$new_comment'"; |
|
73 | + if ($new_title) $ct .= ", title='$new_title'"; |
|
74 | + Database::query("UPDATE $table_document SET" . substr($ct, 1) ." WHERE id = '$docid'"); |
|
75 | + } |
|
76 | 76 | //check for missing images in html files |
77 | 77 | $missing_files = check_for_missing_files($base_work_dir.$_POST['curdirpath'].$new_path); |
78 | 78 | if ($missing_files) { |
@@ -128,8 +128,8 @@ discard block |
||
128 | 128 | } |
129 | 129 | //they want to create a directory |
130 | 130 | if (isset($_POST['create_dir']) && $_POST['dirname']!='') { |
131 | - $added_slash = ($path=='/')?'':'/'; |
|
132 | - $dir_name = $path.$added_slash.api_replace_dangerous_char($_POST['dirname']); |
|
131 | + $added_slash = ($path=='/')?'':'/'; |
|
132 | + $dir_name = $path.$added_slash.api_replace_dangerous_char($_POST['dirname']); |
|
133 | 133 | $created_dir = create_unexisting_directory( |
134 | 134 | $_course, |
135 | 135 | $_user['user_id'], |
@@ -149,15 +149,15 @@ discard block |
||
149 | 149 | } |
150 | 150 | |
151 | 151 | if (isset($_GET['createdir'])) { |
152 | - //create the form that asks for the directory name |
|
153 | - $new_folder_text = '<form action="'.api_get_self().'" method="POST">'; |
|
154 | - $new_folder_text .= '<input type="hidden" name="curdirpath" value="'.$path.'"/>'; |
|
155 | - $new_folder_text .= get_lang('NewDir') .' '; |
|
156 | - $new_folder_text .= '<input type="text" name="dirname"/>'; |
|
157 | - $new_folder_text .= '<input type="submit" name="create_dir" value="'.get_lang('Ok').'"/>'; |
|
158 | - $new_folder_text .= '</form>'; |
|
159 | - //show the form |
|
160 | - Display::display_normal_message($new_folder_text); |
|
152 | + //create the form that asks for the directory name |
|
153 | + $new_folder_text = '<form action="'.api_get_self().'" method="POST">'; |
|
154 | + $new_folder_text .= '<input type="hidden" name="curdirpath" value="'.$path.'"/>'; |
|
155 | + $new_folder_text .= get_lang('NewDir') .' '; |
|
156 | + $new_folder_text .= '<input type="text" name="dirname"/>'; |
|
157 | + $new_folder_text .= '<input type="submit" name="create_dir" value="'.get_lang('Ok').'"/>'; |
|
158 | + $new_folder_text .= '</form>'; |
|
159 | + //show the form |
|
160 | + Display::display_normal_message($new_folder_text); |
|
161 | 161 | } else { //give them a link to create a directory |
162 | 162 | ?> |
163 | 163 | <p> |
@@ -26,14 +26,14 @@ |
||
26 | 26 | * Redirect to the correct script to handle this type of upload |
27 | 27 | */ |
28 | 28 | switch ($_SESSION['my_tool']) { |
29 | - case TOOL_LEARNPATH: |
|
30 | - require 'upload.scorm.php'; |
|
31 | - break; |
|
32 | - //the following cases need to be distinguished later on |
|
33 | - case TOOL_DROPBOX: |
|
34 | - case TOOL_STUDENTPUBLICATION: |
|
35 | - case TOOL_DOCUMENT: |
|
36 | - default: |
|
37 | - require 'upload.document.php'; |
|
38 | - break; |
|
29 | + case TOOL_LEARNPATH: |
|
30 | + require 'upload.scorm.php'; |
|
31 | + break; |
|
32 | + //the following cases need to be distinguished later on |
|
33 | + case TOOL_DROPBOX: |
|
34 | + case TOOL_STUDENTPUBLICATION: |
|
35 | + case TOOL_DOCUMENT: |
|
36 | + default: |
|
37 | + require 'upload.document.php'; |
|
38 | + break; |
|
39 | 39 | } |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | /* For licensing terms, see /license.txt */ |
3 | 3 | /** |
4 | - * Action controller for the upload process. The display scripts (web forms) redirect |
|
5 | - * the process here to do what needs to be done with each file. |
|
6 | - * @package chamilo.upload |
|
7 | - * @author Yannick Warnier <[email protected]> |
|
8 | - */ |
|
4 | + * Action controller for the upload process. The display scripts (web forms) redirect |
|
5 | + * the process here to do what needs to be done with each file. |
|
6 | + * @package chamilo.upload |
|
7 | + * @author Yannick Warnier <[email protected]> |
|
8 | + */ |
|
9 | 9 | |
10 | 10 | require_once '../inc/global.inc.php'; |
11 | 11 |
@@ -12,8 +12,8 @@ discard block |
||
12 | 12 | */ |
13 | 13 | $noPHP_SELF = false; |
14 | 14 | $nameTools = get_lang('FileUpload'); |
15 | -$interbreadcrumb[]= array ("url"=>"../newscorm/lp_controller.php?action=list", "name"=> get_lang(TOOL_DOCUMENT)); |
|
16 | -Display::display_header($nameTools,"Doc"); |
|
15 | +$interbreadcrumb[] = array("url"=>"../newscorm/lp_controller.php?action=list", "name"=> get_lang(TOOL_DOCUMENT)); |
|
16 | +Display::display_header($nameTools, "Doc"); |
|
17 | 17 | //show the title |
18 | 18 | api_display_tool_title($nameTools.$add_group_to_title); |
19 | 19 | ?> |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | <div id="dynamic_div" style="display:block;margin-left:40%;margin-top:10px;height:50px;"> |
22 | 22 | </div> |
23 | 23 | <div id="upload_form_div" name="form_div" style="display:block;"> |
24 | - <form method="POST" action="upload.php" id="upload_form" enctype="multipart/form-data" onsubmit="javascript: myUpload.start('dynamic_div','progressbar_green.gif','<?php echo(get_lang('Uploading', ''));?>','upload_form_div');"> |
|
24 | + <form method="POST" action="upload.php" id="upload_form" enctype="multipart/form-data" onsubmit="javascript: myUpload.start('dynamic_div','progressbar_green.gif','<?php echo(get_lang('Uploading', '')); ?>','upload_form_div');"> |
|
25 | 25 | <input type="hidden" name="curdirpath" value="<?php echo $path; ?>"> |
26 | 26 | <input type="hidden" name="tool" value="<?php echo $my_tool; ?>"> |
27 | 27 | <input type="file" name="user_file"> |
@@ -52,10 +52,10 @@ discard block |
||
52 | 52 | exit; |
53 | 53 | break; |
54 | 54 | case 'create_subgroups': |
55 | - GroupManager::create_subgroups( |
|
56 | - $_POST['base_group'], |
|
57 | - $_POST['number_of_groups'] |
|
58 | - ); |
|
55 | + GroupManager::create_subgroups( |
|
56 | + $_POST['base_group'], |
|
57 | + $_POST['number_of_groups'] |
|
58 | + ); |
|
59 | 59 | Display::addFlash(Display::return_message(get_lang('GroupsAdded'))); |
60 | 60 | header("Location: ".$currentUrl); |
61 | 61 | exit; |
@@ -80,10 +80,10 @@ discard block |
||
80 | 80 | if (isset($_POST['number_of_groups'])) { |
81 | 81 | if (!is_numeric($_POST['number_of_groups']) || intval($_POST['number_of_groups']) < 1) { |
82 | 82 | Display :: display_error_message( |
83 | - get_lang('PleaseEnterValidNumber').'<br /><br /> |
|
83 | + get_lang('PleaseEnterValidNumber').'<br /><br /> |
|
84 | 84 | <a href="group_creation.php?'.api_get_cidreq().'">« '.get_lang('Back').'</a>', |
85 | - false |
|
86 | - ); |
|
85 | + false |
|
86 | + ); |
|
87 | 87 | } else { |
88 | 88 | $number_of_groups = intval($_POST['number_of_groups']); |
89 | 89 | if ($number_of_groups > 1) { |
@@ -121,20 +121,20 @@ discard block |
||
121 | 121 | } |
122 | 122 | </script> |
123 | 123 | <?php |
124 | - } |
|
125 | - $group_categories = GroupManager::get_categories(); |
|
126 | - $group_id = GroupManager :: get_number_of_groups() + 1; |
|
127 | - $cat_options = []; |
|
128 | - foreach ($group_categories as $index => $category) { |
|
129 | - $cat_options[$category['id']] = $category['title']; |
|
130 | - } |
|
124 | + } |
|
125 | + $group_categories = GroupManager::get_categories(); |
|
126 | + $group_id = GroupManager :: get_number_of_groups() + 1; |
|
127 | + $cat_options = []; |
|
128 | + foreach ($group_categories as $index => $category) { |
|
129 | + $cat_options[$category['id']] = $category['title']; |
|
130 | + } |
|
131 | 131 | $form = new FormValidator('create_groups_step2', 'POST', api_get_self().'?'.api_get_cidreq()); |
132 | 132 | |
133 | - // Modify the default templates |
|
134 | - $renderer = $form->defaultRenderer(); |
|
135 | - $form_template = "<form {attributes}>\n<div class='create-groups'>\n<table>\n{content}\n</table>\n</div>\n</form>"; |
|
136 | - $renderer->setFormTemplate($form_template); |
|
137 | - $element_template = <<<EOT |
|
133 | + // Modify the default templates |
|
134 | + $renderer = $form->defaultRenderer(); |
|
135 | + $form_template = "<form {attributes}>\n<div class='create-groups'>\n<table>\n{content}\n</table>\n</div>\n</form>"; |
|
136 | + $renderer->setFormTemplate($form_template); |
|
137 | + $element_template = <<<EOT |
|
138 | 138 | <tr class="separate"> |
139 | 139 | <td> |
140 | 140 | <!-- BEGIN required --> |
@@ -147,149 +147,149 @@ discard block |
||
147 | 147 | </tr> |
148 | 148 | |
149 | 149 | EOT; |
150 | - $renderer->setCustomElementTemplate($element_template); |
|
150 | + $renderer->setCustomElementTemplate($element_template); |
|
151 | 151 | $form->addElement('header', $nameTools); |
152 | - $form->addElement('hidden', 'action'); |
|
153 | - $form->addElement('hidden', 'number_of_groups'); |
|
154 | - $defaults = array(); |
|
155 | - // Table heading |
|
156 | - $group_el = array(); |
|
157 | - $group_el[] = $form->createElement('static', null, null, '<b>'.get_lang('GroupName').'</b>'); |
|
152 | + $form->addElement('hidden', 'action'); |
|
153 | + $form->addElement('hidden', 'number_of_groups'); |
|
154 | + $defaults = array(); |
|
155 | + // Table heading |
|
156 | + $group_el = array(); |
|
157 | + $group_el[] = $form->createElement('static', null, null, '<b>'.get_lang('GroupName').'</b>'); |
|
158 | 158 | |
159 | - if (api_get_setting('allow_group_categories') == 'true') { |
|
160 | - $group_el[] = $form->createElement('static', null, null, '<b>'.get_lang('GroupCategory').'</b>'); |
|
161 | - } |
|
162 | - $group_el[] = $form->createElement('static', null, null, '<b>'.get_lang('GroupPlacesThis').'</b>'); |
|
163 | - $form->addGroup($group_el, 'groups', null, "</td><td>", false); |
|
164 | - // Checkboxes |
|
165 | - if ($_POST['number_of_groups'] > 1) { |
|
166 | - $group_el = array (); |
|
167 | - $group_el[] = $form->createElement('static', null, null, ' '); |
|
168 | - if (api_get_setting('allow_group_categories') == 'true') { |
|
169 | - $group_el[] = $form->createElement('checkbox', 'same_category', null, get_lang('SameForAll'), array('onclick' => "javascript: switch_state('category');")); |
|
170 | - } |
|
171 | - $group_el[] = $form->createElement('checkbox', 'same_places', null, get_lang('SameForAll'), array ('onclick' => "javascript: switch_state('places');")); |
|
172 | - $form->addGroup($group_el, 'groups', null, '</td><td>', false); |
|
173 | - } |
|
174 | - // Properties for all groups |
|
175 | - for ($group_number = 0; $group_number < $_POST['number_of_groups']; $group_number ++) { |
|
176 | - $group_el = array(); |
|
177 | - $group_el[] = $form->createElement('text', 'group_'.$group_number.'_name'); |
|
178 | - if (api_get_setting('allow_group_categories') == 'true') { |
|
179 | - $group_el[] = $form->createElement('select', 'group_'.$group_number.'_category', null, $cat_options, array('id' => 'category_'.$group_number)); |
|
180 | - } |
|
181 | - $group_el[] = $form->createElement('text', 'group_'.$group_number.'_places', null, array('class' => 'span1', 'id' => 'places_'.$group_number)); |
|
159 | + if (api_get_setting('allow_group_categories') == 'true') { |
|
160 | + $group_el[] = $form->createElement('static', null, null, '<b>'.get_lang('GroupCategory').'</b>'); |
|
161 | + } |
|
162 | + $group_el[] = $form->createElement('static', null, null, '<b>'.get_lang('GroupPlacesThis').'</b>'); |
|
163 | + $form->addGroup($group_el, 'groups', null, "</td><td>", false); |
|
164 | + // Checkboxes |
|
165 | + if ($_POST['number_of_groups'] > 1) { |
|
166 | + $group_el = array (); |
|
167 | + $group_el[] = $form->createElement('static', null, null, ' '); |
|
168 | + if (api_get_setting('allow_group_categories') == 'true') { |
|
169 | + $group_el[] = $form->createElement('checkbox', 'same_category', null, get_lang('SameForAll'), array('onclick' => "javascript: switch_state('category');")); |
|
170 | + } |
|
171 | + $group_el[] = $form->createElement('checkbox', 'same_places', null, get_lang('SameForAll'), array ('onclick' => "javascript: switch_state('places');")); |
|
172 | + $form->addGroup($group_el, 'groups', null, '</td><td>', false); |
|
173 | + } |
|
174 | + // Properties for all groups |
|
175 | + for ($group_number = 0; $group_number < $_POST['number_of_groups']; $group_number ++) { |
|
176 | + $group_el = array(); |
|
177 | + $group_el[] = $form->createElement('text', 'group_'.$group_number.'_name'); |
|
178 | + if (api_get_setting('allow_group_categories') == 'true') { |
|
179 | + $group_el[] = $form->createElement('select', 'group_'.$group_number.'_category', null, $cat_options, array('id' => 'category_'.$group_number)); |
|
180 | + } |
|
181 | + $group_el[] = $form->createElement('text', 'group_'.$group_number.'_places', null, array('class' => 'span1', 'id' => 'places_'.$group_number)); |
|
182 | 182 | |
183 | - if ($_POST['number_of_groups'] < 10000) { |
|
184 | - if ($group_id < 10) { |
|
185 | - $prev = '000'; |
|
186 | - } elseif ($group_id < 100) { |
|
187 | - $prev = '00'; |
|
188 | - } elseif ($group_id<1000) { |
|
189 | - $prev = '0'; |
|
190 | - } else { |
|
191 | - $prev = ''; |
|
192 | - } |
|
193 | - } |
|
183 | + if ($_POST['number_of_groups'] < 10000) { |
|
184 | + if ($group_id < 10) { |
|
185 | + $prev = '000'; |
|
186 | + } elseif ($group_id < 100) { |
|
187 | + $prev = '00'; |
|
188 | + } elseif ($group_id<1000) { |
|
189 | + $prev = '0'; |
|
190 | + } else { |
|
191 | + $prev = ''; |
|
192 | + } |
|
193 | + } |
|
194 | 194 | |
195 | - $defaults['group_'.$group_number.'_name'] = get_lang('GroupSingle').' '.$prev.$group_id ++; |
|
196 | - $form->addGroup($group_el, 'group_'.$group_number, null, '</td><td>', false); |
|
197 | - } |
|
198 | - $defaults['action'] = 'create_groups'; |
|
199 | - $defaults['number_of_groups'] = intval($_POST['number_of_groups']); |
|
200 | - $form->setDefaults($defaults); |
|
201 | - $form->addButtonCreate(get_lang('CreateGroup'), 'submit'); |
|
195 | + $defaults['group_'.$group_number.'_name'] = get_lang('GroupSingle').' '.$prev.$group_id ++; |
|
196 | + $form->addGroup($group_el, 'group_'.$group_number, null, '</td><td>', false); |
|
197 | + } |
|
198 | + $defaults['action'] = 'create_groups'; |
|
199 | + $defaults['number_of_groups'] = intval($_POST['number_of_groups']); |
|
200 | + $form->setDefaults($defaults); |
|
201 | + $form->addButtonCreate(get_lang('CreateGroup'), 'submit'); |
|
202 | 202 | $form->display(); |
203 | - } |
|
203 | + } |
|
204 | 204 | } else { |
205 | - /* |
|
205 | + /* |
|
206 | 206 | * Show form to generate new groups |
207 | 207 | */ |
208 | 208 | |
209 | - $create_groups_form = new FormValidator('create_groups', 'post', api_get_self().'?'.api_get_cidreq()); |
|
210 | - $create_groups_form->addElement('header', $nameTools); |
|
211 | - /* $group_el = array (); |
|
209 | + $create_groups_form = new FormValidator('create_groups', 'post', api_get_self().'?'.api_get_cidreq()); |
|
210 | + $create_groups_form->addElement('header', $nameTools); |
|
211 | + /* $group_el = array (); |
|
212 | 212 | $group_el[] = $create_groups_form->createElement('text', 'number_of_groups', array(get_lang('Create'), '1')); |
213 | 213 | $group_el[] = $create_groups_form->addButtonCreate(get_lang('ProceedToCreateGroup'), 'submit', true); |
214 | 214 | $create_groups_form->addGroup($group_el, 'create_groups', get_lang('NumberOfGroupsToCreate'), ' ', false); |
215 | 215 | */ |
216 | 216 | $create_groups_form->addText('number_of_groups',get_lang('NumberOfGroupsToCreate'),null,array('value'=>'1')); |
217 | 217 | $create_groups_form->addButton('submit', get_lang('ProceedToCreateGroup'),'plus','primary'); |
218 | - $defaults = array(); |
|
219 | - $defaults['number_of_groups'] = 1; |
|
220 | - $create_groups_form->setDefaults($defaults); |
|
221 | - $create_groups_form->display(); |
|
218 | + $defaults = array(); |
|
219 | + $defaults['number_of_groups'] = 1; |
|
220 | + $create_groups_form->setDefaults($defaults); |
|
221 | + $create_groups_form->display(); |
|
222 | 222 | |
223 | - /* |
|
223 | + /* |
|
224 | 224 | * Show form to generate subgroups |
225 | 225 | */ |
226 | - if (api_get_setting('allow_group_categories') == 'true' && count(GroupManager :: get_group_list()) > 0) { |
|
227 | - $base_group_options = array (); |
|
228 | - $groups = GroupManager :: get_group_list(); |
|
229 | - foreach ($groups as $index => $group) { |
|
230 | - $number_of_students = GroupManager :: number_of_students($group['id']); |
|
231 | - if ($number_of_students > 0) { |
|
232 | - $base_group_options[$group['id']] = $group['name'].' ('.$number_of_students.' '.get_lang('Users').')'; |
|
233 | - } |
|
234 | - } |
|
235 | - if (count($base_group_options) > 0) { |
|
236 | - $create_subgroups_form = new FormValidator('create_subgroups', 'post', api_get_self().'?'.api_get_cidreq()); |
|
226 | + if (api_get_setting('allow_group_categories') == 'true' && count(GroupManager :: get_group_list()) > 0) { |
|
227 | + $base_group_options = array (); |
|
228 | + $groups = GroupManager :: get_group_list(); |
|
229 | + foreach ($groups as $index => $group) { |
|
230 | + $number_of_students = GroupManager :: number_of_students($group['id']); |
|
231 | + if ($number_of_students > 0) { |
|
232 | + $base_group_options[$group['id']] = $group['name'].' ('.$number_of_students.' '.get_lang('Users').')'; |
|
233 | + } |
|
234 | + } |
|
235 | + if (count($base_group_options) > 0) { |
|
236 | + $create_subgroups_form = new FormValidator('create_subgroups', 'post', api_get_self().'?'.api_get_cidreq()); |
|
237 | 237 | $create_subgroups_form->addElement('header', get_lang('CreateSubgroups')); |
238 | 238 | $create_subgroups_form->addElement('html', get_lang('CreateSubgroupsInfo')); |
239 | - $create_subgroups_form->addElement('hidden', 'action'); |
|
240 | - $group_el = array(); |
|
241 | - $group_el[] = $create_subgroups_form->createElement('static', null, null, get_lang('CreateNumberOfGroups')); |
|
242 | - $group_el[] = $create_subgroups_form->createElement('text', 'number_of_groups', null, array('size' => 3)); |
|
243 | - $group_el[] = $create_subgroups_form->createElement('static', null, null, get_lang('WithUsersFrom')); |
|
244 | - $group_el[] = $create_subgroups_form->createElement('select', 'base_group', null, $base_group_options); |
|
245 | - $group_el[] = $create_subgroups_form->createElement('button', 'submit', get_lang('Ok')); |
|
246 | - $create_subgroups_form->addGroup($group_el, 'create_groups', null, ' ', false); |
|
247 | - $defaults = array(); |
|
248 | - $defaults['action'] = 'create_subgroups'; |
|
249 | - $create_subgroups_form->setDefaults($defaults); |
|
250 | - $create_subgroups_form->display(); |
|
251 | - } |
|
252 | - } |
|
239 | + $create_subgroups_form->addElement('hidden', 'action'); |
|
240 | + $group_el = array(); |
|
241 | + $group_el[] = $create_subgroups_form->createElement('static', null, null, get_lang('CreateNumberOfGroups')); |
|
242 | + $group_el[] = $create_subgroups_form->createElement('text', 'number_of_groups', null, array('size' => 3)); |
|
243 | + $group_el[] = $create_subgroups_form->createElement('static', null, null, get_lang('WithUsersFrom')); |
|
244 | + $group_el[] = $create_subgroups_form->createElement('select', 'base_group', null, $base_group_options); |
|
245 | + $group_el[] = $create_subgroups_form->createElement('button', 'submit', get_lang('Ok')); |
|
246 | + $create_subgroups_form->addGroup($group_el, 'create_groups', null, ' ', false); |
|
247 | + $defaults = array(); |
|
248 | + $defaults['action'] = 'create_subgroups'; |
|
249 | + $create_subgroups_form->setDefaults($defaults); |
|
250 | + $create_subgroups_form->display(); |
|
251 | + } |
|
252 | + } |
|
253 | 253 | |
254 | - /* |
|
254 | + /* |
|
255 | 255 | * Show form to generate groups from classes subscribed to the course |
256 | 256 | */ |
257 | 257 | $options['where'] = array(" usergroup.course_id = ? " => api_get_real_course_id()); |
258 | 258 | $obj = new UserGroup(); |
259 | 259 | $classes = $obj->getUserGroupInCourse($options); |
260 | - if (count($classes) > 0) { |
|
261 | - echo '<b>'.get_lang('GroupsFromClasses').'</b>'; |
|
262 | - echo '<blockquote>'; |
|
263 | - echo '<p>'.get_lang('GroupsFromClassesInfo').'</p>'; |
|
264 | - echo '<ul>'; |
|
265 | - foreach ($classes as $index => $class) { |
|
266 | - $number_of_users = count($obj->get_users_by_usergroup($class['id'])); |
|
267 | - echo '<li>'; |
|
268 | - echo $class['name']; |
|
269 | - echo ' ('.$number_of_users.' '.get_lang('Users').')'; |
|
270 | - echo '</li>'; |
|
271 | - } |
|
272 | - echo '</ul>'; |
|
260 | + if (count($classes) > 0) { |
|
261 | + echo '<b>'.get_lang('GroupsFromClasses').'</b>'; |
|
262 | + echo '<blockquote>'; |
|
263 | + echo '<p>'.get_lang('GroupsFromClassesInfo').'</p>'; |
|
264 | + echo '<ul>'; |
|
265 | + foreach ($classes as $index => $class) { |
|
266 | + $number_of_users = count($obj->get_users_by_usergroup($class['id'])); |
|
267 | + echo '<li>'; |
|
268 | + echo $class['name']; |
|
269 | + echo ' ('.$number_of_users.' '.get_lang('Users').')'; |
|
270 | + echo '</li>'; |
|
271 | + } |
|
272 | + echo '</ul>'; |
|
273 | 273 | |
274 | - $create_class_groups_form = new FormValidator('create_class_groups_form', 'post', api_get_self().'?'.api_get_cidreq()); |
|
275 | - $create_class_groups_form->addElement('hidden', 'action'); |
|
276 | - if (api_get_setting('allow_group_categories') == 'true') { |
|
277 | - $group_categories = GroupManager :: get_categories(); |
|
278 | - $cat_options = array(); |
|
279 | - foreach ($group_categories as $index => $category) { |
|
280 | - $cat_options[$category['id']] = $category['title']; |
|
281 | - } |
|
282 | - $create_class_groups_form->addElement('select', 'group_category', null, $cat_options); |
|
283 | - } else { |
|
284 | - $create_class_groups_form->addElement('hidden', 'group_category'); |
|
285 | - } |
|
286 | - $create_class_groups_form->addElement('submit', 'submit', get_lang('Ok')); |
|
287 | - $defaults['group_category'] = GroupManager::DEFAULT_GROUP_CATEGORY; |
|
288 | - $defaults['action'] = 'create_class_groups'; |
|
289 | - $create_class_groups_form->setDefaults($defaults); |
|
290 | - $create_class_groups_form->display(); |
|
291 | - echo '</blockquote>'; |
|
292 | - } |
|
274 | + $create_class_groups_form = new FormValidator('create_class_groups_form', 'post', api_get_self().'?'.api_get_cidreq()); |
|
275 | + $create_class_groups_form->addElement('hidden', 'action'); |
|
276 | + if (api_get_setting('allow_group_categories') == 'true') { |
|
277 | + $group_categories = GroupManager :: get_categories(); |
|
278 | + $cat_options = array(); |
|
279 | + foreach ($group_categories as $index => $category) { |
|
280 | + $cat_options[$category['id']] = $category['title']; |
|
281 | + } |
|
282 | + $create_class_groups_form->addElement('select', 'group_category', null, $cat_options); |
|
283 | + } else { |
|
284 | + $create_class_groups_form->addElement('hidden', 'group_category'); |
|
285 | + } |
|
286 | + $create_class_groups_form->addElement('submit', 'submit', get_lang('Ok')); |
|
287 | + $defaults['group_category'] = GroupManager::DEFAULT_GROUP_CATEGORY; |
|
288 | + $defaults['action'] = 'create_class_groups'; |
|
289 | + $create_class_groups_form->setDefaults($defaults); |
|
290 | + $create_class_groups_form->display(); |
|
291 | + echo '</blockquote>'; |
|
292 | + } |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | Display :: display_footer(); |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | */ |
7 | 7 | require_once '../inc/global.inc.php'; |
8 | 8 | $this_section = SECTION_COURSES; |
9 | -$current_course_tool = TOOL_GROUP; |
|
9 | +$current_course_tool = TOOL_GROUP; |
|
10 | 10 | |
11 | 11 | // Notice for unauthorized people. |
12 | 12 | api_protect_course_script(true); |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | case 'create_groups': |
20 | 20 | $groups = array(); |
21 | 21 | |
22 | - for ($i = 0; $i < $_POST['number_of_groups']; $i ++) { |
|
22 | + for ($i = 0; $i < $_POST['number_of_groups']; $i++) { |
|
23 | 23 | $group1['name'] = empty($_POST['group_'.$i.'_name']) ? get_lang('Group').' '.$i : $_POST['group_'.$i.'_name']; |
24 | 24 | $group1['category'] = isset($_POST['group_'.$i.'_category']) ? $_POST['group_'.$i.'_category'] : null; |
25 | 25 | $group1['tutor'] = isset($_POST['group_'.$i.'_tutor']) ? $_POST['group_'.$i.'_tutor'] : null; |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | } |
71 | 71 | |
72 | 72 | $nameTools = get_lang('GroupCreation'); |
73 | -$interbreadcrumb[] = array ('url' => 'group.php', 'name' => get_lang('Groups')); |
|
73 | +$interbreadcrumb[] = array('url' => 'group.php', 'name' => get_lang('Groups')); |
|
74 | 74 | Display :: display_header($nameTools, 'Group'); |
75 | 75 | |
76 | 76 | if (!api_is_allowed_to_edit(false, true)) { |
@@ -163,16 +163,16 @@ discard block |
||
163 | 163 | $form->addGroup($group_el, 'groups', null, "</td><td>", false); |
164 | 164 | // Checkboxes |
165 | 165 | if ($_POST['number_of_groups'] > 1) { |
166 | - $group_el = array (); |
|
166 | + $group_el = array(); |
|
167 | 167 | $group_el[] = $form->createElement('static', null, null, ' '); |
168 | 168 | if (api_get_setting('allow_group_categories') == 'true') { |
169 | 169 | $group_el[] = $form->createElement('checkbox', 'same_category', null, get_lang('SameForAll'), array('onclick' => "javascript: switch_state('category');")); |
170 | 170 | } |
171 | - $group_el[] = $form->createElement('checkbox', 'same_places', null, get_lang('SameForAll'), array ('onclick' => "javascript: switch_state('places');")); |
|
171 | + $group_el[] = $form->createElement('checkbox', 'same_places', null, get_lang('SameForAll'), array('onclick' => "javascript: switch_state('places');")); |
|
172 | 172 | $form->addGroup($group_el, 'groups', null, '</td><td>', false); |
173 | 173 | } |
174 | 174 | // Properties for all groups |
175 | - for ($group_number = 0; $group_number < $_POST['number_of_groups']; $group_number ++) { |
|
175 | + for ($group_number = 0; $group_number < $_POST['number_of_groups']; $group_number++) { |
|
176 | 176 | $group_el = array(); |
177 | 177 | $group_el[] = $form->createElement('text', 'group_'.$group_number.'_name'); |
178 | 178 | if (api_get_setting('allow_group_categories') == 'true') { |
@@ -185,14 +185,14 @@ discard block |
||
185 | 185 | $prev = '000'; |
186 | 186 | } elseif ($group_id < 100) { |
187 | 187 | $prev = '00'; |
188 | - } elseif ($group_id<1000) { |
|
188 | + } elseif ($group_id < 1000) { |
|
189 | 189 | $prev = '0'; |
190 | 190 | } else { |
191 | 191 | $prev = ''; |
192 | 192 | } |
193 | 193 | } |
194 | 194 | |
195 | - $defaults['group_'.$group_number.'_name'] = get_lang('GroupSingle').' '.$prev.$group_id ++; |
|
195 | + $defaults['group_'.$group_number.'_name'] = get_lang('GroupSingle').' '.$prev.$group_id++; |
|
196 | 196 | $form->addGroup($group_el, 'group_'.$group_number, null, '</td><td>', false); |
197 | 197 | } |
198 | 198 | $defaults['action'] = 'create_groups'; |
@@ -213,8 +213,8 @@ discard block |
||
213 | 213 | $group_el[] = $create_groups_form->addButtonCreate(get_lang('ProceedToCreateGroup'), 'submit', true); |
214 | 214 | $create_groups_form->addGroup($group_el, 'create_groups', get_lang('NumberOfGroupsToCreate'), ' ', false); |
215 | 215 | */ |
216 | - $create_groups_form->addText('number_of_groups',get_lang('NumberOfGroupsToCreate'),null,array('value'=>'1')); |
|
217 | - $create_groups_form->addButton('submit', get_lang('ProceedToCreateGroup'),'plus','primary'); |
|
216 | + $create_groups_form->addText('number_of_groups', get_lang('NumberOfGroupsToCreate'), null, array('value'=>'1')); |
|
217 | + $create_groups_form->addButton('submit', get_lang('ProceedToCreateGroup'), 'plus', 'primary'); |
|
218 | 218 | $defaults = array(); |
219 | 219 | $defaults['number_of_groups'] = 1; |
220 | 220 | $create_groups_form->setDefaults($defaults); |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | * Show form to generate subgroups |
225 | 225 | */ |
226 | 226 | if (api_get_setting('allow_group_categories') == 'true' && count(GroupManager :: get_group_list()) > 0) { |
227 | - $base_group_options = array (); |
|
227 | + $base_group_options = array(); |
|
228 | 228 | $groups = GroupManager :: get_group_list(); |
229 | 229 | foreach ($groups as $index => $group) { |
230 | 230 | $number_of_students = GroupManager :: number_of_students($group['id']); |