public static function decode($str) { if (extension_loaded('JSON')) { return json_decode($str); } else { $temp = new TJSON(); return $temp->decode($str); } }
/** * Raises the callback event. This method is required by {@link * ICallbackEventHandler} interface. If {@link getCausesValidation * CausesValidation} is true, it will invoke the page's {@link TPage:: * validate validate} method first. It will raise {@link onClick * OnClick} event first and then the {@link onCallback OnCallback} event. * This method is mainly used by framework and control developers. * @param TCallbackEventParameter the event parameter */ public function raiseCallbackEvent($param) { $json = new TJSON(); $paramObj = $json->decode($param->getCallbackParameter()); switch ($paramObj->eventType) { case "__BActiveGoogleMap_OnMoveEnd__": // raise the event $eventParam = new TCallbackEventParameter($this->getResponse(), $paramObj->clientSide); $this->onMoveEnd($eventParam); break; case "__BActiveGoogleMap_OnMarkerChanged__": // raise the event $eventParam = new TCallbackEventParameter($this->getResponse(), $paramObj->markerID); $this->onMarkerChanged($eventParam); break; case "__BActiveGoogleMap_OnMarkerDrag__": $eventParam = new TCallbackEventParameter($this->getResponse(), new BMarkerDragEventParameter($paramObj->markerID, $paramObj->clientSide, $paramObj->lat, $paramObj->lng)); $this->onMarkerDrag($eventParam); $eventParam = new TCallbackEventParameter($this->getResponse(), $paramObj->clientSide); $this->onMoveEnd($eventParam); break; case "__BActiveGoogleMap_OnClick__": $eventParam = new TCallbackEventParameter($this->getResponse(), new BMapClickEventParameter($paramObj->clientSide, $paramObj->lat, $paramObj->lng)); $this->onClick($eventParam); break; } }
/** * Gets the data collected during the callback request. It contains * all the inputs for controls that implements IPostBackEventHandler. * @return array callback data. */ public function getPostData() { if (isset($_POST['__data'])) { require_once dirname(__FILE__) . '/TJSON.php'; $json = new TJSON(); return $json->decode($_POST['__data']); } return array(); }
/** * Returns the requested method parameter data. * @return array parameter data. */ protected function getRequestArgs() { if (isset($_POST['__parameters'])) { require_once dirname(__FILE__) . '/TJSON.php'; $json = new TJSON(); return $json->decode($_POST['__parameters']); } return array(); }