Author: khiramatsu
Date: 2010-05-12 19:26:04 +0200 (Wed, 12 May 2010)
New Revision: 29427

Added:
   
plugins/sfSimpleCommentPlugin/lib/filter/doctrine/sfSimpleCommentAdminFromFilter.class.php
Modified:
   
plugins/sfSimpleCommentPlugin/modules/sfSimpleCommentAdmin/config/generator.yml
Log:
fixed default filter form

Added: 
plugins/sfSimpleCommentPlugin/lib/filter/doctrine/sfSimpleCommentAdminFromFilter.class.php
===================================================================
--- 
plugins/sfSimpleCommentPlugin/lib/filter/doctrine/sfSimpleCommentAdminFromFilter.class.php
                          (rev 0)
+++ 
plugins/sfSimpleCommentPlugin/lib/filter/doctrine/sfSimpleCommentAdminFromFilter.class.php
  2010-05-12 17:26:04 UTC (rev 29427)
@@ -0,0 +1,36 @@
+<?php
+
+/**
+ * Comment filter form.
+ *
+ * @package    rankingzdrowia.pl
+ * @subpackage filter
+ * @author     Crimson Oak
+ * @version    SVN: $Id: sfDoctrineFormFilterTemplate.php 23810 2009-11-12 
11:07:44Z Kris.Wallsmith $
+ */
+class sfSimpleCommentAdminFormFilter extends PluginsfSimpleCommentFormFilter
+{
+  public function configure()
+  {
+    $this->widgetSchema['object_type'] = new sfWidgetFormSelect(array(
+      'choices' => 
array_combine(sfConfig::get('app_sfSimpleComment_commentable_types'), 
sfConfig::get('app_sfSimpleComment_commentable_types'))
+    ));
+
+    $this->validatorSchema['object_type'] = new sfValidatorChoice(array(
+      'choices' => sfConfig::get('app_sfSimpleComment_commentable_types')
+    ));
+  }
+
+  public function addObjectTypeColumnQuery(Doctrine_Query $q, $element, 
$value) {
+      return strlen($value) > 0 ? 
$q->andWhere($q->getRootAlias().'.object_type = ?', $value) : $q;
+  }
+
+  public function addObjectIdColumnQuery(Doctrine_Query $q, $element, $value) {
+      return strlen($value['text']) > 0 ? 
$q->andWhere($q->getRootAlias().'.object_id = ?', $value['text']) : $q;
+  }
+
+  public function addUsernameColumnQuery(Doctrine_Query $q, $element, $value) {
+      return strlen($value['text']) > 0 ? 
$q->andWhere($q->getRootAlias().'.body LIKE ?', '%'.$value['text'].'%') : $q;
+  }
+
+}

Modified: 
plugins/sfSimpleCommentPlugin/modules/sfSimpleCommentAdmin/config/generator.yml
===================================================================
--- 
plugins/sfSimpleCommentPlugin/modules/sfSimpleCommentAdmin/config/generator.yml 
    2010-05-12 16:21:08 UTC (rev 29426)
+++ 
plugins/sfSimpleCommentPlugin/modules/sfSimpleCommentAdmin/config/generator.yml 
    2010-05-12 17:26:04 UTC (rev 29427)
@@ -20,7 +20,8 @@
         actions: []
         object_actions:
           _delete: ~
-      filter:  ~
+      filter:  
+        class: sfSimpleCommentAdminFormFilter
       form:    ~
       edit:    ~
       new:     ~

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