public function mapFieldsToObjects($fields, $id = 0)
 {
     $objects = array();
     $system = new Zend_Session_Namespace('System');
     $user = Zend_Auth::getInstance()->getIdentity();
     $pageform = new SxModule_Pageform();
     $pageform->setId((int) $id)->setName($this->_getParam('pf_name'))->setContent($this->_getParam('pf_content'))->setMailoption($this->_getParam('pf_mailoption'))->setMailto($this->_getParam('pf_mailto'))->setPages($this->_getParam('pages'))->setCaptcha($this->_getParam('pf_captcha') ? 1 : 0);
     $pageform_tsl = new SxModule_Pageform_Tsl();
     $pageform_tsl->setId($this->_getParam('pf_tsl_id'))->setLanguage($system->lng)->setPageformId((int) $id)->setName($this->_getParam('pf_name'))->setContent($this->_getParam('pf_content'))->setConfirm($this->_getParam('pf_confirm'))->setConfirmto($this->_getParam('pf_confirmto'))->setConfirmsubject($this->_getParam('pf_confirmsubject'))->setConfirmcontent($this->_getParam('pf_confirmcontent'))->setActive($this->_getParam('pf_active'));
     $pageform->setTsl($pageform_tsl);
     foreach ($fields as $field) {
         $object = new SxModule_Pageform_Field();
         $object->setId($field['id'])->setKey($this->toKey($field['name']))->setFieldType($field['type'])->setValidation($field['validation']);
         if (isset($field['option'])) {
             foreach ($field['option'] as $values) {
                 $meta = new SxModule_Pageform_Field_Meta();
                 $meta->setId($values['id']);
                 $meta_tsl = new SxModule_Pageform_Field_Meta_Tsl();
                 $meta_tsl->setLanguage($system->lng)->setId($values['tsl-id'])->setName($values['name'])->setValue($values['key']);
                 $meta->setTsl($meta_tsl);
                 $object->addMeta($meta);
             }
         }
         $object_tsl = new SxModule_Pageform_Field_Tsl();
         $object_tsl->setId($field['tsl-id'])->setName($field['name'])->setLanguage($system->lng);
         $object->setTsl($object_tsl);
         $pageform->addField($object);
     }
     return $pageform;
 }