소스 검색

Gestion des vidéos dailymotions.

bastien 13 년 전
부모
커밋
bf7a04aaec

+ 11 - 16
src/Muzich/CoreBundle/Controller/CoreController.php 파일 보기

@@ -214,26 +214,21 @@ class CoreController extends Controller
214 214
         }
215 215
         else
216 216
         {
217
-          //$this->setFlash('error', 'element.add.error');
218 217
           
219 218
           $search_object = $this->getElementSearcher();
220
-          $user = $this->getUser(true, array('join' => array(
221
-            'groups_owned'
222
-          )), true);
223
-
224
-          $search_form = $this->createForm(
225
-            new ElementSearchForm(), 
226
-            $search_object->getParams(),
227
-            array(
228
-              'tags' => $tags = $this->getTagsArray()
229
-            )
230
-          );
219
+          $search_form = $this->getSearchForm($search_object);
220
+          $add_form = $this->getAddForm();
231 221
 
232 222
           return $this->render('MuzichHomeBundle:Home:index.html.twig', array(
233
-            'user'        => $this->getUser(),
234
-            'add_form'    => $form->createView(),
235
-            'search_form' => $search_form->createView(),
236
-            'elements'    => $search_object->getElements($this->getDoctrine(), $this->getUserId())
223
+            'tags'             => $this->getTagsArray(),
224
+            'search_tags_id'   => $search_object->getTags(),
225
+            'user'             => $this->getUser(),
226
+            'add_form'         => $add_form->createView(),
227
+            'add_form_name'    => $add_form->getName(),
228
+            'search_form'      => $search_form->createView(),
229
+            'search_form_name' => $search_form->getName(),
230
+            'elements'         => $search_object->getElements($this->getDoctrine(), $this->getUserId()),
231
+            'more_count'       => $this->container->getParameter('search_default_count')*2
237 232
           ));
238 233
           
239 234
         }

+ 2 - 1
src/Muzich/CoreBundle/DataFixtures/ORM/LoadElementTypeData.php 파일 보기

@@ -42,7 +42,8 @@ class LoadElementTypeData  extends AbstractFixture implements OrderedFixtureInte
42 42
     
43 43
     foreach (array(
44 44
       'youtube.com' => 'Youtube', 'soundcloud.com' => 'SoundCloud', 
45
-      'son2teuf.org' => 'Son2Teuf', 'jamendo.com' => 'jamendo'
45
+      'son2teuf.org' => 'Son2Teuf', 'jamendo.com' => 'jamendo',
46
+      'dailymotion.com' => 'Dailymotion'
46 47
       ) as $id => $name)
47 48
     {
48 49
       $this->createElementType($id, $name);

+ 9 - 3
src/Muzich/CoreBundle/ElementFactory/ElementManager.php 파일 보기

@@ -8,6 +8,10 @@ use Doctrine\ORM\EntityManager;
8 8
 use Symfony\Component\DependencyInjection\Container;
9 9
 
10 10
 use Muzich\CoreBundle\ElementFactory\Site\YoutubeFactory;
11
+use Muzich\CoreBundle\ElementFactory\Site\DailymotionFactory;
12
+use Muzich\CoreBundle\ElementFactory\Site\Son2TeufFactory;
13
+use Muzich\CoreBundle\ElementFactory\Site\JamendoFactory;
14
+use Muzich\CoreBundle\ElementFactory\Site\SoundCloudFactory;
11 15
 
12 16
 /**
13 17
  * 
@@ -21,7 +25,8 @@ class ElementManager
21 25
     'youtube.com', 
22 26
     'soundcloud.com', 
23 27
     'son2teuf.org', 
24
-    'jamendo.com'
28
+    'jamendo.com',
29
+    'dailymotion.com'
25 30
   );
26 31
   
27 32
   protected $em;
@@ -104,7 +109,6 @@ class ElementManager
104 109
     
105 110
     $type = null;
106 111
     
107
-    
108 112
     if (in_array($chaines[0], $this->types))
109 113
     {
110 114
       $type = $this->em->getRepository('MuzichCoreBundle:ElementType')->find($chaines[0]);
@@ -148,7 +152,9 @@ class ElementManager
148 152
       case 'jamendo.com':
149 153
         return new JamendoFactory($this->element, $this->container);
150 154
       break;
151
-    
155
+      case 'dailymotion.com':
156
+        return new DailymotionFactory($this->element, $this->container);
157
+      break;
152 158
       default:
153 159
         throw new Exception("La Factory n'est pas connu pour ce type.");
154 160
       break;

+ 17 - 0
src/Muzich/CoreBundle/ElementFactory/Site/DailymotionFactory.php 파일 보기

@@ -0,0 +1,17 @@
1
+<?php
2
+
3
+namespace Muzich\CoreBundle\ElementFactory\Site;
4
+
5
+use Muzich\CoreBundle\ElementFactory\Site\base\VideoSiteFactory;
6
+
7
+/**
8
+ * 
9
+ *
10
+ * @author bux
11
+ */
12
+class DailymotionFactory extends VideoSiteFactory
13
+{
14
+  
15
+}
16
+
17
+?>

+ 24 - 0
src/Muzich/CoreBundle/lib/Controller.php 파일 보기

@@ -5,6 +5,8 @@ namespace Muzich\CoreBundle\lib;
5 5
 use Symfony\Bundle\FrameworkBundle\Controller\Controller as BaseController;
6 6
 use Muzich\CoreBundle\Searcher\ElementSearcher;
7 7
 use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
8
+use Muzich\CoreBundle\Form\Search\ElementSearchForm;
9
+use Muzich\CoreBundle\Form\Element\ElementAddForm;
8 10
 
9 11
 class Controller extends BaseController
10 12
 {
@@ -219,4 +221,26 @@ class Controller extends BaseController
219 221
     }
220 222
   }
221 223
   
224
+  protected function getSearchForm($search_object)
225
+  {
226
+    return $this->createForm(
227
+      new ElementSearchForm(), 
228
+      $search_object->getParams(),
229
+      array(
230
+        'tags' => $this->getTagsArray()
231
+      )
232
+    );
233
+  }
234
+  
235
+  protected function getAddForm()
236
+  {
237
+    return $this->createForm(
238
+      new ElementAddForm(),
239
+      array(),
240
+      array(
241
+        'tags' => $this->getTagsArray()
242
+      )
243
+    );
244
+  }
245
+  
222 246
 }

+ 3 - 17
src/Muzich/HomeBundle/Controller/HomeController.php 파일 보기

@@ -25,25 +25,11 @@ class HomeController extends Controller
25 25
       'groups_owned'
26 26
     )), true);
27 27
     
28
-    $search_form = $this->createForm(
29
-      new ElementSearchForm(), 
30
-      $search_object->getParams(),
31
-      array(
32
-        'tags' => $tags = $this->getTagsArray()
33
-      )
34
-    );
35
-    
36
-    $add_form = $this->createForm(
37
-      new ElementAddForm(),
38
-      array(),
39
-      array(
40
-        'tags' => $tags,
41
-        //'groups' => $user->getGroupsOwnedArray(),
42
-      )
43
-    );
28
+    $search_form = $this->getSearchForm($search_object);
29
+    $add_form = $this->getAddForm();
44 30
     
45 31
     return array(
46
-      'tags'             => $tags,
32
+      'tags'             => $this->getTagsArray(),
47 33
       'search_tags_id'   => $search_object->getTags(),
48 34
       'user'             => $this->getUser(),
49 35
       'add_form'         => $add_form->createView(),