Minor - flint fixes

pull/3064/head
Julio Montoya 5 years ago
parent 10c0b1f3d8
commit 8858cc49c0
  1. 2
      public/main/exercise/exercise_result.class.php
  2. 19
      src/CoreBundle/Controller/AccountController.php
  3. 4
      src/CoreBundle/Controller/UserController.php
  4. 1
      src/CoreBundle/Framework/Container.php
  5. 4
      src/CoreBundle/Repository/IllustrationRepository.php
  6. 1
      src/CoreBundle/Resources/config/routing.yml

@ -226,7 +226,7 @@ class ExerciseResult
$return[$i]['result'] = $result['exresult'];
$return[$i]['max'] = $result['exweight'];
// Revised: 1 = revised, 0 = not revised, -1 = not even finished by user
$return[$i]['status'] = $revised === 1 ? get_lang('Validated') : ($revised === 0 ? get_lang('NotValidated') : get_lang('Unclosed') );
$return[$i]['status'] = $revised === 1 ? get_lang('Validated') : ($revised === 0 ? get_lang('NotValidated') : get_lang('Unclosed'));
$return[$i]['lp_id'] = $result['orig_lp_id'];
$return[$i]['lp_name'] = $result['lp_name'];

@ -3,8 +3,8 @@
namespace Chamilo\CoreBundle\Controller;
use Chamilo\CoreBundle\Repository\IllustrationRepository;
use Chamilo\ThemeBundle\Model\UserInterface;
use Chamilo\UserBundle\Entity\User;
use Chamilo\UserBundle\Form\ProfileType;
use Chamilo\UserBundle\Repository\UserRepository;
use FOS\UserBundle\Model\UserManagerInterface;
@ -35,14 +35,12 @@ class AccountController extends BaseController
*
* @param string $username
*/
public function editAction(Request $request, UserManagerInterface $userManager, TranslatorInterface $translator)
public function editAction(Request $request, UserManagerInterface $userManager, TranslatorInterface $translator, IllustrationRepository $illustrationRepository)
{
$user = $this->getUser();
if (!is_object($user) || !$user instanceof UserInterface) {
throw $this->createAccessDeniedException(
'This user does not have access to this section'
);
throw $this->createAccessDeniedException('This user does not have access to this section');
}
$form = $this->createForm(ProfileType::class, $user);
@ -51,7 +49,14 @@ class AccountController extends BaseController
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
//$event = new FormEvent($form, $request);
$illustration = $form['illustration']->getData();
if ($illustration) {
$file = $illustrationRepository->addIllustration($resource, $this->getUser(), $illustration);
$em = $illustrationRepository->getEntityManager();
$em->persist($file);
$em->flush();
}
$userManager->updateUser($user);
$this->addFlash('success', $translator->trans('Updated'));
@ -61,6 +66,6 @@ class AccountController extends BaseController
return $response;
}
return $this->render('@ChamiloCore/Account/edit.html.twig', ['form' => $form->createView()]);
return $this->render('@ChamiloCore/Account/edit.html.twig', ['form' => $form->createView(), 'user' => $user]);
}
}

@ -26,9 +26,7 @@ class UserController extends BaseController
$user = $userRepository->findByUsername($username);
if (!is_object($user) || !$user instanceof UserInterface) {
throw $this->createAccessDeniedException(
'This user does not have access to this section'
);
throw $this->createAccessDeniedException('This user does not have access to this section');
}
return $this->render('@ChamiloCore/User/profile.html.twig', ['user' => $user]);

@ -134,6 +134,7 @@ class Container
if (isset(self::$container)) {
return self::$container->get('kernel')->getRealRootDir();
}
return str_replace('\\', '/', realpath(__DIR__.'/../../../')).'/';
}

@ -19,6 +19,10 @@ class IllustrationRepository extends ResourceRepository
*/
public function addIllustration(AbstractResource $resource, User $user, $uploadFile): ?ResourceFile
{
if (null === $uploadFile) {
return null;
}
$illustrationNode = $this->getIllustrationNodeFromResource($resource);
$em = $this->getEntityManager();

@ -1,4 +1,3 @@
legacy_main:
path: /main/{name}
defaults: {_controller: 'ChamiloCoreBundle:Legacy:classic'}

Loading…
Cancel
Save