# HG changeset patch # User ymh # Date 1318852199 -7200 # Node ID 41a9fa70a47bc74b09907486bba8102a3d0f30fc # Parent 062b0cefef7ed249463f521dd6e9833fa35fef4e continue to implement example app diff -r 062b0cefef7e -r 41a9fa70a47b .settings/org.eclipse.php.core.prefs --- a/.settings/org.eclipse.php.core.prefs Thu Oct 06 10:22:59 2011 +0200 +++ b/.settings/org.eclipse.php.core.prefs Mon Oct 17 13:49:59 2011 +0200 @@ -1,3 +1,4 @@ -#Fri Sep 23 19:07:18 CEST 2011 +#Fri Oct 07 19:36:03 CEST 2011 eclipse.preferences.version=1 include_path=0;/hdabo_sf/app\u00050;/hdabo_sf/web\u00050;/hdabo_sf/vendor\u00050;/hdabo_sf/src +org.eclipse.php.core.phpDoc=false diff -r 062b0cefef7e -r 41a9fa70a47b .settings/org.eclipse.php.ui.prefs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.settings/org.eclipse.php.ui.prefs Mon Oct 17 13:49:59 2011 +0200 @@ -0,0 +1,3 @@ +#Fri Oct 07 19:38:02 CEST 2011 +eclipse.preferences.version=1 +org.eclipse.php.ui.text.custom_code_templates= diff -r 062b0cefef7e -r 41a9fa70a47b src/Company/BaseBundle/Controller/IndexController.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/Company/BaseBundle/Controller/IndexController.php Mon Oct 17 13:49:59 2011 +0200 @@ -0,0 +1,79 @@ +render('CompanyBaseBundle:Index:index.html.twig'); + } + + public function otherAction() + { + return $this->render('CompanyBaseBundle:Index:other_page.html.twig'); + } + + + public function addDocumentAction(Request $request) + { + $doc = new Document(); + + $form = $this->createFormBuilder($doc) + ->add('title', 'text') + ->add('description', 'textarea', array("required" => false,)) + ->getForm(); + + if ($request->getMethod() == 'POST') { + $form->bindRequest($request); + if ($form->isValid()) { + $doc = $form->getData(); + $em = $this->getDoctrine()->getEntityManager(); + $em->persist($doc); + $em->flush(); + return $this->redirect($this->generateUrl('all_documents')); + } + } + else{ + return $this->render('CompanyBaseBundle:Index:add_document.html.twig', array('form' => $form->createView())); + } + } + + + public function allDocumentsAction() + { + $rep_docs = $this->getDoctrine()->getRepository('CompanyBaseBundle:Document'); + $documents = $rep_docs->findAll(); + + return $this->render('CompanyBaseBundle:Index:all_documents.html.twig', array('documents' => $documents)); + } + + + public function allDocumentsPartialAction($param="") + { + $rep_docs = $this->getDoctrine()->getRepository('CompanyBaseBundle:Document'); + $documents = $rep_docs->findAll(); + + return $this->render('CompanyBaseBundle:Index:all_documents_partial.html.twig', array('documents' => $documents, 'param' => $param)); + } + + /** + * Template with tag management + * + */ + public function documentWithTagAction($idDoc) + { + $rep_docs = $this->getDoctrine()->getRepository('CompanyBaseBundle:Document'); + $doc = $rep_docs->findOneById($idDoc); + return $this->render('CompanyBaseBundle:Index:tag_embedder.html.twig', array('doc' => $doc)); + } + +} diff -r 062b0cefef7e -r 41a9fa70a47b src/Company/BaseBundle/Entity/Document.php --- a/src/Company/BaseBundle/Entity/Document.php Thu Oct 06 10:22:59 2011 +0200 +++ b/src/Company/BaseBundle/Entity/Document.php Mon Oct 17 13:49:59 2011 +0200 @@ -3,6 +3,7 @@ namespace Company\BaseBundle\Entity; use Doctrine\ORM\Mapping as ORM; +use IRI\Bundle\WikiTagBundle\Model\DocumentInterface; /** * Company\BaseBundle\Entity\Document @@ -10,7 +11,7 @@ * @ORM\Table() * @ORM\Entity(repositoryClass="Company\BaseBundle\Entity\DocumentRepository") */ -class Document +class Document implements DocumentInterface { /** * @var integer $id @@ -39,7 +40,7 @@ /** * Get id * - * @return integer + * @return integer */ public function getId() { @@ -59,7 +60,7 @@ /** * Get title * - * @return string + * @return string */ public function getTitle() { @@ -79,7 +80,7 @@ /** * Get description * - * @return text + * @return text */ public function getDescription() { diff -r 062b0cefef7e -r 41a9fa70a47b src/Company/BaseBundle/Resources/config/routing.yml --- a/src/Company/BaseBundle/Resources/config/routing.yml Thu Oct 06 10:22:59 2011 +0200 +++ b/src/Company/BaseBundle/Resources/config/routing.yml Mon Oct 17 13:49:59 2011 +0200 @@ -2,6 +2,17 @@ pattern: / defaults: { _controller: CompanyBaseBundle:Default:index } +all_documents: + pattern: /alldocs + defaults: { _controller: CompanyBaseBundle:Index:allDocuments } +company_other: + pattern: /other + defaults: { _controller: CompanyBaseBundle:Index:other } +doctag: + pattern: /doctag/{idDoc} + defaults: { _controller: CompanyBaseBundle:Index:documentWithTag } + CompanyBaseBundle_document: resource: "@CompanyBaseBundle/Resources/config/routing/document.yml" - prefix: /document \ No newline at end of file + prefix: /document + \ No newline at end of file diff -r 062b0cefef7e -r 41a9fa70a47b src/Company/BaseBundle/Resources/views/Default/index.html.twig --- a/src/Company/BaseBundle/Resources/views/Default/index.html.twig Thu Oct 06 10:22:59 2011 +0200 +++ b/src/Company/BaseBundle/Resources/views/Default/index.html.twig Mon Oct 17 13:49:59 2011 +0200 @@ -1,5 +1,10 @@ {% extends 'CompanyBaseBundle::layout.html.twig' %} +{% block toolbar %} +
COMPANY TOOL BAR - other url - All Documents
+{% endblock %} + + {% block content %}
{% if is_granted("IS_AUTHENTICATED_FULLY") %} diff -r 062b0cefef7e -r 41a9fa70a47b src/Company/BaseBundle/Resources/views/Index/add_document.html.twig --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/Company/BaseBundle/Resources/views/Index/add_document.html.twig Mon Oct 17 13:49:59 2011 +0200 @@ -0,0 +1,15 @@ +{# example of other page extending the company base template #} +{% extends 'CompanyBaseBundle:Index:index.html.twig' %} + +{% block content %} +
+
+
+ {{ form_widget(form) }} + +
+
+ {% render "CompanyBaseBundle:Index:allDocumentsPartial" with {'param': 'mon super param'} %} + {# render "SensioDistributionBundle:Configurator:step" #} +
+{% endblock %} \ No newline at end of file diff -r 062b0cefef7e -r 41a9fa70a47b src/Company/BaseBundle/Resources/views/Index/all_documents.html.twig --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/Company/BaseBundle/Resources/views/Index/all_documents.html.twig Mon Oct 17 13:49:59 2011 +0200 @@ -0,0 +1,16 @@ +{# display all documents #} +{% extends 'CompanyBaseBundle:Default:index.html.twig' %} + +{% block content %} +
+
+ + + {% for doc in documents %} + + {% endfor %} +
IDTITLEDESClien
{{ doc.id }}{{ doc.title }}{{ doc.description }}voir les tags
+

Add another document

+
+
+{% endblock %} \ No newline at end of file diff -r 062b0cefef7e -r 41a9fa70a47b src/Company/BaseBundle/Resources/views/Index/all_documents_partial.html.twig --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/Company/BaseBundle/Resources/views/Index/all_documents_partial.html.twig Mon Oct 17 13:49:59 2011 +0200 @@ -0,0 +1,8 @@ +{# partial display all documents #} + +lien +{% for doc in documents %} + +{% endfor %} +
IDTITLEDESC
{{ doc.id }}{{ doc.title }}{{ doc.description }}
+

param = {{ param }}

\ No newline at end of file diff -r 062b0cefef7e -r 41a9fa70a47b src/Company/BaseBundle/Resources/views/Index/other_page.html.twig --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/Company/BaseBundle/Resources/views/Index/other_page.html.twig Mon Oct 17 13:49:59 2011 +0200 @@ -0,0 +1,10 @@ +{# example of other page extending the company base template #} +{% extends 'CompanyBaseBundle:Default:index.html.twig' %} + +{% block content %} +
+
+

This is a simple template extending the base template.

+
+
+{% endblock %} \ No newline at end of file diff -r 062b0cefef7e -r 41a9fa70a47b src/Company/BaseBundle/Resources/views/Index/tag_embedder.html.twig --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/Company/BaseBundle/Resources/views/Index/tag_embedder.html.twig Mon Oct 17 13:49:59 2011 +0200 @@ -0,0 +1,46 @@ +{# example of other page extending the company base template #} +{% extends 'CompanyBaseBundle:Default:index.html.twig' %} + +{% block css_import %} +{{ parent() }} +{% render "WikiTagBundle:WikiTag:addCss" %} +{% endblock %} + +{% block js_declaration %} +{{ parent() }} +{% render "WikiTagBundle:WikiTag:addJavascript" %} +{% endblock %} + +{% block content %} +
+
+
+
+

HERE ARE THE INFORMATIONS ABOUT A DOCUMENT

+

doc id
{{doc.id}}

+

Titre
{{doc.title}}

+

Description
{{doc.description}}

+
+
+

 <  -  > 

+ {% render "WikiTagBundle:WikiTag:documentTags" with {'id_doc': doc.id} %} + {# +
+ {% if valid != "2" %} +
+ Trier les tags : + Ajouter un tag : OK +
+ {% endif %} + {% csrf_token %} + +
+
+ {% include "partial/tag_table.html" %} +
+ #} +
+
+
+
+{% endblock %} \ No newline at end of file