new ezcInputFormDefinitionElement( ezcInputFormDefinitionElement::OPTIONAL, 'string' ), 'lastname' => new ezcInputFormDefinitionElement( ezcInputFormDefinitionElement::OPTIONAL, 'string' ), 'birthday' => new ezcInputFormDefinitionElement( ezcInputFormDefinitionElement::OPTIONAL, 'string' ), 'comment' => new ezcInputFormDefinitionElement( ezcInputFormDefinitionElement::OPTIONAL, 'string' ), ); $form = new ezcInputForm( INPUT_POST, $definition ); if ( $form->hasValidData( 'firstname' ) === true && $form->hasValidData( 'lastname' ) === true ) { $session = ezcPersistentSessionInstance::get(); $this->person = new ezcappContactPerson(); $this->person->firstname = $form->firstname; $this->person->lastname = $form->lastname; $session->save( $this->person ); $this->detail = new ezcappContactDetail(); $this->detail->birthday = trim( $form->birthday ) !== "" ? strtotime( $form->birthday ) : null; $this->detail->comment = $form->comment; $session->addRelatedObject( $this->person, $this->detail ); $session->save( $this->detail ); $this->template = "createsuccess"; } } public function getTemplate() { return $this->template; } } ?>