isBound()) { return null; } $result = ""; foreach($this->getFormFieldSchema() as $fieldname => $field) { if(isset($this['type'])) { if($this['type']->getValue() == 0 && ($fieldname == 'part' || $fieldname == 'description')) { continue; } elseif($this['type']->getValue() != 0 && $fieldname == 'cat_num') { continue; } } $result .= $this->widgetSchema[$fieldname]->getLabel().': '; if($fieldname == 'type') { $result .= $this->types[$this[$fieldname]->getValue()]."\n"; } elseif($fieldname == 'part') { $result .= $this->parts[$this[$fieldname]->getValue()]."\n"; } else { $result .= $this[$fieldname]->getValue()."\n"; } } return $result; } protected function addStarToRequiredFieldsLabel() { foreach($this->getFormFieldSchema() as $fieldname => $field) { if(isset($this->validatorSchema[$fieldname]) && $this->validatorSchema[$fieldname]->getOption('required') == true) { $this->widgetSchema[$fieldname]->setLabel($this->widgetSchema[$fieldname]->getLabel().' *'); } } } public function getName() { return "parts_request_form"; } public function getRecipientMail() { return sfConfig::get('app_email_from_email'); } public function addMailTelPostvalidator($mailName, $telName) { $this->mailFieldName = $mailName; $this->telFieldName = $telName; $this->validatorSchema->setPostValidator( new sfValidatorCallback(array('callback' => array($this, 'checkValues'))) ); } public function checkValues($validator, $values) { if(strlen($values[$this->mailFieldName]) == 0 && strlen($values[$this->telFieldName]) == 0) { $error = new sfValidatorError($validator, 'Vyplňte e-mail nebo telefon.'); throw new sfValidatorErrorSchema($validator, array('val' => $error)); } return true; } }