private static function getAjaxResponse($model)
 {
     $res = new FrameworkResponse();
     $res->setStatus(FrameworkResponse::$STATUS__CHANGE_MODULE);
     $moduleClass = $model->getModuleClassName() . "_Model";
     if ($model->getCurrentState() == $moduleClass::$STATE__REGISTER_VIEW) {
         $res->setStatus(FrameworkResponse::$STATUS__READY);
         $json = array("moduleAction" => "afterRegisterView", "moduleActionParam" => $model->getSweepstakeUserData());
         $res->setJson($json);
     } else {
         if ($model->getCurrentState() == $moduleClass::$STATE__REGISTER_ENTER) {
             $res->setStatus(FrameworkResponse::$STATUS__READY);
             $json = array("moduleAction" => "afterRegisterEnter", "moduleActionParam" => $model->getSweepstakeUserData());
             $res->setJson($json);
         } else {
             if ($model->getCurrentState() == $moduleClass::$STATE__REGISTER_EMAIL || $model->getCurrentState() == $moduleClass::$STATE__REGISTER_FACEBOOK_INVITE) {
                 $res->setStatus(FrameworkResponse::$STATUS__READY);
                 $json = array("moduleAction" => "emptyResponse", "moduleActionParam" => "");
                 $res->setJson($json);
             } else {
                 if ($model->getCurrentState() == $moduleClass::$STATE__REGISTER_TWITTER_PUBLISH || $model->getCurrentState() == $moduleClass::$STATE__REGISTER_FACEBOOK_PUBLISH) {
                     $res->setStatus(FrameworkResponse::$STATUS__READY);
                     $json = array("moduleAction" => "appPoint", "moduleActionParam" => $model->getAddPoint());
                     $res->setJson($json);
                 }
             }
         }
     }
     return $res;
 }
 private static function getAjaxResponse($model)
 {
     $res = new FrameworkResponse();
     $res->setStatus(FrameworkResponse::$STATUS__READY);
     $res->setJson(array());
     return $res;
 }
 private static function getAjaxResponse($model)
 {
     $parentResponse = parent::getBasicAjaxResponse($model);
     if (!is_null($parentResponse)) {
         return $parentResponse;
     }
     $res = new FrameworkResponse();
     $res->setStatus(FrameworkResponse::$STATUS__CHANGE_MODULE);
     if ($model->getCurrentState() == FrameModEditSweepstake_Model::$STATE__FINISH_CREATION_SAVE || $model->getCurrentState() == FrameModEditSweepstake_Model::$STATE__FINISH_EDIT_SAVE) {
         $res->setStatus(FrameworkResponse::$STATUS__READY);
         $json = array("moduleAction" => "sweepstakeSaveSuccess", "moduleActionParam" => "");
         $res->setJson($json);
     }
     return $res;
 }
 private static function getAjaxResponse($model)
 {
     $parentResponse = parent::getBasicAjaxResponse($model);
     if (!is_null($parentResponse)) {
         return $parentResponse;
     }
     $res = new FrameworkResponse();
     $res->setStatus(FrameworkResponse::$STATUS__CHANGE_MODULE);
     if ($model->getCurrentState() == FrameModEntriesList_Model::$STATE__SHOW_LIST) {
         $res->setStatus(FrameworkResponse::$STATUS__READY);
         $json = array("moduleAction" => "refershList", "moduleActionParam" => $model->getListData());
         $res->setJson($json);
     }
     return $res;
 }
 private static function getAjaxResponse($model)
 {
     $parentResponse = parent::getBasicAjaxResponse($model);
     if (!is_null($parentResponse)) {
         return $parentResponse;
     }
     $res = new FrameworkResponse();
     $res->setStatus(FrameworkResponse::$STATUS__CHANGE_MODULE);
     $moduleClass = $model->getModuleClassName() . "_Model";
     if ($model->getCurrentState() == $moduleClass::$STATE__FINISH_SAVE) {
         $res->setStatus(FrameworkResponse::$STATUS__READY);
         $json = array("moduleAction" => "saveSuccess", "moduleActionParam" => "");
         $res->setJson($json);
     }
     return $res;
 }
 protected static function getBasicAjaxResponse($model)
 {
     $res = new FrameworkResponse();
     if ($model->isErrorState()) {
         $res->setStatus(FrameworkResponse::$STATUS__READY);
         $json = array("moduleAction" => $model->getModuleId() . "__" . $model->getActionName() . "__ERROR", "moduleActionParam" => $model->getErrorMessage());
         $res->setJson($json);
         return $res;
     } else {
         if ($model->isNotPermittedState()) {
             $res->setStatus(FrameworkResponse::$STATUS__READY);
             $json = array("moduleAction" => $model->getModuleId() . "__" . $model->getActionName() . "__NO_PERMISSION", "moduleActionParam" => "You are not permitted to do this action");
             $res->setJson($json);
             return $res;
         }
     }
     return null;
 }
 private static function getAjaxResponse($model)
 {
     $parentResponse = parent::getBasicAjaxResponse($model);
     if (!is_null($parentResponse)) {
         return $parentResponse;
     }
     $res = new FrameworkResponse();
     $res->setStatus(FrameworkResponse::$STATUS__CHANGE_MODULE);
     if ($model->getCurrentState() == FrameModSweepstakeList_Model::$STATE__SHOW_LIST) {
         $res->setStatus(FrameworkResponse::$STATUS__READY);
         $json = array("moduleId" => $model->getModuleId(), "moduleAction" => "refershList", "moduleActionParam" => $model->getListData());
         $res->setJson($json);
     } else {
         if ($model->getCurrentState() == FrameModSweepstakeList_Model::$STATE__SHOW_ACTIVITY) {
             $res->setStatus(FrameworkResponse::$STATUS__READY);
             $json = array("moduleId" => $model->getModuleId(), "moduleAction" => "drawSweepstakeActivity", "moduleActionParam" => array("id" => $model->getSweepstakeId(), "data" => $model->getSweepstakeActivity()));
             $res->setJson($json);
         }
     }
     return $res;
 }
 private static function getAjaxResponse($model)
 {
     $parentResponse = parent::getBasicAjaxResponse($model);
     if (!is_null($parentResponse)) {
         return $parentResponse;
     }
     $res = new FrameworkResponse();
     $res->setStatus(FrameworkResponse::$STATUS__CHANGE_MODULE);
     $moduleClass = $model->getModuleClassName() . "_Model";
     if ($model->getCurrentState() == $moduleClass::$STATE__SHOW_LIST) {
         $res->setStatus(FrameworkResponse::$STATUS__READY);
         $json = array("moduleAction" => "winnersList", "moduleActionParam" => $model->getListData());
         $res->setJson($json);
     } else {
         if ($model->getCurrentState() == $moduleClass::$STATE__EMAIL_SENT) {
             $res->setStatus(FrameworkResponse::$STATUS__READY);
             $json = array("moduleAction" => "emailSent", "moduleActionParam" => "");
             $res->setJson($json);
         }
     }
     return $res;
 }
 private static function getAjaxResponse($model)
 {
     $parentResponse = parent::getBasicAjaxResponse($model);
     if (!is_null($parentResponse)) {
         return $parentResponse;
     }
     $res = new FrameworkResponse();
     $res->setStatus(FrameworkResponse::$STATUS__CHANGE_MODULE);
     $moduleClass = $model->getModuleClassName() . "_Model";
     if ($model->getCurrentState() == $moduleClass::$STATE__ACTIVE) {
         $res->setStatus(FrameworkResponse::$STATUS__READY);
         $json = array("moduleAction" => "activeSweepstake", "moduleActionParam" => "");
         $res->setJson($json);
     } else {
         if ($model->getCurrentState() == $moduleClass::$STATE__PASSIVE) {
             $res->setStatus(FrameworkResponse::$STATUS__READY);
             $json = array("moduleAction" => "passiveSweepstake", "moduleActionParam" => "");
             $res->setJson($json);
         }
     }
     return $res;
 }
 public function getView($userRequest)
 {
     $userResponse = new FrameworkResponse();
     if (GlobalHelper::isRequestAjax()) {
         // json result for ajax call
         $json = array();
         $userRequest->setTemplatePlace("main");
         $placeResponse = FrameworkModuleManager::getModuleViewForTemplateArea(clone $userRequest);
         // if modules are more than one, then view separater is FrameworkModuleManager::$destMod_ModSeparator
         if ($placeResponse->getStatus() == FrameworkResponse::$STATUS__READY) {
             $json[] = $placeResponse->getJson();
         } else {
             //ete modulneric inch vor mek@ asuma sax normal chi orinak problem ka kam STATUS__CHANGE_TEMPLATE, miangamic @ndhatum enq u et veradarznum enq verev
             return $placeResponse;
         }
         $userResponse->setStatus(FrameworkResponse::$STATUS__READY);
         $userResponse->setHtml(json_encode($json));
     } else {
         //mixed html, script, import response for simple request
         $import = "";
         $script = "";
         $html = "<div align='center'>";
         $userRequest->setTemplatePlace("main");
         $placeResponse = FrameworkModuleManager::getModuleViewForTemplateArea(clone $userRequest);
         if ($placeResponse->getStatus() == FrameworkResponse::$STATUS__READY) {
             $html .= $placeResponse->getHtml();
             $import .= $placeResponse->getImport();
             $script .= $placeResponse->getScript();
         } else {
             //ete modulneric inch vor mek@ asuma sax normal chi orinak problem ka kam STATUS__CHANGE_TEMPLATE, miangamic @ndhatum enq u et veradarznum enq verev
             return $placeResponse;
         }
         $html .= "</div>";
         $userResponseView = "<html><head>" . $import . "<script>var _CURRENT_TEMPLATE_ID = '" . self::getTemplateId() . "';</script></head><body style='padding: 0px; margin: 0px;'>" . $html . "<script>" . $script . "</script></body></html>";
         $userResponse->setStatus(FrameworkResponse::$STATUS__READY);
         $userResponse->setHtml($userResponseView);
     }
     return $userResponse;
 }