@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | if ($action == 'delete') { |
27 | 27 | CourseCategory::deleteNode($categoryId); |
28 | 28 | Display::addFlash(Display::return_message(get_lang('Deleted'))); |
29 | - header('Location: ' . api_get_self() . '?category=' . Security::remove_XSS($category)); |
|
29 | + header('Location: '.api_get_self().'?category='.Security::remove_XSS($category)); |
|
30 | 30 | exit(); |
31 | 31 | } elseif (($action == 'add' || $action == 'edit') && isset($_POST['formSent']) && $_POST['formSent']) { |
32 | 32 | if ($action == 'add') { |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | } |
55 | 55 | } elseif ($action == 'moveUp') { |
56 | 56 | CourseCategory::moveNodeUp($categoryId, $_GET['tree_pos'], $category); |
57 | - header('Location: ' . api_get_self() . '?category=' . Security::remove_XSS($category)); |
|
57 | + header('Location: '.api_get_self().'?category='.Security::remove_XSS($category)); |
|
58 | 58 | Display::addFlash(Display::return_message(get_lang('Updated'))); |
59 | 59 | exit(); |
60 | 60 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | $form_title = ($action == 'add') ? get_lang('AddACategory') : get_lang('EditNode'); |
80 | 80 | if (!empty($category)) { |
81 | - $form_title .= ' ' . get_lang('Into') . ' ' . Security::remove_XSS($category); |
|
81 | + $form_title .= ' '.get_lang('Into').' '.Security::remove_XSS($category); |
|
82 | 82 | } |
83 | 83 | $url = api_get_self().'?action='.Security::remove_XSS($action).'&category='.Security::remove_XSS($category).'&id='.Security::remove_XSS($categoryId); |
84 | 84 | $form = new FormValidator('course_category', 'post', $url); |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $vimeoMatch = preg_match('#://player.vimeo.com/#i', $matches[1]); |
62 | 62 | $googleMapsMatch = preg_match('#src="https://maps.google.com/#i', $matches[1]); |
63 | 63 | $slideShare = preg_match('#src="(https?:)?//www.slideshare.net/#', $matches[1]); |
64 | - $platformDomain = preg_match('#src="https?://(.+\.)?' . $hostName[1] . '#i', $matches[1]); |
|
64 | + $platformDomain = preg_match('#src="https?://(.+\.)?'.$hostName[1].'#i', $matches[1]); |
|
65 | 65 | |
66 | 66 | if ($youTubeMatch || $vimeoMatch || $googleMapsMatch || $slideShare || $platformDomain) { |
67 | 67 | $extra = ' frameborder="0"'; |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | } elseif ($vimeoMatch) { |
71 | 71 | $extra .= ' webkitAllowFullScreen mozallowfullscreen allowFullScreen'; |
72 | 72 | } |
73 | - return '<iframe ' . $matches[1] . $extra . '></iframe>'; |
|
73 | + return '<iframe '.$matches[1].$extra.'></iframe>'; |
|
74 | 74 | } else { |
75 | 75 | return ''; |
76 | 76 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | 0, //howMany |
75 | 75 | 1, //$orderby = 1 |
76 | 76 | 'ASC', |
77 | - -1, //visibility |
|
77 | + -1, //visibility |
|
78 | 78 | $_GET['q'], |
79 | 79 | null, //$urlId |
80 | 80 | true //AlsoSearchCode |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | |
97 | 97 | if (!empty($course['category_code'])) { |
98 | 98 | $parents = CourseCategory::getParentsToString($course['category_code']); |
99 | - $title = $parents . $course['title']; |
|
99 | + $title = $parents.$course['title']; |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | $results['items'][] = array( |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | INNER JOIN $session_course_user r ON u.user_id = r.user_id |
177 | 177 | WHERE session_id = %d AND c_id = '%s' |
178 | 178 | AND (u.firstname LIKE '%s' OR u.username LIKE '%s' OR u.lastname LIKE '%s')"; |
179 | - $needle = '%' . $_GET['q'] . '%'; |
|
179 | + $needle = '%'.$_GET['q'].'%'; |
|
180 | 180 | $sql_query = sprintf($sql, $_GET['session_id'], $course['real_id'], $needle, $needle, $needle); |
181 | 181 | |
182 | 182 | $result = Database::query($sql_query); |
@@ -195,11 +195,11 @@ discard block |
||
195 | 195 | case 'search_exercise_by_course': |
196 | 196 | if (api_is_platform_admin()) { |
197 | 197 | $course = api_get_course_info_by_id($_GET['course_id']); |
198 | - $session_id = (!empty($_GET['session_id'])) ? intval($_GET['session_id']) : 0 ; |
|
198 | + $session_id = (!empty($_GET['session_id'])) ? intval($_GET['session_id']) : 0; |
|
199 | 199 | $exercises = ExerciseLib::get_all_exercises($course, $session_id, false, $_GET['q'], true, 3); |
200 | 200 | |
201 | 201 | foreach ($exercises as $exercise) { |
202 | - $data[] = array('id' => $exercise['id'], 'text' => html_entity_decode($exercise['title']) ); |
|
202 | + $data[] = array('id' => $exercise['id'], 'text' => html_entity_decode($exercise['title'])); |
|
203 | 203 | } |
204 | 204 | if (!empty($data)) { |
205 | 205 | $data[] = array('id' => 'T', 'text' => 'TODOS'); |
@@ -224,11 +224,11 @@ discard block |
||
224 | 224 | $sql, |
225 | 225 | intval($_GET['course_id']), |
226 | 226 | intval($_GET['session_id']), |
227 | - '%' . Database::escape_string($_GET['q']).'%' |
|
227 | + '%'.Database::escape_string($_GET['q']).'%' |
|
228 | 228 | ); |
229 | 229 | $result = Database::query($sql_query); |
230 | 230 | while ($survey = Database::fetch_assoc($result)) { |
231 | - $survey['title'] .= ($survey['anonymous'] == 1) ? ' (' . get_lang('Anonymous') . ')' : ''; |
|
231 | + $survey['title'] .= ($survey['anonymous'] == 1) ? ' ('.get_lang('Anonymous').')' : ''; |
|
232 | 232 | $data[] = array( |
233 | 233 | 'id' => $survey['id'], |
234 | 234 | 'text' => strip_tags(html_entity_decode($survey['title'])) |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | WHERE status=1".$order_clause; |
24 | 24 | // Filtering teachers when creating a course. |
25 | 25 | if (api_is_multiple_url_enabled()) { |
26 | - $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
26 | + $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
27 | 27 | $sql = "SELECT u.user_id,lastname,firstname |
28 | 28 | FROM $table_user as u |
29 | 29 | INNER JOIN $access_url_rel_user_table url_rel_user |
@@ -92,12 +92,12 @@ discard block |
||
92 | 92 | ); |
93 | 93 | |
94 | 94 | // Course department |
95 | -$form->addText('department_name', get_lang('CourseDepartment'), false, array ('size' => '60')); |
|
95 | +$form->addText('department_name', get_lang('CourseDepartment'), false, array('size' => '60')); |
|
96 | 96 | $form->applyFilter('department_name', 'html_filter'); |
97 | 97 | $form->applyFilter('department_name', 'trim'); |
98 | 98 | |
99 | 99 | // Department URL |
100 | -$form->addText('department_url', get_lang('CourseDepartmentURL'), false, array ('size' => '60')); |
|
100 | +$form->addText('department_url', get_lang('CourseDepartmentURL'), false, array('size' => '60')); |
|
101 | 101 | $form->applyFilter('department_url', 'html_filter'); |
102 | 102 | |
103 | 103 | $form->addElement('select_language', 'course_language', get_lang('CourseLanguage')); |
@@ -112,32 +112,32 @@ discard block |
||
112 | 112 | get_lang('PickACourseAsATemplateForThisNewCourse'), |
113 | 113 | ], |
114 | 114 | null, |
115 | - ['url' => api_get_path(WEB_AJAX_PATH) . 'course.ajax.php?a=search_course'] |
|
115 | + ['url' => api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=search_course'] |
|
116 | 116 | ); |
117 | 117 | } |
118 | 118 | |
119 | 119 | $form->addElement('checkbox', 'exemplary_content', '', get_lang('FillWithExemplaryContent')); |
120 | 120 | |
121 | 121 | $group = array(); |
122 | -$group[]= $form->createElement('radio', 'visibility', get_lang('CourseAccess'), get_lang('OpenToTheWorld'), COURSE_VISIBILITY_OPEN_WORLD); |
|
123 | -$group[]= $form->createElement('radio', 'visibility', null, get_lang('OpenToThePlatform'), COURSE_VISIBILITY_OPEN_PLATFORM); |
|
124 | -$group[]= $form->createElement('radio', 'visibility', null, get_lang('Private'), COURSE_VISIBILITY_REGISTERED); |
|
125 | -$group[]= $form->createElement('radio', 'visibility', null, get_lang('CourseVisibilityClosed'), COURSE_VISIBILITY_CLOSED); |
|
126 | -$group[]= $form->createElement('radio', 'visibility', null, get_lang('CourseVisibilityHidden'), COURSE_VISIBILITY_HIDDEN); |
|
122 | +$group[] = $form->createElement('radio', 'visibility', get_lang('CourseAccess'), get_lang('OpenToTheWorld'), COURSE_VISIBILITY_OPEN_WORLD); |
|
123 | +$group[] = $form->createElement('radio', 'visibility', null, get_lang('OpenToThePlatform'), COURSE_VISIBILITY_OPEN_PLATFORM); |
|
124 | +$group[] = $form->createElement('radio', 'visibility', null, get_lang('Private'), COURSE_VISIBILITY_REGISTERED); |
|
125 | +$group[] = $form->createElement('radio', 'visibility', null, get_lang('CourseVisibilityClosed'), COURSE_VISIBILITY_CLOSED); |
|
126 | +$group[] = $form->createElement('radio', 'visibility', null, get_lang('CourseVisibilityHidden'), COURSE_VISIBILITY_HIDDEN); |
|
127 | 127 | |
128 | -$form->addGroup($group,'', get_lang('CourseAccess'), '<br />'); |
|
128 | +$form->addGroup($group, '', get_lang('CourseAccess'), '<br />'); |
|
129 | 129 | |
130 | 130 | $group = array(); |
131 | -$group[]= $form->createElement('radio', 'subscribe', get_lang('Subscription'), get_lang('Allowed'), 1); |
|
132 | -$group[]= $form->createElement('radio', 'subscribe', null, get_lang('Denied'), 0); |
|
133 | -$form->addGroup($group,'', get_lang('Subscription'), '<br />'); |
|
131 | +$group[] = $form->createElement('radio', 'subscribe', get_lang('Subscription'), get_lang('Allowed'), 1); |
|
132 | +$group[] = $form->createElement('radio', 'subscribe', null, get_lang('Denied'), 0); |
|
133 | +$form->addGroup($group, '', get_lang('Subscription'), '<br />'); |
|
134 | 134 | |
135 | 135 | $group = array(); |
136 | -$group[]= $form->createElement('radio', 'unsubscribe', get_lang('Unsubscription'), get_lang('AllowedToUnsubscribe'), 1); |
|
137 | -$group[]= $form->createElement('radio', 'unsubscribe', null, get_lang('NotAllowedToUnsubscribe'), 0); |
|
136 | +$group[] = $form->createElement('radio', 'unsubscribe', get_lang('Unsubscription'), get_lang('AllowedToUnsubscribe'), 1); |
|
137 | +$group[] = $form->createElement('radio', 'unsubscribe', null, get_lang('NotAllowedToUnsubscribe'), 0); |
|
138 | 138 | $form->addGroup($group, '', get_lang('Unsubscription'), '<br />'); |
139 | 139 | |
140 | -$form->addElement('text','disk_quota',array(get_lang('CourseQuota'), null, get_lang('MB'))); |
|
140 | +$form->addElement('text', 'disk_quota', array(get_lang('CourseQuota'), null, get_lang('MB'))); |
|
141 | 141 | $form->addRule('disk_quota', get_lang('ThisFieldShouldBeNumeric'), 'numeric'); |
142 | 142 | |
143 | 143 | $obj = new GradeModel(); |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | $extra_field = new ExtraField('course'); |
148 | 148 | $extra = $extra_field->addElements($form); |
149 | 149 | |
150 | -$htmlHeadXtra[] =' |
|
150 | +$htmlHeadXtra[] = ' |
|
151 | 151 | <script> |
152 | 152 | |
153 | 153 | $(function() { |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | |
161 | 161 | // Set some default values. |
162 | 162 | $values['course_language'] = api_get_setting('platformLanguage'); |
163 | -$values['disk_quota'] = round(api_get_setting('default_document_quotum')/1024/1024, 1); |
|
163 | +$values['disk_quota'] = round(api_get_setting('default_document_quotum') / 1024 / 1024, 1); |
|
164 | 164 | |
165 | 165 | $default_course_visibility = api_get_setting('courses_default_creation_visibility'); |
166 | 166 | |
@@ -180,16 +180,16 @@ discard block |
||
180 | 180 | $course = $form->exportValues(); |
181 | 181 | |
182 | 182 | $course_teachers = isset($course['course_teachers']) ? $course['course_teachers'] : null; |
183 | - $course['disk_quota'] = $course['disk_quota']*1024*1024; |
|
183 | + $course['disk_quota'] = $course['disk_quota'] * 1024 * 1024; |
|
184 | 184 | $course['exemplary_content'] = empty($course['exemplary_content']) ? false : true; |
185 | 185 | $course['teachers'] = $course_teachers; |
186 | 186 | $course['wanted_code'] = $course['visual_code']; |
187 | - $course['gradebook_model_id'] = isset($course['gradebook_model_id']) ? $course['gradebook_model_id'] : null; |
|
187 | + $course['gradebook_model_id'] = isset($course['gradebook_model_id']) ? $course['gradebook_model_id'] : null; |
|
188 | 188 | // Fixing category code |
189 | - $course['course_category'] = isset($course['category_code']) ? $course['category_code'] : ''; |
|
189 | + $course['course_category'] = isset($course['category_code']) ? $course['category_code'] : ''; |
|
190 | 190 | $course_info = CourseManager::create_course($course); |
191 | 191 | |
192 | - header('Location: course_list.php'.($course_info===false?'?action=show_msg&warn='.api_get_last_failure():'')); |
|
192 | + header('Location: course_list.php'.($course_info === false ? '?action=show_msg&warn='.api_get_last_failure() : '')); |
|
193 | 193 | exit; |
194 | 194 | } |
195 | 195 |
@@ -63,10 +63,10 @@ discard block |
||
63 | 63 | $name_no_ext = substr($name, 0, strlen($name) - strlen(strstr($name, $ext))); |
64 | 64 | $n = 0; |
65 | 65 | $unique = ''; |
66 | - while (file_exists($path . $name_no_ext . $unique . $ext)) { |
|
67 | - $unique = '_' . ++$n; |
|
66 | + while (file_exists($path.$name_no_ext.$unique.$ext)) { |
|
67 | + $unique = '_'.++$n; |
|
68 | 68 | } |
69 | - return $name_no_ext . $unique . $ext; |
|
69 | + return $name_no_ext.$unique.$ext; |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | // Not used at the moment, but could be handy if we want to limit the size of an upload (e.g. image upload in html editor). |
106 | 106 | $max_file_size = intval($_POST['MAX_FILE_SIZE']); |
107 | 107 | if ($show_output) { |
108 | - Display::display_error_message(get_lang('UplExceedMaxPostSize'). format_file_size($max_file_size)); |
|
108 | + Display::display_error_message(get_lang('UplExceedMaxPostSize').format_file_size($max_file_size)); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | return false; |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | case 4: |
120 | 120 | // No file was uploaded. |
121 | 121 | if ($show_output) { |
122 | - Display::display_error_message(get_lang('UplNoFileUploaded').' '. get_lang('UplSelectFileFirst')); |
|
122 | + Display::display_error_message(get_lang('UplNoFileUploaded').' '.get_lang('UplSelectFileFirst')); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | return false; |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | // Display success message with extra info to user |
460 | 460 | if ($output) { |
461 | 461 | Display::display_confirmation_message( |
462 | - get_lang('UplUploadSucceeded') . '<br /> ' . $documentTitle . ' ' . get_lang('UplFileOverwritten'), |
|
462 | + get_lang('UplUploadSucceeded').'<br /> '.$documentTitle.' '.get_lang('UplFileOverwritten'), |
|
463 | 463 | false |
464 | 464 | ); |
465 | 465 | } |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | // Display success message to user |
584 | 584 | if ($output) { |
585 | 585 | Display::display_confirmation_message( |
586 | - get_lang('UplUploadSucceeded') . '<br />' . get_lang('UplFileSavedAs') .' '.$documentTitle, |
|
586 | + get_lang('UplUploadSucceeded').'<br />'.get_lang('UplFileSavedAs').' '.$documentTitle, |
|
587 | 587 | false |
588 | 588 | ); |
589 | 589 | } |
@@ -730,12 +730,12 @@ discard block |
||
730 | 730 | function dir_total_space($dir_path) |
731 | 731 | { |
732 | 732 | $save_dir = getcwd(); |
733 | - chdir($dir_path) ; |
|
733 | + chdir($dir_path); |
|
734 | 734 | $handle = opendir($dir_path); |
735 | 735 | $sumSize = 0; |
736 | 736 | $dirList = array(); |
737 | 737 | while ($element = readdir($handle)) { |
738 | - if ( $element == '.' || $element == '..') { |
|
738 | + if ($element == '.' || $element == '..') { |
|
739 | 739 | continue; // Skip the current and parent directories |
740 | 740 | } |
741 | 741 | if (is_file($element)) { |
@@ -746,11 +746,11 @@ discard block |
||
746 | 746 | } |
747 | 747 | } |
748 | 748 | |
749 | - closedir($handle) ; |
|
749 | + closedir($handle); |
|
750 | 750 | |
751 | 751 | if (sizeof($dirList) > 0) { |
752 | 752 | foreach ($dirList as $j) { |
753 | - $sizeDir = dir_total_space($j); // Recursivity |
|
753 | + $sizeDir = dir_total_space($j); // Recursivity |
|
754 | 754 | $sumSize += $sizeDir; |
755 | 755 | } |
756 | 756 | } |
@@ -784,63 +784,63 @@ discard block |
||
784 | 784 | |
785 | 785 | static $mime_type = array(); |
786 | 786 | |
787 | - $mime_type[] = 'application/msword'; $extension[] = '.doc'; |
|
788 | - $mime_type[] = 'application/rtf'; $extension[] = '.rtf'; |
|
789 | - $mime_type[] = 'application/vnd.ms-powerpoint'; $extension[] = '.ppt'; |
|
790 | - $mime_type[] = 'application/vnd.ms-excel'; $extension[] = '.xls'; |
|
791 | - $mime_type[] = 'application/pdf'; $extension[] = '.pdf'; |
|
792 | - $mime_type[] = 'application/postscript'; $extension[] = '.ps'; |
|
793 | - $mime_type[] = 'application/mac-binhex40'; $extension[] = '.hqx'; |
|
794 | - $mime_type[] = 'application/x-gzip'; $extension[] = 'tar.gz'; |
|
795 | - $mime_type[] = 'application/x-shockwave-flash'; $extension[] = '.swf'; |
|
796 | - $mime_type[] = 'application/x-stuffit'; $extension[] = '.sit'; |
|
797 | - $mime_type[] = 'application/x-tar'; $extension[] = '.tar'; |
|
798 | - $mime_type[] = 'application/zip'; $extension[] = '.zip'; |
|
799 | - $mime_type[] = 'application/x-tar'; $extension[] = '.tar'; |
|
800 | - $mime_type[] = 'text/html'; $extension[] = '.html'; |
|
801 | - $mime_type[] = 'text/plain'; $extension[] = '.txt'; |
|
802 | - $mime_type[] = 'text/rtf'; $extension[] = '.rtf'; |
|
803 | - $mime_type[] = 'img/gif'; $extension[] = '.gif'; |
|
804 | - $mime_type[] = 'img/jpeg'; $extension[] = '.jpg'; |
|
805 | - $mime_type[] = 'img/png'; $extension[] = '.png'; |
|
806 | - $mime_type[] = 'audio/midi'; $extension[] = '.mid'; |
|
807 | - $mime_type[] = 'audio/mpeg'; $extension[] = '.mp3'; |
|
808 | - $mime_type[] = 'audio/x-aiff'; $extension[] = '.aif'; |
|
809 | - $mime_type[] = 'audio/x-pn-realaudio'; $extension[] = '.rm'; |
|
810 | - $mime_type[] = 'audio/x-pn-realaudio-plugin'; $extension[] = '.rpm'; |
|
811 | - $mime_type[] = 'audio/x-wav'; $extension[] = '.wav'; |
|
812 | - $mime_type[] = 'video/mpeg'; $extension[] = '.mpg'; |
|
813 | - $mime_type[] = 'video/mpeg4-generic'; $extension[] = '.mp4'; |
|
814 | - $mime_type[] = 'video/quicktime'; $extension[] = '.mov'; |
|
815 | - $mime_type[] = 'video/x-msvideo'; $extension[] = '.avi'; |
|
816 | - |
|
817 | - $mime_type[] = 'video/x-ms-wmv'; $extension[] = '.wmv'; |
|
818 | - $mime_type[] = 'video/x-flv'; $extension[] = '.flv'; |
|
819 | - $mime_type[] = 'image/svg+xml'; $extension[] = '.svg'; |
|
820 | - $mime_type[] = 'image/svg+xml'; $extension[] = '.svgz'; |
|
821 | - $mime_type[] = 'video/ogg'; $extension[] = '.ogv'; |
|
822 | - $mime_type[] = 'audio/ogg'; $extension[] = '.oga'; |
|
823 | - $mime_type[] = 'application/ogg'; $extension[] = '.ogg'; |
|
824 | - $mime_type[] = 'application/ogg'; $extension[] = '.ogx'; |
|
825 | - $mime_type[] = 'application/x-freemind'; $extension[] = '.mm'; |
|
826 | - |
|
827 | - $mime_type[] = 'application/vnd.ms-word.document.macroEnabled.12'; $extension[] = '.docm'; |
|
828 | - $mime_type[] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'; $extension[] = '.docx'; |
|
829 | - $mime_type[] = 'application/vnd.ms-word.template.macroEnabled.12'; $extension[] = '.dotm'; |
|
830 | - $mime_type[] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.template'; $extension[] = '.dotx'; |
|
831 | - $mime_type[] = 'application/vnd.ms-powerpoint.template.macroEnabled.12'; $extension[] = '.potm'; |
|
832 | - $mime_type[] = 'application/vnd.openxmlformats-officedocument.presentationml.template'; $extension[] = '.potx'; |
|
833 | - $mime_type[] = 'application/vnd.ms-powerpoint.addin.macroEnabled.12'; $extension[] = '.ppam'; |
|
834 | - $mime_type[] = 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12'; $extension[] = '.ppsm'; |
|
835 | - $mime_type[] = 'application/vnd.openxmlformats-officedocument.presentationml.slideshow'; $extension[] = '.ppsx'; |
|
836 | - $mime_type[] = 'application/vnd.ms-powerpoint.presentation.macroEnabled.12'; $extension[] = '.pptm'; |
|
837 | - $mime_type[] = 'application/vnd.openxmlformats-officedocument.presentationml.presentation'; $extension[] = '.pptx'; |
|
838 | - $mime_type[] = 'application/vnd.ms-excel.addin.macroEnabled.12'; $extension[] = '.xlam'; |
|
839 | - $mime_type[] = 'application/vnd.ms-excel.sheet.binary.macroEnabled.12'; $extension[] = '.xlsb'; |
|
840 | - $mime_type[] = 'application/vnd.ms-excel.sheet.macroEnabled.12'; $extension[] = '.xlsm'; |
|
841 | - $mime_type[] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; $extension[] = '.xlsx'; |
|
842 | - $mime_type[] = 'application/vnd.ms-excel.template.macroEnabled.12'; $extension[] = '.xltm'; |
|
843 | - $mime_type[] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.template'; $extension[] = '.xltx'; |
|
787 | + $mime_type[] = 'application/msword'; $extension[] = '.doc'; |
|
788 | + $mime_type[] = 'application/rtf'; $extension[] = '.rtf'; |
|
789 | + $mime_type[] = 'application/vnd.ms-powerpoint'; $extension[] = '.ppt'; |
|
790 | + $mime_type[] = 'application/vnd.ms-excel'; $extension[] = '.xls'; |
|
791 | + $mime_type[] = 'application/pdf'; $extension[] = '.pdf'; |
|
792 | + $mime_type[] = 'application/postscript'; $extension[] = '.ps'; |
|
793 | + $mime_type[] = 'application/mac-binhex40'; $extension[] = '.hqx'; |
|
794 | + $mime_type[] = 'application/x-gzip'; $extension[] = 'tar.gz'; |
|
795 | + $mime_type[] = 'application/x-shockwave-flash'; $extension[] = '.swf'; |
|
796 | + $mime_type[] = 'application/x-stuffit'; $extension[] = '.sit'; |
|
797 | + $mime_type[] = 'application/x-tar'; $extension[] = '.tar'; |
|
798 | + $mime_type[] = 'application/zip'; $extension[] = '.zip'; |
|
799 | + $mime_type[] = 'application/x-tar'; $extension[] = '.tar'; |
|
800 | + $mime_type[] = 'text/html'; $extension[] = '.html'; |
|
801 | + $mime_type[] = 'text/plain'; $extension[] = '.txt'; |
|
802 | + $mime_type[] = 'text/rtf'; $extension[] = '.rtf'; |
|
803 | + $mime_type[] = 'img/gif'; $extension[] = '.gif'; |
|
804 | + $mime_type[] = 'img/jpeg'; $extension[] = '.jpg'; |
|
805 | + $mime_type[] = 'img/png'; $extension[] = '.png'; |
|
806 | + $mime_type[] = 'audio/midi'; $extension[] = '.mid'; |
|
807 | + $mime_type[] = 'audio/mpeg'; $extension[] = '.mp3'; |
|
808 | + $mime_type[] = 'audio/x-aiff'; $extension[] = '.aif'; |
|
809 | + $mime_type[] = 'audio/x-pn-realaudio'; $extension[] = '.rm'; |
|
810 | + $mime_type[] = 'audio/x-pn-realaudio-plugin'; $extension[] = '.rpm'; |
|
811 | + $mime_type[] = 'audio/x-wav'; $extension[] = '.wav'; |
|
812 | + $mime_type[] = 'video/mpeg'; $extension[] = '.mpg'; |
|
813 | + $mime_type[] = 'video/mpeg4-generic'; $extension[] = '.mp4'; |
|
814 | + $mime_type[] = 'video/quicktime'; $extension[] = '.mov'; |
|
815 | + $mime_type[] = 'video/x-msvideo'; $extension[] = '.avi'; |
|
816 | + |
|
817 | + $mime_type[] = 'video/x-ms-wmv'; $extension[] = '.wmv'; |
|
818 | + $mime_type[] = 'video/x-flv'; $extension[] = '.flv'; |
|
819 | + $mime_type[] = 'image/svg+xml'; $extension[] = '.svg'; |
|
820 | + $mime_type[] = 'image/svg+xml'; $extension[] = '.svgz'; |
|
821 | + $mime_type[] = 'video/ogg'; $extension[] = '.ogv'; |
|
822 | + $mime_type[] = 'audio/ogg'; $extension[] = '.oga'; |
|
823 | + $mime_type[] = 'application/ogg'; $extension[] = '.ogg'; |
|
824 | + $mime_type[] = 'application/ogg'; $extension[] = '.ogx'; |
|
825 | + $mime_type[] = 'application/x-freemind'; $extension[] = '.mm'; |
|
826 | + |
|
827 | + $mime_type[] = 'application/vnd.ms-word.document.macroEnabled.12'; $extension[] = '.docm'; |
|
828 | + $mime_type[] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'; $extension[] = '.docx'; |
|
829 | + $mime_type[] = 'application/vnd.ms-word.template.macroEnabled.12'; $extension[] = '.dotm'; |
|
830 | + $mime_type[] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.template'; $extension[] = '.dotx'; |
|
831 | + $mime_type[] = 'application/vnd.ms-powerpoint.template.macroEnabled.12'; $extension[] = '.potm'; |
|
832 | + $mime_type[] = 'application/vnd.openxmlformats-officedocument.presentationml.template'; $extension[] = '.potx'; |
|
833 | + $mime_type[] = 'application/vnd.ms-powerpoint.addin.macroEnabled.12'; $extension[] = '.ppam'; |
|
834 | + $mime_type[] = 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12'; $extension[] = '.ppsm'; |
|
835 | + $mime_type[] = 'application/vnd.openxmlformats-officedocument.presentationml.slideshow'; $extension[] = '.ppsx'; |
|
836 | + $mime_type[] = 'application/vnd.ms-powerpoint.presentation.macroEnabled.12'; $extension[] = '.pptm'; |
|
837 | + $mime_type[] = 'application/vnd.openxmlformats-officedocument.presentationml.presentation'; $extension[] = '.pptx'; |
|
838 | + $mime_type[] = 'application/vnd.ms-excel.addin.macroEnabled.12'; $extension[] = '.xlam'; |
|
839 | + $mime_type[] = 'application/vnd.ms-excel.sheet.binary.macroEnabled.12'; $extension[] = '.xlsb'; |
|
840 | + $mime_type[] = 'application/vnd.ms-excel.sheet.macroEnabled.12'; $extension[] = '.xlsm'; |
|
841 | + $mime_type[] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; $extension[] = '.xlsx'; |
|
842 | + $mime_type[] = 'application/vnd.ms-excel.template.macroEnabled.12'; $extension[] = '.xltm'; |
|
843 | + $mime_type[] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.template'; $extension[] = '.xltx'; |
|
844 | 844 | |
845 | 845 | // Test on PC (files with no extension get application/octet-stream) |
846 | 846 | //$mime_type[] = 'application/octet-stream'; $extension[] = '.ext'; |
@@ -849,7 +849,7 @@ discard block |
||
849 | 849 | |
850 | 850 | foreach ($mime_type as $key => & $type) { |
851 | 851 | if ($type == $file_type) { |
852 | - $file_name .= $extension[$key]; |
|
852 | + $file_name .= $extension[$key]; |
|
853 | 853 | break; |
854 | 854 | } |
855 | 855 | } |
@@ -957,12 +957,12 @@ discard block |
||
957 | 957 | } |
958 | 958 | |
959 | 959 | // It happens on Linux that $upload_path sometimes doesn't start with '/' |
960 | - if ($upload_path[0] != '/' && substr($base_work_dir,-1,1) != '/') { |
|
960 | + if ($upload_path[0] != '/' && substr($base_work_dir, -1, 1) != '/') { |
|
961 | 961 | $upload_path = '/'.$upload_path; |
962 | 962 | } |
963 | 963 | |
964 | 964 | if ($upload_path[strlen($upload_path) - 1] == '/') { |
965 | - $upload_path=substr($upload_path, 0, -1); |
|
965 | + $upload_path = substr($upload_path, 0, -1); |
|
966 | 966 | } |
967 | 967 | |
968 | 968 | /* Uncompressing phase */ |
@@ -974,15 +974,15 @@ discard block |
||
974 | 974 | - add it to the database |
975 | 975 | - parse & change relative html links |
976 | 976 | */ |
977 | - if (PHP_OS == 'Linux' && ! get_cfg_var('safe_mode') && false) { // *** UGent, changed by OC *** |
|
977 | + if (PHP_OS == 'Linux' && !get_cfg_var('safe_mode') && false) { // *** UGent, changed by OC *** |
|
978 | 978 | // Shell Method - if this is possible, it gains some speed |
979 | - exec("unzip -d \"".$base_work_dir.$upload_path."/\"".$uploaded_file['name']." " .$uploaded_file['tmp_name']); |
|
979 | + exec("unzip -d \"".$base_work_dir.$upload_path."/\"".$uploaded_file['name']." ".$uploaded_file['tmp_name']); |
|
980 | 980 | } else { |
981 | 981 | // PHP method - slower... |
982 | 982 | $save_dir = getcwd(); |
983 | 983 | chdir($base_work_dir.$upload_path); |
984 | 984 | $unzippingState = $zip_file->extract(); |
985 | - for ($j=0; $j < count($unzippingState); $j++) { |
|
985 | + for ($j = 0; $j < count($unzippingState); $j++) { |
|
986 | 986 | $state = $unzippingState[$j]; |
987 | 987 | |
988 | 988 | // Fix relative links in html files |
@@ -996,8 +996,8 @@ discard block |
||
996 | 996 | if (is_dir($base_work_dir.$upload_path.'/'.$file)) $filetype = 'folder'; |
997 | 997 | |
998 | 998 | $safe_file = api_replace_dangerous_char($file, 'strict'); |
999 | - @rename($base_work_dir.$upload_path.'/'.$file,$base_work_dir.$upload_path.'/'.$safe_file); |
|
1000 | - set_default_settings($upload_path, $safe_file,$filetype); |
|
999 | + @rename($base_work_dir.$upload_path.'/'.$file, $base_work_dir.$upload_path.'/'.$safe_file); |
|
1000 | + set_default_settings($upload_path, $safe_file, $filetype); |
|
1001 | 1001 | } |
1002 | 1002 | } |
1003 | 1003 | |
@@ -1047,7 +1047,7 @@ discard block |
||
1047 | 1047 | $zip = new PclZip($uploaded_file['tmp_name']); |
1048 | 1048 | |
1049 | 1049 | // Check the zip content (real size and file extension) |
1050 | - $zip_content_array = (array)$zip->listContent(); |
|
1050 | + $zip_content_array = (array) $zip->listContent(); |
|
1051 | 1051 | |
1052 | 1052 | $realSize = 0; |
1053 | 1053 | foreach ($zip_content_array as & $this_content) { |
@@ -1143,7 +1143,7 @@ discard block |
||
1143 | 1143 | function filter_extension(&$filename) |
1144 | 1144 | { |
1145 | 1145 | if (substr($filename, -1) == '/') { |
1146 | - return 1; // Authorize directories |
|
1146 | + return 1; // Authorize directories |
|
1147 | 1147 | } |
1148 | 1148 | $blacklist = api_get_setting('upload_extensions_list_type'); |
1149 | 1149 | if ($blacklist != 'whitelist') { // if = blacklist |
@@ -1369,9 +1369,9 @@ discard block |
||
1369 | 1369 | $upload_path = str_replace('//', '/', $upload_path); |
1370 | 1370 | |
1371 | 1371 | if ($upload_path == '/') { |
1372 | - $upload_path=''; |
|
1372 | + $upload_path = ''; |
|
1373 | 1373 | } elseif (!empty($upload_path) && $upload_path[0] != '/') { |
1374 | - $upload_path="/$upload_path"; |
|
1374 | + $upload_path = "/$upload_path"; |
|
1375 | 1375 | } |
1376 | 1376 | |
1377 | 1377 | $endchar = substr($filename, strlen($filename) - 1, 1); |
@@ -1409,7 +1409,7 @@ discard block |
||
1409 | 1409 | $img_path_list = array(); |
1410 | 1410 | |
1411 | 1411 | if (!$fp = fopen($html_file, 'r')) { |
1412 | - return ; |
|
1412 | + return; |
|
1413 | 1413 | } |
1414 | 1414 | |
1415 | 1415 | // Aearch and store occurences of the <img> tag in an array |
@@ -1429,7 +1429,7 @@ discard block |
||
1429 | 1429 | $img_tag_list = $matches[0]; |
1430 | 1430 | } |
1431 | 1431 | |
1432 | - fclose ($fp); |
|
1432 | + fclose($fp); |
|
1433 | 1433 | unset($buffer); |
1434 | 1434 | |
1435 | 1435 | // Search the image file path from all the <IMG> tag detected |
@@ -1529,7 +1529,7 @@ discard block |
||
1529 | 1529 | |
1530 | 1530 | if (!is_dir($base_work_dir.$systemFolderName)) { |
1531 | 1531 | $result = mkdir( |
1532 | - $base_work_dir . $systemFolderName, |
|
1532 | + $base_work_dir.$systemFolderName, |
|
1533 | 1533 | api_get_permissions_for_new_directories(), |
1534 | 1534 | true |
1535 | 1535 | ); |
@@ -1542,7 +1542,7 @@ discard block |
||
1542 | 1542 | WHERE |
1543 | 1543 | c_id = $course_id AND |
1544 | 1544 | ( |
1545 | - path = '" . $systemFolderName . "' |
|
1545 | + path = '".$systemFolderName."' |
|
1546 | 1546 | ) |
1547 | 1547 | "; |
1548 | 1548 | |
@@ -1695,7 +1695,7 @@ discard block |
||
1695 | 1695 | |
1696 | 1696 | // Fix the image tags |
1697 | 1697 | |
1698 | - for ($i = 0, $fileNb = count($original_img_path); $i < $fileNb ; $i++) { |
|
1698 | + for ($i = 0, $fileNb = count($original_img_path); $i < $fileNb; $i++) { |
|
1699 | 1699 | $replace_what = $original_img_path[$i]; |
1700 | 1700 | // We only need the directory and the filename /path/to/file_html_files/missing_file.gif -> file_html_files/missing_file.gif |
1701 | 1701 | $exploded_file_path = explode('/', $new_img_path[$i]); |
@@ -1736,7 +1736,7 @@ discard block |
||
1736 | 1736 | .'</body>' |
1737 | 1737 | .'</html>'; |
1738 | 1738 | if (file_exists($file_path)) { |
1739 | - if (!($fp = fopen ($file_path, 'w'))) { |
|
1739 | + if (!($fp = fopen($file_path, 'w'))) { |
|
1740 | 1740 | return false; |
1741 | 1741 | } |
1742 | 1742 | return fwrite($fp, $file_content); |
@@ -1756,7 +1756,7 @@ discard block |
||
1756 | 1756 | // Open the file |
1757 | 1757 | if (file_exists($full_file_name)) { |
1758 | 1758 | $fp = fopen($full_file_name, 'r'); |
1759 | - $buffer = fread ($fp, filesize ($full_file_name)); |
|
1759 | + $buffer = fread($fp, filesize($full_file_name)); |
|
1760 | 1760 | |
1761 | 1761 | // Parse the contents |
1762 | 1762 | $new_html_content = api_replace_links_in_string($upload_path, $buffer); |
@@ -1899,7 +1899,7 @@ discard block |
||
1899 | 1899 | |
1900 | 1900 | foreach ($tag_list as & $this_tag) { |
1901 | 1901 | //Display::display_normal_message(htmlentities($this_tag)); //debug |
1902 | - if ( preg_match("~".$param_name."[\s]*=[\s]*[\"]{1}([^\"]+)[\"]{1}~i", $this_tag, $matches)) { |
|
1902 | + if (preg_match("~".$param_name."[\s]*=[\s]*[\"]{1}([^\"]+)[\"]{1}~i", $this_tag, $matches)) { |
|
1903 | 1903 | $file_path_list[] = $matches[1]; // older |
1904 | 1904 | $href_list[] = $matches[0]; // to also add target="_self" |
1905 | 1905 | } |
@@ -1920,9 +1920,9 @@ discard block |
||
1920 | 1920 | |
1921 | 1921 | // Fix the link to use download.php or showinframes.php |
1922 | 1922 | if (preg_match("/<a([\s]*[\"\/:'=a-z0-9]*){5}href[^<]*>/i", $tag_list[$count])) { |
1923 | - $replace_by[$count] = " $param_name =\"showinframes.php?file=" . $upload_path.$file_path_list[$count]."\" target=\"_self\" "; |
|
1923 | + $replace_by[$count] = " $param_name =\"showinframes.php?file=".$upload_path.$file_path_list[$count]."\" target=\"_self\" "; |
|
1924 | 1924 | } else { |
1925 | - $replace_by[$count] = " $param_name =\"download.php?doc_url=" . $upload_path.$file_path_list[$count]."\" "; |
|
1925 | + $replace_by[$count] = " $param_name =\"download.php?doc_url=".$upload_path.$file_path_list[$count]."\" "; |
|
1926 | 1926 | } |
1927 | 1927 | } else { |
1928 | 1928 | // "mailto" or url already fixed, leave as is |
@@ -1931,7 +1931,7 @@ discard block |
||
1931 | 1931 | } |
1932 | 1932 | } elseif ($is_absolute_hyperlink) { |
1933 | 1933 | //$message .= "Absolute hyperlink, don't change, add target=_self: "; |
1934 | - $replace_by[$count] = " $param_name=\"" . $file_path_list[$count] . "\" target =\"_self\""; |
|
1934 | + $replace_by[$count] = " $param_name=\"".$file_path_list[$count]."\" target =\"_self\""; |
|
1935 | 1935 | } else { |
1936 | 1936 | // Don't change anything |
1937 | 1937 | //$message .= "Local anchor, don't change: "; |
@@ -1976,7 +1976,7 @@ discard block |
||
1976 | 1976 | { |
1977 | 1977 | // Do we need a / or not? |
1978 | 1978 | $added_slash = ($upload_path == '/') ? '' : '/'; |
1979 | - $folder_id = DocumentManager::get_document_id(api_get_course_info(), $upload_path); |
|
1979 | + $folder_id = DocumentManager::get_document_id(api_get_course_info(), $upload_path); |
|
1980 | 1980 | // Build the form |
1981 | 1981 | $form = "<p><strong>".get_lang('MissingImagesDetected')."</strong></p>" |
1982 | 1982 | ."<form method=\"post\" action=\"".api_get_self()."\" enctype=\"multipart/form-data\">" |
@@ -9,16 +9,16 @@ |
||
9 | 9 | /** |
10 | 10 | * Class constructor |
11 | 11 | */ |
12 | - public function __construct($elementName=null, $elementLabel=null, $options=null, $attributes=null) |
|
12 | + public function __construct($elementName = null, $elementLabel = null, $options = null, $attributes = null) |
|
13 | 13 | { |
14 | 14 | parent::__construct($elementName, $elementLabel, $options, $attributes); |
15 | 15 | // Get all languages |
16 | 16 | $themes = api_get_themes(); |
17 | 17 | $this->_options = array(); |
18 | 18 | $this->_values = array(); |
19 | - $this->addOption('--',''); // no theme select |
|
20 | - for ($i=0; $i< count($themes[0]); $i++) { |
|
21 | - $this->addOption($themes[1][$i],$themes[0][$i]); |
|
19 | + $this->addOption('--', ''); // no theme select |
|
20 | + for ($i = 0; $i < count($themes[0]); $i++) { |
|
21 | + $this->addOption($themes[1][$i], $themes[0][$i]); |
|
22 | 22 | } |
23 | 23 | } |
24 | 24 | } |
@@ -14,28 +14,28 @@ discard block |
||
14 | 14 | * @param $form_name |
15 | 15 | * @param null $action |
16 | 16 | */ |
17 | - public function __construct($form_name, $action= null) |
|
17 | + public function __construct($form_name, $action = null) |
|
18 | 18 | { |
19 | 19 | parent :: __construct($form_name, 'post', $action); |
20 | 20 | $displayscore = ScoreDisplay :: instance(); |
21 | 21 | $customdisplays = $displayscore->get_custom_score_display_settings(); |
22 | 22 | |
23 | - $nr_items = (count($customdisplays)!='0') ? count($customdisplays) : '1'; |
|
24 | - $this->setDefaults(array ( |
|
23 | + $nr_items = (count($customdisplays) != '0') ? count($customdisplays) : '1'; |
|
24 | + $this->setDefaults(array( |
|
25 | 25 | 'scorecolpercent' => $displayscore->get_color_split_value() |
26 | 26 | )); |
27 | 27 | |
28 | 28 | $this->addElement('hidden', 'maxvalue', '100'); |
29 | 29 | $this->addElement('hidden', 'minvalue', '0'); |
30 | - $counter= 1; |
|
30 | + $counter = 1; |
|
31 | 31 | |
32 | 32 | //setting the default values |
33 | 33 | |
34 | - if(is_array($customdisplays)) { |
|
34 | + if (is_array($customdisplays)) { |
|
35 | 35 | foreach ($customdisplays as $customdisplay) { |
36 | - $this->setDefaults(array ( |
|
37 | - 'endscore[' . $counter . ']' => $customdisplay['score'], |
|
38 | - 'displaytext[' . $counter . ']' => $customdisplay['display'] |
|
36 | + $this->setDefaults(array( |
|
37 | + 'endscore['.$counter.']' => $customdisplay['score'], |
|
38 | + 'displaytext['.$counter.']' => $customdisplay['display'] |
|
39 | 39 | )); |
40 | 40 | $counter++; |
41 | 41 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | $this->addElement('header', get_lang('ScoreEdit')); |
47 | 47 | |
48 | 48 | if ($displayscore->is_coloring_enabled()) { |
49 | - $this->addElement('html', '<b>' . get_lang('ScoreColor') . '</b>'); |
|
49 | + $this->addElement('html', '<b>'.get_lang('ScoreColor').'</b>'); |
|
50 | 50 | $this->addElement('text', 'scorecolpercent', array(get_lang('Below'), get_lang('WillColorRed'), '%'), array( |
51 | 51 | 'size' => 5, |
52 | 52 | 'maxlength' => 5, |
@@ -58,14 +58,14 @@ discard block |
||
58 | 58 | } |
59 | 59 | |
60 | 60 | $this->addRule('scorecolpercent', get_lang('OnlyNumbers'), 'numeric'); |
61 | - $this->addRule(array('scorecolpercent','maxvalue'), get_lang('Over100'), 'compare', '<='); |
|
62 | - $this->addRule(array('scorecolpercent','minvalue'), get_lang('UnderMin'), 'compare', '>'); |
|
61 | + $this->addRule(array('scorecolpercent', 'maxvalue'), get_lang('Over100'), 'compare', '<='); |
|
62 | + $this->addRule(array('scorecolpercent', 'minvalue'), get_lang('UnderMin'), 'compare', '>'); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | //Settings for the scoring system |
66 | 66 | |
67 | 67 | if ($displayscore->is_custom()) { |
68 | - $this->addElement('html', '<br /><b>' . get_lang('ScoringSystem') . '</b>'); |
|
68 | + $this->addElement('html', '<br /><b>'.get_lang('ScoringSystem').'</b>'); |
|
69 | 69 | $this->addElement('static', null, null, get_lang('ScoreInfo')); |
70 | 70 | $this->setDefaults(array( |
71 | 71 | 'beginscore' => '0' |
@@ -77,10 +77,10 @@ discard block |
||
77 | 77 | 'input-size' => 2 |
78 | 78 | )); |
79 | 79 | |
80 | - for ($counter= 1; $counter <= 20; $counter++) { |
|
81 | - $renderer =& $this->defaultRenderer(); |
|
80 | + for ($counter = 1; $counter <= 20; $counter++) { |
|
81 | + $renderer = & $this->defaultRenderer(); |
|
82 | 82 | $elementTemplateTwoLabel = |
83 | - '<div id=' . $counter . ' style="display: '.(($counter<=$nr_items)?'inline':'none').';"> |
|
83 | + '<div id='.$counter.' style="display: '.(($counter <= $nr_items) ? 'inline' : 'none').';"> |
|
84 | 84 | |
85 | 85 | <!-- BEGIN required --><span class="form_required">*</span> <!-- END required --> |
86 | 86 | |
@@ -105,39 +105,39 @@ discard block |
||
105 | 105 | |
106 | 106 | '; |
107 | 107 | |
108 | - $elementTemplateTwoLabel2 =' |
|
108 | + $elementTemplateTwoLabel2 = ' |
|
109 | 109 | <div class="col-sm-2"> |
110 | 110 | <!-- BEGIN error --><span class="form_error">{error}</span> |
111 | 111 | <!-- END error --> |
112 | 112 | {element} |
113 | 113 | </div> |
114 | 114 | <div class="col-sm-1"> |
115 | - <a href="javascript:plusItem(' . ($counter+1) . ')"> |
|
116 | - <img style="display: '.(($counter>=$nr_items)?'inline':'none').';" id="plus-' . ($counter+1) . '" src="'.Display::returnIconPath('add.png').'" alt="'.get_lang('Add').'" title="'.get_lang('Add').'"></a> |
|
117 | - <a href="javascript:minItem(' . ($counter) . ')"> |
|
118 | - <img style="display: '.(($counter>=$nr_items && $counter!=1)?'inline':'none').';" id="min-' . $counter . '" src="'.Display::returnIconPath('delete.png').'" alt="'.get_lang('Delete').'" title="'.get_lang('Delete').'"></a> |
|
115 | + <a href="javascript:plusItem(' . ($counter + 1).')"> |
|
116 | + <img style="display: '.(($counter >= $nr_items) ? 'inline' : 'none').';" id="plus-'.($counter + 1).'" src="'.Display::returnIconPath('add.png').'" alt="'.get_lang('Add').'" title="'.get_lang('Add').'"></a> |
|
117 | + <a href="javascript:minItem(' . ($counter).')"> |
|
118 | + <img style="display: '.(($counter >= $nr_items && $counter != 1) ? 'inline' : 'none').';" id="min-'.$counter.'" src="'.Display::returnIconPath('delete.png').'" alt="'.get_lang('Delete').'" title="'.get_lang('Delete').'"></a> |
|
119 | 119 | </div> |
120 | 120 | </div> |
121 | 121 | </div>'; |
122 | 122 | |
123 | 123 | $scorebetw = array(); |
124 | - $this->addElement('text', 'endscore[' . $counter . ']', null, array ( |
|
124 | + $this->addElement('text', 'endscore['.$counter.']', null, array( |
|
125 | 125 | 'size' => 5, |
126 | 126 | 'maxlength' => 5, |
127 | 127 | 'id' => 'txta-'.$counter, |
128 | 128 | 'input-size' => 2 |
129 | 129 | )); |
130 | 130 | |
131 | - $this->addElement('text', 'displaytext[' . $counter . ']', null,array ( |
|
131 | + $this->addElement('text', 'displaytext['.$counter.']', null, array( |
|
132 | 132 | 'size' => 40, |
133 | 133 | 'maxlength' => 40, |
134 | 134 | 'id' => 'txtb-'.$counter |
135 | 135 | )); |
136 | - $renderer->setElementTemplate($elementTemplateTwoLabel, 'endscore[' . $counter . ']'); |
|
137 | - $renderer->setElementTemplate($elementTemplateTwoLabel2, 'displaytext[' . $counter . ']'); |
|
138 | - $this->addRule('endscore[' . $counter . ']', get_lang('OnlyNumbers'), 'numeric'); |
|
139 | - $this->addRule(array ('endscore[' . $counter . ']', 'maxvalue'), get_lang('Over100'), 'compare', '<='); |
|
140 | - $this->addRule(array ('endscore[' . $counter . ']', 'minvalue'), get_lang('UnderMin'), 'compare', '>'); |
|
136 | + $renderer->setElementTemplate($elementTemplateTwoLabel, 'endscore['.$counter.']'); |
|
137 | + $renderer->setElementTemplate($elementTemplateTwoLabel2, 'displaytext['.$counter.']'); |
|
138 | + $this->addRule('endscore['.$counter.']', get_lang('OnlyNumbers'), 'numeric'); |
|
139 | + $this->addRule(array('endscore['.$counter.']', 'maxvalue'), get_lang('Over100'), 'compare', '<='); |
|
140 | + $this->addRule(array('endscore['.$counter.']', 'minvalue'), get_lang('UnderMin'), 'compare', '>'); |
|
141 | 141 | } |
142 | 142 | } |
143 | 143 |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | */ |
10 | 10 | class UserForm extends FormValidator |
11 | 11 | { |
12 | - const TYPE_USER_INFO= 1; |
|
12 | + const TYPE_USER_INFO = 1; |
|
13 | 13 | const TYPE_SIMPLE_SEARCH = 3; |
14 | 14 | /** |
15 | 15 | * Builds a form containing form items based on a given parameter |
@@ -19,15 +19,15 @@ discard block |
||
19 | 19 | * @param method |
20 | 20 | * @param action |
21 | 21 | */ |
22 | - public function __construct($form_type, $user, $form_name, $method= 'post', $action= null) |
|
22 | + public function __construct($form_type, $user, $form_name, $method = 'post', $action = null) |
|
23 | 23 | { |
24 | 24 | parent :: __construct($form_name, $method, $action); |
25 | - $this->form_type= $form_type; |
|
25 | + $this->form_type = $form_type; |
|
26 | 26 | if (isset ($user)) { |
27 | - $this->user_info= $user; |
|
27 | + $this->user_info = $user; |
|
28 | 28 | } |
29 | 29 | if (isset ($result_object)) { |
30 | - $this->result_object= $result_object; |
|
30 | + $this->result_object = $result_object; |
|
31 | 31 | } |
32 | 32 | if ($this->form_type == self :: TYPE_USER_INFO) { |
33 | 33 | $this->build_user_info_form(); |
@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | 'keyword' => Security::remove_XSS($_GET['search']) |
46 | 46 | )); |
47 | 47 | } |
48 | - $renderer =& $this->defaultRenderer(); |
|
48 | + $renderer = & $this->defaultRenderer(); |
|
49 | 49 | $renderer->setCustomElementTemplate('<span>{element}</span> '); |
50 | - $this->addElement('text','keyword',''); |
|
50 | + $this->addElement('text', 'keyword', ''); |
|
51 | 51 | $this->addButtonSearch(get_lang('Search'), 'submit'); |
52 | 52 | } |
53 | 53 | |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $this->addElement('static', 'fname', get_lang('FirstName'), $this->user_info['firstname']); |
62 | 62 | } |
63 | 63 | $this->addElement('static', 'uname', get_lang('UserName'), $this->user_info['username']); |
64 | - $this->addElement('static', 'email', get_lang('Email'), '<a href="mailto:' . $this->user_info['email'] . '">' . $this->user_info['email'] . '</a>'); |
|
64 | + $this->addElement('static', 'email', get_lang('Email'), '<a href="mailto:'.$this->user_info['email'].'">'.$this->user_info['email'].'</a>'); |
|
65 | 65 | $this->addElement('static', 'ofcode', get_lang('OfficialCode'), $this->user_info['official_code']); |
66 | 66 | $this->addElement('static', 'phone', get_lang('Phone'), $this->user_info['phone']); |
67 | 67 | $this->addButtonSave(get_lang('Back'), 'submit'); |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | parent :: display(); |
73 | 73 | } |
74 | 74 | |
75 | - function setDefaults($defaults= array(), $filter = null) |
|
75 | + function setDefaults($defaults = array(), $filter = null) |
|
76 | 76 | { |
77 | 77 | parent :: setDefaults($defaults, $filter); |
78 | 78 | } |
@@ -21,9 +21,9 @@ discard block |
||
21 | 21 | * @param method |
22 | 22 | * @param action |
23 | 23 | */ |
24 | - public function __construct($form_type, $form_name, $method = 'post', $action = null, $target='', $locked_status) |
|
24 | + public function __construct($form_type, $form_name, $method = 'post', $action = null, $target = '', $locked_status) |
|
25 | 25 | { |
26 | - parent :: __construct($form_name, $method, $action,$target); |
|
26 | + parent :: __construct($form_name, $method, $action, $target); |
|
27 | 27 | $this->form_type = $form_type; |
28 | 28 | if ($this->form_type == self :: TYPE_IMPORT) { |
29 | 29 | $this->build_import_form(); |
@@ -41,13 +41,13 @@ discard block |
||
41 | 41 | |
42 | 42 | protected function build_pdf_export_form() |
43 | 43 | { |
44 | - $renderer =& $this->defaultRenderer(); |
|
44 | + $renderer = & $this->defaultRenderer(); |
|
45 | 45 | $renderer->setCustomElementTemplate('<span>{element}</span>'); |
46 | 46 | $this->addElement('header', get_lang('ChooseOrientation')); |
47 | 47 | $this->addElement('radio', 'orientation', null, get_lang('Portrait'), 'portrait'); |
48 | 48 | $this->addElement('radio', 'orientation', null, get_lang('Landscape'), 'landscape'); |
49 | 49 | $this->addButtonExport(get_lang('Export')); |
50 | - $this->setDefaults(array ( |
|
50 | + $this->setDefaults(array( |
|
51 | 51 | 'orientation' => 'portrait' |
52 | 52 | )); |
53 | 53 | } |
@@ -59,19 +59,19 @@ discard block |
||
59 | 59 | $this->addElement('radio', 'file_type', null, 'XML (Extensible Markup Language)', 'xml'); |
60 | 60 | $this->addElement('radio', 'file_type', null, 'PDF (Portable Document Format)', 'pdf'); |
61 | 61 | $this->addButtonExport(get_lang('Export')); |
62 | - $this->setDefaults(array ( |
|
62 | + $this->setDefaults(array( |
|
63 | 63 | 'file_type' => 'csv' |
64 | 64 | )); |
65 | 65 | } |
66 | 66 | |
67 | - protected function build_export_form_option($show_pdf=true) |
|
67 | + protected function build_export_form_option($show_pdf = true) |
|
68 | 68 | { |
69 | 69 | $this->addElement('header', get_lang('ChooseFormat')); |
70 | 70 | $this->addElement('radio', 'file_type', get_lang('OutputFileType'), 'CSV (Comma-Separated Values)', 'csv'); |
71 | 71 | $this->addElement('radio', 'file_type', null, 'XML (Extensible Markup Language)', 'xml'); |
72 | - $this->addElement('radio', 'file_type', Display::return_icon('info3.gif',get_lang('ToExportMustLockEvaluation')), 'PDF (Portable Document Format)', 'pdf', array('disabled')); |
|
72 | + $this->addElement('radio', 'file_type', Display::return_icon('info3.gif', get_lang('ToExportMustLockEvaluation')), 'PDF (Portable Document Format)', 'pdf', array('disabled')); |
|
73 | 73 | $this->addButtonExport(get_lang('Export')); |
74 | - $this->setDefaults(array ( |
|
74 | + $this->setDefaults(array( |
|
75 | 75 | 'file_type' => 'csv' |
76 | 76 | )); |
77 | 77 | } |
@@ -80,16 +80,16 @@ discard block |
||
80 | 80 | { |
81 | 81 | $this->addElement('hidden', 'formSent'); |
82 | 82 | $this->addElement('header', get_lang('ImportFileLocation')); |
83 | - $this->addElement('file', 'import_file',get_lang('Location')); |
|
84 | - $allowed_file_types = array ( |
|
83 | + $this->addElement('file', 'import_file', get_lang('Location')); |
|
84 | + $allowed_file_types = array( |
|
85 | 85 | 'xml', |
86 | 86 | 'csv' |
87 | 87 | ); |
88 | 88 | //$this->addRule('file', get_lang('InvalidExtension') . ' (' . implode(',', $allowed_file_types) . ')', 'filetype', $allowed_file_types); |
89 | - $this->addElement('radio', 'file_type', get_lang('FileType'), 'CSV (<a href="docs/example_csv.html" target="_blank">' . get_lang('ExampleCSVFile') . '</a>)', 'csv'); |
|
90 | - $this->addElement('radio', 'file_type', null, 'XML (<a href="docs/example_xml.html" target="_blank">' . get_lang('ExampleXMLFile') . '</a>)', 'xml'); |
|
91 | - $this->addElement('checkbox','overwrite', null,get_lang('OverwriteScores')); |
|
92 | - $this->addElement('checkbox','ignoreerrors',null,get_lang('IgnoreErrors')); |
|
89 | + $this->addElement('radio', 'file_type', get_lang('FileType'), 'CSV (<a href="docs/example_csv.html" target="_blank">'.get_lang('ExampleCSVFile').'</a>)', 'csv'); |
|
90 | + $this->addElement('radio', 'file_type', null, 'XML (<a href="docs/example_xml.html" target="_blank">'.get_lang('ExampleXMLFile').'</a>)', 'xml'); |
|
91 | + $this->addElement('checkbox', 'overwrite', null, get_lang('OverwriteScores')); |
|
92 | + $this->addElement('checkbox', 'ignoreerrors', null, get_lang('IgnoreErrors')); |
|
93 | 93 | $this->addButtonImport(get_lang('Ok')); |
94 | 94 | $this->setDefaults(array( |
95 | 95 | 'formSent' => '1', |