/** * Executes page lifecycles for a callback request * * If the page is requested is not a service request * - Execute the normal page lifecycles @see TPage::execute() * * If the page is requested in response to a AJAX request * (may be a Callback request) then * - OnInit event * - OnLoad event * - ** execute service ** * - OnUnload event * - ** flush server outputs ** * * If the page is requested in response to a valid Callback request, then * - OnInit event * - ** initialize the server request ** * - ** load post data from request ** * - load viewstate * - load post data * - OnLoad event * - load post data (for newly created components during Load event) * - ** raise callback event ** * - OnUnload event * - ** flush server outputs ** * * @see TPage::execute() */ public function execute() { //Callback life-cycle if ($this->service->isServiceRequest()) { if ($this->Application->getApplicationState() == TApplication::STATE_DEBUG) { //let the callback server handle errors and exceptions $server = $this->service->server(); set_error_handler(array($server, 'handleError')); set_exception_handler(array($server, 'handleException')); } $this->onPreInit(new TEventParameter()); $this->determinePostBackMode(); $this->onInitRecursive(new TEventParameter()); $this->service->register($this); //a valid callback request if ($this->isCallBack()) { $this->service->server()->initialize(); $this->service->loadCallBackPostData(); $state = $this->loadPageStateFromPersistenceMedium(); $this->loadViewState($state); $this->loadPostData(); $this->onLoadRecursive(new TEventParameter()); $this->loadPostData(); /** raise post back data changed or not? **/ //$this->raisePostDataChangedEvents(); //$this->handlePostBackEvent(); } else { $this->onLoadRecursive(new TEventParameter()); } $this->service->execute(); $this->onUnloadRecursive(new TEventParameter()); $this->service->server()->flush(); } else { //normal page execution cycle parent::execute(); } }
function execute() { if ($this->isServiceRequest()) { $this->onPreInit(new TEventParameter()); $this->determinePostBackMode(); $this->onInitRecursive(new TEventParameter()); $this->service->setPostDataKeys($this->postDataContainerIDs); if ($this->isCallBack()) { $this->service->loadCallBackPostData(); try { $state = $this->loadPageStateFromPersistenceMedium(); $this->loadViewState($state); $this->loadPostData(); $this->onLoadRecursive(new TEventParameter()); $this->loadPostData(); $this->raisePostDataChangedEvents(); $this->handlePostBackEvent(); } catch (Exception $e) { if ($this->Application->getApplicationState() == TApplication::STATE_DEBUG) { trigger_error($e->getMessage()); } } } else { $this->onLoadRecursive(new TEventParameter()); } $this->registerCallbackHandler($this, $this->getCallbackCandidateDescriptions()); $this->Application->getServiceManager()->execute(TService_Callback::service); $this->onUnloadRecursive(new TEventParameter()); } else { parent::execute(); } }