spApplication
Inherits from spObject.
component: -
class: spApplication
The spApplication Object in PHsPeed serves as a central repository containing references to various components and functions within your application. It plays a pivotal role in the context of PHP app development within your project structure. To illustrate, upon creating a PHP application named "MaintainCustomers," PHsPeed will automatically generate the subsequent declaration:
class MaintainCustomers extends spApplication; |
Upon this declaration, an instance of the MaintainCustomers object is instantiated, employing the $app 'super' variable. This process is executed using the following code:
$app = new MaintainCustomers($config, $connectionstrings); |
It is important to note that the $app variable, once instantiated, remains consistently accessible throughout various events and segments of your application. This variable holds the capability to serve as a conduit for interacting with other components, methods, and properties integrated within your application.
By leveraging the $app variable, you can seamlessly navigate through the interconnected elements of your application. This allows you to effectively manage and manipulate diverse functionalities and features within your PHP application. The spApplication Object serves as a foundation for streamlining the communication and interaction between different components, ensuring a cohesive and organized development process.
Function |
Returns |
Description |
public function canRender($id) |
true if the component can be rendered, otherwise false |
PHsPeed keeps track of components that require to be rendered. It is maintained in the $this->norender[]. |
public function clearBreadCrumbs() |
none |
Clears teh breadcrumb array |
resetMessage |
none |
Clears the system popup message. |
showMessage |
none |
Shows a dialog on the form. This function can be used in ajax calls, but displaying will be prosponed until the form gets focus again. |
getMessage |
the saved message |
Used to retrieve the errormessage that was set during an ajax event. |
public function Redirect($theUrl, $origin='', $parms='', $initialformmode='' |
none |
This function will redirect the application to another PHsPeed application. It takes care of security tokens, encrypts parameters and can be used in ajax calls as well. $theUrl: the name of the PHP module to jump to. $origin: should be used to store the name of the calling application (so that the called application can return to the callee). $parms: parameters in the a=b&... pairs. Depending on your design $initialformmode: allows to call a Crud application and set it's default update state (init, add, edit, delete) |
public function RedirectOut($theUrl, $parms) |
none |
Redirects to an arbitrary URL, outside of PHsPeed |
public function getRedirect() |
none |
Gets the stored redirect, used to redirect after Ajax call |
public function findComponentByName($theCompName) |
reference to the object if found, otherwise NULL |
Searches the component list and returns the reference if found. |
public function login($uid, $pwd) |
true when logged in, false otherwise |
Calls the login routine of the application root |
public function logoff() |
none |
Calls the logoff routine of the application root |
Samples
The following sample redirect to 'shoppinglist' and set the form in 'add' mode (empty form for input, enabled buttons for commit and cancel).
$app->Redirect('shoppinglist.php', $app->name,'', 'Add'); |