Created
April 29, 2011 20:00
-
-
Save jmather/948931 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Photo filter form. | |
* | |
* @package cms | |
* @subpackage filter | |
* @author JMather | |
* @version SVN: $Id: sfDoctrineFormFilterTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $ | |
*/ | |
class PhotoFormFilter extends BasePhotoFormFilter | |
{ | |
public function configure() | |
{ | |
unset($this['image_file_id'], $this['content'], $this['content_html']); | |
$this->setWidget('areas_list', new dcmsWidgetFormPreferencePoweredAreaSelect(array('label' => 'Published To'))); | |
$this->setValidator('areas_list', new sfValidatorDoctrineChoice(array('multiple' => true, 'model' => 'Area', 'required' => false))); | |
} | |
public function addAreasListColumnQuery(Doctrine_Query $query, $field, $values) | |
{ | |
if (!is_array($values)) | |
{ | |
$values = array($values); | |
} | |
if (!count($values)) | |
{ | |
return; | |
} | |
$query | |
->leftJoin($query->getRootAlias().'.ContentRegistryEntry ContentRegistryEntry') | |
->leftJoin('ContentRegistryEntry.AreaContentRegistryEntry AreaContentRegistryEntry') | |
->andWhereIn('AreaContentRegistryEntry.area_id', $values) | |
; | |
} | |
public function getFields() | |
{ | |
$fields = parent::getFields(); | |
$fields['areas_list'] = 'ManyKey'; | |
return $fields; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment