- Timestamp:
- 10/09/08 14:39:31 (2 years ago)
- Files:
-
- trunk/lib/form/JobForm.class.php (modified) (2 diffs)
- trunk/lib/model/Job.php (modified) (7 diffs)
- trunk/lib/utils/SymfoniansTestBrowser.class.php (modified) (1 diff)
- trunk/lib/validator/sfValidatorSchemaLicence.class.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lib/form/JobForm.class.php
r75 r79 9 9 { 10 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 /** 11 33 * Form configuration 12 34 * … … 14 36 public function configure() 15 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)); 16 66 } 17 67 } trunk/lib/model/Job.php
r49 r79 4 4 * 5 5 * @package lib.model 6 */ 6 */ 7 7 class Job extends BaseJob 8 8 { 9 9 10 10 protected $place = null; 11 11 12 12 public function getCountryName() 13 13 { … … 18 18 } 19 19 } 20 20 21 21 public function getIsActive() 22 22 { 23 23 return !$this->getExpiresAt() or $this->getExpiresAt(null) > time(); 24 24 } 25 25 26 26 public function getPlace() 27 27 { … … 56 56 return $this->place; 57 57 } 58 58 59 59 public function getOwnerName() 60 60 { … … 72 72 } 73 73 } 74 74 75 75 public function save($con = null) 76 76 { … … 78 78 $modified = $this->isModified(); 79 79 $affectedRows = parent::save($con); 80 80 81 81 if ($this->getCompanyId() && !$this->getCompany()->getAllowContact()) 82 82 { 83 83 $this->getCompany()->setAllowContact(true); 84 84 $this->getCompany()->save(); 85 //sfContext::getInstance()->getLogger()->info(sprintf('Company "%s" has now email contact enabled',86 // $this->getCompany()->getName()));87 85 } 88 86 89 87 // Create "company created" event object 90 88 if ($modified) … … 116 114 $event->save(); 117 115 } 118 116 119 117 return $affectedRows; 120 118 } … … 125 123 'to' => JobPeer::SLUG); 126 124 127 sfPropelBehavior::add('Job', 128 array('sfPropelActAsSluggableBehavior' => 129 array('columns' => $columns_map, 130 'separator' => '-', 125 sfPropelBehavior::add('Job', 126 array('sfPropelActAsSluggableBehavior' => 127 array('columns' => $columns_map, 128 'separator' => '-', 131 129 'permanent' => true), 132 'sfPropelActAsLocalizableBehavior' => 130 'sfPropelActAsLocalizableBehavior' => 133 131 array('location_getter' => 'getPlace'))); 134 132 trunk/lib/utils/SymfoniansTestBrowser.class.php
r75 r79 157 157 { 158 158 self::$test->comment('Loading fixtures...'); 159 160 $t = new sfPropelLoadDataTask(self::$configuration->getEventDispatcher(), new sfAnsiColorFormatter()); 161 $t->run(array('application' => self::$configuration->getApplication())); 162 163 self::$test->comment('Fixtures loaded.'); 159 160 try 161 { 162 $t = new sfPropelLoadDataTask(self::$configuration->getEventDispatcher(), new sfAnsiColorFormatter()); 163 $t->run(array('application' => self::$configuration->getApplication())); 164 165 self::$test->comment('Fixtures loaded.'); 166 } 167 catch (PropelException $e) 168 { 169 self::$test->fail('Unable to load fixtures: '.$e->getMessage()); 170 } 164 171 } 165 172 trunk/lib/validator/sfValidatorSchemaLicence.class.php
r75 r79 13 13 protected function doClean($values) 14 14 { 15 //parent::doClean($values);16 17 $errorSchema = new sfValidatorErrorSchema($this);18 19 15 if ($values['is_opensource'] && 0 === strlen(trim($values['licence']))) 20 16 {
