Access key init.
authorhiroto
Wed, 04 Sep 2013 12:16:40 +0900
changeset 38 fa983cc0e405
parent 37 98fc2a3c3519
child 39 50f946b51282
Access key init.
autotweet-php/src/Org/W3/AutotweetBundle/Controller/DefaultController.php
autotweet-php/src/Org/W3/AutotweetBundle/Entity/TalkRepository.php
autotweet-php/src/Org/W3/AutotweetBundle/Resources/views/Default/newtalk.html.twig
example_slidy/index.html
--- a/autotweet-php/src/Org/W3/AutotweetBundle/Controller/DefaultController.php	Wed Sep 04 11:55:46 2013 +0900
+++ b/autotweet-php/src/Org/W3/AutotweetBundle/Controller/DefaultController.php	Wed Sep 04 12:16:40 2013 +0900
@@ -38,24 +38,10 @@
     public function newTalkAction(Request $request)
     {
                      
-               $form = $this->createFormBuilder()
-                ->add('title', 'text')
-                ->getForm();
-
-        if ($request->getMethod() == 'POST')
-        {
-             $form->handleRequest($request);
-            if ($form->isValid())
-            {
-             $data = $form->getData();
              $user = $this->getDoctrine()->getRepository('OrgW3AutotweetBundle:User')->find(99999);
-            $newpost = $this->getDoctrine()->getRepository('OrgW3AutotweetBundle:Talk')->addnew($user,$data['title']);
-            return $this->redirect($this->generateUrl('org_w3_autotweet_list'));
-          
-
-            }
-        }
-        return $this->render('OrgW3AutotweetBundle:Default:newtalk.html.twig', array('form'=>$form->createView(), 'err'=>'')); 
+            $newpost = $this->getDoctrine()->getRepository('OrgW3AutotweetBundle:Talk')->addnew($user);
+           
+        return $this->render('OrgW3AutotweetBundle:Default:newtalk.html.twig', array('talk'=>$newpost)); 
     }
     
     public function testAction(){
--- a/autotweet-php/src/Org/W3/AutotweetBundle/Entity/TalkRepository.php	Wed Sep 04 11:55:46 2013 +0900
+++ b/autotweet-php/src/Org/W3/AutotweetBundle/Entity/TalkRepository.php	Wed Sep 04 12:16:40 2013 +0900
@@ -12,7 +12,7 @@
  */
 class TalkRepository extends EntityRepository
 {
-               public function addNew($user,$title)
+               public function addNew($user)
     {
            $em_default = $this->getEntityManager('default'); 
            //$talk=$em_default->getRepository('OrgW3AutotweetBundle:Talk')->find($talk->getId());
@@ -26,9 +26,10 @@
         $sRes .= $sCharList[mt_rand(0, strlen($sCharList) - 1)];
         
             $post= new Talk();
-            $post->setName($title);
+            $post->setName(uniqid());
             $post->setUser($user);
             $post->setAccesskey($sRes);
+            $post->setTitle('Undefined');
             $em_default->persist($post);
             $em_default->flush();    
             return $post;
--- a/autotweet-php/src/Org/W3/AutotweetBundle/Resources/views/Default/newtalk.html.twig	Wed Sep 04 11:55:46 2013 +0900
+++ b/autotweet-php/src/Org/W3/AutotweetBundle/Resources/views/Default/newtalk.html.twig	Wed Sep 04 12:16:40 2013 +0900
@@ -21,23 +21,10 @@
     </div>
     <div class="row-fluid detail">
         <div class="span8 offset2 paymentdata">
-                           <h1>New Talk</h1><br />
+                           <h1>Accesskey Generated.</h1><br />
 <br />
+<p>{{talk.accesskey}}</p>
 <a href="{{ path('org_w3_autotweet_list') }}">Back</a>
-<p>{{err}}</strong></p>
-<form class="publish-form" action="{{ path('org_w3_autotweet_newtalk') }}" method="post" {{ form_enctype(form) }}>
-{{ form_errors(form) }}
-<table class="table table-striped">
-<tr>
-    <td>{{ form_label(form.title) }}</td>
-    <td>{{ form_errors(form.title) }}
-        {{ form_widget(form.title) }}</td>
-</tr>
-</table>
-{{ form_rest(form) }}
-<button type="submit" class="btn btn-large btn-print" type="button">Create</button>
-</form>
-
 
 
                                     </p>
--- a/example_slidy/index.html	Wed Sep 04 11:55:46 2013 +0900
+++ b/example_slidy/index.html	Wed Sep 04 12:16:40 2013 +0900
@@ -265,7 +265,7 @@
 </ul>
 </div>
 
-<div class="slide" data-note="Also possible to use it offline :-)">
+<div class="slide" data-note="Also possible to use it offline. yay!">
 <h1>To use it off-line</h1>
 
 <ul>