root/trunk/lib/form/JobForm.class.php

Revision 79, 1.5 kB (checked in by nperriault, 1 month ago)

[1.1] Updated functional tests, migrated Job form

Line 
1 <?php
2 /**
3  * Job form.
4  *
5  * @package    form
6  * @subpackage jobs
7  */
8 class JobForm extends BaseJobForm
9 {
10   /**
11    * @var array of Company
12    */
13   protected $userCompanies = array();
14
15   /**
16    * Constructor
17    *
18    * @param Job $job
19    * @param array $userCompanies
20    */
21   public function __construct(Job $job, $options = array(), $CSRFSecret = null)
22   {
23     if (isset($options['userCompanies']))
24     {
25       $this->userCompanies = $options['userCompanies'];
26       unset($options['userCompanies']);
27     }
28
29     parent::__construct($job, $options, $CSRFSecret);
30   }
31
32   /**
33    * Form configuration
34    *
35    */
36   public function configure()
37   {
38     // Unset unused widgets
39     unset($this['created_at'],
40           $this['updated_at'],
41           $this['contact_id'],
42           $this['slug']);
43
44     $this->initWidgets();
45     $this->initValidators();
46   }
47
48   /**
49    * Intitialize widgets
50    *
51    */
52   public function initWidgets()
53   {
54     $this->widgetSchema['country']    = new ExtendedWidgetFormI18nSelectCountry(array('culture' => $this->culture, 'add_label_option' => __('Select a country')));
55     $this->widgetSchema['expires_at'] = new sfWidgetFormI18nDate(array('culture' => $this->culture));
56   }
57
58   /**
59    * Initialize validators
60    *
61    */
62   public function initValidators()
63   {
64     $this->validatorSchema['country']    = new sfValidatorI18nChoiceCountry(array('culture' => $this->culture, 'required' => false));
65     $this->validatorSchema['expires_at'] = new sfValidatorDate(array('required' => false));
66   }
67 }
68
Note: See TracBrowser for help on using the browser.