~agasti-rhok-02/sahana-agasti/mayon-rhok-02

« back to all changes in this revision

Viewing changes to lib/filter/doctrine/agGisPlugin/base/BaseagGeoFeatureFormFilter.class.php

  • Committer: charles wisniewski
  • Date: 2010-12-08 22:06:31 UTC
  • mfrom: (1.1.3 cuny-sps-trunk)
  • Revision ID: charles.wisniewski@mail.cuny.edu-20101208220631-63o0t8b9vi7nbbu6
all up to date

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
 
 
3
/**
 
4
 * agGeoFeature filter form base class.
 
5
 *
 
6
 * @package    AGASTI_CORE
 
7
 * @subpackage filter
 
8
 * @author     CUNY SPS
 
9
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 
10
 */
 
11
abstract class BaseagGeoFeatureFormFilter extends BaseFormFilterDoctrine
 
12
{
 
13
  public function setup()
 
14
  {
 
15
    $this->setWidgets(array(
 
16
      'geo_id'               => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('agGeo'), 'add_empty' => true)),
 
17
      'geo_coordinate_id'    => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('agGeoCoordinate'), 'add_empty' => true)),
 
18
      'geo_coordinate_order' => new sfWidgetFormFilterInput(array('with_empty' => false)),
 
19
      'created_at'           => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
 
20
      'updated_at'           => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
 
21
    ));
 
22
 
 
23
    $this->setValidators(array(
 
24
      'geo_id'               => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('agGeo'), 'column' => 'id')),
 
25
      'geo_coordinate_id'    => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('agGeoCoordinate'), 'column' => 'id')),
 
26
      'geo_coordinate_order' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
 
27
      'created_at'           => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
 
28
      'updated_at'           => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
 
29
    ));
 
30
 
 
31
    $this->widgetSchema->setNameFormat('ag_geo_feature_filters[%s]');
 
32
 
 
33
    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
 
34
 
 
35
    $this->setupInheritance();
 
36
 
 
37
    parent::setup();
 
38
  }
 
39
 
 
40
  public function getModelName()
 
41
  {
 
42
    return 'agGeoFeature';
 
43
  }
 
44
 
 
45
  public function getFields()
 
46
  {
 
47
    return array(
 
48
      'id'                   => 'Number',
 
49
      'geo_id'               => 'ForeignKey',
 
50
      'geo_coordinate_id'    => 'ForeignKey',
 
51
      'geo_coordinate_order' => 'Number',
 
52
      'created_at'           => 'Date',
 
53
      'updated_at'           => 'Date',
 
54
    );
 
55
  }
 
56
}