Fix student publication comments, fix php errors

pull/3844/head
Julio Montoya 4 years ago
parent f0233584b3
commit ea2a0eb69a
  1. 5
      public/main/inc/lib/agenda.lib.php
  2. 4
      public/main/inc/lib/internationalization.lib.php
  3. 17
      public/main/work/edit.php
  4. 3
      public/main/work/view.php
  5. 49
      public/main/work/work.lib.php
  6. 3
      src/CoreBundle/Form/JuryMembersType.php
  7. 9
      src/CoreBundle/Framework/Container.php
  8. 3
      src/CoreBundle/Repository/BranchSyncRepository.php
  9. 1
      src/CoreBundle/Repository/Node/IllustrationRepository.php
  10. 5
      src/CoreBundle/Repository/Node/UserRepository.php
  11. 3
      src/CoreBundle/Repository/ResourceNodeRepository.php
  12. 17
      src/CoreBundle/Repository/ResourceRepository.php
  13. 52
      src/CoreBundle/Resources/views/Work/comments.html.twig
  14. 7
      src/CourseBundle/Repository/CStudentPublicationRepository.php

@ -8,6 +8,7 @@ use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CourseBundle\Entity\CCalendarEvent; use Chamilo\CourseBundle\Entity\CCalendarEvent;
use Chamilo\CourseBundle\Entity\CCalendarEventAttachment; use Chamilo\CourseBundle\Entity\CCalendarEventAttachment;
use Chamilo\CourseBundle\Entity\CGroup; use Chamilo\CourseBundle\Entity\CGroup;
use Doctrine\DBAL\Types\Types;
use Symfony\Component\HttpFoundation\File\UploadedFile; use Symfony\Component\HttpFoundation\File\UploadedFile;
/** /**
@ -1575,8 +1576,8 @@ class Agenda
) )
) )
) )
->setParameter('start', $start) ->setParameter('start', $start, Types::INTEGER)
->setParameter('end', $end); ->setParameter('end', $end, Types::INTEGER);
} }
/* /*

@ -2,6 +2,7 @@
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
use Carbon\Carbon;
use Chamilo\CoreBundle\Framework\Container; use Chamilo\CoreBundle\Framework\Container;
use ChamiloSession as Session; use ChamiloSession as Session;
use Westsworld\TimeAgo; use Westsworld\TimeAgo;
@ -590,6 +591,9 @@ function date_to_str_ago($date, $timeZone = 'UTC', $returnDateDifference = false
} else { } else {
$language = new Westsworld\TimeAgo\Translations\En(); $language = new Westsworld\TimeAgo\Translations\En();
} }
// Use carbon?
//Carbon::instance($this->getCreatedAt())->diffForHumans();
$timeAgo = new TimeAgo($language); $timeAgo = new TimeAgo($language);
if (!($date instanceof DateTime)) { if (!($date instanceof DateTime)) {
$date = api_get_utc_datetime($date, null, true); $date = api_get_utc_datetime($date, null, true);

@ -16,8 +16,6 @@ if ($blockEdition && !api_is_platform_admin()) {
api_not_allowed(true); api_not_allowed(true);
} }
$this_section = SECTION_COURSES; $this_section = SECTION_COURSES;
$work_id = isset($_REQUEST['id']) ? (int) ($_REQUEST['id']) : null; $work_id = isset($_REQUEST['id']) ? (int) ($_REQUEST['id']) : null;
@ -62,7 +60,7 @@ $is_author = false;
$repo = Container::getStudentPublicationRepository(); $repo = Container::getStudentPublicationRepository();
/** @var CStudentPublication $studentPublication */ /** @var CStudentPublication $studentPublication */
$studentPublication = $repo->find($item_id); $studentPublication = $repo->find($item_id);
if (empty($studentPublication)) { if (null === $studentPublication) {
api_not_allowed(true); api_not_allowed(true);
} }
@ -85,7 +83,6 @@ if (!empty($my_folder_data)) {
if (!empty($homework['expires_on']) || !empty($homework['ends_on'])) { if (!empty($homework['expires_on']) || !empty($homework['ends_on'])) {
$time_now = time(); $time_now = time();
if (!empty($homework['expires_on']) && if (!empty($homework['expires_on']) &&
!empty($homework['expires_on']) !empty($homework['expires_on'])
) { ) {
@ -113,6 +110,7 @@ if (!empty($my_folder_data)) {
} }
} }
$interbreadcrumb[] = [ $interbreadcrumb[] = [
'url' => api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq(), 'url' => api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq(),
'name' => get_lang('Assignments'), 'name' => get_lang('Assignments'),
@ -145,14 +143,8 @@ $show_progress_bar = false;
$form->addElement('hidden', 'id', $work_id); $form->addElement('hidden', 'id', $work_id);
$form->addElement('hidden', 'item_id', $item_id); $form->addElement('hidden', 'item_id', $item_id);
$form->addText('title', get_lang('Title'), true, ['id' => 'file_upload']); $form->addText('title', get_lang('Title'), true, ['id' => 'file_upload']);
if ($is_allowed_to_edit && !empty($item_id)) { if ($is_allowed_to_edit) {
$sql = "SELECT contains_file, url if ($studentPublication->getContainsFile()) {
FROM $work_table
WHERE c_id = $course_id AND iid ='$item_id' ";
$result = Database::query($sql);
if (false !== $result && Database::num_rows($result) > 0) {
$row = Database::fetch_array($result);
if ($row['contains_file'] || !empty($row['url'])) {
$form->addLabel( $form->addLabel(
get_lang('Download'), get_lang('Download'),
'<a href="'.api_get_path(WEB_CODE_PATH).'work/download.php?id='.$item_id.'&'.api_get_cidreq().'">'. '<a href="'.api_get_path(WEB_CODE_PATH).'work/download.php?id='.$item_id.'&'.api_get_cidreq().'">'.
@ -160,7 +152,6 @@ if ($is_allowed_to_edit && !empty($item_id)) {
</a>' </a>'
); );
} }
}
} }
$form->addHtmlEditor( $form->addHtmlEditor(
'description', 'description',

@ -197,10 +197,13 @@ if (($isDrhOfCourse || $allowEdition || $isDrhOfSession || user_is_author($id))
break; break;
} }
$comments = getWorkComments($work);
$commentForm = getWorkCommentForm($work, $folderData); $commentForm = getWorkCommentForm($work, $folderData);
$tpl = new Template(); $tpl = new Template();
$tpl->assign('work', $work); $tpl->assign('work', $work);
$tpl->assign('comments', $comments);
$actions = ''; $actions = '';
if ($work->getContainsFile()) { if ($work->getContainsFile()) {

@ -2353,7 +2353,7 @@ function get_work_user_list(
['class' => 'work-name'] ['class' => 'work-name']
); );
// Title // Title
$title = $studentPublication->getTitle(); $title = $assignment->getTitle();
$work['title_clean'] = $title; $work['title_clean'] = $title;
$title = Security::remove_XSS($title); $title = Security::remove_XSS($title);
if (strlen($title) > 30) { if (strlen($title) > 30) {
@ -3909,6 +3909,22 @@ function getWorkDescriptionToolbar()
]; ];
} }
function getWorkComments(CStudentPublication $work)
{
$comments = $work->getComments();
$commentList = [];
if (!empty($comments)) {
foreach ($comments as $comment) {
//$userInfo = api_get_user_info($comment['user_id']);
//$comment['picture'] = $userInfo['avatar'];
//$comment['complete_name'] = $userInfo['complete_name_with_username'];
$commentList[] = getWorkComment($comment);
}
}
return $commentList;
}
/** /**
* Get total score from a work list. * Get total score from a work list.
* *
@ -4160,18 +4176,12 @@ function formatWorkScore($score, $weight)
$finalScore, $finalScore,
$label $label
); );
} else {
return $scoreBasedInModel;
} }
return $scoreBasedInModel;
} }
/** function getWorkComment(CStudentPublicationComment $commentEntity, array $courseInfo = []): array
* @param int $id comment id
* @param array $courseInfo
*
* @return string
*/
function getWorkComment($id, $courseInfo = [])
{ {
if (empty($courseInfo)) { if (empty($courseInfo)) {
$courseInfo = api_get_course_info(); $courseInfo = api_get_course_info();
@ -4182,13 +4192,6 @@ function getWorkComment($id, $courseInfo = [])
} }
$repo = Container::getStudentPublicationCommentRepository(); $repo = Container::getStudentPublicationCommentRepository();
$criteria = [
'iid' => $id,
'cId' => $courseInfo['real_id'],
];
/** @var CStudentPublicationComment $commentEntity */
$commentEntity = $repo->findOneBy($criteria);
$comment = []; $comment = [];
if ($commentEntity) { if ($commentEntity) {
@ -4196,11 +4199,13 @@ function getWorkComment($id, $courseInfo = [])
$fileUrl = null; $fileUrl = null;
$deleteUrl = null; $deleteUrl = null;
$fileName = null; $fileName = null;
$id = $commentEntity->getIid();
if ($commentEntity->getResourceNode()->hasResourceFile()) { if ($commentEntity->getResourceNode()->hasResourceFile()) {
$fileUrl = $repo->getResourceFileDownloadUrl($commentEntity); $fileUrl = $repo->getResourceFileDownloadUrl($commentEntity);
$workId = $commentEntity->getWorkId(); $workId = $commentEntity->getPublication()->getIid();
$filePath = ''; $filePath = '';
$deleteUrl = api_get_path(WEB_CODE_PATH).'work/view.php?'.api_get_cidreq().'&id='.$workId.'&action=delete_attachment&comment_id='.$id; $deleteUrl = api_get_path(WEB_CODE_PATH).
'work/view.php?'.api_get_cidreq().'&id='.$workId.'&action=delete_attachment&comment_id='.$id;
$fileName = $commentEntity->getResourceNode()->getResourceFile()->getName(); $fileName = $commentEntity->getResourceNode()->getResourceFile()->getName();
} }
$comment['comment'] = $commentEntity->getComment(); $comment['comment'] = $commentEntity->getComment();
@ -6089,7 +6094,7 @@ function getFileContents($id, $courseInfo, $sessionId = 0, $correction = false,
$isAllow = allowOnlySubscribedUser( $isAllow = allowOnlySubscribedUser(
api_get_user_id(), api_get_user_id(),
$studentPublication->getParentId(), $studentPublication->getPublicationParent()->getIid(),
$courseInfo['real_id'], $courseInfo['real_id'],
$forceAccessForCourseAdmins $forceAccessForCourseAdmins
); );
@ -6306,9 +6311,7 @@ function exportAllStudentWorkFromPublication(
$score = $work['qualification_only']; $score = $work['qualification_only'];
} }
throw new Exception('work comments'); $comments = getWorkComments($work);
//$comments = getWorkComments($work);
$comments = null;
$feedback = null; $feedback = null;
if (!empty($comments)) { if (!empty($comments)) {
$content .= '<h4>'.get_lang('Feedback').': </h4>'; $content .= '<h4>'.get_lang('Feedback').': </h4>';

@ -8,6 +8,7 @@ namespace Chamilo\CoreBundle\Form;
use Doctrine\ORM\EntityRepository; use Doctrine\ORM\EntityRepository;
use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvents; use Symfony\Component\Form\FormEvents;
use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\OptionsResolver\OptionsResolver;
@ -53,7 +54,7 @@ class JuryMembersType extends AbstractType
$form->add( $form->add(
$factory->createNamed( $factory->createNamed(
'user_id', 'user_id',
'hidden', HiddenType::class,
$id, $id,
[ [
'auto_initialize' => false, 'auto_initialize' => false,

@ -69,7 +69,6 @@ use Symfony\Component\Routing\Router;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\Authorization\AuthorizationChecker; use Symfony\Component\Security\Core\Authorization\AuthorizationChecker;
use Symfony\Component\Security\Core\Role\RoleHierarchy;
use Symfony\Contracts\Translation\TranslatorInterface; use Symfony\Contracts\Translation\TranslatorInterface;
use Twig\Environment; use Twig\Environment;
@ -114,14 +113,6 @@ class Container
return self::$container->get('kernel')->getEnvironment(); return self::$container->get('kernel')->getEnvironment();
} }
/**
* @return RoleHierarchy
*/
public static function getRoles()
{
return self::$container->get('security.role_hierarchy');
}
public static function getLogDir(): string public static function getLogDir(): string
{ {
return self::$container->get('kernel')->getLogDir(); return self::$container->get('kernel')->getLogDir();

@ -6,6 +6,7 @@ declare(strict_types=1);
namespace Chamilo\CoreBundle\Repository; namespace Chamilo\CoreBundle\Repository;
use Doctrine\DBAL\Types\Types;
use Gedmo\Tree\Entity\Repository\NestedTreeRepository; use Gedmo\Tree\Entity\Repository\NestedTreeRepository;
class BranchSyncRepository extends NestedTreeRepository class BranchSyncRepository extends NestedTreeRepository
@ -28,7 +29,7 @@ class BranchSyncRepository extends NestedTreeRepository
//@todo check app settings //@todo check app settings
$qb->addOrderBy('b.branchName ASC'); $qb->addOrderBy('b.branchName ASC');
$qb->where('b.branchName LIKE :keyword'); $qb->where('b.branchName LIKE :keyword');
$qb->setParameter('keyword', "%{$keyword}%"); $qb->setParameter('keyword', "%{$keyword}%", Types::STRING);
$q = $qb->getQuery(); $q = $qb->getQuery();
return $q->execute(); return $q->execute();

@ -36,7 +36,6 @@ final class IllustrationRepository extends ResourceRepository implements GridInt
{ {
$qb = $this->createQueryBuilder('resource') $qb = $this->createQueryBuilder('resource')
->select('resource') ->select('resource')
//->from($className, 'resource')
->innerJoin( ->innerJoin(
'resource.resourceNode', 'resource.resourceNode',
'node' 'node'

@ -52,6 +52,7 @@ use Chamilo\CourseBundle\Entity\CWiki;
use Datetime; use Datetime;
use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\Criteria; use Doctrine\Common\Collections\Criteria;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Query\Expr\Join; use Doctrine\ORM\Query\Expr\Join;
use Doctrine\Persistence\ManagerRegistry; use Doctrine\Persistence\ManagerRegistry;
use Exception; use Exception;
@ -234,7 +235,7 @@ class UserRepository extends ResourceRepository implements UserLoaderInterface,
$qb->select('u') $qb->select('u')
->from($this->_entityName, 'u') ->from($this->_entityName, 'u')
->where('u.roles LIKE :roles') ->where('u.roles LIKE :roles')
->setParameter('roles', '%"'.$role.'"%') ->setParameter('roles', '%"'.$role.'"%', Types::STRING)
; ;
return $qb->getQuery()->getResult(); return $qb->getQuery()->getResult();
@ -255,7 +256,7 @@ class UserRepository extends ResourceRepository implements UserLoaderInterface,
//@todo check app settings //@todo check app settings
$qb->orderBy('b.firstname', 'ASC'); $qb->orderBy('b.firstname', 'ASC');
$qb->where('b.firstname LIKE :keyword OR b.lastname LIKE :keyword '); $qb->where('b.firstname LIKE :keyword OR b.lastname LIKE :keyword ');
$qb->setParameter('keyword', "%{$keyword}%"); $qb->setParameter('keyword', "%{$keyword}%", Types::STRING);
$query = $qb->getQuery(); $query = $qb->getQuery();
return $query->execute(); return $query->execute();

@ -12,6 +12,7 @@ use Chamilo\CoreBundle\Entity\ResourceLink;
use Chamilo\CoreBundle\Entity\ResourceNode; use Chamilo\CoreBundle\Entity\ResourceNode;
use Chamilo\CoreBundle\Entity\ResourceType; use Chamilo\CoreBundle\Entity\ResourceType;
use Chamilo\CoreBundle\Entity\Session; use Chamilo\CoreBundle\Entity\Session;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Gedmo\Tree\Entity\Repository\MaterializedPathRepository; use Gedmo\Tree\Entity\Repository\MaterializedPathRepository;
use League\Flysystem\FilesystemInterface; use League\Flysystem\FilesystemInterface;
@ -106,7 +107,7 @@ class ResourceNodeRepository extends MaterializedPathRepository
->innerJoin('node.resourceFile', 'file') ->innerJoin('node.resourceFile', 'file')
->innerJoin('node.resourceLinks', 'l') ->innerJoin('node.resourceLinks', 'l')
->where('node.resourceType = :type') ->where('node.resourceType = :type')
->setParameter('type', $type) ->setParameter('type', $type, Types::STRING)
->andWhere('node.parent = :parentNode') ->andWhere('node.parent = :parentNode')
->setParameter('parentNode', $resourceNode) ->setParameter('parentNode', $resourceNode)
->andWhere('file IS NOT NULL') ->andWhere('file IS NOT NULL')

@ -25,6 +25,7 @@ use Chamilo\CourseBundle\Entity\CGroup;
use Cocur\Slugify\SlugifyInterface; use Cocur\Slugify\SlugifyInterface;
use DateTime; use DateTime;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\EntityManager; use Doctrine\ORM\EntityManager;
use Doctrine\ORM\EntityRepository; use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\QueryBuilder; use Doctrine\ORM\QueryBuilder;
@ -149,7 +150,7 @@ abstract class ResourceRepository extends ServiceEntityRepository
$qb = $this->getResourcesByCourse($course, $session, $group, $parentNode); $qb = $this->getResourcesByCourse($course, $session, $group, $parentNode);
$qb $qb
->andWhere('node.title = :title') ->andWhere('node.title = :title')
->setParameter('title', $title) ->setParameter('title', $title, Types::STRING)
->setMaxResults(1) ->setMaxResults(1)
; ;
@ -380,7 +381,7 @@ abstract class ResourceRepository extends ServiceEntityRepository
->leftJoin('node.resourceFile', 'file') ->leftJoin('node.resourceFile', 'file')
->where('type.name = :type') ->where('type.name = :type')
->setParameter('type', $resourceTypeName) ->setParameter('type', $resourceTypeName, Types::STRING)
->andWhere('links.course = :course') ->andWhere('links.course = :course')
->setParameter('course', $course) ->setParameter('course', $course)
->addSelect('node') ->addSelect('node')
@ -397,13 +398,13 @@ abstract class ResourceRepository extends ServiceEntityRepository
// Do not show deleted resources. // Do not show deleted resources.
$qb $qb
->andWhere('links.visibility != :visibilityDeleted') ->andWhere('links.visibility != :visibilityDeleted')
->setParameter('visibilityDeleted', ResourceLink::VISIBILITY_DELETED) ->setParameter('visibilityDeleted', ResourceLink::VISIBILITY_DELETED, Types::INTEGER)
; ;
if (!$isAdmin) { if (!$isAdmin) {
$qb $qb
->andWhere('links.visibility = :visibility') ->andWhere('links.visibility = :visibility')
->setParameter('visibility', ResourceLink::VISIBILITY_PUBLISHED) ->setParameter('visibility', ResourceLink::VISIBILITY_PUBLISHED, Types::INTEGER)
; ;
// @todo Add start/end visibility restrictions. // @todo Add start/end visibility restrictions.
} }
@ -460,7 +461,7 @@ abstract class ResourceRepository extends ServiceEntityRepository
->innerJoin('node.resourceLinks', 'links') ->innerJoin('node.resourceLinks', 'links')
->innerJoin('node.resourceType', 'type') ->innerJoin('node.resourceType', 'type')
->where('type.name = :type') ->where('type.name = :type')
->setParameter('type', $resourceTypeName) ->setParameter('type', $resourceTypeName, Types::STRING)
->andWhere('links.course = :course') ->andWhere('links.course = :course')
->setParameter('course', $course) ->setParameter('course', $course)
; ;
@ -470,13 +471,13 @@ abstract class ResourceRepository extends ServiceEntityRepository
// Do not show deleted resources // Do not show deleted resources
$qb $qb
->andWhere('links.visibility != :visibilityDeleted') ->andWhere('links.visibility != :visibilityDeleted')
->setParameter('visibilityDeleted', ResourceLink::VISIBILITY_DELETED) ->setParameter('visibilityDeleted', ResourceLink::VISIBILITY_DELETED, Types::INTEGER)
; ;
if (!$isAdmin) { if (!$isAdmin) {
$qb $qb
->andWhere('links.visibility = :visibility') ->andWhere('links.visibility = :visibility')
->setParameter('visibility', ResourceLink::VISIBILITY_PUBLISHED) ->setParameter('visibility', ResourceLink::VISIBILITY_PUBLISHED, Types::INTEGER)
; ;
// @todo Add start/end visibility restrictions // @todo Add start/end visibility restrictions
} }
@ -547,7 +548,7 @@ abstract class ResourceRepository extends ServiceEntityRepository
->innerJoin('node.resourceLinks', 'links') ->innerJoin('node.resourceLinks', 'links')
->innerJoin('node.resourceType', 'type') ->innerJoin('node.resourceType', 'type')
->where('type.name = :type') ->where('type.name = :type')
->setParameter('type', $resourceTypeName) ->setParameter('type', $resourceTypeName, Types::STRING)
->andWhere('links.user = :user') ->andWhere('links.user = :user')
->setParameter('user', $user) ->setParameter('user', $user)
; ;

@ -5,12 +5,12 @@
</h3> </h3>
<hr> <hr>
<ul> <ul>
{% for comment in comments %} {% for comment in work.comments %}
<li> <li>
<div class="page-header"> <div class="page-header">
<img height="24" src="{{ comment.picture }}"/> {{ comment.complete_name }} <img height="24" src="{{ comment.user | illustration }}"/> {{ comment.user.username }}
- {{ comment.sent_at_with_label }} - {{ comment.sentAt | date_to_time_ago }}
</div> </div>
<p> <p>
{% if comment.comment is not empty %} {% if comment.comment is not empty %}
@ -19,21 +19,47 @@
{{ 'Here is your feedback' | trans }} {{ 'Here is your feedback' | trans }}
{% endif %} {% endif %}
</p> </p>
{% if comment.file_url is not empty %}
{% if comment.resourceNode.hasResourceFile %}
<ul class="fa-ul"> <ul class="fa-ul">
<li> <li>
<span class="fa-li fa fa-paperclip"></span> <span class="fa-li fa fa-paperclip"></span>
<a href="{{ comment.file_url }}"> <a
{{ comment.file_name_to_show }} href="{{ url('chamilo_core_resource_view', {
</a> 'id': comment.resourceNode.id,
{% if is_allowed_to_edit %} 'cid': course ? course.id : 0,
<a href="{{ comment.delete_file_url }}"> 'sid': session ? session.id : 0,
{{ 'delete.png'|img(22, 'Delete'|trans) }} 'type' : 'student_publications_comments',
'tool' : 'student_publications',
})
}}"
/>
{{ comment.resourceNode.resourceFile }}
</a> </a>
{# {% if is_allowed_to_edit %}#}
{# <a href="{{ comment.delete_file_url }}">#}
{# {{ 'delete.png'|img(22, 'Delete'|trans) }}#}
{# </a>#}
{# {% endif %}#}
{% endif %} {% endif %}
</li>
</ul>
{% endif %} {# {% if comment.file_url is not empty %}#}
{# <ul class="fa-ul">#}
{# <li>#}
{# <span class="fa-li fa fa-paperclip"></span>#}
{# <a href="{{ comment.file_url }}">#}
{# {{ comment.file_name_to_show }}#}
{# </a>#}
{# {% if is_allowed_to_edit %}#}
{# <a href="{{ comment.delete_file_url }}">#}
{# {{ 'delete.png'|img(22, 'Delete'|trans) }}#}
{# </a>#}
{# {% endif %}#}
{# </li>#}
{# </ul>#}
{# {% endif %}#}
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>

@ -31,10 +31,13 @@ final class CStudentPublicationRepository extends ResourceRepository
Session $session = null, Session $session = null,
CGroup $group = null CGroup $group = null
): QueryBuilder { ): QueryBuilder {
$qb = $this->getResourcesByCourse($course, $session, $group, $publication->getResourceNode()); $qb = $this->getResourcesByCourse($course, $session, $group);
$qb->andWhere($qb->expr()->in('resource.active', [1, 0])); $qb->andWhere($qb->expr()->in('resource.active', [1, 0]));
$qb->andWhere($qb->expr()->eq('resource.publicationParent', $publication)); $qb
->andWhere('resource.publicationParent =:publicationParent')
->setParameter('publicationParent', $publication)
;
return $qb; return $qb;
} }

Loading…
Cancel
Save