continue to implement example app
authorymh <ymh.work@gmail.com>
Mon, 17 Oct 2011 13:49:59 +0200
changeset 9 41a9fa70a47b
parent 8 062b0cefef7e
child 11 e9b2fb7586a3
continue to implement example app
.settings/org.eclipse.php.core.prefs
.settings/org.eclipse.php.ui.prefs
src/Company/BaseBundle/Controller/IndexController.php
src/Company/BaseBundle/Entity/Document.php
src/Company/BaseBundle/Resources/config/routing.yml
src/Company/BaseBundle/Resources/views/Default/index.html.twig
src/Company/BaseBundle/Resources/views/Index/add_document.html.twig
src/Company/BaseBundle/Resources/views/Index/all_documents.html.twig
src/Company/BaseBundle/Resources/views/Index/all_documents_partial.html.twig
src/Company/BaseBundle/Resources/views/Index/other_page.html.twig
src/Company/BaseBundle/Resources/views/Index/tag_embedder.html.twig
--- 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
--- /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=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="php_gettercomment_context" deleted\="false" description\="Comment for getter methods" enabled\="true" id\="org.eclipse.php.ui.editor.templates.php.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="php_settercomment_context" deleted\="false" description\="Comment for setter methods" enabled\="true" id\="org.eclipse.php.ui.editor.templates.php.codetemplates.settercomment" name\="settercomment">/**\n * @param ${field_type} ${bare_field_name}\n */</template><template autoinsert\="true" context\="php_constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.php.ui.editor.templates.php.codetemplates.constructorcomment" name\="constructorcomment">/**\n * Enter description here ...\n * ${tags}\n */</template><template autoinsert\="true" context\="php_filecomment_context" deleted\="false" description\="Comment for created PHP files" enabled\="true" id\="org.eclipse.php.ui.editor.templates.php.codetemplates.filecomment" name\="filecomment">/**\n * Enter description here ...\n * \n */\n</template><template autoinsert\="true" context\="php_typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.php.ui.editor.templates.php.codetemplates.typecomment" name\="typecomment">/**\n * Enter description here ...\n * @author ${user}\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="php_fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.php.ui.editor.templates.php.codetemplates.fieldcomment" name\="fieldcomment">/**\n * Enter description here ...\n * @var ${field_type}\n */</template><template autoinsert\="true" context\="php_methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.php.ui.editor.templates.php.codetemplates.methodcomment" name\="methodcomment">/**\n * Enter description here ...\n * ${cursor}${tags}\n */</template><template autoinsert\="true" context\="php_overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.php.ui.editor.templates.php.codetemplates.overridecomment" name\="overridecomment">/* (non-PHPdoc)\n * ${see_to_overridden}\n */</template><template autoinsert\="true" context\="php_delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.php.ui.editor.templates.php.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n */</template><template autoinsert\="true" context\="php_newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.php.ui.editor.templates.php.codetemplates.newtype" name\="newtype">${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="false" context\="php_classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.php.ui.editor.templates.php.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="false" context\="php_interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.php.ui.editor.templates.php.codetemplates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="php_catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.php.ui.editor.templates.php.codetemplates.catchblock" name\="catchblock">// ${TODO} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="php_methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.php.ui.editor.templates.php.codetemplates.methodbody" name\="methodbody">// ${TODO} Auto-generated method stub\n${body_statement}</template><template autoinsert\="true" context\="php_constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.php.ui.editor.templates.php.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${TODO} Auto-generated constructor stub</template><template autoinsert\="true" context\="php_getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.php.ui.editor.templates.php.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="php_setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.php.ui.editor.templates.php.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template><template autoinsert\="false" context\="php_new_file_context" deleted\="false" description\="Simple php file" enabled\="true" id\="org.eclipse.php.ui.editor.templates.php.author" name\="New simple PHP file">&lt;?php\n/*\n * This file is part of the WikiTagBundle package.\n *\n * (c) IRI &lt;http\://www.iri.centrepompidou.fr/&gt;\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n${cursor}</template><template autoinsert\="true" context\="php_new_file_context" deleted\="false" description\="html 4.01 frameset" enabled\="true" id\="org.eclipse.php.ui.editor.templates.php.html.frameset" name\="New PHP file - HTML frameset">&lt;\!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"&gt;\n&lt;html&gt;\n&lt;head&gt;\n&lt;meta http-equiv\="Content-Type" content\="text/html; charset\=${encoding}"&gt;\n&lt;title&gt;Insert title here&lt;/title&gt;\n&lt;/head&gt;\n&lt;frameset&gt;\n    &lt;frame&gt;\n    &lt;frame&gt;\n    &lt;noframes&gt;\n    &lt;body&gt;\n    &lt;p&gt;This page uses frames. The current browser you are using does not support frames.&lt;/p&gt;\n    &lt;?php\n${cursor}\n\t?&gt;\n    &lt;/body&gt;\n    &lt;/noframes&gt;\n&lt;/frameset&gt;\n&lt;/html&gt;</template></templates>
--- /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 @@
+<?php
+
+namespace Company\BaseBundle\Controller;
+
+use Company\BaseBundle\Entity\Document;
+use IRI\Bundle\WikiTagBundle\Entity\Document as BaseDocument;
+
+use Symfony\Component\HttpFoundation\Request;
+use Symfony\Bundle\FrameworkBundle\Controller\Controller;
+
+
+class IndexController extends Controller
+{
+    
+    public function indexAction()
+    {
+        return $this->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));
+    }
+    
+}
--- 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()
     {
--- 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
--- 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 %}
+    <div>COMPANY TOOL BAR - <a href="{{ url('company_other') }}">other url</a> - <a href="{{ url('all_documents') }}">All Documents</a></div>
+{% endblock %}
+
+
 {% block content %}
 <div>
 {% if is_granted("IS_AUTHENTICATED_FULLY") %}
--- /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 %}
+	<div id="content" class="span-24 last">
+	    <div id="inner_content">
+	       <form action="{{ path('add_document') }}" method="post" {{ form_enctype(form) }}>
+                {{ form_widget(form) }}
+                <input type="submit" />
+            </form>
+	    </div>
+	    {% render "CompanyBaseBundle:Index:allDocumentsPartial" with {'param': 'mon super param'} %}
+	    {# render "SensioDistributionBundle:Configurator:step" #}
+	</div>
+{% endblock %}
\ No newline at end of file
--- /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 %}
+<div id="content" class="span-24 last">
+  <div id="inner_content">
+    <table>
+    <tr><th>ID</th><th>TITLE</th><th>DESC</th><th>lien</th></tr>
+    {% for doc in documents %}
+    <tr><td>{{ doc.id }}</td><td>{{ doc.title }}</td><td>{{ doc.description }}</td><td><a href="{{ url('doctag', { 'idDoc': doc.id }) }}">voir les tags</a></td></tr>
+    {% endfor %}
+    </table>
+    <p><a href="{{ url('document_new') }}">Add another document</a></p>
+  </div>
+</div>
+{% endblock %}
\ No newline at end of file
--- /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 #}
+<table>
+<tr><th>ID</th><th>TITLE</th><th>DESC</th>lien</tr>
+{% for doc in documents %}
+<tr><td>{{ doc.id }}</td><td>{{ doc.title }}</td><td>{{ doc.description }}</td></tr>
+{% endfor %}
+</table>
+<p>param = {{ param }}</p>
\ No newline at end of file
--- /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 %}
+	<div id="content" class="span-24 last">
+	    <div id="inner_content">
+	       <p>This is a simple template extending the base template.</p>
+	    </div>
+	</div>
+{% endblock %}
\ No newline at end of file
--- /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 %}
+<div id="content" class="span-24 last">
+  <div id="inner_content">
+    <div class="complete_sheet">
+      <div class="left_sheet">
+        <p><b>HERE ARE THE INFORMATIONS ABOUT A DOCUMENT</b><br/></p>
+        <p><b>doc id</b><br/>{{doc.id}}</p>
+        <p><b>Titre</b><br><span class="sheet_title">{{doc.title}}</span></p>
+        <p><b>Description</b><br/>{{doc.description}}</p>
+      </div>
+      <div class="right_sheet">
+        <p style="float:right;"><a href="{{ url('doctag', { 'idDoc': (doc.id-1) }) }}">&nbsp;&lt;&nbsp;</a> - <a href="{{ url('doctag', { 'idDoc': (doc.id+1) }) }}">&nbsp;&gt;&nbsp;</a></p>
+        {% render "WikiTagBundle:WikiTag:documentTags" with {'id_doc': doc.id} %}
+        {#
+        <div id="tags_commands" style="float:left;width: 100%" >
+            {% if valid != "2" %}
+            <div style="float:right;" id="tags_actions">
+              <span>Trier les tags : <input type="image" src="{{STATIC_URL}}hdabo/img/sort-descending.png" width="16" height="16" name="trier" id="tags_sort" /></span>
+              <span>Ajouter un tag : <input type="text" name="wp_search" id="wp_search" size="35" /> <span id="ok_search" class="hand_cursor"><b>OK</b></span></span>
+            </div>
+            {% endif %}
+            {% csrf_token %}
+            <input type="hidden" name="datasheet_id" value="{{ds.hda_id}}" id="datasheet_id" />
+        </div>
+        <div id="tag_table_container" style="float:left; width: 100%">
+        {% include "partial/tag_table.html" %}
+        </div>
+        #}
+      </div>
+    </div>            
+  </div>
+</div>
+{% endblock %}
\ No newline at end of file