Browse Source

Gestion des vidéos dailymotions.

bastien 13 years ago
parent
commit
bf7a04aaec

+ 11 - 16
src/Muzich/CoreBundle/Controller/CoreController.php View File

214
         }
214
         }
215
         else
215
         else
216
         {
216
         {
217
-          //$this->setFlash('error', 'element.add.error');
218
           
217
           
219
           $search_object = $this->getElementSearcher();
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
           return $this->render('MuzichHomeBundle:Home:index.html.twig', array(
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 View File

42
     
42
     
43
     foreach (array(
43
     foreach (array(
44
       'youtube.com' => 'Youtube', 'soundcloud.com' => 'SoundCloud', 
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
       ) as $id => $name)
47
       ) as $id => $name)
47
     {
48
     {
48
       $this->createElementType($id, $name);
49
       $this->createElementType($id, $name);

+ 9 - 3
src/Muzich/CoreBundle/ElementFactory/ElementManager.php View File

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

+ 17 - 0
src/Muzich/CoreBundle/ElementFactory/Site/DailymotionFactory.php View File

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 View File

5
 use Symfony\Bundle\FrameworkBundle\Controller\Controller as BaseController;
5
 use Symfony\Bundle\FrameworkBundle\Controller\Controller as BaseController;
6
 use Muzich\CoreBundle\Searcher\ElementSearcher;
6
 use Muzich\CoreBundle\Searcher\ElementSearcher;
7
 use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
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
 class Controller extends BaseController
11
 class Controller extends BaseController
10
 {
12
 {
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 View File

25
       'groups_owned'
25
       'groups_owned'
26
     )), true);
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
     return array(
31
     return array(
46
-      'tags'             => $tags,
32
+      'tags'             => $this->getTagsArray(),
47
       'search_tags_id'   => $search_object->getTags(),
33
       'search_tags_id'   => $search_object->getTags(),
48
       'user'             => $this->getUser(),
34
       'user'             => $this->getUser(),
49
       'add_form'         => $add_form->createView(),
35
       'add_form'         => $add_form->createView(),