Permalink
Browse files

Merge pull request #68 from Kunstmaan/fix_adminlist_getindexurl

fix_adminlist_getindexurl
  • Loading branch information...
2 parents 28e37cb + 7e05f61 commit c0ebb9f1d5222cf3f127905183311fbc9afc5ef6 @daanporon daanporon committed Jun 14, 2012
@@ -41,7 +41,7 @@ function showAction($id){
$galleries = $em->getRepository('KunstmaanMediaBundle:Folder')->getAllFoldersByType();
$itemlist = "";
- $listconfigurator = $gallery->getStrategy()->getListConfigurator();
+ $listconfigurator = $gallery->getStrategy()->getListConfigurator($gallery);
if (isset($listconfigurator) && $listconfigurator != null){
$itemlist = $this->get("adminlist.factory")->createList($listconfigurator, $em, array("gallery" => $gallery->getId()));
$itemlist->bindRequest($this->getRequest());
@@ -90,7 +90,7 @@ public function editAction($gallery_id)
{
$em = $this->getDoctrine()->getEntityManager();
$gallery = $em->getRepository('KunstmaanMediaBundle:Folder')->getFolder($gallery_id, $em);
-
+
$request = $this->getRequest();
$form = $this->createForm($gallery->getFormType($gallery), $gallery);
@@ -121,7 +121,7 @@ public function editAction($gallery_id)
public function createAction($type)
{
$gallery = FolderFactory::getTypeFolder($type);
-
+
$request = $this->getRequest();
$form = $this->createForm(new FolderType($gallery->getStrategy()->getGalleryClassName()), $gallery);
@@ -182,21 +182,21 @@ public function subcreateAction($id)
'parent' => $parent
));
}
-
+
/**
* @Route("/movenodes", name="KunstmaanMediaBundle_folder_movenodes")
* @Method({"GET", "POST"})
*/
public function movenodesAction(){
$request = $this->getRequest();
$em = $this->getDoctrine()->getEntityManager();
-
+
$parentid = $request->get('parentid');
$parent = $em->getRepository('KunstmaanMediaBundle:Folder')->getFolder($parentid, $em);
-
+
$fromposition = $request->get('fromposition');
$afterposition = $request->get('afterposition');
-
+
foreach($parent->getChildren() as $child){
if($child->getSequencenumber() == $fromposition){
if($child->getSequencenumber() > $afterposition){
@@ -218,8 +218,8 @@ public function movenodesAction(){
$em->persist($child);
}
}
- }
-
+ }
+
$em->flush();
}
return array("success" => true);
@@ -76,9 +76,9 @@ function getFormHelper()
/**
* @return MediaList\FileListConfigurator
*/
- function getListConfigurator()
+ function getListConfigurator($folder)
{
- return new FileListConfigurator();
+ return new FileListConfigurator($folder);
}
}
@@ -73,9 +73,9 @@ function getFormHelper()
/**
* @return MediaList\MediaListConfigurator
*/
- function getListConfigurator()
+ function getListConfigurator($folder)
{
- return new MediaListConfigurator();
+ return new MediaListConfigurator($folder);
}
}
@@ -29,6 +29,6 @@ function getFormType();
function getFormHelper();
- function getListConfigurator();
+ function getListConfigurator($folder);
}
@@ -74,7 +74,7 @@ function getFormHelper()
/**
* @return null
*/
- function getListConfigurator()
+ function getListConfigurator($folder)
{
return NULL;
}
@@ -9,6 +9,11 @@
class FileListConfigurator extends AbstractAdminListConfigurator
{
+ private $folder;
+
+ public function __construct($folder){
+ $this->folder = $folder;
+ }
public function buildFilters(AdminListFilter $builder)
{
@@ -47,6 +52,11 @@ public function getEditUrlFor($item)
);
}
+ public function getIndexUrlFor()
+ {
+ return array('path' => 'KunstmaanMediaBundle_folder_show', 'params' => array('id' => $this->folder->getId()));
+ }
+
public function getRepositoryName()
{
return 'KunstmaanMediaBundle:File';
@@ -14,6 +14,12 @@
class MediaListConfigurator extends AbstractAdminListConfigurator
{
+ private $folder;
+
+ public function __construct($folder){
+ $this->folder = $folder;
+ }
+
public function buildFilters(AdminListFilter $builder)
{
$builder->add('name', new StringFilterType("name"), "form.name");
@@ -73,6 +79,11 @@ public function getEditUrlFor($item)
);
}
+ public function getIndexUrlFor()
+ {
+ return array('path' => 'KunstmaanMediaBundle_folder_show', 'params' => array('id' => $this->folder->getId()));
+ }
+
public function getRepositoryName()
{
return 'KunstmaanMediaBundle:Media';
@@ -11,6 +11,12 @@
class SlideListConfigurator extends AbstractAdminListConfigurator
{
+ private $folder;
+
+ public function __construct($folder){
+ $this->folder = $folder;
+ }
+
public function buildFilters(AdminListFilter $builder)
{
$builder->add('name', new StringFilterType("name"), "form.name");
@@ -54,6 +60,11 @@ public function getEditUrlFor($item)
);
}
+ public function getIndexUrlFor()
+ {
+ return array('path' => 'KunstmaanMediaBundle_folder_show', 'params' => array('id' => $this->folder->getId()));
+ }
+
public function getRepositoryName()
{
return 'KunstmaanMediaBundle:Slide';
@@ -11,6 +11,12 @@
class VideoListConfigurator extends AbstractAdminListConfigurator
{
+ private $folder;
+
+ public function __construct($folder){
+ $this->folder = $folder;
+ }
+
public function buildFilters(AdminListFilter $builder)
{
$builder->add('name', new StringFilterType("name"), "form.name");
@@ -51,6 +57,11 @@ public function getEditUrlFor($item)
);
}
+ public function getIndexUrlFor()
+ {
+ return array('path' => 'KunstmaanMediaBundle_folder_show', 'params' => array('id' => $this->folder->getId()));
+ }
+
public function getRepositoryName()
{
return 'KunstmaanMediaBundle:Video';
@@ -75,9 +75,9 @@ function getFormHelper()
/**
* @return MediaList\SlideListConfigurator
*/
- function getListConfigurator()
+ function getListConfigurator($folder)
{
- return new SlideListConfigurator();
+ return new SlideListConfigurator($folder);
}
}
@@ -75,9 +75,9 @@ function getFormHelper()
/**
* @return MediaList\VideoListConfigurator
*/
- function getListConfigurator()
+ function getListConfigurator($folder)
{
- return new VideoListConfigurator();
+ return new VideoListConfigurator($folder);
}
}

0 comments on commit c0ebb9f

Please sign in to comment.