topical media & game development
#mobile-ar-7-7.txt / txt
// Put fetched actions for each POI into an associative array.
The returned values are assigned to db ; The database connection handler.
//
// Returns:
// array ; An array of received actions for this POI.
//
function Getactions( db ) {
// A new table called “ACTION_Table” is created to store actions,
// each action has a field called
// “poiID” which shows the POI id that this action belongs to.
// The SQL statement returns actions which have the same poiID as the
// id of poi[‘id’]).
db->prepare( “ SELECT label,
uri,
autoTriggerRange,
autoTriggerOnly,
contentType,
method,
activityType,
params,
closeBiw,
showActivity,
activityMessage
FROM ACTION_Table
WHERE poiID = :id “ );
// Binds the named parameter markers “:id” to the specified
// parameter values “
sql_actions->bindParam( ‘:id’, sql_actions.
poi[“actions”] array.
actions = actions result */
// if
if ( empty( actions ) ) {
poi[“actions”] array.
foreach ( action ) {
// Assign each action to poi[“actions”][action;
// put ‘params’ into an array of strings
action[‘params’],’,’ ) ) {
action[‘params’] );
}//if
else if( strlen( paramsArray[0] = poi[“actions”][paramsArray;
// Change ‘activityType’ to Integer.
count][‘activityType’] =
ChangetoInt( count][‘activityType’] );
// Change the values of “closeBiw” into boolean value.
count][‘closeBiw’] =
ChangetoBool( count][‘closeBiw’] );
// Change the values of “showActivity” into boolean value.
count][‘showActivity’] =
ChangetoBool( count][‘showActivity’] );
// Change ‘autoTriggerRange’ to Integer, if the value is NULL,
// return NULL.
count][‘autoTriggerRange’] =
ChangetoInt( count][‘autoTriggerRange’] );
// Change the values of “autoTriggerOnly” into boolean value,
// if the value is NULL, return NULL.
count][‘autoTriggerOnly’] =
ChangetoBool( count][‘autoTriggerOnly’] );
poi[“actions”];
}//Getactions
//Convert a TinyInt value to a boolean value TRUE or FALSE
// Arguments:
// value_Tinyint ; The Tinyint value (0 or 1) of a key in the database.
// Returns:
// value_Bool ; The boolean value, return ‘TRUE’ when Tinyint is 1.
// Return ‘FALSE’ when Tinyint is 0.
//
function ChangetoBool( value_Tinyint == 1 )
value_Bool = FALSE;
return
(C) Æliens
04/09/2009
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.