Crypt field

A place for users and developers of the Xataface to discuss and receive support.

Postby siainmi » Tue Oct 09, 2007 1:59 am

Hi,
I have some field as name and surname crypted in database, and, if is set session var with password, I have to
decrypt it with mcrypt function.

where I can modify record view value for all result set?

I try to work on function block__before_result_list with
$app =& Dataface_Application::getInstance(); // reference to Dataface_Application object
$query =& $app->getQuery();
$records =& df_get_records_array($query['-table'], $query);
foreach ($records as $record)
{
$record->htmlValue ("Nome",$record->val("Nome")."criptato");
}

but don't work.

Thanks for help!!
siainmi
 
Posts: 30
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Tue Oct 09, 2007 9:00 am

Probably better to do this by way of the xxx__display() methods in the delegate class. This allows you to override how a value is displayed.

e.g.
Code: Select all
function Nome__display(&$record){
    return my_decryption_function($record->val('Nome'));
}
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby siainmi » Tue Oct 16, 2007 4:11 am

Hi now I have problems when edit fields,
Before edit I want that the fieds is decrypt and before update on databese is crypt,
there are a function like:
Nome__beforeEdit($records) and Nome__afterEdit($records)?

Thanks for all!!
siainmi
 
Posts: 30
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Tue Oct 16, 2007 4:23 pm

I believe your are probably looking for xxx__pushValue() and xxx__pullValue().
http://weblite.ca/dataface/documentation/how-to/how-to-define-custom-serialization-for-fields

-Steve
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 38 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved