Minor - flint fixes

pull/3064/head
Julio 6 years ago
parent 85285fcd3e
commit dca3222061
  1. 3
      public/main/inc/lib/usermanager.lib.php
  2. 30
      public/main/lp/learnpath.class.php
  3. 2
      public/main/upload/upload.php
  4. 10
      src/CoreBundle/Component/Utils/ResourceSettings.php
  5. 1
      src/CoreBundle/Controller/CourseController.php
  6. 113
      src/CoreBundle/Controller/CourseHomeController.php
  7. 8
      src/CoreBundle/Entity/ExtraField.php
  8. 1
      src/CoreBundle/Entity/Resource/ResourceNode.php
  9. 2
      src/CoreBundle/Repository/ResourceNodeRepository.php
  10. 3
      src/CoreBundle/ToolChain.php
  11. 4
      src/CourseBundle/DependencyInjection/Compiler/RegisterSchemasPass.php
  12. 8
      src/CourseBundle/Entity/CDocument.php
  13. 19
      src/CourseBundle/Entity/CShortcut.php
  14. 11
      src/CourseBundle/Entity/CStudentPublicationAssignment.php
  15. 15
      src/CourseBundle/Entity/CTool.php
  16. 2
      src/CourseBundle/Repository/CShortcutRepository.php
  17. 2
      src/CourseBundle/Repository/CStudentPublicationRepository.php
  18. 1
      src/CourseBundle/Repository/CToolRepository.php
  19. 1
      src/CourseBundle/Schema/SchemaRegistry.php
  20. 1
      src/UserBundle/Repository/UserRepository.php

@ -765,7 +765,6 @@ class UserManager
$repository->deleteUser($user);
// Unsubscribe the user from all groups in all his courses
$sql = "SELECT c.id
FROM $table_course c
@ -921,8 +920,6 @@ class UserManager
$app_plugin = new AppPlugin();
$app_plugin->performActionsWhenDeletingItem('user', $user_id);
// Add event to system log
$authorId = api_get_user_id();

@ -4935,25 +4935,25 @@ class learnpath
$lp->setName($name);
$repo->updateNodeForResource($lp);
/*
/*
$course_id = $this->course_info['real_id'];
$sql = "UPDATE $lp_table SET
name = '$name'
WHERE iid = $lp_id";
name = '$name'
WHERE iid = $lp_id";
$result = Database::query($sql);
// If the lp is visible on the homepage, change his name there.
if (Database::affected_rows($result)) {
$session_id = api_get_session_id();
$session_condition = api_get_session_condition($session_id);
$tbl_tool = Database::get_course_table(TABLE_TOOL_LIST);
$link = 'lp/lp_controller.php?action=view&lp_id='.$lp_id.'&id_session='.$session_id;
$sql = "UPDATE $tbl_tool SET name = '$name'
WHERE
c_id = $course_id AND
(link='$link' AND image='scormbuilder.gif' $session_condition)";
Database::query($sql);*/
$session_id = api_get_session_id();
$session_condition = api_get_session_condition($session_id);
$tbl_tool = Database::get_course_table(TABLE_TOOL_LIST);
$link = 'lp/lp_controller.php?action=view&lp_id='.$lp_id.'&id_session='.$session_id;
$sql = "UPDATE $tbl_tool SET name = '$name'
WHERE
c_id = $course_id AND
(link='$link' AND image='scormbuilder.gif' $session_condition)";
Database::query($sql);*/
//return true;
//return true;
//}
return false;
@ -6650,7 +6650,7 @@ class learnpath
$documentId = $folderData->getIid();
$dir = $dir.'/';
if ($folder) {
// $filepath = api_get_path(SYS_COURSE_PATH).$course['path'].'/document'.$dir;
// $filepath = api_get_path(SYS_COURSE_PATH).$course['path'].'/document'.$dir;
}
}
@ -11813,7 +11813,6 @@ EOD;
$item->setName($params['name']);
$item->setCId($params['c_id']);
$repo = Container::getLpCategoryRepository();
$em = $repo->getEntityManager();
$em->persist($item);
@ -11830,7 +11829,6 @@ EOD;
$em->flush();
/*api_item_property_update(
api_get_course_info(),
TOOL_LEARNPATH_CATEGORY,

@ -1,8 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/**
* Action controller for the upload process. The display scripts (web forms) redirect
* the process here to do what needs to be done with each file.

@ -72,25 +72,15 @@ class ResourceSettings
return $this;
}
/**
* @return bool
*/
public function isAllowDownloadAll(): bool
{
return $this->allowDownloadAll;
}
/**
* @param bool $allowDownloadAll
*
* @return ResourceSettings
*/
public function setAllowDownloadAll(bool $allowDownloadAll): ResourceSettings
{
$this->allowDownloadAll = $allowDownloadAll;
return $this;
}
}

@ -16,7 +16,6 @@ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use UserManager;
/**
* Class CourseController.
*

@ -222,6 +222,62 @@ class CourseHomeController extends ToolBaseController
return $this->redirect($url);
}
/**
* Edit configuration with given namespace.
*
* @param string $namespace
* @Route("/{cid}/settings/{namespace}", name="chamilo_core_course_settings")
* @Entity("course", expr="repository.find(cid)")
*
* @return Response
*/
public function updateAction(Request $request, Course $course, $namespace, SettingsManager $manager, SettingsFormFactory $formFactory)
{
$schemaAlias = $manager->convertNameSpaceToService($namespace);
$settings = $manager->load($namespace);
$form = $formFactory->create($schemaAlias);
$form->setData($settings);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$messageType = 'success';
try {
$manager->setCourse($course);
$manager->save($form->getData());
$message = $this->trans('Update');
} catch (ValidatorException $exception) {
$message = $this->trans(
$exception->getMessage(),
[],
'validators'
);
$messageType = 'error';
}
$request->getSession()->getBag('flashes')->add(
$messageType,
$message
);
if ($request->headers->has('referer')) {
return $this->redirect($request->headers->get('referer'));
}
}
$schemas = $manager->getSchemas();
return $this->render(
'@ChamiloTheme/Course/settings.html.twig',
[
'course' => $course,
'schemas' => $schemas,
'settings' => $settings,
'form' => $form->createView(),
]
);
}
/**
* @return array
*/
@ -386,61 +442,4 @@ class CourseHomeController extends ToolBaseController
));
}
}
/**
* Edit configuration with given namespace.
*
* @param string $namespace
* @Route("/{cid}/settings/{namespace}", name="chamilo_core_course_settings")
* @Entity("course", expr="repository.find(cid)")
*
*
* @return Response
*/
public function updateAction(Request $request, Course $course, $namespace, SettingsManager $manager, SettingsFormFactory $formFactory)
{
$schemaAlias = $manager->convertNameSpaceToService($namespace);
$settings = $manager->load($namespace);
$form = $formFactory->create($schemaAlias);
$form->setData($settings);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$messageType = 'success';
try {
$manager->setCourse($course);
$manager->save($form->getData());
$message = $this->trans('Update');
} catch (ValidatorException $exception) {
$message = $this->trans(
$exception->getMessage(),
[],
'validators'
);
$messageType = 'error';
}
$request->getSession()->getBag('flashes')->add(
$messageType,
$message
);
if ($request->headers->has('referer')) {
return $this->redirect($request->headers->get('referer'));
}
}
$schemas = $manager->getSchemas();
return $this->render(
'@ChamiloTheme/Course/settings.html.twig',
[
'course' => $course,
'schemas' => $schemas,
'settings' => $settings,
'form' => $form->createView(),
]
);
}
}

@ -392,19 +392,11 @@ class ExtraField // extends BaseAttribute
}
}
/**
* @return string
*/
public function getHelperText(): string
{
return $this->helperText;
}
/**
* @param string $helperText
*
* @return ExtraField
*/
public function setHelperText(string $helperText): ExtraField
{
$this->helperText = $helperText;

@ -528,5 +528,4 @@ class ResourceNode
return '<i class="'.$class.'"></i>';
}
}

@ -3,10 +3,8 @@
namespace Chamilo\CoreBundle\Repository;
use Chamilo\CoreBundle\Entity\Resource\ResourceFile;
use Chamilo\CoreBundle\Entity\Resource\ResourceNode;
use Chamilo\CoreBundle\Entity\Resource\ResourceType;
use Doctrine\ORM\Query\Expr\Join;
use Gedmo\Tree\Entity\Repository\MaterializedPathRepository;
/**

@ -4,7 +4,6 @@
namespace Chamilo\CoreBundle;
use Chamilo\CoreBundle\Entity\Course;
use Chamilo\CoreBundle\Entity\Resource\AbstractResource;
use Chamilo\CoreBundle\Entity\Resource\ResourceLink;
use Chamilo\CoreBundle\Entity\Resource\ResourceType;
use Chamilo\CoreBundle\Entity\Tool;
@ -169,7 +168,7 @@ class ToolChain
{
$tools = $this->getTools();
$manager = $this->entityManager;
$toolVisibility = $this->settingsManager ->getSetting('course.active_tools_on_create');
$toolVisibility = $this->settingsManager->getSetting('course.active_tools_on_create');
$user = $this->security->getToken()->getUser();

@ -27,9 +27,7 @@ class RegisterSchemasPass implements CompilerPassInterface
foreach ($taggedServicesIds as $id => $tags) {
foreach ($tags as $attributes) {
if (!isset($attributes['alias'])) {
throw new \InvalidArgumentException(
sprintf('Service "%s" must define the "alias" attribute on "sylius.settings_schema" tags.', $id)
);
throw new \InvalidArgumentException(sprintf('Service "%s" must define the "alias" attribute on "sylius.settings_schema" tags.', $id));
}
$schemaRegistry->addMethodCall('register', [$attributes['alias'], new Reference($id)]);

@ -129,19 +129,11 @@ class CDocument extends AbstractResource implements ResourceInterface
return $this->getTitle();
}
/**
* @return bool
*/
public function isTemplate(): bool
{
return $this->template;
}
/**
* @param bool $template
*
* @return CDocument
*/
public function setTemplate(bool $template): CDocument
{
$this->template = $template;

@ -4,7 +4,6 @@
namespace Chamilo\CourseBundle\Entity;
use APY\DataGridBundle\Grid\Mapping as GRID;
use Chamilo\CoreBundle\Entity\Resource\AbstractResource;
use Chamilo\CoreBundle\Entity\Resource\ResourceInterface;
use Doctrine\ORM\Mapping as ORM;
@ -33,19 +32,16 @@ class CShortcut extends AbstractResource implements ResourceInterface
*/
protected $name;
/**
* @return string
*/
public function __toString(): string
{
return $this->getName();
}
public function getName(): string
{
return $this->name;
}
/**
* @param string $name
*
* @return CShortcut
*/
public function setName(string $name): CShortcut
{
$this->name = $name;
@ -65,9 +61,4 @@ class CShortcut extends AbstractResource implements ResourceInterface
{
return $this->getName();
}
public function __toString(): string
{
return $this->getName();
}
}

@ -78,17 +78,14 @@ class CStudentPublicationAssignment extends AbstractResource implements Resource
*/
protected $publicationId;
/**
* @return int
*/
public function getIid(): int
public function __toString(): string
{
return $this->iid;
return (string) $this->getIid();
}
public function __toString(): string
public function getIid(): int
{
return (string) $this->getIid();
return $this->iid;
}
/**

@ -106,16 +106,16 @@ class CTool extends AbstractResource implements ResourceInterface
$this->id = 0;
}
public function __toString(): string
{
return (string) $this->getName();
}
public function getName(): string
{
return $this->name;
}
/**
* @param string $name
*
* @return CTool
*/
public function setName(string $name): CTool
{
$this->name = $name;
@ -304,9 +304,4 @@ class CTool extends AbstractResource implements ResourceInterface
{
return (string) $this->getName();
}
public function __toString(): string
{
return (string) $this->getName();
}
}

@ -7,12 +7,10 @@ use APY\DataGridBundle\Grid\Column\Column;
use APY\DataGridBundle\Grid\Grid;
use Chamilo\CoreBundle\Component\Utils\ResourceSettings;
use Chamilo\CoreBundle\Entity\Course;
use Chamilo\CoreBundle\Entity\Resource\ResourceLink;
use Chamilo\CoreBundle\Entity\Resource\ResourceNode;
use Chamilo\CoreBundle\Entity\Session;
use Chamilo\CoreBundle\Repository\ResourceRepository;
use Chamilo\CoreBundle\Repository\ResourceRepositoryInterface;
use Chamilo\CourseBundle\Entity\CDocument;
use Chamilo\CourseBundle\Entity\CGroupInfo;
use Chamilo\UserBundle\Entity\User;
use Symfony\Component\Form\FormInterface;

@ -16,7 +16,7 @@ final class CStudentPublicationRepository extends ResourceRepository
{
/**
* Find all the works registered by a teacher.
*/
*/
public function findWorksByTeacher(User $user, Course $course, Session $session = null, $groupId = 0): array
{
$qb = $this->createQueryBuilder('w');

@ -15,7 +15,6 @@ use Chamilo\CoreBundle\Repository\ResourceRepositoryInterface;
use Chamilo\CourseBundle\Entity\CGroupInfo;
use Chamilo\UserBundle\Entity\User;
use Doctrine\ORM\Query\Expr\Join;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;

@ -6,5 +6,4 @@ use Chamilo\CourseBundle\Manager\ServiceRegistry;
class SchemaRegistry extends ServiceRegistry
{
}

@ -49,7 +49,6 @@ use Chamilo\TicketBundle\Entity\Ticket;
use Chamilo\UserBundle\Entity\User;
use Doctrine\Common\Collections\Criteria;
use Doctrine\ORM\Query\Expr\Join;
use FOS\UserBundle\Model\UserInterface;
use Symfony\Component\Finder\Finder;
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
use Symfony\Component\Serializer\Encoder\JsonEncoder;

Loading…
Cancel
Save