Minor - flint fixes

pull/3064/head
Julio 5 years ago
parent 199b8a89fe
commit 581cc00baf
  1. 1
      public/main/inc/lib/fileUpload.lib.php
  2. 2
      src/CoreBundle/Controller/AccountController.php
  3. 1
      src/CoreBundle/Controller/BaseController.php
  4. 2
      src/CoreBundle/Controller/CourseController.php
  5. 8
      src/CoreBundle/Controller/ResourceController.php
  6. 3
      src/CoreBundle/Controller/SessionController.php
  7. 3
      src/CoreBundle/Entity/Course.php
  8. 11
      src/CoreBundle/Entity/Illustration.php
  9. 10
      src/CoreBundle/Entity/PersonalFile.php
  10. 4
      src/CoreBundle/Entity/Resource/ResourceInterface.php
  11. 6
      src/CoreBundle/Migrations/Schema/V200/Version20.php
  12. 2
      src/CoreBundle/Repository/IllustrationRepository.php
  13. 4
      src/CoreBundle/Repository/ResourceFactory.php
  14. 13
      src/CoreBundle/Repository/ResourceRepository.php
  15. 2
      src/CoreBundle/Repository/ResourceRepositoryInterface.php
  16. 6
      src/CoreBundle/Tool/AbstractTool.php
  17. 4
      src/CoreBundle/Twig/Extension/ChamiloExtension.php
  18. 2
      src/CourseBundle/Component/CourseCopy/CourseBuilder.php
  19. 10
      src/CourseBundle/Entity/CAnnouncement.php
  20. 4
      src/CourseBundle/Entity/CDocument.php
  21. 12
      src/CourseBundle/Entity/CLink.php
  22. 10
      src/CourseBundle/Entity/CLp.php
  23. 10
      src/CourseBundle/Entity/CQuiz.php
  24. 10
      src/CourseBundle/Entity/CQuizQuestion.php
  25. 10
      src/CourseBundle/Entity/CQuizQuestionCategory.php
  26. 2
      src/CourseBundle/EventListener/CourseListener.php
  27. 47
      src/UserBundle/Entity/User.php
  28. 4
      src/UserBundle/Repository/UserRepository.php

@ -1434,7 +1434,6 @@ function create_unexisting_directory(
return $document; return $document;
} }
$folderExists = DocumentManager::folderExists( $folderExists = DocumentManager::folderExists(
$desired_dir_name, $desired_dir_name,
$_course, $_course,

@ -6,7 +6,6 @@ namespace Chamilo\CoreBundle\Controller;
use Chamilo\CoreBundle\Repository\IllustrationRepository; use Chamilo\CoreBundle\Repository\IllustrationRepository;
use Chamilo\ThemeBundle\Model\UserInterface; use Chamilo\ThemeBundle\Model\UserInterface;
use Chamilo\UserBundle\Form\ProfileType; use Chamilo\UserBundle\Form\ProfileType;
use Chamilo\UserBundle\Repository\UserRepository;
use FOS\UserBundle\Model\UserManagerInterface; use FOS\UserBundle\Model\UserManagerInterface;
use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
@ -21,7 +20,6 @@ use Symfony\Component\Routing\Annotation\Route;
*/ */
class AccountController extends BaseController class AccountController extends BaseController
{ {
/** /**
* @Route("/home", methods={"GET"}, name="chamilo_core_account_home") * @Route("/home", methods={"GET"}, name="chamilo_core_account_home")
* *

@ -12,7 +12,6 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Contracts\Translation\TranslatorInterface; use Symfony\Contracts\Translation\TranslatorInterface;
/** /**
* Each entity controller must extends this class. * Each entity controller must extends this class.
* *

@ -220,6 +220,4 @@ class CourseController extends AbstractController
return $this->render('@ChamiloTheme/Course/about.html.twig', [$params]); return $this->render('@ChamiloTheme/Course/about.html.twig', [$params]);
} }
} }

@ -720,6 +720,7 @@ class ResourceController extends AbstractResourceController implements CourseCon
/** /**
* Gets a document when calling route resources_document_get_file. * Gets a document when calling route resources_document_get_file.
1 *
* @deprecated * @deprecated
* *
* @throws \League\Flysystem\FileNotFoundException * @throws \League\Flysystem\FileNotFoundException
@ -962,11 +963,8 @@ class ResourceController extends AbstractResourceController implements CourseCon
} }
/** /**
* @param Request $request * @param string $mode
* @param ResourceNode $resourceNode * @param string $filter
* @param string $mode
* @param Glide|null $glide
* @param string $filter
* *
* @return mixed|StreamedResponse * @return mixed|StreamedResponse
*/ */

@ -179,9 +179,6 @@ class SessionController extends AbstractController
$courseController = new CoursesController(); $courseController = new CoursesController();
$plugin = \BuyCoursesPlugin::create(); $plugin = \BuyCoursesPlugin::create();
$checker = $plugin->isEnabled(); $checker = $plugin->isEnabled();
$sessionIsPremium = null; $sessionIsPremium = null;

@ -376,9 +376,6 @@ class Course extends AbstractResource implements ResourceInterface
$this->sharedSurveys = new ArrayCollection(); $this->sharedSurveys = new ArrayCollection();
} }
/**
* @return string
*/
public function __toString(): string public function __toString(): string
{ {
return $this->getTitle(); return $this->getTitle();

@ -12,6 +12,7 @@ use Gedmo\Timestampable\Traits\TimestampableEntity;
/** /**
* Illustration. * Illustration.
*
* @ORM\Table(name="illustration") * @ORM\Table(name="illustration")
* @ORM\Entity * @ORM\Entity
* @GRID\Source(columns="id, name, resourceNode.createdAt", filterable=false, groups={"resource"}) * @GRID\Source(columns="id, name, resourceNode.createdAt", filterable=false, groups={"resource"})
@ -45,6 +46,11 @@ class Illustration extends AbstractResource implements ResourceInterface
$this->name = 'illustration'; $this->name = 'illustration';
} }
public function __toString(): string
{
return $this->getName();
}
public function getId(): int public function getId(): int
{ {
return $this->id; return $this->id;
@ -78,9 +84,4 @@ class Illustration extends AbstractResource implements ResourceInterface
{ {
return $this->getName(); return $this->getName();
} }
public function __toString(): string
{
return $this->getName();
}
} }

@ -44,6 +44,11 @@ class PersonalFile extends AbstractResource implements ResourceInterface
$this->name = 'personal_file'; $this->name = 'personal_file';
} }
public function __toString(): string
{
return $this->getName();
}
public function getId(): int public function getId(): int
{ {
return $this->id; return $this->id;
@ -80,9 +85,4 @@ class PersonalFile extends AbstractResource implements ResourceInterface
{ {
return $this->getName(); return $this->getName();
} }
public function __toString(): string
{
return $this->getName();
}
} }

@ -8,11 +8,11 @@ namespace Chamilo\CoreBundle\Entity\Resource;
*/ */
interface ResourceInterface interface ResourceInterface
{ {
public function __toString(): string;
/** Returns the resource id identifier. Example for CDocument it will be the value of the field iid. */ /** Returns the resource id identifier. Example for CDocument it will be the value of the field iid. */
public function getResourceIdentifier(): int; public function getResourceIdentifier(): int;
/** Returns the resource name. Example for CDocument it will be the field "title". */ /** Returns the resource name. Example for CDocument it will be the field "title". */
public function getResourceName(): string; public function getResourceName(): string;
public function __toString(): string;
} }

@ -970,9 +970,9 @@ class Version20 extends AbstractMigrationChamilo
$this->addSql("CREATE UNIQUE INDEX UNIQ_8D93D6491BAD783F ON user (resource_node_id);"); $this->addSql("CREATE UNIQUE INDEX UNIQ_8D93D6491BAD783F ON user (resource_node_id);");
$this->addSql("ALTER TABLE user_audit ADD resource_node_id INT DEFAULT NULL;"); $this->addSql("ALTER TABLE user_audit ADD resource_node_id INT DEFAULT NULL;");
/* $this->addSql(""); /* $this->addSql("");
$this->addSql(""); $this->addSql("");
$this->addSql("");*/ $this->addSql("");*/
} }
public function down(Schema $schema) public function down(Schema $schema)

@ -110,8 +110,6 @@ final class IllustrationRepository extends ResourceRepository implements Resourc
/** /**
* @param string $filter See: services.yaml parameter "glide_media_filters" to see the list of filters. * @param string $filter See: services.yaml parameter "glide_media_filters" to see the list of filters.
*
* @return string
*/ */
public function getIllustrationUrl(AbstractResource $resource, $filter = ''): string public function getIllustrationUrl(AbstractResource $resource, $filter = ''): string
{ {

@ -3,17 +3,15 @@
namespace Chamilo\CoreBundle\Repository; namespace Chamilo\CoreBundle\Repository;
use Chamilo\CoreBundle\Block\BreadcrumbBlockService;
use Chamilo\CoreBundle\ToolChain; use Chamilo\CoreBundle\ToolChain;
use Cocur\Slugify\SlugifyInterface; use Cocur\Slugify\SlugifyInterface;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use League\Flysystem\MountManager; use League\Flysystem\MountManager;
use Symfony\Component\DependencyInjection\ContainerInterface as Container;
use Symfony\Component\PropertyAccess\Exception\InvalidArgumentException; use Symfony\Component\PropertyAccess\Exception\InvalidArgumentException;
use Symfony\Component\Routing\RouterInterface; use Symfony\Component\Routing\RouterInterface;
use Symfony\Component\Security\Core\Authorization\AuthorizationChecker; use Symfony\Component\Security\Core\Authorization\AuthorizationChecker;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface; use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface as Container;
class ResourceFactory class ResourceFactory
{ {

@ -276,6 +276,7 @@ class ResourceRepository extends EntityRepository
return $resourceFile; return $resourceFile;
} }
//unction createNodeForResource(AbstractResource $resource, User $creator, ResourceNode $parent = null, UploadedFile $file = null): ResourceNode //unction createNodeForResource(AbstractResource $resource, User $creator, ResourceNode $parent = null, UploadedFile $file = null): ResourceNode
public function addResourceNode(AbstractResource $resource, User $creator, AbstractResource $parent = null): ResourceNode public function addResourceNode(AbstractResource $resource, User $creator, AbstractResource $parent = null): ResourceNode
{ {
@ -510,7 +511,7 @@ class ResourceRepository extends EntityRepository
) )
->innerJoin('node.resourceLinks', 'links') ->innerJoin('node.resourceLinks', 'links')
->where('node.resourceType = :type') ->where('node.resourceType = :type')
->setParameter('type',$type); ->setParameter('type', $type);
if ($isPersonalResource === false) { if ($isPersonalResource === false) {
$qb $qb
@ -550,7 +551,7 @@ class ResourceRepository extends EntityRepository
} }
if (null === $group) { if (null === $group) {
$qb->andWhere('links.group IS NULL'); $qb->andWhere('links.group IS NULL');
} }
///var_dump($qb->getQuery()->getSQL(), $type->getId(), $parentNode->getId());exit; ///var_dump($qb->getQuery()->getSQL(), $type->getId(), $parentNode->getId());exit;
@ -584,10 +585,10 @@ class ResourceRepository extends EntityRepository
//->where('node.resourceType = :type') //->where('node.resourceType = :type')
//->setParameter('type',$type) //->setParameter('type',$type)
; ;
/*$qb /*$qb
->andWhere('links.visibility = :visibility') ->andWhere('links.visibility = :visibility')
->setParameter('visibility', ResourceLink::VISIBILITY_PUBLISHED) ->setParameter('visibility', ResourceLink::VISIBILITY_PUBLISHED)
;*/ ;*/
if (null !== $parentNode) { if (null !== $parentNode) {
$qb->andWhere('node.parent = :parentNode'); $qb->andWhere('node.parent = :parentNode');

@ -17,6 +17,6 @@ interface ResourceRepositoryInterface
public function saveResource(FormInterface $form, $course, $session, $fileType); public function saveResource(FormInterface $form, $course, $session, $fileType);
//public function updateResource(FormInterface $form); //public function updateResource(FormInterface $form);
public function getTitleColumn(Grid $grid): Column; public function getTitleColumn(Grid $grid): Column;
} }

@ -3,7 +3,6 @@
namespace Chamilo\CoreBundle\Tool; namespace Chamilo\CoreBundle\Tool;
use Sonata\CoreBundle\Model\BaseEntityManager;
use Sylius\Bundle\SettingsBundle\Schema\SchemaInterface; use Sylius\Bundle\SettingsBundle\Schema\SchemaInterface;
/** /**
@ -117,11 +116,6 @@ abstract class AbstractTool implements ToolInterface
return $this->resourceTypes; return $this->resourceTypes;
} }
/**
* @param array $resourceTypes
*
* @return AbstractTool
*/
public function setResourceTypes(array $resourceTypes): AbstractTool public function setResourceTypes(array $resourceTypes): AbstractTool
{ {
$this->resourceTypes = $resourceTypes; $this->resourceTypes = $resourceTypes;

@ -4,7 +4,6 @@
namespace Chamilo\CoreBundle\Twig\Extension; namespace Chamilo\CoreBundle\Twig\Extension;
use Chamilo\CoreBundle\Repository\IllustrationRepository; use Chamilo\CoreBundle\Repository\IllustrationRepository;
use Chamilo\SettingsBundle\Templating\Helper\SettingsHelper;
use Twig\Extension\AbstractExtension; use Twig\Extension\AbstractExtension;
use Twig\TwigFilter; use Twig\TwigFilter;
@ -15,9 +14,6 @@ class ChamiloExtension extends AbstractExtension
{ {
private $illustrationRepository; private $illustrationRepository;
/**
* @param IllustrationRepository $illustrationRepository
*/
public function __construct(IllustrationRepository $illustrationRepository) public function __construct(IllustrationRepository $illustrationRepository)
{ {
$this->illustrationRepository = $illustrationRepository; $this->illustrationRepository = $illustrationRepository;

@ -119,7 +119,7 @@ class CourseBuilder
$this->course = new Course(); $this->course = new Course();
$this->course->code = $_course['code']; $this->course->code = $_course['code'];
$this->course->type = $type; $this->course->type = $type;
// $this->course->path = api_get_path(SYS_COURSE_PATH).$_course['path'].'/'; // $this->course->path = api_get_path(SYS_COURSE_PATH).$_course['path'].'/';
// $this->course->backup_path = api_get_path(SYS_COURSE_PATH).$_course['path']; // $this->course->backup_path = api_get_path(SYS_COURSE_PATH).$_course['path'];
$this->course->encoding = api_get_system_encoding(); $this->course->encoding = api_get_system_encoding();
$this->course->info = $_course; $this->course->info = $_course;

@ -86,6 +86,11 @@ class CAnnouncement extends AbstractResource implements ResourceInterface
*/ */
protected $sessionId; protected $sessionId;
public function __toString(): string
{
return $this->getTitle();
}
/** /**
* Set title. * Set title.
* *
@ -300,9 +305,4 @@ class CAnnouncement extends AbstractResource implements ResourceInterface
{ {
return $this->getTitle(); return $this->getTitle();
} }
public function __toString(): string
{
return $this->getTitle();
}
} }

@ -115,9 +115,6 @@ class CDocument extends AbstractResource implements ResourceInterface
$this->id = 0; $this->id = 0;
} }
/**
* @return string
*/
public function __toString(): string public function __toString(): string
{ {
return $this->getTitle(); return $this->getTitle();
@ -334,7 +331,6 @@ class CDocument extends AbstractResource implements ResourceInterface
return $this; return $this;
} }
public function postPersist(LifecycleEventArgs $args) public function postPersist(LifecycleEventArgs $args)
{ {
// Update id with iid value // Update id with iid value

@ -7,7 +7,7 @@ use APY\DataGridBundle\Grid\Mapping as GRID;
use Chamilo\CoreBundle\Entity\Resource\AbstractResource; use Chamilo\CoreBundle\Entity\Resource\AbstractResource;
use Chamilo\CoreBundle\Entity\Resource\ResourceInterface; use Chamilo\CoreBundle\Entity\Resource\ResourceInterface;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
//
/** /**
* CLink. * CLink.
* *
@ -102,6 +102,11 @@ class CLink extends AbstractResource implements ResourceInterface
*/ */
protected $sessionId; protected $sessionId;
public function __toString(): string
{
return $this->getTitle();
}
/** /**
* Set url. * Set url.
* *
@ -354,9 +359,4 @@ class CLink extends AbstractResource implements ResourceInterface
{ {
return $this->getTitle(); return $this->getTitle();
} }
public function __toString(): string
{
return $this->getTitle();
}
} }

@ -282,6 +282,11 @@ class CLp extends AbstractResource implements ResourceInterface
$this->createdOn = new \DateTime(); $this->createdOn = new \DateTime();
} }
public function __toString(): string
{
return $this->getName();
}
/** /**
* Set lpType. * Set lpType.
* *
@ -1074,9 +1079,4 @@ class CLp extends AbstractResource implements ResourceInterface
{ {
return $this->getName(); return $this->getName();
} }
public function __toString(): string
{
return $this->getName();
}
} }

@ -264,6 +264,11 @@ class CQuiz extends AbstractResource implements ResourceInterface
$this->autoLaunch = 0; $this->autoLaunch = 0;
} }
public function __toString(): string
{
return $this->getTitle();
}
/** /**
* Set title. * Set title.
* *
@ -959,9 +964,4 @@ class CQuiz extends AbstractResource implements ResourceInterface
{ {
return $this->getTitle(); return $this->getTitle();
} }
public function __toString(): string
{
return $this->getTitle();
}
} }

@ -122,6 +122,11 @@ class CQuizQuestion extends AbstractResource implements ResourceInterface
$this->ponderation = 0.0; $this->ponderation = 0.0;
} }
public function __toString(): string
{
return $this->getQuestion();
}
/** /**
* Set question. * Set question.
* *
@ -426,9 +431,4 @@ class CQuizQuestion extends AbstractResource implements ResourceInterface
{ {
return $this->getQuestion(); return $this->getQuestion();
} }
public function __toString(): string
{
return $this->getQuestion();
}
} }

@ -67,6 +67,11 @@ class CQuizQuestionCategory extends AbstractResource implements ResourceInterfac
*/ */
protected $session; protected $session;
public function __toString(): string
{
return $this->getTitle();
}
/** /**
* @return int * @return int
*/ */
@ -219,9 +224,4 @@ class CQuizQuestionCategory extends AbstractResource implements ResourceInterfac
{ {
return $this->getTitle(); return $this->getTitle();
} }
public function __toString(): string
{
return $this->getTitle();
}
} }

@ -323,8 +323,6 @@ class CourseListener
* @param int $sessionId * @param int $sessionId
* @param int $groupId * @param int $groupId
* @param string $origin * @param string $origin
*
* @return string
*/ */
private function generateCourseUrl($course, $sessionId, $groupId, $origin): string private function generateCourseUrl($course, $sessionId, $groupId, $origin): string
{ {

@ -79,6 +79,14 @@ class User extends BaseUser implements ThemeUser, EquatableInterface //implement
public const STUDENT = 5; public const STUDENT = 5;
public const ANONYMOUS = 6; public const ANONYMOUS = 6;
/**
* @ORM\OneToOne(
* targetEntity="Chamilo\CoreBundle\Entity\Resource\ResourceNode", cascade={"remove"}, orphanRemoval=true
* )
* @ORM\JoinColumn(name="resource_node_id", referencedColumnName="id", onDelete="CASCADE")
*/
public $resourceNode;
/** /**
* @var int * @var int
* *
@ -497,30 +505,6 @@ class User extends BaseUser implements ThemeUser, EquatableInterface //implement
*/ */
protected $receivedMessages; protected $receivedMessages;
/**
*
* @ORM\OneToOne(
* targetEntity="Chamilo\CoreBundle\Entity\Resource\ResourceNode", cascade={"remove"}, orphanRemoval=true
* )
* @ORM\JoinColumn(name="resource_node_id", referencedColumnName="id", onDelete="CASCADE")
*/
public $resourceNode;
/**
* @return $this
*/
public function setResourceNode(ResourceNode $resourceNode): self
{
$this->resourceNode = $resourceNode;
return $this;
}
public function getResourceNode(): ResourceNode
{
return $this->resourceNode;
}
/** /**
* Constructor. * Constructor.
*/ */
@ -562,6 +546,21 @@ class User extends BaseUser implements ThemeUser, EquatableInterface //implement
return $this->username; return $this->username;
} }
/**
* @return $this
*/
public function setResourceNode(ResourceNode $resourceNode): self
{
$this->resourceNode = $resourceNode;
return $this;
}
public function getResourceNode(): ResourceNode
{
return $this->resourceNode;
}
/** /**
* Updates the id with the user_id. * Updates the id with the user_id.
* *

@ -30,7 +30,6 @@ use Chamilo\CoreBundle\Entity\UserCourseCategory;
use Chamilo\CoreBundle\Entity\UsergroupRelUser; use Chamilo\CoreBundle\Entity\UsergroupRelUser;
use Chamilo\CoreBundle\Entity\UserRelCourseVote; use Chamilo\CoreBundle\Entity\UserRelCourseVote;
use Chamilo\CoreBundle\Repository\ResourceRepository; use Chamilo\CoreBundle\Repository\ResourceRepository;
use Chamilo\CoreBundle\Repository\ResourceRepositoryInterface;
use Chamilo\CourseBundle\Entity\CAttendanceResult; use Chamilo\CourseBundle\Entity\CAttendanceResult;
use Chamilo\CourseBundle\Entity\CAttendanceSheet; use Chamilo\CourseBundle\Entity\CAttendanceSheet;
use Chamilo\CourseBundle\Entity\CBlogPost; use Chamilo\CourseBundle\Entity\CBlogPost;
@ -48,8 +47,6 @@ use Chamilo\CourseBundle\Entity\CSurveyAnswer;
use Chamilo\CourseBundle\Entity\CWiki; use Chamilo\CourseBundle\Entity\CWiki;
use Chamilo\TicketBundle\Entity\Ticket; use Chamilo\TicketBundle\Entity\Ticket;
use Chamilo\UserBundle\Entity\User; use Chamilo\UserBundle\Entity\User;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\Query\Expr\Join; use Doctrine\ORM\Query\Expr\Join;
use Symfony\Component\Finder\Finder; use Symfony\Component\Finder\Finder;
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException; use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
@ -139,7 +136,6 @@ class UserRepository extends ResourceRepository
return $query->execute(); return $query->execute();
} }
/** /**
* Get course user relationship based in the course_rel_user table. * Get course user relationship based in the course_rel_user table.
* *

Loading…
Cancel
Save