Added document view support
This commit is contained in:
parent
aa453242df
commit
b173b9a9bb
@ -195,4 +195,19 @@ class DefaultController extends Controller
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Route("/dokumentum/{documentSlug}", name="KekRozsakFrontBundle_documentView")
|
||||||
|
* @Template()
|
||||||
|
*/
|
||||||
|
public function documentViewAction($documentSlug)
|
||||||
|
{
|
||||||
|
$docRepo = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:Document');
|
||||||
|
if (!($document = $docRepo->findOneBySlug($documentSlug)))
|
||||||
|
throw $this->createNotFoundException('A kért dokumentum nem létezik!');
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'document' => $document,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -182,7 +182,12 @@ class Document
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Doctrine\Common\Collections\ArrayCollection $groups
|
* @var Doctrine\Common\Collections\ArrayCollection $groups
|
||||||
* @ORM\ManyToMany(targetEntity="KekRozsak\FrontBundle\Entity\Group", mappedBy="documents")
|
* @ORM\ManyToMany(targetEntity="KekRozsak\FrontBundle\Entity\Group")
|
||||||
|
* @ORM\JoinTable(name="group_document", joinColumns={
|
||||||
|
* @ORM\JoinColumn(name="document_id", referencedColumnName="id"),
|
||||||
|
* }, inverseJoinColumns={
|
||||||
|
* @ORM\JoinColumn(name="group_id", referencedColumnName="id")
|
||||||
|
* })
|
||||||
*/
|
*/
|
||||||
protected $groups;
|
protected $groups;
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ use Doctrine\ORM\Mapping as ORM;
|
|||||||
use Doctrine\Common\Collections\ArrayCollection;
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
|
|
||||||
use KekRozsak\SecurityBundle\Entity\User;
|
use KekRozsak\SecurityBundle\Entity\User;
|
||||||
|
use KekRozsak\FrontBundle\Entity\Document;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* KekRozsak\FrontBundle\Entity\Group
|
* KekRozsak\FrontBundle\Entity\Group
|
||||||
@ -17,6 +18,7 @@ class Group
|
|||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->members = new ArrayCollection();
|
$this->members = new ArrayCollection();
|
||||||
|
$this->documents = new ArrayCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -300,4 +302,32 @@ class Group
|
|||||||
{
|
{
|
||||||
return $this->open;
|
return $this->open;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Doctrine\Common\Collections\ArrayCollection $documents
|
||||||
|
* @ORM\ManyToMany(targetEntity="Document")
|
||||||
|
*/
|
||||||
|
protected $documents;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add document
|
||||||
|
*
|
||||||
|
* @param KekRozsak\FrontBundle\Entity\Document $document
|
||||||
|
* @return Group
|
||||||
|
*/
|
||||||
|
public function addDocument(\KekRozsak\FrontBundle\Entity\Document $document)
|
||||||
|
{
|
||||||
|
$this->documents[] = $document;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all documents
|
||||||
|
*
|
||||||
|
* @return Doctrine\Common\Collections\ArrayCollection
|
||||||
|
*/
|
||||||
|
public function getDocuments()
|
||||||
|
{
|
||||||
|
return $this->documents;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
{% extends '::main_template.html.twig' %}
|
||||||
|
{% block title %} - Dokumentum - {{ document.title }}{% endblock %}
|
||||||
|
{% block content %}
|
||||||
|
<h3>{{ document.title }}</h3>
|
||||||
|
{{ document.content }}
|
||||||
|
<div class="szerzo">{{ document.createdBy.displayName }}</div>
|
||||||
|
{% endblock content %}
|
@ -5,8 +5,13 @@
|
|||||||
{% endblock additional_css %}
|
{% endblock additional_css %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<ul id="submenu">
|
<ul id="submenu">
|
||||||
<li><a href="{{ path('KekRozsakFrontBundle_groupView', {groupSlug: group.slug }) }}">Leírás</a></li>
|
<li><a href="{{ path('KekRozsakFrontBundle_groupView', { groupSlug: group.slug }) }}">Leírás</a></li>
|
||||||
<li><a href="{{ path('KekRozsakFrontBundle_groupMembers', {groupSlug: group.slug }) }}">Tagok</a></li>
|
<li><a href="{{ path('KekRozsakFrontBundle_groupMembers', { groupSlug: group.slug }) }}">Tagok</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<h3>{{ group.name }} - Dokumentumok</h3>
|
<h3>{{ group.name }} - Dokumentumok</h3>
|
||||||
|
<ul>
|
||||||
|
{% for document in group.documents %}
|
||||||
|
<li><a href="{{ path('KekRozsakFrontBundle_documentView', { documentSlug: document.slug }) }}">{{ document.title }}</a></li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
Loading…
Reference in New Issue
Block a user