function displayFieldsOnWebFormEdit($id) { $do_wf_user_field = new WebFormUserField(); $data_form_field = $do_wf_user_field->getFieldsByWebFormUser($id); $out = '<table> <tr style="field_form_line"> <td>' . _('Selected') . '</td><td>' . _('Label') . '</td><td>' . _('Size in characters') . '</td><!--<td>Required</td>--> </tr>'; while ($this->next()) { $data = $data_form_field; $checked = ""; foreach ($data as $data) { if ($this->name == $data["name"]) { $checked = "Checked"; $name = $data["name"]; $label = $data["label"]; $size = $data["size"]; } } if ($checked == "") { $name = $this->name; $label = $this->label; $size = $this->size; } $out .= '<tr style="field_form_line">'; $out .= '<td><input type="checkbox" name="field_selected[' . $name . ']" value="Yes" ' . $checked . '></td>'; $out .= '<td><input type="text" name="field_label[' . $name . ']" value="' . $label . '"></td>'; $out .= '<td><input type="text" name="field_size[' . $name . ']" value="' . $size . '"></td>'; //$out .= '<td><input type="checkbox" name="field_required['.$this->name.']" value="'.$this->required.'"></td>'; $out .= '</tr>'; } $out .= '</table>'; return $out; }
/** * saveWebForm() * this will check if contact exists with firname, lastname, name and email * If exist add to it, if doesn't exists create a new one. */ function posteventAddContact($fid, $fields, $nxturl, $uid, $tags) { //echo 'hh';die(); //$fields = $_REQUEST['fields']; //$fields = $event_controler->fields; $this->setLog("\n eventAddContact, creating new contact from form, using " . count($fields) . " fields. (" . date("Y/m/d H:i:s") . ")"); //$dropcode = $_POST['dropcode']; $do_contact = new Contact(); $do_contact->iduser = $uid; $do_contact->add(); $this->setLog("\n new contact:" . $do_contact->idcontact . " for user:"******"\n Processing field:" . $field_name . " with value:" . $field_value); $do_webform_fields = new WebFormUserField(); $do_webform_fields->query("SELECT wfu.name, wff.class as class_name, wff.variable, wff.variable_type, wfu.required \n\t\t FROM webformfields as wff, webformuserfield as wfu \n\t\t\t\t\t\t\t\t\t\t WHERE wff.name=wfu.name\n\t\t\t\t\t\t\t\t\t\t AND wfu.name = '" . $field_name . "'\n\t\t\t\t\t\t\t\t\t\t\t AND wfu.idwebformuser= "******"\n Field information class:" . $do_webform_fields->class_name . " Variable:" . $do_webform_fields->variable); $this->setLog("\n rows:" . $do_webform_fields->getNumRows()); if ($do_webform_fields->getNumRows() == 1) { if ($do_webform_fields->class_name == "Contact") { $this->setLog("\n Updating contact"); $do_contact->{$do_webform_fields->variable} = $field_value; $do_contact->update(); } else { $update = false; if (is_object(${'sub_' . $do_webform_fields->class_name})) { if (${'sub_' . $do_webform_fields->class_name}->getType() == $do_webform_fields->variable_type) { $update = true; } } if ($update) { $this->setLog("\n Updating class:" . $do_webform_fields->class_name); $obj = ${'sub_' . $do_webform_fields->class_name}; $obj->{$do_webform_fields->variable} = $field_value; $obj->update(); } else { $class_name = $do_webform_fields->class_name; ${'sub_' . $class_name} = new $class_name(); $obj = ${'sub_' . $class_name}; $obj->{$do_webform_fields->variable} = $field_value; if (method_exists($obj, "setType") && strlen($do_webform_fields->variable_type) > 0) { $obj->setType($do_webform_fields->variable_type); } $obj->idcontact = $do_contact->getPrimaryKeyValue(); $obj->add(); } } } } $contact_view = new ContactView(); $contact_view->setUser($uid); $contact_view->addFromContact($do_contact); $tags = explode(",", $tags); foreach ($tags as $tag) { $tag = trim($tag); $do_tag = new Tag(); $do_tag->addNew(); $do_tag->addTagAssociation($do_contact->getPrimaryKeyValue(), $tag, "contact", $fid); $contact_view->addTag($tag); } if (strlen($nexturl) > 0) { //$event_controler->setUrlNext($this->urlnext); header("location:{$nxturl}"); } else { //$event_controler->setUrlNext($GLOBALS['cfg_ofuz_site_http_base'].'web_form_thankyou.php'); $url = $GLOBALS['cfg_ofuz_site_http_base'] . 'web_form_thankyou.php'; header("location:{$url}"); } //$event_controler->addParam("do_contact", $do_contact); }