@@ -132,38 +132,38 @@ discard block |
||
132 | 132 | */ |
133 | 133 | function my_rename($file_path, $new_file_name) { |
134 | 134 | |
135 | - $save_dir = getcwd(); |
|
136 | - $path = dirname($file_path); |
|
137 | - $old_file_name = basename($file_path); |
|
138 | - $new_file_name = api_replace_dangerous_char($new_file_name); |
|
135 | + $save_dir = getcwd(); |
|
136 | + $path = dirname($file_path); |
|
137 | + $old_file_name = basename($file_path); |
|
138 | + $new_file_name = api_replace_dangerous_char($new_file_name); |
|
139 | 139 | |
140 | - // If no extension, take the old one |
|
141 | - if ((strpos($new_file_name, '.') === false) && ($dotpos = strrpos($old_file_name, '.'))) { |
|
142 | - $new_file_name .= substr($old_file_name, $dotpos); |
|
143 | - } |
|
140 | + // If no extension, take the old one |
|
141 | + if ((strpos($new_file_name, '.') === false) && ($dotpos = strrpos($old_file_name, '.'))) { |
|
142 | + $new_file_name .= substr($old_file_name, $dotpos); |
|
143 | + } |
|
144 | 144 | |
145 | - // Note: still possible: 'xx.yy' -rename-> '.yy' -rename-> 'zz' |
|
146 | - // This is useful for folder names, where otherwise '.' would be sticky |
|
145 | + // Note: still possible: 'xx.yy' -rename-> '.yy' -rename-> 'zz' |
|
146 | + // This is useful for folder names, where otherwise '.' would be sticky |
|
147 | 147 | |
148 | - // Extension PHP is not allowed, change to PHPS |
|
149 | - $new_file_name = php2phps($new_file_name); |
|
148 | + // Extension PHP is not allowed, change to PHPS |
|
149 | + $new_file_name = php2phps($new_file_name); |
|
150 | 150 | |
151 | - if ($new_file_name == $old_file_name) { |
|
152 | - return $old_file_name; |
|
153 | - } |
|
151 | + if ($new_file_name == $old_file_name) { |
|
152 | + return $old_file_name; |
|
153 | + } |
|
154 | 154 | |
155 | - if (strtolower($new_file_name) != strtolower($old_file_name) && check_name_exist($path.'/'.$new_file_name)) { |
|
156 | - return false; |
|
157 | - } |
|
158 | - // On a Windows server, it would be better not to do the above check |
|
159 | - // because it succeeds for some new names resembling the old name. |
|
160 | - // But on Unix/Linux the check must be done because rename overwrites. |
|
155 | + if (strtolower($new_file_name) != strtolower($old_file_name) && check_name_exist($path.'/'.$new_file_name)) { |
|
156 | + return false; |
|
157 | + } |
|
158 | + // On a Windows server, it would be better not to do the above check |
|
159 | + // because it succeeds for some new names resembling the old name. |
|
160 | + // But on Unix/Linux the check must be done because rename overwrites. |
|
161 | 161 | |
162 | - chdir($path); |
|
163 | - $res = rename($old_file_name, $new_file_name) ? $new_file_name : false; |
|
164 | - chdir($save_dir); |
|
162 | + chdir($path); |
|
163 | + $res = rename($old_file_name, $new_file_name) ? $new_file_name : false; |
|
164 | + chdir($save_dir); |
|
165 | 165 | |
166 | - return $res; |
|
166 | + return $res; |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | /** |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | $file_name = basename($source); |
186 | 186 | // move onto self illegal: mv a/b/c a/b/c or mv a/b/c a/b |
187 | 187 | if (strcasecmp($target, dirname($source)) === 0) { |
188 | - return false; |
|
188 | + return false; |
|
189 | 189 | } |
190 | 190 | $isWindowsOS = api_is_windows_os(); |
191 | 191 | $canExec = function_exists('exec'); |
@@ -265,8 +265,8 @@ discard block |
||
265 | 265 | */ |
266 | 266 | function getextension($filename) |
267 | 267 | { |
268 | - $bouts = explode('.', $filename); |
|
269 | - return array(array_pop($bouts), implode('.', $bouts)); |
|
268 | + $bouts = explode('.', $filename); |
|
269 | + return array(array_pop($bouts), implode('.', $bouts)); |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | /** |
@@ -277,17 +277,17 @@ discard block |
||
277 | 277 | * @param boolean $recursive if true , include subdirectory in total |
278 | 278 | */ |
279 | 279 | function dirsize($root, $recursive = true) { |
280 | - $dir = @opendir($root); |
|
281 | - $size = 0; |
|
282 | - while ($file = @readdir($dir)) { |
|
283 | - if (!in_array($file, array('.', '..'))) { |
|
284 | - if (is_dir($root.'/'.$file)) { |
|
285 | - $size += $recursive ? dirsize($root.'/'.$file) : 0; |
|
286 | - } else { |
|
287 | - $size += @filesize($root.'/'.$file); |
|
288 | - } |
|
289 | - } |
|
290 | - } |
|
291 | - @closedir($dir); |
|
292 | - return $size; |
|
280 | + $dir = @opendir($root); |
|
281 | + $size = 0; |
|
282 | + while ($file = @readdir($dir)) { |
|
283 | + if (!in_array($file, array('.', '..'))) { |
|
284 | + if (is_dir($root.'/'.$file)) { |
|
285 | + $size += $recursive ? dirsize($root.'/'.$file) : 0; |
|
286 | + } else { |
|
287 | + $size += @filesize($root.'/'.$file); |
|
288 | + } |
|
289 | + } |
|
290 | + } |
|
291 | + @closedir($dir); |
|
292 | + return $size; |
|
293 | 293 | } |
@@ -31,9 +31,9 @@ discard block |
||
31 | 31 | public function getFunctions() |
32 | 32 | { |
33 | 33 | return array( |
34 | - new \Twig_SimpleFunction('chamilo_settings_all', array($this, 'getSettings')), |
|
35 | - new \Twig_SimpleFunction('chamilo_settings_get', array($this, 'getSettingsParameter')), |
|
36 | - new \Twig_SimpleFunction('chamilo_settings_has', [$this, 'hasSettingsParameter']), |
|
34 | + new \Twig_SimpleFunction('chamilo_settings_all', array($this, 'getSettings')), |
|
35 | + new \Twig_SimpleFunction('chamilo_settings_get', array($this, 'getSettingsParameter')), |
|
36 | + new \Twig_SimpleFunction('chamilo_settings_has', [$this, 'hasSettingsParameter']), |
|
37 | 37 | ); |
38 | 38 | } |
39 | 39 | |
@@ -44,9 +44,9 @@ discard block |
||
44 | 44 | public function getFilters() |
45 | 45 | { |
46 | 46 | return array( |
47 | - //new \Twig_SimpleFunction('chamilo_settings_all', array($this, 'getSettings')), |
|
48 | - new \Twig_SimpleFilter('get_setting', array($this, 'getSettingsParameter')), |
|
49 | - //new \Twig_SimpleFunction('chamilo_settings_has', [$this, 'hasSettingsParameter']), |
|
47 | + //new \Twig_SimpleFunction('chamilo_settings_all', array($this, 'getSettings')), |
|
48 | + new \Twig_SimpleFilter('get_setting', array($this, 'getSettingsParameter')), |
|
49 | + //new \Twig_SimpleFunction('chamilo_settings_has', [$this, 'hasSettingsParameter']), |
|
50 | 50 | ); |
51 | 51 | } |
52 | 52 |
@@ -996,7 +996,7 @@ |
||
996 | 996 | } |
997 | 997 | } |
998 | 998 | |
999 | - return array( |
|
999 | + return array( |
|
1000 | 1000 | 'content' => $html, |
1001 | 1001 | 'tool_list' => $items |
1002 | 1002 | ); |
@@ -747,10 +747,10 @@ discard block |
||
747 | 747 | Database::query($sql); |
748 | 748 | } |
749 | 749 | |
750 | - /** |
|
751 | - * Delete this category from the database |
|
752 | - * @param int $courseId |
|
753 | - */ |
|
750 | + /** |
|
751 | + * Delete this category from the database |
|
752 | + * @param int $courseId |
|
753 | + */ |
|
754 | 754 | public static function deleteCategoryFromCourse($courseId) |
755 | 755 | { |
756 | 756 | $table = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY); |
@@ -1617,7 +1617,6 @@ discard block |
||
1617 | 1617 | * @param string $course_code Course code (optional) |
1618 | 1618 | * @param int $session_id Session ID (optional) |
1619 | 1619 | * @param bool $order |
1620 | - |
|
1621 | 1620 | * @return array Array of subcategories |
1622 | 1621 | */ |
1623 | 1622 | public function get_subcategories($stud_id = null, $course_code = null, $session_id = null, $order = null) |
@@ -1896,7 +1895,6 @@ discard block |
||
1896 | 1895 | * This function, locks a category , only one who can unlock it is |
1897 | 1896 | * the platform administrator. |
1898 | 1897 | * @param int locked 1 or unlocked 0 |
1899 | - |
|
1900 | 1898 | * @return boolean|null |
1901 | 1899 | * */ |
1902 | 1900 | public function lock($locked) |
@@ -20,24 +20,18 @@ |
||
20 | 20 | * src/Chamilo/CourseBundle/Tool |
21 | 21 | * |
22 | 22 | * All this classes are registered as a service with the tag "chamilo_course.tool" here: |
23 | - |
|
24 | 23 | * src/Chamilo/CourseBundle/Resources/config/services.yml |
25 | 24 | * |
26 | 25 | * The register process is made using the class ToolCompilerClass: |
27 | 26 | * |
28 | 27 | * src/Chamilo/CourseBundle/DependencyInjection/Compiler/ToolCompilerClass.php |
29 | - |
|
30 | 28 | * The tool chain is just an array that includes all the tools registered in services.yml |
31 | 29 | * |
32 | 30 | * The tool chain is hook when a new course is created via a listener here: |
33 | - |
|
34 | 31 | * src/Chamilo/CoreBundle/Entity/Listener/CourseListener.php |
35 | - |
|
36 | 32 | * After a course is created this function is called: CourseListener::prePersist() |
37 | 33 | * This function includes the called to the function "addToolsInCourse" inside the tool chain. |
38 | - |
|
39 | 34 | * This allows to create course tools more easily. Steps: |
40 | - |
|
41 | 35 | * 1. Create a new tool class here: src/Chamilo/CourseBundle/Tool |
42 | 36 | * 2. Add the class as a service here: src/Chamilo/CourseBundle/Resources/config/services.yml (see examples there) |
43 | 37 | * 3. Create a new course. When you create a new course the new tool will be created |
@@ -25,9 +25,9 @@ |
||
25 | 25 | return 'chamilo_core.block.breadcrumb'; |
26 | 26 | } |
27 | 27 | |
28 | - /** |
|
29 | - * {@inheritdoc} |
|
30 | - */ |
|
28 | + /** |
|
29 | + * {@inheritdoc} |
|
30 | + */ |
|
31 | 31 | public function configureSettings(OptionsResolver $resolver) |
32 | 32 | { |
33 | 33 | parent::configureSettings($resolver); |
@@ -14,9 +14,9 @@ |
||
14 | 14 | */ |
15 | 15 | class SettingsHelper extends Helper implements SettingsHelperInterface |
16 | 16 | { |
17 | - /** |
|
18 | - * @var SettingsManager |
|
19 | - */ |
|
17 | + /** |
|
18 | + * @var SettingsManager |
|
19 | + */ |
|
20 | 20 | private $settingsManager; |
21 | 21 | |
22 | 22 | /** |
@@ -615,7 +615,7 @@ |
||
615 | 615 | return [ |
616 | 616 | '_p' => $_p, |
617 | 617 | '_s' => $_s, |
618 | - // '_u' => $user_info, |
|
618 | + // '_u' => $user_info, |
|
619 | 619 | 'template' => 'default' // @todo setup template folder in config.yml; |
620 | 620 | ]; |
621 | 621 | } |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | |
25 | 25 | private function setContainerValuesToLegacy() |
26 | 26 | { |
27 | - /** @var Connection $dbConnection */ |
|
27 | + /** @var Connection $dbConnection */ |
|
28 | 28 | $dbConnection = $this->container->get('database_connection'); |
29 | 29 | $em = $this->get('kernel')->getContainer()->get('doctrine.orm.entity_manager'); |
30 | 30 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | /** |
64 | 64 | * Some legacy Chamilo files still use this variables directly, |
65 | 65 | * instead of using a function. |
66 | - **/ |
|
66 | + **/ |
|
67 | 67 | $is_allowed_in_course = api_is_allowed_in_course(); |
68 | 68 | $is_courseAdmin = api_is_course_admin(); |
69 | 69 | $is_platformAdmin = api_is_platform_admin(); |