Minor - phpcs fixes

pull/2487/head
jmontoyaa 7 years ago
parent c1fae9955a
commit 9b8b2424da
  1. 1
      src/CoreBundle/Form/BranchType.php
  2. 3
      src/CoreBundle/Framework/Container.php
  3. 86
      src/CoreBundle/Framework/PageController.php
  4. 135
      src/CoreBundle/Menu/LeftMenuBuilder.php
  5. 68
      src/CoreBundle/Menu/NavBuilder.php

@ -6,7 +6,6 @@ namespace Chamilo\CoreBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Entity;
class BranchType extends AbstractType
{

@ -245,7 +245,7 @@ class Container
*/
public static function getMailer()
{
return self::$container->get('mailer');
return self::$container->get('mailer');
}
/**
@ -338,5 +338,4 @@ class Container
{
return self::$container->get('chamilo_course.tool_chain');
}
}

@ -48,7 +48,7 @@ class PageController
get_lang('MenuGeneral'),
null,
'help_block',
array('content' => $home_menu_content)
['content' => $home_menu_content]
);
}
}
@ -60,18 +60,18 @@ class PageController
public function returnSkillsLinks()
{
if (api_get_setting('skill.allow_skills_tool') == 'true') {
$content = array();
$content[] = array(
$content = [];
$content[] = [
'title' => get_lang('MySkills'),
'href' => api_get_path(WEB_CODE_PATH).'social/skills_wheel.php'
);
];
if (api_get_setting('skill.allow_hr_skills_management') == 'true'
|| api_is_platform_admin()) {
$content[] = array(
$content[] = [
'title' => get_lang('ManageSkills'),
'href' => api_get_path(WEB_CODE_PATH).'admin/skills_wheel.php'
);
];
}
$this->show_right_block(get_lang("Skills"), $content, 'skill_block');
}
@ -96,9 +96,9 @@ class PageController
if (!empty($home_notice)) {
$home_notice = api_to_system_encoding($home_notice, api_detect_encoding(strip_tags($home_notice)));
$home_notice = Display::div($home_notice, array('class' => 'homepage_notice'));
$home_notice = Display::div($home_notice, ['class' => 'homepage_notice']);
$this->show_right_block(get_lang('Notice'), null, 'notice_block', array('content' => $home_notice));
$this->show_right_block(get_lang('Notice'), null, 'notice_block', ['content' => $home_notice]);
}
}
@ -117,12 +117,12 @@ class PageController
if (!empty($id)) {
$params['id'] = $id;
}
$block_menu = array(
$block_menu = [
'id' => $params['id'],
'title' => $title,
'elements' => $content,
'content' => isset($params['content']) ? $params['content'] : null
);
];
//$app['template']->assign($id, $block_menu);
}
@ -272,7 +272,7 @@ class PageController
);
}
if (!empty($classes)) {
$classes = Display::tag('ul', $classes, array('class' => 'nav nav-list'));
$classes = Display::tag('ul', $classes, ['class' => 'nav nav-list']);
$html .= $this->show_right_block(get_lang('Classes'), $classes, 'classes_block');
}
}
@ -287,7 +287,7 @@ class PageController
*/
public function return_exercise_block($personal_course_list, $tpl)
{
$exercise_list = array();
$exercise_list = [];
if (!empty($personal_course_list)) {
foreach ($personal_course_list as $course_item) {
$course_code = $course_item['c'];
@ -475,7 +475,6 @@ class PageController
$courses_list_string = '';
$courses_shown = 0;
if ($numrows > 0) {
$courses_list_string .= Display::page_header(get_lang('CourseList'));
$courses_list_string .= "<ul>";
@ -493,7 +492,7 @@ class PageController
$courses_shown++;
$courses_list_string .= "<li>\n";
$courses_list_string .= '<a href="'.$web_course_path.$course['directory'].'/">'.$course['title'].'</a><br />';
$course_details = array();
$course_details = [];
if (api_get_setting('course.display_coursecode_in_courselist') ==
'true') {
$course_details[] = $course['visual_code'];
@ -546,7 +545,7 @@ class PageController
) {
$courses_list_string .= '</a><br />';
}
$course_details = array();
$course_details = [];
if (api_get_setting('course.display_coursecode_in_courselist') == 'true') {
$course_details[] = $course['visual_code'];
}
@ -630,24 +629,23 @@ class PageController
$this->maxPerPage
);
$adapter = new FixedAdapter($nbResults, array());
$adapter = new FixedAdapter($nbResults, []);
$pagerfanta = new Pagerfanta($adapter);
$pagerfanta->setMaxPerPage($this->maxPerPage); // 10 by default
$pagerfanta->setCurrentPage($page); // 1 by default
$this->app['pagerfanta.view.router.name'] = 'userportal';
$this->app['pagerfanta.view.router.params'] = array(
$this->app['pagerfanta.view.router.params'] = [
'filter' => $filter,
'type' => 'courses',
'page' => $page
);
];
$this->app['template']->assign('pagination', $pagerfanta);
return $html;
}
function returnSpecialCourses($user_id, $filter, $page)
public function returnSpecialCourses($user_id, $filter, $page)
{
if (empty($user_id)) {
return false;
@ -660,17 +658,16 @@ class PageController
$html = CourseManager::displaySpecialCourses($user_id, $filter, $loadDirs, false, $start, $this->maxPerPage);
if (!empty($html)) {
$adapter = new FixedAdapter($nbResults, array());
$adapter = new FixedAdapter($nbResults, []);
$pagerfanta = new Pagerfanta($adapter);
$pagerfanta->setMaxPerPage($this->maxPerPage); // 10 by default
$pagerfanta->setCurrentPage($page); // 1 by default
$this->app['pagerfanta.view.router.name'] = 'userportal';
$this->app['pagerfanta.view.router.params'] = array(
$this->app['pagerfanta.view.router.params'] = [
'filter' => $filter,
'type' => 'courses',
'page' => $page
);
];
$this->app['template']->assign('pagination', $pagerfanta);
}
@ -712,7 +709,7 @@ class PageController
);
if (!empty($html)) {
$adapter = new FixedAdapter($nbResults, array());
$adapter = new FixedAdapter($nbResults, []);
$pagerfanta = new Pagerfanta($adapter);
$pagerfanta->setMaxPerPage($this->maxPerPage); // 10 by default
$pagerfanta->setCurrentPage($page); // 1 by default
@ -802,12 +799,12 @@ class PageController
$count++;
}
$params = array();
$params = [];
if ($count > 0) {
$params['icon'] = Display::return_icon(
'window_list.png',
$session['session_name'],
array('id' => 'session_img_'.$session_id),
['id' => 'session_img_'.$session_id],
ICON_SIZE_LARGE
);
@ -820,7 +817,7 @@ class PageController
$session_link = Display::tag(
'a',
$session['session_name'],
array('href' => api_get_path(WEB_CODE_PATH).'session/index.php?session_id='.$session_id)
['href' => api_get_path(WEB_CODE_PATH).'session/index.php?session_id='.$session_id]
);
$params['link'] = api_get_path(WEB_CODE_PATH).'session/index.php?session_id='.$session_id;
}
@ -841,7 +838,7 @@ class PageController
$params['right_actions'] = '<a href="'.api_get_path(WEB_CODE_PATH).'session/resume_session.php?id_session='.$session_id.'">'.Display::return_icon(
'edit.png',
get_lang('Edit'),
array('align' => 'absmiddle'),
['align' => 'absmiddle'],
ICON_SIZE_SMALL
).'</a>';
}
@ -850,11 +847,11 @@ class PageController
}
if ($count_courses_session > 0) {
$params = array();
$params = [];
$params['icon'] = Display::return_icon(
'folder_blue.png',
$session_category['session_category']['name'],
array(),
[],
ICON_SIZE_LARGE
);
@ -864,7 +861,7 @@ class PageController
).'admin/session_category_edit.php?&id='.$session_category['session_category']['id'].'">'.Display::return_icon(
'edit.png',
get_lang('Edit'),
array(),
[],
ICON_SIZE_SMALL
).'</a>';
}
@ -902,17 +899,17 @@ class PageController
}
//Pagination
$adapter = new FixedAdapter($nbResults, array());
$adapter = new FixedAdapter($nbResults, []);
$pagerfanta = new Pagerfanta($adapter);
$pagerfanta->setMaxPerPage($this->maxPerPage); // 10 by default
$pagerfanta->setCurrentPage($page); // 1 by default
$this->app['pagerfanta.view.router.name'] = 'userportal';
$this->app['pagerfanta.view.router.params'] = array(
$this->app['pagerfanta.view.router.params'] = [
'filter' => $filter,
'type' => 'sessioncategories',
'page' => $page
);
];
$this->app['template']->assign('pagination', $pagerfanta);
}
@ -1084,18 +1081,17 @@ class PageController
$course_session['skill'] = isset($courseUserHtml['skill']) ? $courseUserHtml['skill'] : '';
$html_courses_session[] = $course_session;
}
}
$count_courses_session++;
}
if ($count_courses_session > 0) {
$params = array();
$params = [];
$params['icon'] = Display::return_icon(
'window_list.png',
$session['session_name'],
array('id' => 'session_img_'.$session_id),
['id' => 'session_img_'.$session_id],
ICON_SIZE_LARGE
);
$params['is_session'] = true;
@ -1108,9 +1104,9 @@ class PageController
$session_link = Display::tag(
'a',
$session['session_name'],
array(
[
'href' => api_get_path(WEB_CODE_PATH).'session/index.php?session_id='.$session_id
)
]
);
$params['link'] = api_get_path(WEB_CODE_PATH).'session/index.php?session_id='.$session_id;
}
@ -1135,7 +1131,7 @@ class PageController
Display::return_icon(
'edit.png',
get_lang('Edit'),
array('align' => 'absmiddle'),
['align' => 'absmiddle'],
ICON_SIZE_SMALL
),
api_get_path(WEB_CODE_PATH).'session/resume_session.php?id_session='.$session_id
@ -1197,9 +1193,9 @@ class PageController
$tpl->assign('welcome_to_course_block', 1);
}
/**
* @param array
*/
/**
* @param array
*/
public function returnNavigationLinks($items)
{
// Main navigation section.
@ -1213,7 +1209,7 @@ class PageController
$content .= '</li>';
}
$content .= '</ul>';
$this->show_right_block(get_lang('MainNavigation'), null, 'navigation_block', array('content' => $content));
$this->show_right_block(get_lang('MainNavigation'), null, 'navigation_block', ['content' => $content]);
}
}
}

@ -93,7 +93,6 @@ class LeftMenuBuilder implements ContainerAwareInterface
],
]
);
}
return $menu;
@ -154,62 +153,62 @@ class LeftMenuBuilder implements ContainerAwareInterface
$menu->addChild(
$translator->trans('Inbox'),
array(
[
'route' => 'main',
'routeParameters' => array(
'routeParameters' => [
'name' => 'messages/inbox.php',
),
)
],
]
);
$menu->addChild(
$translator->trans('Compose'),
array(
[
'route' => 'main',
'routeParameters' => array(
'routeParameters' => [
'name' => 'messages/new_message.php',
),
)
],
]
);
$menu->addChild(
$translator->trans('PendingInvitations'),
array(
[
'route' => 'main',
'routeParameters' => array(
'routeParameters' => [
'name' => 'social/invitations.php',
),
)
],
]
);
$menu->addChild(
$translator->trans('MyFiles'),
array(
[
'route' => 'main',
'routeParameters' => array(
'routeParameters' => [
'name' => 'social/myfiles.php',
),
)
],
]
);
$menu->addChild(
$translator->trans('EditProfile'),
array(
[
'route' => 'main',
'routeParameters' => array(
'routeParameters' => [
'name' => 'messages/inbox.php',
),
)
],
]
);
$menu->addChild(
$translator->trans('Inbox'),
array(
[
'route' => 'main',
'routeParameters' => array(
'routeParameters' => [
'name' => 'messages/inbox.php',
),
)
],
]
);
}
@ -233,82 +232,82 @@ class LeftMenuBuilder implements ContainerAwareInterface
$menu->addChild(
$translator->trans('Home'),
array(
[
'route' => 'main',
'routeParameters' => array(
'routeParameters' => [
'name' => 'social/home.php',
),
)
],
]
);
$menu->addChild(
$translator->trans('Messages'),
array(
[
'route' => 'main',
'routeParameters' => array(
'routeParameters' => [
'name' => 'messages/inbox.php',
),
)
],
]
);
$menu->addChild(
$translator->trans('Invitations'),
array(
[
'route' => 'main',
'routeParameters' => array(
'routeParameters' => [
'name' => 'social/invitations.php',
),
)
],
]
);
$menu->addChild(
$translator->trans('ViewMySharedProfile'),
array(
[
'route' => 'main',
'routeParameters' => array(
'routeParameters' => [
'name' => 'social/profile.php',
),
)
],
]
);
$menu->addChild(
$translator->trans('Friends'),
array(
[
'route' => 'main',
'routeParameters' => array(
'routeParameters' => [
'name' => 'social/friends.php',
),
)
],
]
);
$menu->addChild(
$translator->trans('SocialGroups'),
array(
[
'route' => 'main',
'routeParameters' => array(
'routeParameters' => [
'name' => 'social/groups.php',
),
)
],
]
);
$menu->addChild(
$translator->trans('Search'),
array(
[
'route' => 'main',
'routeParameters' => array(
'routeParameters' => [
'name' => 'social/search.php',
),
)
],
]
);
$menu->addChild(
$translator->trans('MyFiles'),
array(
[
'route' => 'main',
'routeParameters' => array(
'routeParameters' => [
'name' => 'social/myfiles.php',
),
)
],
]
);
}
@ -396,14 +395,14 @@ class LeftMenuBuilder implements ContainerAwareInterface
$menu->addChild(
$translator->trans(
'registration.submit',
array(),
[],
'FOSUserBundle'
),
array(
[
'route' => 'main',
'routeParameters' => ['name' => 'auth/inscription.php'],
array("attributes" => array("id" => 'nav')),
)
["attributes" => ["id" => 'nav']],
]
);
}
@ -411,15 +410,15 @@ class LeftMenuBuilder implements ContainerAwareInterface
$menu->addChild(
$translator->trans(
'resetting.request.submit',
array(),
[],
'FOSUserBundle'
),
array(
[
//'route' => 'fos_user_resetting_request',
'route' => 'main',
'routeParameters' => ['name' => 'auth/lostPassword.php'],
array("attributes" => array("id" => 'nav')),
)
["attributes" => ["id" => 'nav']],
]
);
}
@ -437,10 +436,10 @@ class LeftMenuBuilder implements ContainerAwareInterface
$menu = $factory->createItem('main');
$menu->addChild(
$translator->trans('Forum'),
array(
[
'uri' => 'https://chamilo.org/forum/',
array("attributes" => array("id" => 'nav')),
)
["attributes" => ["id" => 'nav']],
]
);
return $menu;

@ -27,7 +27,7 @@ class NavBuilder implements ContainerAwareInterface
*
* @return \Knp\Menu\ItemInterface
*/
public function createCategoryMenu(array $itemOptions = array(), $currentUri = null)
public function createCategoryMenu(array $itemOptions = [], $currentUri = null)
{
$factory = $this->container->get('knp_menu.factory');
$menu = $factory->createItem('categories', $itemOptions);
@ -42,12 +42,12 @@ class NavBuilder implements ContainerAwareInterface
* @param array $options The item options
* @param string $currentUri The current URI
*/
public function buildCategoryMenu(ItemInterface $menu, array $options = array(), $currentUri = null)
public function buildCategoryMenu(ItemInterface $menu, array $options = [], $currentUri = null)
{
//$categories = $this->categoryManager->getCategoryTree();
//$this->fillMenu($menu, $categories, $options, $currentUri);
$menu->addChild('home', array('route' => 'home'));
$menu->addChild('home', ['route' => 'home']);
}
/**
@ -66,61 +66,61 @@ class NavBuilder implements ContainerAwareInterface
$menu->addChild(
$translator->trans('Home'),
array('route' => 'home')
['route' => 'home']
);
if ($checker->isGranted('IS_AUTHENTICATED_FULLY')) {
$menu->addChild(
$translator->trans('MyCourses'),
array('route' => 'userportal')
['route' => 'userportal']
);
$menu->addChild(
$translator->trans('Calendar'),
array(
[
'route' => 'main',
'routeParameters' => array(
'routeParameters' => [
'name' => 'calendar/agenda_js.php',
),
)
],
]
);
$menu->addChild(
$translator->trans('Reporting'),
array(
[
'route' => 'main',
'routeParameters' => array(
'routeParameters' => [
'name' => 'mySpace/index.php',
),
)
],
]
);
$menu->addChild(
$translator->trans('Social'),
array(
[
'route' => 'main',
'routeParameters' => array(
'routeParameters' => [
'name' => 'social/home.php',
),
)
],
]
);
if ($checker->isGranted('ROLE_ADMIN')) {
$menu->addChild(
$translator->trans('Dashboard'),
array(
[
'route' => 'main',
'routeParameters' => array(
'routeParameters' => [
'name' => 'dashboard/index.php',
),
)
],
]
);
$menu->addChild(
$translator->trans('Administration'),
array(
[
'route' => 'administration',
)
]
);
}
}
@ -137,13 +137,13 @@ class NavBuilder implements ContainerAwareInterface
foreach ($categories as $category) {
$faq->addChild(
$category->getHeadline(),
array(
[
'route' => 'faq',
'routeParameters' => array(
'routeParameters' => [
'categorySlug' => $category->getSlug(),
'questionSlug' => '',
),
)
],
]
)->setAttribute('divider_append', true);
}
}
@ -153,10 +153,10 @@ class NavBuilder implements ContainerAwareInterface
$host = $site->getRequestContext()->getHost();
$siteManager = $this->container->get('sonata.page.manager.site');
/** @var Site $site */
$site = $siteManager->findOneBy(array(
'host' => array($host, 'localhost'),
$site = $siteManager->findOneBy([
'host' => [$host, 'localhost'],
'enabled' => true,
));
]);
if ($site) {
$pageManager = $this->container->get('sonata.page.manager.page');
@ -195,12 +195,12 @@ class NavBuilder implements ContainerAwareInterface
foreach ($page->getChildren() as $child) {
$subMenu->addChild(
$child->getName(),
array(
[
'route' => $page->getRouteName(),
'routeParameters' => array(
'routeParameters' => [
'path' => $child->getUrl(),
),
)
],
]
)->setAttribute('divider_append', true);
}
}

Loading…
Cancel
Save