hi steve
for the delay in answering..
even the bullet proof $_GLOBALS method did not work...
the Error is still the same.
maybe it's too much triggering for this delegate class, there' is also an before save trigger in it.
-----------whole thing--------------
class tables_jos_events {
function getPermissions(&$record){
$app =& Dataface_Application::getInstance();
$query =& $app->getQuery();
if ( $query['-action'] == 'new'/* and (!$record || !$record->val('registrantid'))*/ ){
return Dataface_PermissionsTool::ALL();
} else {
$auth =& Dataface_AuthenticationTool::getInstance();
$user =& $auth->getLoggedInUser();
if ( $user and isAdmin($user->val('role'))){
return Dataface_PermissionsTool::ALL();
} else {
return Dataface_PermissionsTool::NO_ACCESS();
}
}
}
function block__before_new_record_form(){
echo <<
Trage Deine Laufsportveranstaltung in unsere Datenbank ein
FŸlle nach Mšglichkeit alle untenstehenden Felder aus
Falls Du bereits bestehende Laufveranstaltungen aktualisieren mšchtest, sende uns bitte eine e-mail mit den geŠnderten Daten.
END;
}
function block__custom_stylesheets(){
echo <<
END;
}
/**
* Trigger that is called before new records are inserted. We will use it to
* get latitude longitude values from the google maps api.
*/
function field__full_address(&$record){
return $record->strval('adresse_info').'+'.$record->strval('contact_info');
}
function beforeSave(&$record){
$auth =& Dataface_AuthenticationTool::getInstance();
$key='ABQIAAAAooZ_SZteboYmTOL4jxD62BSOvuGUx-vwd1f9BNBwMyfFwZh75RRNqIYghOSJherZZaxKd-Rvj_PH1Q';
$nonvalid_adr = $record->val('full_address');
$seach = array(" ", ".");
$replace = array("+", "+");
$valid_adr = str_replace($seach, $replace, $nonvalid_adr);
$url ="
http://maps.google.com/maps/geo?q=".urlencode($valid_adr)."&key=$key&output=csv";
$geo = file_get_contents($url,'r');
$geo_array = explode(',',$geo);
$lat = $geo_array[2];
$lng = $geo_array[3];
$record->setValue('content', 'lat='.$lat.'&lng='.$lng);
}
function afterInsert(&$record){
$_GLOBALS['inserted_record'] =& $record;
$inserted_record =& $record;
$id = $inserted_record->val('id');
echo $id;
}
/**
* Trigger that is called after new records are inserted. We will use it to
* forward to the correct page.
*/
function after_action_new(){
$app =& Dataface_Application::getInstance();
//global $inserted_record;
$_GLOBALS['inserted_record'];
$id = $_GLOBALS['inserted_record']->val('id');
$auth =& Dataface_AuthenticationTool::getInstance();
$user =& $auth->getLoggedInUser();
if ( !$user ){
// The user is not logged in so we forward to a success page.
header('Location: success.php?&-id=$id');
exit;
}
}
}
------------------------------------
greetings ..with sugar and fancy toppings
martin