public static function Run($strFormId, $strAlternateHtmlFile = null) { // Ensure strFormId is a class $objClass = new $strFormId(); $objClass->strFormId = $strFormId; $objClass->strTransition = MJaxTransition::NONE; // Ensure strFormId is a subclass of QForm if (!$objClass instanceof MJaxForm) { throw new QCallerException('Object is not a subclass of MJaxForm (note, it can NOT be a subclass of QFormBase): ' . $strFormId); } //Check to see if the form has posted data if (key_exists(MJaxFormPostData::MJaxForm__FormState, $_POST)) { //Tell the object and the application what the call type is $strPostDataState = $_POST[MJaxFormPostData::MJaxForm__FormState]; if ($strPostDataState) { // We might have a valid form state -- let's see by unserializing this object $objClass = MJaxForm::Unserialize($strPostDataState); } $objClass->ParsePostData(); $objClass->strCallType = QCallType::Ajax; QApplication::$RequestMode = QRequestMode::Ajax; } elseif (key_exists(MJaxFormPostData::ACTION, $_POST) && $_POST[MJaxFormPostData::ACTION] == MJaxFormAction::CHANGE_PAGE) { $objClass->strCallType = QCallType::Ajax; QApplication::$RequestMode = QRequestMode::Ajax; //Create a proxy for the main content panel $objClass->pxyMainWindow = new MJaxControlProxy($objClass, 'mainWindow_inner'); $objClass->Form_Create(); } else { $objClass->strCallType = QCallType::None; QApplication::$RequestMode = QRequestMode::Standard; //Create a proxy for the main content panel $objClass->pxyMainWindow = new MJaxControlProxy($objClass, 'mainWindow_inner'); $objClass->Form_Create(); } if (key_exists(MJaxFormPostData::ACTION, $_POST)) { self::$objForm = $objClass; self::$strCurrAction = $_POST[MJaxFormPostData::ACTION]; switch (self::$strCurrAction) { case MJaxFormAction::CONTROL_EVENT: $objClass->TriggerControlEvent($_POST[MJaxFormPostData::CONTROL_ID], $_POST[MJaxFormPostData::EVENT]); break; } } if (is_null($strAlternateHtmlFile)) { $objClass->strTemplate = MJaxForm::LocateTemplate($_SERVER[MLCServer::SCRIPT_FILENAME]); } else { $objClass->strTemplate = $strAlternateHtmlFile; } $objClass->Form_PreRender(); if ($objClass->strCallType == QCallType::Ajax) { $objClass->RenderAjax(); } else { $objClass->Render(); } $objClass->Form_Exit(); }