Author: francois
Date: 2010-03-22 15:11:02 +0100 (Mon, 22 Mar 2010)
New Revision: 28677

Modified:
   plugins/sfPropel15Plugin/trunk/README
   
plugins/sfPropel15Plugin/trunk/data/generator/sfPropelModule/admin15/parts/indexAction.php
Log:
[1.5] Added an easy way to filter the admin list view with get parameters

Modified: plugins/sfPropel15Plugin/trunk/README
===================================================================
--- plugins/sfPropel15Plugin/trunk/README       2010-03-22 14:10:43 UTC (rev 
28676)
+++ plugins/sfPropel15Plugin/trunk/README       2010-03-22 14:11:02 UTC (rev 
28677)
@@ -181,4 +181,15 @@
       fields: 
         - Author:      { is_sortable: true, sort_method: orderByAuthorLastName 
}
         
-The generator will execute `BookQuery::orderByAuthorLastName()` instead of 
`BookQuery::orderByAuthor()` in that case. 
\ No newline at end of file
+The generator will execute `BookQuery::orderByAuthorLastName()` instead of 
`BookQuery::orderByAuthor()` in that case. 
+
+### Filtering The List With GET Parameters ###
+
+The admin generator doesn't allow to filter the list using GET parameters. 
This neat feature used to be supported in previous versions of the generator, 
and is supported again in the `admin15` theme.
+
+All you have to do to filter a list view is to prepend a query string to the 
URL, describing the filters in a `filters` array. For instance, to link to the 
book list view filtered by Author, try the following link:
+
+    [php]
+    <?php echo link_to($author->getName(), 'book', array(), 
array('query_string' => 'filters[author_id]=' . $author->getId())) ?>
+
+This is very useful for partial lists, to link admin modules together.
\ No newline at end of file

Modified: 
plugins/sfPropel15Plugin/trunk/data/generator/sfPropelModule/admin15/parts/indexAction.php
===================================================================
--- 
plugins/sfPropel15Plugin/trunk/data/generator/sfPropelModule/admin15/parts/indexAction.php
  2010-03-22 14:10:43 UTC (rev 28676)
+++ 
plugins/sfPropel15Plugin/trunk/data/generator/sfPropelModule/admin15/parts/indexAction.php
  2010-03-22 14:11:02 UTC (rev 28677)
@@ -1,5 +1,11 @@
   public function executeIndex(sfWebRequest $request)
   {
+    // filtering
+    if ($request->getParameter('filters'))
+    {
+      $this->setFilters($request->getParameter('filters'));
+    }
+    
     // sorting
     if ($request->getParameter('sort'))
     {

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-svn?hl=en.

Reply via email to