// ENTER URL ENDING
$urlend = ".html";
// FIELD NAMES AND USER ATTRIBUTES
// enter them in form of [attr,fieldname] e.g. [firstname, vorname]
$data = [
["firma","Firma_Makler"],
["name","Name_Makler"],
["adresse","Anschrift_Makler"],
["postleitzahl","PLZ_Ort_Makler"],
["ort","PLZ_Ort_Makler"],
["email","Email_Makler"],
["gläubiger-identifikationsnummer","Glaeubiger_ID"],
["lastschrift-fälligkeit","Termin_der_Lastschrift"]
];
// ENTER SELECT KEYWORD
// e.g. 'servicegebühr' lists all field values where 'servicegebühr' is contained in the name
$selectKeyword = "servicegebühr";
$selectName = "select1";
echo "<!-- FillForm Script -->";
// %%%%%%%%%% INPUT FILL ALGORITHM %%%%%%%%%%%%%%
// get current url
$url = JUri::getInstance();
// filter for name in it
$suburl = explode("/",$url);
$temp = end($suburl);
$temp = explode("-",$temp);
$idtag = end($temp);
$id = str_replace($urlend,"",str_replace("id","",$idtag));
// if id isset, execute the following
if(!empty($id)){
// get user id and email with that name
$db =& JFactory::getDBO();
$query = $db->getQuery(true);
$query->select('name, email');
$query->from('#__users');
$query->where('id = '.$id);
$db->setQuery($query);
$result= $db->loadObjectList();
$uid = $id;
$uemail = $result[0]->email;
$name = $result[0]->name;
// get user profile from that id
$query = $db->getQuery(true);
$query->select('*');
$query->from('#__user_profiles');
$query->where('user_id = '.$uid.'');
$db->setQuery($query);
$result= $db->loadObjectList();
//print_r($result);
echo "<script type='text/javascript'>setTimeout(setValues,500); function setValues(){";
foreach($data as $touple){
$value = "";
if($touple[0] == "name"){
$value = $name;
}
elseif($touple[0] == "email"){
$value = $uemail;
}
else{
foreach($result as $info){
if($info->profile_key == "profile.".$touple[0]){
$value = $info->profile_value;
break;
}
}
}
// if value is still not set (because its not found in profile)
if($value == ""){
// search for it in the fields
// get user profile from that id
$query = $db->getQuery(true);
$query->select('id');
$query->from('#__fields');
$query->where('name = "'.$touple[0].'"');
$db->setQuery($query);
$result= $db->loadObjectList();
// if field is found
if(!empty($result[0]->id)){
$fieldID = $result[0]->id;
$query = $db->getQuery(true);
$query->select('value');
$query->from('#__fields_values');
$query->where('field_id = '.$fieldID.' AND item_id = '.$uid);
$db->setQuery($query);
$result= $db->loadObjectList();
if(!empty($result[0]->value)){
$value = $result[0]->value;
}
}
}
// if value has surrounding ", delete
$value = str_replace('"',"",$value);
// get the field, set its value
//if(is_numeric($value)){echo "document.getElementsByName('ff_nm_".$touple[1]."[]')[0].value = ".$value."; ";}
//else{
echo "document.getElementsByName('ff_nm_".$touple[1]."[]')[0].value = (document.getElementsByName('ff_nm_".$touple[1]."[]')[0].value.toString() + '".$value." ' );";
//}
}
echo "}</script>";
// %%%%%%%%%% SELECT FILLING ALGORITHM %%%%%%%%%%%%%%
$this->execPieceByName('ff_InitLib'); //Include BreezingForms Library
$query = $db->getQuery(true);
$query->select('id');
$query->from('#__fields');
$query->where('name LIKE "%'.$selectKeyword.'%"');
$db->setQuery($query);
$result= $db->loadObjectList();
foreach($result as $res){
$fieldIDs[] = $res->id;
}
$fieldIDs = implode(",",$fieldIDs);
// get field values (required: field ids like "id,id,id,id,id" )
$db->setQuery('Select value FROM #__fields_values WHERE field_id IN ('.$fieldIDs.') AND item_id = '.$uid);
$result = $db->loadColumn(); //load the result from the query
$test = "";
for ($i = 0; $i < count($result); $i++)
{
$test .= "0;".$result[$i].";".$result[$i]."\n";
}
function ff_setSelectList($name, $value)
{
global $ff_processor;
for ($r = 0; $r < $ff_processor->rowcount; $r++)
{
$row =& $ff_processor->rows[$r];
if ($row->name==$name)
$row->data2 = $value;
unset($row);
} // for
} // ff_setSelectList
ff_setSelectList($selectName, $test);
}
// %%%%%%%% DEFAULT BREEZINGFORMS STUFF %%%%%%%%%%%%%
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80")
{
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
}
else
{
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
$this->execPieceByName('ff_InitLib');
ff_setValue('page', $pageURL); // 'page' is the name of the hidden field
This works perfectly.
Now I want to add the user's logo at the end of the form (footer).
could you please send to me the backend link and access data by email ma@evolutio.hr I would to like see your FORM, and please write the name of the FORM