Bienvenido, Invitado
Recordarme

TEMA:

Fill script user LOGO footer 2 meses 5 días antes #273493

  • Avatar de RonnyM Autor del tema
  • RonnyM
  • Fuera de línea
  • Junior Breezer
  • Junior Breezer
  • Mensajes: 63
  • Gracias recibidas: 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?

Por favor, Identificarse o Crear cuenta para unirse a la conversación.

Fill script user LOGO footer 2 meses 5 días antes #273494

  • Avatar de Mirec
  • Mirec
  • Fuera de línea
  • Ultimate Breezer
  • Ultimate Breezer
  • Mensajes: 2698
  • Karma: 2
  • Gracias recibidas: 145
Hi,

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

regards,
Mirko

Por favor, Identificarse o Crear cuenta para unirse a la conversación.

Fill script user LOGO footer 2 meses 5 días antes #273496

  • Avatar de Mirec
  • Mirec
  • Fuera de línea
  • Ultimate Breezer
  • Ultimate Breezer
  • Mensajes: 2698
  • Karma: 2
  • Gracias recibidas: 145
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

Por favor, Identificarse o Crear cuenta para unirse a la conversación.

Última Edición: Post by Mirec.

Fill script user LOGO footer 2 meses 5 días antes #273500

  • Avatar de RonnyM Autor del tema
  • RonnyM
  • Fuera de línea
  • Junior Breezer
  • Junior Breezer
  • Mensajes: 63
  • Gracias recibidas: 0
done :)

Por favor, Identificarse o Crear cuenta para unirse a la conversación.

Fill script user LOGO footer 2 meses 5 días antes #273502

  • Avatar de Mirec
  • Mirec
  • Fuera de línea
  • Ultimate Breezer
  • Ultimate Breezer
  • Mensajes: 2698
  • Karma: 2
  • Gracias recibidas: 145
HI,

oke, I reply to you over email! :)

regards,
Mirko

Por favor, Identificarse o Crear cuenta para unirse a la conversación.

Fill script user LOGO footer 2 meses 5 días antes #273506

  • Avatar de Mirec
  • Mirec
  • Fuera de línea
  • Ultimate Breezer
  • Ultimate Breezer
  • Mensajes: 2698
  • Karma: 2
  • Gracias recibidas: 145
Hi,

the topic is solved over email!


Regards,
Mirko

Por favor, Identificarse o Crear cuenta para unirse a la conversación.

  • Página:
  • 1
Moderadores: ForumSupport
Tiempo de carga de la página: 0.056 segundos