Minor: Improve code checking Flintci feedbacks - refs BT#19052

pull/3973/head
Christian 4 years ago
parent 210a4e20a5
commit c43e2ccd01
  1. 2
      main/inc/ajax/lang.ajax.php
  2. 7
      main/inc/lib/PortfolioController.php
  3. 2
      main/portfolio/index.php
  4. 4
      src/Chamilo/CoreBundle/Entity/PortfolioCategory.php

@ -17,9 +17,7 @@ switch ($action) {
echo api_get_language_translate_html();
break;
case 'translate_portfolio_category':
if (isset($_REQUEST['new_language']) && isset($_REQUEST['variable_language']) && isset($_REQUEST['category_id'])) {
$newLanguage = Security::remove_XSS($_REQUEST['new_language']);
$langVariable = Security::remove_XSS($_REQUEST['variable_language']);
$categoryId = (int) $_REQUEST['category_id'];

@ -57,7 +57,6 @@ class PortfolioController
}
/**
*
* @throws \Doctrine\ORM\ORMException
* @throws \Doctrine\ORM\OptimisticLockException
*/
@ -484,7 +483,7 @@ class PortfolioController
$parentCategories = $this->getCategoriesForIndex(null, 0);
foreach ($parentCategories as $parentCategory) {
$categoriesSelect->addOption($parentCategory->getTitle(), $parentCategory->getId());
$subCategories = $this->getCategoriesForIndex(null, $parentCategory->getId());
$subCategories = $this->getCategoriesForIndex(null, $parentCategory->getId());
if (count($subCategories) > 0) {
foreach ($subCategories as $subCategory) {
$categoriesSelect->addOption(' — '.$subCategory->getTitle(), $subCategory->getId());
@ -2919,7 +2918,7 @@ class PortfolioController
}
/**
* It parsers a title for a variable in lang
* It parsers a title for a variable in lang.
*
* @param $defaultDisplayText
* @return string
@ -2934,7 +2933,7 @@ class PortfolioController
}
/**
* It translates the text as parameter
* It translates the text as parameter.
*
* @param $defaultDisplayText
* @return mixed

@ -23,7 +23,7 @@ $httpRequest = HttpRequest::createFromGlobals();
$action = $httpRequest->query->get('action', 'list');
// It validates the management of categories will be only for admins
if (in_array($action , ['list_categories', 'add_category', 'edit_category']) && !api_is_platform_admin()) {
if (in_array($action, ['list_categories', 'add_category', 'edit_category']) && !api_is_platform_admin()) {
api_not_allowed(true);
}

@ -217,7 +217,11 @@ class PortfolioCategory
}
/**
* Set parent id
*
* @param int $parentId
*
* @return PortfolioCategory
*/
public function setParentId(int $parentId)
{

Loading…
Cancel
Save