Browse Source

Scrutinizer Auto-Fixes

This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
Scrutinizer Auto-Fixer 8 years ago
parent
commit
18c0ec9187

+ 3 - 3
main/admin/skill.php

@@ -18,7 +18,7 @@ $list = $em->getRepository('ChamiloCoreBundle:Skill')->findAll();
 
 $listAction = api_get_self();
 
-$action =  '';
+$action = '';
 if (isset($_GET['action']) && in_array($_GET['action'], ['add', 'edit', 'delete'])) {
     $action = $_GET['action'];
 }
@@ -53,8 +53,8 @@ if (!empty($item)) {
 }
 $formToDisplay = $form->returnForm();
 
-$interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array ('url' => api_get_self(), 'name' => get_lang('ManageSkillsLevels'));
+$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = array('url' => api_get_self(), 'name' => get_lang('ManageSkillsLevels'));
 
 $tpl = new Template($action);
 switch ($action) {

+ 6 - 6
main/admin/skill_profile.php

@@ -17,7 +17,7 @@ $list = $em->getRepository('ChamiloSkillBundle:Profile')->findAll();
 
 $listAction = api_get_self();
 
-$action =  '';
+$action = '';
 if (isset($_GET['action']) && in_array($_GET['action'], ['add', 'edit', 'delete', 'move_up', 'move_down'])) {
     $action = $_GET['action'];
 }
@@ -43,9 +43,9 @@ if (!empty($item)) {
 }
 $formToDisplay = $form->returnForm();
 
-$interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array ('url' => 'skill.php', 'name' => get_lang('ManageSkillsLevels'));
-$interbreadcrumb[] = array ('url' =>  api_get_self(), 'name' => get_lang('SkillProfile'));
+$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = array('url' => 'skill.php', 'name' => get_lang('ManageSkillsLevels'));
+$interbreadcrumb[] = array('url' =>  api_get_self(), 'name' => get_lang('SkillProfile'));
 
 $tpl = new Template($action);
 switch ($action) {
@@ -56,7 +56,7 @@ switch ($action) {
         $position = $item->getPosition();
 
         if (!empty($position)) {
-            $item->setPosition($position-1);
+            $item->setPosition($position - 1);
         }
         $em->persist($item);
         $em->flush();
@@ -69,7 +69,7 @@ switch ($action) {
 
         $position = $item->getPosition();
 
-        $item->setPosition($position+1);
+        $item->setPosition($position + 1);
 
         $em->persist($item);
         $em->flush();

+ 3 - 3
main/document/create_draw.php

@@ -73,7 +73,7 @@ if (!is_dir($filepath)) {
 $groupId = api_get_group_id();
 
 if (!empty($groupId)) {
-	$interbreadcrumb[] = array (
+	$interbreadcrumb[] = array(
         "url" => "../group/group_space.php?".api_get_cidreq(),
         "name" => get_lang('GroupSpace')
     );
@@ -134,7 +134,7 @@ Display :: display_header($nameTools, 'Doc');
 
 echo '<div class="actions">';
 echo '<a href="document.php?id='.$document_id.'">'.
-    Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('DocumentsOverview'),'',ICON_SIZE_MEDIUM).'</a>';
+    Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('DocumentsOverview'), '', ICON_SIZE_MEDIUM).'</a>';
 echo '</div>';
 
 if (api_browser_support('svg')) {
@@ -144,7 +144,7 @@ if (api_browser_support('svg')) {
 	$langsvgedit = api_get_language_isocode();
 	$langsvgedit = isset($svgedit_code_translation_table[$langsvgedit]) ? $svgedit_code_translation_table[$langsvgedit] : $langsvgedit;
 	$langsvgedit = file_exists(api_get_path(LIBRARY_PATH).'javascript/svgedit/locale/lang.'.$langsvgedit.'.js') ? $langsvgedit : 'en';
-	$svg_url= api_get_path(WEB_LIBRARY_PATH).'javascript/svgedit/svg-editor.php?lang='.$langsvgedit;
+	$svg_url = api_get_path(WEB_LIBRARY_PATH).'javascript/svgedit/svg-editor.php?lang='.$langsvgedit;
 	?>
 	<script>
 		document.write ('<iframe id="frame" frameborder="0" scrolling="no" src="<?php echo  $svg_url; ?>" width="100%" height="100%"><noframes><p>Sorry, your browser does not handle frames</p></noframes></iframe>');

+ 6 - 6
main/document/edit_draw.php

@@ -40,7 +40,7 @@ if (empty($document_data)) {
 $dir = str_replace('\\', '/', $dir);
 
 /* Constants & Variables */
-$current_session_id=api_get_session_id();
+$current_session_id = api_get_session_id();
 $group_id = api_get_group_id();
 
 //path for svg-edit save
@@ -53,8 +53,8 @@ $get_file = Security::remove_XSS($file_path);
 $file = basename($get_file);
 $temp_file = explode(".", $file);
 $filename = $temp_file[0];
-$nameTools = get_lang('EditDocument') . ': ' . $filename;
-$courseDir = $_course['path'] . '/document';
+$nameTools = get_lang('EditDocument').': '.$filename;
+$courseDir = $_course['path'].'/document';
 $is_allowed_to_edit = api_is_allowed_to_edit(null, true);
 
 /*	Other initialization code */
@@ -129,15 +129,15 @@ Event::event_access_tool(TOOL_DOCUMENT);
 Display :: display_header($nameTools, 'Doc');
 echo '<div class="actions">';
 echo '<a href="document.php?id='.$parent_id.'">'.
-    Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('DocumentsOverview'),'',ICON_SIZE_MEDIUM).'</a>';
+    Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('DocumentsOverview'), '', ICON_SIZE_MEDIUM).'</a>';
 echo '<a href="edit_document.php?'.api_get_cidreq().'&id='.$document_id.'&origin=editdraw">'.
-    Display::return_icon('edit.png',get_lang('Rename').'/'.get_lang('Comments'),'',ICON_SIZE_MEDIUM).'</a>';
+    Display::return_icon('edit.png', get_lang('Rename').'/'.get_lang('Comments'), '', ICON_SIZE_MEDIUM).'</a>';
 echo '</div>';
 
 if (api_browser_support('svg')) {
 	//automatic loading the course language
 	$svgedit_code_translation_table = array('' => 'en', 'pt' => 'pt-Pt', 'sr' => 'sr_latn');
-	$langsvgedit  = api_get_language_isocode();
+	$langsvgedit = api_get_language_isocode();
 	$langsvgedit = isset($svgedit_code_translation_table[$langsvgedit]) ? $svgedit_code_translation_table[$langsvgedit] : $langsvgedit;
 	$langsvgedit = file_exists(api_get_path(LIBRARY_PATH).'javascript/svgedit/locale/lang.'.$langsvgedit.'.js') ? $langsvgedit : 'en';
 	$svg_url = api_get_path(WEB_LIBRARY_PATH).'javascript/svgedit/svg-editor.php?url=../../../../../courses/'.$courseDir.$dir.$file.'&lang='.$langsvgedit;

+ 1 - 1
main/exercise/evalmathnotation.php

@@ -7,7 +7,7 @@ get_lang('SubstractionMinus')."\n".
 get_lang('MultiplicationStar')."\n".
 get_lang('DivisionSlash')."\n".
 get_lang('ExponentiationCircumflex')."\n".
-get_lang('ModuloPercentage') . "\n" .
+get_lang('ModuloPercentage')."\n".
 "\n".
 get_lang('SquareRootSqrt')."\n".
 get_lang('AbsoluteValueAbs')."\n".

+ 4 - 4
main/inc/global.inc.php

@@ -42,7 +42,7 @@ if (file_exists($kernel->getConfigurationFile())) {
     if (!$alreadyInstalled) {
         $global_error_code = 2;
         // The system has not been installed yet.
-        require_once __DIR__ . '/../inc/global_error_message.inc.php';
+        require_once __DIR__.'/../inc/global_error_message.inc.php';
         die();
     }
 }
@@ -163,9 +163,9 @@ if (!empty($_configuration['multiple_access_urls'])) {
     $request_url_root = '';
     if (empty($_SERVER['HTTP_HOST'])) {
         if (empty($_SERVER['SERVER_NAME'])) {
-            $request_url_root = $protocol . 'localhost/';
+            $request_url_root = $protocol.'localhost/';
         } else {
-            $request_url_root = $protocol . $_SERVER['SERVER_NAME'] . '/';
+            $request_url_root = $protocol.$_SERVER['SERVER_NAME'].'/';
         }
     } else {
         $request_url_root = $protocol.$_SERVER['HTTP_HOST'].'/';
@@ -468,7 +468,7 @@ if (!empty($valid_languages)) {
     }
 
     if (!empty($language_priority1) && api_get_language_from_type($language_priority1) !== false) {
-        $language_interface =  api_get_language_from_type($language_priority1);
+        $language_interface = api_get_language_from_type($language_priority1);
     } else {
         if (isset($_course['language'])) {
             $language_interface = $_course['language'];

+ 13 - 13
main/inc/lib/exercise_show_functions.lib.php

@@ -54,7 +54,7 @@ class ExerciseShowFunctions
                 </td>
 
                 <?php
-                if (!api_is_allowed_to_edit(null,true) && $feedbackType != EXERCISE_FEEDBACK_TYPE_EXAM) { ?>
+                if (!api_is_allowed_to_edit(null, true) && $feedbackType != EXERCISE_FEEDBACK_TYPE_EXAM) { ?>
                     <td>
                         <?php
                         $comm = Event::get_comments($id, $questionId);
@@ -82,7 +82,7 @@ class ExerciseShowFunctions
         $showTotalScoreAndUserChoices
     ) {
         if (empty($id)) {
-            echo '<tr><td>'. Security::remove_XSS($answer).'</td></tr>';
+            echo '<tr><td>'.Security::remove_XSS($answer).'</td></tr>';
         } else {
         ?>
             <tr>
@@ -93,10 +93,10 @@ class ExerciseShowFunctions
                 </td>
 
             <?php
-            if (!api_is_allowed_to_edit(null,true) && $feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { ?>
+            if (!api_is_allowed_to_edit(null, true) && $feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { ?>
                 <td>
                     <?php
-                    $comm = Event::get_comments($id,$questionId);
+                    $comm = Event::get_comments($id, $questionId);
                     ?>
                 </td>
             <?php } ?>
@@ -151,7 +151,7 @@ class ExerciseShowFunctions
         if (isset($fileUrl)) {
             echo '
                 <tr>
-                    <td><audio src="' . $fileUrl . '" controls></audio></td>
+                    <td><audio src="' . $fileUrl.'" controls></audio></td>
                 </tr>
             ';
         }
@@ -162,7 +162,7 @@ class ExerciseShowFunctions
             echo '</tr>';
             if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) {
                 echo '<tr>';
-                echo Display::tag('td',get_lang('notCorrectedYet'), array('width'=>'45%'));
+                echo Display::tag('td', get_lang('notCorrectedYet'), array('width'=>'45%'));
                 echo '</tr>';
             } else {
                 echo '<tr><td>&nbsp;</td></tr>';
@@ -175,9 +175,9 @@ class ExerciseShowFunctions
             }
             echo '</td>';
 
-            if (!api_is_allowed_to_edit(null,true) && $feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) {
+            if (!api_is_allowed_to_edit(null, true) && $feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) {
                 echo '<td>';
-                $comm = Event::get_comments($id,$questionId);
+                $comm = Event::get_comments($id, $questionId);
                 echo '</td>';
             }
             echo '</tr>';
@@ -352,8 +352,8 @@ class ExerciseShowFunctions
 			?>
 		</td>
 			<?php
-		    if ($ans==1) {
-		        $comm = Event::get_comments($id,$questionId);
+		    if ($ans == 1) {
+		        $comm = Event::get_comments($id, $questionId);
 			}
 		    ?>
 		 <?php } else { ?>
@@ -456,7 +456,7 @@ class ExerciseShowFunctions
             ?>
         </td>
             <?php
-            if ($ans==1) {
+            if ($ans == 1) {
                 $comm = Event::get_comments($id, $questionId);
             }
             ?>
@@ -559,8 +559,8 @@ class ExerciseShowFunctions
             ?>
         </td>
             <?php
-            if ($ans==1) {
-                $comm = Event::get_comments($id,$questionId);
+            if ($ans == 1) {
+                $comm = Event::get_comments($id, $questionId);
             }
             ?>
          <?php } else { ?>

+ 9 - 9
main/inc/lib/surveymanager.lib.php

@@ -47,20 +47,20 @@ class SurveyTree
         $res = Database::query($sql);
         $refs = array();
         $list = array();
-        $plain_array=array();
+        $plain_array = array();
 
         while ($survey = Database::fetch_array($res, 'ASSOC')) {
-            $plain_array[$survey['survey_id']]=$survey;
-            $surveys_parents[]=$survey['survey_version'];
-            $thisref = &$refs[ $survey['survey_id'] ];
+            $plain_array[$survey['survey_id']] = $survey;
+            $surveys_parents[] = $survey['survey_version'];
+            $thisref = &$refs[$survey['survey_id']];
             $thisref['parent_id'] = $survey['parent_id'];
             $thisref['name'] = $survey['name'];
             $thisref['id'] = $survey['survey_id'];
             $thisref['survey_version'] = $survey['survey_version'];
             if ($survey['parent_id'] == 0) {
-                $list[ $survey['survey_id'] ] = &$thisref;
+                $list[$survey['survey_id']] = &$thisref;
             } else {
-                $refs[ $survey['parent_id'] ]['children'][ $survey['survey_id'] ] = &$thisref;
+                $refs[$survey['parent_id']]['children'][$survey['survey_id']] = &$thisref;
             }
         }
         $this->surveylist = $list;
@@ -79,7 +79,7 @@ class SurveyTree
     public function getParentId($id)
     {
         $node = $this->plainsurveylist[$id];
-        if (is_array($node)&& !empty($node['parent_id'])) {
+        if (is_array($node) && !empty($node['parent_id'])) {
             return $node['parent_id'];
         } else {
             return -1;
@@ -99,12 +99,12 @@ class SurveyTree
         if (is_array($list)) {
             foreach ($list as $key => $node) {
                 if (isset($node['children']) && is_array($node['children'])) {
-                    $result[$key]= $node['name'];
+                    $result[$key] = $node['name'];
                     $re = self::createList($node['children']);
                     if (!empty($re)) {
                         if (is_array($re)) {
                             foreach ($re as $key => $r) {
-                                $result[$key] = '' . $r;
+                                $result[$key] = ''.$r;
                             }
                         } else {
                             $result[] = $re;

+ 2 - 2
main/ticket/download.php

@@ -41,8 +41,8 @@ $file_url = str_replace('/..', '', $file_url);
 $file_url = Database::escape_string($file_url);
 $title = $_GET['title'];
 $path_attachment = api_get_path(SYS_ARCHIVE_PATH);
-$path_message_attach = $path_attachment . 'plugin_ticket_messageattch/';
-$full_file_name = $path_message_attach . $file_url;
+$path_message_attach = $path_attachment.'plugin_ticket_messageattch/';
+$full_file_name = $path_message_attach.$file_url;
 if (Security::check_abs_path($full_file_name, $path_message_attach)) {
     DocumentManager::file_send_for_download($full_file_name, true, $title);
 }

+ 1 - 1
main/ticket/index.php

@@ -7,5 +7,5 @@
  */
 
 require_once __DIR__.'/../inc/global.inc.php';
-header('Location:' . api_get_path(WEB_CODE_PATH) . 'ticket/tickets.php');
+header('Location:'.api_get_path(WEB_CODE_PATH).'ticket/tickets.php');
 exit;

+ 1 - 1
plugin/resubscription/src/HookResubscription.php

@@ -101,7 +101,7 @@ class HookResubscription extends HookObserver implements HookResubscribeObserver
                     $resubscriptionDate = gmdate($limitDateFormat, strtotime($endDate." +$resubscriptionOffset"));
                     $icon = Display::return_icon('students.gif', get_lang('Student'));
                     $canResubscribeFrom = sprintf(get_plugin_lang('CanResubscribeFromX', 'resubscription'), $resubscriptionDate);
-                    throw new Exception(Display::label($icon . ' ' . $canResubscribeFrom, "info"));
+                    throw new Exception(Display::label($icon.' '.$canResubscribeFrom, "info"));
                 }
             }
         }

+ 2 - 2
src/Chamilo/CourseBundle/Component/CourseCopy/Resources/Document.php

@@ -28,7 +28,7 @@ class Document extends Resource
     public function __construct($id, $path, $comment, $title, $file_type, $size)
     {
         parent::__construct($id, RESOURCE_DOCUMENT);
-        $this->path = 'document' . $path;
+        $this->path = 'document'.$path;
         $this->comment = $comment;
         $this->title = $title;
         $this->file_type = $file_type;
@@ -44,7 +44,7 @@ class Document extends Resource
         echo preg_replace('@^document@', '', $this->path);
         if (!empty($this->title)) {
             if (strpos($this->path, $this->title) === false) {
-                echo " - " . $this->title;
+                echo " - ".$this->title;
             }
         }
     }

+ 55 - 55
src/Chamilo/CourseBundle/Component/CourseCopy/Resources/DummyCourseCreator.php

@@ -33,7 +33,7 @@ class DummyCourseCreator
         $this->default_property['to_user_id'] = null;
         $this->default_property['visibility'] = '1';
         $this->default_property['start_visible'] = null;
-        $this->default_property['end_visible'] =  null;
+        $this->default_property['end_visible'] = null;
 
         $course = api_get_course_info($course_code);
         $this->course = new Course();
@@ -60,13 +60,13 @@ class DummyCourseCreator
         $course = api_get_course_info();
         $course_doc_path = $this->course->backup_path.'/document/';
         $number_of_documents = rand(10, 30);
-        $extensions = array ('html', 'doc');
+        $extensions = array('html', 'doc');
         $directories = array();
         $property = $this->default_property;
         $property['lastedit_type'] = 'DocumentAdded';
         $property['tool'] = TOOL_DOCUMENT;
         $doc_id = 0;
-        for ($doc_id = 1; $doc_id < $number_of_documents; $doc_id ++)
+        for ($doc_id = 1; $doc_id < $number_of_documents; $doc_id++)
         {
             $path = '';
             $doc_type = rand(0, count($extensions) - 1);
@@ -74,7 +74,7 @@ class DummyCourseCreator
             $filename = $this->get_dummy_content('title').'_'.$doc_id.'.'.$extension;
             $content = $this->get_dummy_content('text');
             $dirs = rand(0, 3);
-            for ($i = 0; $i < $dirs; $i ++)
+            for ($i = 0; $i < $dirs; $i++)
             {
                 $path .= 'directory/';
                 $directories[$path] = 1;
@@ -89,14 +89,14 @@ class DummyCourseCreator
             fwrite($fp, $content);
             fclose($fp);
             $size = filesize($file);
-            $document = new Document($doc_id, '/'.$path.$filename,$this->get_dummy_content('description'),$this->get_dummy_content('title'), 'file', $size);
+            $document = new Document($doc_id, '/'.$path.$filename, $this->get_dummy_content('description'), $this->get_dummy_content('title'), 'file', $size);
             $document->item_properties[] = $property;
             $this->course->add_resource($document);
         }
-        foreach($directories as $path => $flag)
+        foreach ($directories as $path => $flag)
         {
-            $path = substr($path,0,strlen($path)-1);
-            $document = new Document($doc_id++,'/'.$path, $this->get_dummy_content('description'),$this->get_dummy_content('title'),'folder',0);
+            $path = substr($path, 0, strlen($path) - 1);
+            $document = new Document($doc_id++, '/'.$path, $this->get_dummy_content('description'), $this->get_dummy_content('title'), 'folder', 0);
             $property['lastedit_type'] = 'FolderCreated';
             $document->item_properties[] = $property;
             $this->course->add_resource($document);
@@ -111,11 +111,11 @@ class DummyCourseCreator
         $property['lastedit_type'] = 'AnnouncementAdded';
         $property['tool'] = TOOL_ANNOUNCEMENT;
         $number_of_announcements = rand(10, 30);
-        for ($i = 0; $i < $number_of_announcements; $i ++)
+        for ($i = 0; $i < $number_of_announcements; $i++)
         {
             $time = mktime(rand(1, 24), rand(1, 60), 0, rand(1, 12), rand(1, 28), intval(date('Y')));
             $date = date('Y-m-d', $time);
-            $announcement = new Announcement($i,$this->get_dummy_content('title'),$this->get_dummy_content('text'), $date,0);
+            $announcement = new Announcement($i, $this->get_dummy_content('title'), $this->get_dummy_content('text'), $date, 0);
             $announcement->item_properties[] = $property;
             $this->course->add_resource($announcement);
         }
@@ -129,23 +129,23 @@ class DummyCourseCreator
         $property = $this->default_property;
         $property['lastedit_type'] = 'AgendaAdded';
         $property['tool'] = TOOL_CALENDAR_EVENT;
-        for ($i = 0; $i < $number_of_events; $i ++)
+        for ($i = 0; $i < $number_of_events; $i++)
         {
-            $hour = rand(1,24);
-            $minute = rand(1,60);
-            $second = rand(1,60);
-            $day = rand(1,28);
-            $month = rand(1,12);
+            $hour = rand(1, 24);
+            $minute = rand(1, 60);
+            $second = rand(1, 60);
+            $day = rand(1, 28);
+            $month = rand(1, 12);
             $year = intval(date('Y'));
-            $time = mktime($hour,$minute,$second,$month,$day,$year);
+            $time = mktime($hour, $minute, $second, $month, $day, $year);
             $start_date = date('Y-m-d H:m:s', $time);
-            $hour = rand($hour,24);
-            $minute = rand($minute,60);
-            $second = rand($second,60);
-            $day = rand($day,28);
-            $month = rand($month,12);
+            $hour = rand($hour, 24);
+            $minute = rand($minute, 60);
+            $second = rand($second, 60);
+            $day = rand($day, 28);
+            $month = rand($month, 12);
             $year = intval(date('Y'));
-            $time = mktime($hour,$minute,$second,$month,$day,$year);
+            $time = mktime($hour, $minute, $second, $month, $day, $year);
             $end_date = date('Y-m-d H:m:s', $time);
             $event = new CalendarEvent(
                 $i,
@@ -165,20 +165,20 @@ class DummyCourseCreator
     {
         // create categorys
         $number_of_categories = rand(5, 10);
-        for ($i = 0; $i < $number_of_categories; $i ++)
+        for ($i = 0; $i < $number_of_categories; $i++)
         {
-            $linkcat = new LinkCategory($i, $this->get_dummy_content('title'), $this->get_dummy_content('description'),$i);
+            $linkcat = new LinkCategory($i, $this->get_dummy_content('title'), $this->get_dummy_content('description'), $i);
             $this->course->add_resource($linkcat);
         }
         // create links
         $number_of_links = rand(5, 50);
-        $on_homepage = rand(0,20) == 0 ? 1 : 0;
+        $on_homepage = rand(0, 20) == 0 ? 1 : 0;
         $property = $this->default_property;
         $property['lastedit_type'] = 'LinkAdded';
         $property['tool'] = TOOL_LINK;
-        for ($i = 0; $i < $number_of_links; $i ++)
+        for ($i = 0; $i < $number_of_links; $i++)
         {
-            $link = new Link($i, $this->get_dummy_content('title'), 'http://www.google.com/search?q='.$this->get_dummy_content('title'), $this->get_dummy_content('description'), rand(0, $number_of_categories -1),$on_homepage);
+            $link = new Link($i, $this->get_dummy_content('title'), 'http://www.google.com/search?q='.$this->get_dummy_content('title'), $this->get_dummy_content('description'), rand(0, $number_of_categories - 1), $on_homepage);
             $link->item_properties[] = $property;
             $this->course->add_resource($link);
         }
@@ -192,18 +192,18 @@ class DummyCourseCreator
         $number_of_forums = rand(5, 50);
         $number_of_topics = rand(30, 100);
         $number_of_posts = rand(100, 1000);
-        $last_forum_post = array ();
-        $last_topic_post = array ();
+        $last_forum_post = array();
+        $last_topic_post = array();
         // create categorys
         $order = 1;
-        for ($i = 1; $i <= $number_of_categories; $i ++)
+        for ($i = 1; $i <= $number_of_categories; $i++)
         {
             $forumcat = new ForumCategory($i, $this->get_dummy_content('title'), $this->get_dummy_content('description'), $order, 0, 0);
             $this->course->add_resource($forumcat);
             $order++;
         }
         // create posts
-        for ($post_id = 1; $post_id <= $number_of_posts; $post_id ++)
+        for ($post_id = 1; $post_id <= $number_of_posts; $post_id++)
         {
             $topic_id = rand(1, $number_of_topics);
             $last_topic_post[$topic_id] = $post_id;
@@ -211,7 +211,7 @@ class DummyCourseCreator
             $this->course->add_resource($post);
         }
         // create topics
-        for ($topic_id = 1; $topic_id <= $number_of_topics; $topic_id ++)
+        for ($topic_id = 1; $topic_id <= $number_of_topics; $topic_id++)
         {
             $forum_id = rand(1, $number_of_forums);
             $last_forum_post[$forum_id] = $last_topic_post[$topic_id];
@@ -219,9 +219,9 @@ class DummyCourseCreator
             $this->course->add_resource($topic);
         }
         // create forums
-        for ($forum_id = 1; $forum_id <= $number_of_forums; $forum_id ++)
+        for ($forum_id = 1; $forum_id <= $number_of_forums; $forum_id++)
         {
-            $forum = new Forum($forum_id, $this->get_dummy_content('title'),$this->get_dummy_content('description'), rand(1, $number_of_categories), $last_forum_post[$forum_id]);
+            $forum = new Forum($forum_id, $this->get_dummy_content('title'), $this->get_dummy_content('description'), rand(1, $number_of_categories), $last_forum_post[$forum_id]);
             $this->course->add_resource($forum);
         }
     }
@@ -230,25 +230,25 @@ class DummyCourseCreator
      */
     function create_dummy_learnpaths()
     {
-        $number_of_learnpaths = rand(3,5);
+        $number_of_learnpaths = rand(3, 5);
         $global_item_id = 1;
-        for($i=1; $i<=$number_of_learnpaths;$i++)
+        for ($i = 1; $i <= $number_of_learnpaths; $i++)
         {
         $chapters = array();
-        $number_of_chapters = rand(1,6);
-        for($chapter_id = 1; $chapter_id <= $number_of_chapters; $chapter_id++)
+        $number_of_chapters = rand(1, 6);
+        for ($chapter_id = 1; $chapter_id <= $number_of_chapters; $chapter_id++)
         {
             $chapter['name'] = $this->get_dummy_content('title');
             $chapter['description'] = $this->get_dummy_content('description');
             $chapter['display_order'] = $chapter_id;
             $chapter['items'] = array();
-            $number_of_items = rand(5,20);
-            for( $item_id = 1; $item_id<$number_of_items; $item_id++)
+            $number_of_items = rand(5, 20);
+            for ($item_id = 1; $item_id < $number_of_items; $item_id++)
             {
-                $types = array(RESOURCE_ANNOUNCEMENT, RESOURCE_EVENT, RESOURCE_DOCUMENT,RESOURCE_LINK,RESOURCE_FORUM,RESOURCE_FORUMPOST,RESOURCE_FORUMTOPIC);
-                $type = $types[rand(0,count($types)-1)];
+                $types = array(RESOURCE_ANNOUNCEMENT, RESOURCE_EVENT, RESOURCE_DOCUMENT, RESOURCE_LINK, RESOURCE_FORUM, RESOURCE_FORUMPOST, RESOURCE_FORUMTOPIC);
+                $type = $types[rand(0, count($types) - 1)];
                 $resources = $this->course->resources[$type];
-                $resource = $resources[rand(0,count($resources)-1)];
+                $resource = $resources[rand(0, count($resources) - 1)];
                 $item = array();
                 $item['type'] = $resource->type;
                 $item['id'] = $resource->source_id;
@@ -256,17 +256,17 @@ class DummyCourseCreator
                 $item['title'] = $this->get_dummy_content('title');
                 $item['description'] = $this->get_dummy_content('description');
                 $item['ref_id'] = $global_item_id;
-                if( rand(0,5) == 1 && $item_id > 1)
+                if (rand(0, 5) == 1 && $item_id > 1)
                 {
                     $item['prereq_type'] = 'i';
-                    $item['prereq'] = rand($global_item_id - $item_id,$global_item_id-1);
+                    $item['prereq'] = rand($global_item_id - $item_id, $global_item_id - 1);
                 }
                 $chapter['items'][] = $item;
                 $global_item_id++;
             }
             $chapters[] = $chapter;
         }
-        $lp = new CourseCopyLearnpath($i,$this->get_dummy_content('title'),$this->get_dummy_content('description'),1,$chapters);
+        $lp = new CourseCopyLearnpath($i, $this->get_dummy_content('title'), $this->get_dummy_content('description'), 1, $chapters);
         $this->course->add_resource($lp);
         }
     }
@@ -280,20 +280,20 @@ class DummyCourseCreator
         Aenean ac wisi non enim aliquam scelerisque. Praesent eget mi. Vestibulum volutpat pulvinar justo. Phasellus sapien ante, pharetra id, bibendum sed, porta non, purus. Maecenas leo velit, luctus quis, porta non, feugiat sit amet, sapien. Proin vitae augue ut massa adipiscing placerat. Morbi ac risus. Proin dapibus eros egestas quam. Fusce fermentum lobortis elit. Duis lectus tellus, convallis nec, lobortis vel, accumsan ut, nunc. Nunc est. Donec ullamcorper laoreet quam.
         Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Suspendisse potenti. Mauris mi. Vivamus risus lacus, faucibus sit amet, sollicitudin a, blandit et, justo. In hendrerit. Sed imperdiet, eros at fringilla tempor, turpis augue semper enim, quis rhoncus nibh enim quis dui. Sed massa sapien, mattis et, laoreet sit amet, dignissim nec, urna. Integer laoreet quam quis lectus. Curabitur convallis gravida dui. Nam metus. Ut sit amet augue in nibh interdum scelerisque. Donec venenatis, lacus et pulvinar euismod, libero massa condimentum pede, commodo tristique nunc massa eu quam. Donec vulputate. Aenean in nibh. Phasellus porttitor. Donec molestie, sem ac porttitor vulputate, mauris dui egestas libero, ac lobortis dolor sem vel ligula. Nam vulputate pretium libero. Cras accumsan. Vivamus lacinia sapien sit amet elit.
         Duis bibendum elementum justo. Duis posuere. Fusce nulla odio, posuere eget, condimentum nec, venenatis eu, elit. In hac habitasse platea dictumst. Aenean ac sem in enim imperdiet feugiat. Integer tincidunt lectus at elit. Integer magna lacus, vehicula quis, eleifend eget, suscipit vitae, leo. Nunc porta augue nec enim. Curabitur vehicula volutpat enim. Aliquam consequat. Vestibulum rhoncus tellus vitae erat. Integer est. Quisque fermentum leo nec odio. Suspendisse lobortis sollicitudin augue. Nullam urna mi, suscipit eu, sagittis laoreet, ultrices ac, sem. Aliquam enim tortor, hendrerit non, cursus a, tristique sit amet, sapien. Suspendisse potenti. Aenean semper placerat neque.';
-        switch($type)
+        switch ($type)
         {
          case 'description':
-            $descriptions = explode(".",$dummy_text);
-            return $descriptions[rand(0,count($descriptions)-1)];
+            $descriptions = explode(".", $dummy_text);
+            return $descriptions[rand(0, count($descriptions) - 1)];
             break;
          case 'title':
-            $dummy_text = str_replace(array("\n",'.',',',"\t"),array(' ','','',' '),$dummy_text);
-            $titles = explode(" ",$dummy_text);
-            return trim($titles[rand(0,count($titles)-1)]);
+            $dummy_text = str_replace(array("\n", '.', ',', "\t"), array(' ', '', '', ' '), $dummy_text);
+            $titles = explode(" ", $dummy_text);
+            return trim($titles[rand(0, count($titles) - 1)]);
             break;
          case 'text':
-            $texts = explode("\n",$dummy_text);
-            return $texts[rand(0,count($texts)-1)];
+            $texts = explode("\n", $dummy_text);
+            return $texts[rand(0, count($texts) - 1)];
             break;
         }
     }

+ 1 - 1
src/Chamilo/CourseBundle/Component/CourseCopy/Resources/ForumPost.php

@@ -25,6 +25,6 @@ class ForumPost extends Resource
     public function show()
     {
         parent::show();
-        echo $this->obj->title . ' (' . $this->obj->poster_name . ', ' . $this->obj->post_date . ')';
+        echo $this->obj->title.' ('.$this->obj->poster_name.', '.$this->obj->post_date.')';
     }
 }