The WFRPC class encapsulates a remote procedure call from the client/UI layer.
This is the lowest-level of RPC data and is only related to the remote call.
Higher level classes like WFAction are used by widgets to coordinate RPC calls.
WFRPC is used mainly by WFAction or low-level programming on the client side that needs lower-level AJAX access, or needs to make an RPC outside of the event model.
Often custom ajax widgets like YUI TreeView or YUI Autocomplete will need to make calls to the server outside of the event model, and will use WFRPC (or the JS WFRPC) to do that.
Since the WFRPC mechanism is inherently PHOCOA-specific, it assumes all AJAX callbacks are done on the current module/page and provides wiring to integrate AJAX as cleanly as possible with the standard PHOCOA page life cycle. If you don't want this tight coupling, you can always just roll your own AJAX stuff for specific instances. You can even use WFAction::JSAction() to bootstrap this.
WFRPC API: All WFRPC calls made from JS will ultimately call a php function with the following prototype:
(object WFActionResponse) ajaxCallback($page, $params, [$userArg1, $userArg2, ... $userArgN]);
Since the prototype is effectively the same as the standard PHOCOA page action callback, you can use the same function for both circumstances.
Note that you can detect whether or not you're in an ajax callback via WFRequestController::sharedRequestController()->isAjax() call.
Has fluent interface for configuration.
Located in /framework/WFRPC.php (line 34)
WFObject | --WFRPC
Convenience constructor function, suitable for fluent configuration: WFRPC::WFRPC()->setForm('myForm') etc.
Detects from the HTTP request whether or not there is an RPC request for the passed invocationPath.
NOTE: Will only return the RPC if the RPC in the parameters is for the passed invocation path. This allows PHOCOA to distinguish if an AJAX request is intended for the current module. Otherwise composited modules would all try to respond.
Execute the RPC. This function is called by the PHOCOA infrastructure to "execute" the RPC request in the PHOCOA infrastructure.
If the target/action method returns a WFActionResponse object, the response will be sent and execution will stop. If the target/action method returns NULL, execution will fall through to the caller.
Are we in AJAX mode?
Get an array of all form parameters that need to be submitted to effect the RPC on the server when submitted.
Will include the php session id in the url params since often this is used by 3rd party clients like flash,java that don't have access to cookies.
Set the action for the rpc. See WFRPC::$action.
Set the arguments to pass along with the RPC.
Set the form associated with the RPC. RPC's with forms will submit to the PHOCOA form-processing infrastructure.
Tell the RPC to use either AJAX mode or simply perform a page refresh to implement the action.
Control whether the RPC will run the action method if the validation fails.
Set the target for the rpc. See WFRPC::$target.
Inherited From WFObject
WFObject::__construct()
WFObject::exposedProperties()
WFObject::getClass()
WFObject::keyPathToTargetAndKey()
WFObject::setValueForKey()
WFObject::setValueForKeyPath()
WFObject::validateValueForKey()
WFObject::validateValueForKeyPath()
WFObject::valueForKey()
WFObject::valueForKeyPath()
WFObject::valueForUndefinedKey()
WFObject::__toString()
PARAM_ACTION
= '__phocoa_rpc_action'
(line 43)
PARAM_ARGC
= '__phocoa_rpc_argc'
(line 46)
PARAM_ARGV_PREFIX
= '__phocoa_rpc_argv_'
(line 47)
PARAM_ENABLE
= '__phocoa_rpc_enable'
(line 40)
PARAM_INVOCATION_PATH
= '__phocoa_rpc_invocationPath'
(line 41)
PARAM_RUNS_IF_VALID
= '__phocoa_rpc_runsIfInvalid'
(line 44)
PARAM_TARGET
= '__phocoa_rpc_target'
(line 42)
TARGET_MODULE
= '#module#'
(line 37)
TARGET_PAGE
= '#page#'
(line 36)
Documentation generated on Thu, 17 Apr 2008 13:52:07 -0400 by phpDocumentor 1.4.1