TOPIC:

Fill script user LOGO footer 2 weeks 2 days ago #273493

  • RonnyM's Avatar Topic Author
  • RonnyM
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 62
  • Thanks: 0
Hi :)

I use the following fill script for my form:
// 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).


Link to page:

web-dokument.de/servicegebuehr-max-mustermann-585


For example, the URL for the logo is:

web-dokument.de/images/Logo/max-mustermann


It is located in the database in the user field "Logo".


How can I implement this?

Please Log in or Create an account to join the conversation.

Fill script user LOGO footer 2 weeks 2 days ago #273494

  • Mirec's Avatar
  • Mirec
  • Offline
  • Ultimate Breezer
  • Ultimate Breezer
  • Posts: 2486
  • Karma: 2
  • Thanks: 135
Hi,

hmm, I need deeply check your code and I will back to you

regards,
Mirko

Please Log in or Create an account to join the conversation.

Fill script user LOGO footer 2 weeks 2 days ago #273496

  • Mirec's Avatar
  • Mirec
  • Offline
  • Ultimate Breezer
  • Ultimate Breezer
  • Posts: 2486
  • Karma: 2
  • Thanks: 135
Hi,

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

If you have more questions, feel free to ask!

Regards,
Mirko

Please Log in or Create an account to join the conversation.

Last edit: Post by Mirec.

Fill script user LOGO footer 2 weeks 2 days ago #273500

  • RonnyM's Avatar Topic Author
  • RonnyM
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 62
  • Thanks: 0
done :)

Please Log in or Create an account to join the conversation.

Fill script user LOGO footer 2 weeks 2 days ago #273502

  • Mirec's Avatar
  • Mirec
  • Offline
  • Ultimate Breezer
  • Ultimate Breezer
  • Posts: 2486
  • Karma: 2
  • Thanks: 135
HI,

oke, I reply to you over email! :)

regards,
Mirko

Please Log in or Create an account to join the conversation.

Fill script user LOGO footer 2 weeks 2 days ago #273506

  • Mirec's Avatar
  • Mirec
  • Offline
  • Ultimate Breezer
  • Ultimate Breezer
  • Posts: 2486
  • Karma: 2
  • Thanks: 135
Hi,

the topic is solved over email!


Regards,
Mirko

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Moderators: ForumSupport
Time to create page: 0.051 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!