public function handle_request_abs()
 {
     $params = $this->getParameters();
     $action = $params[self::ACTION];
     if ($this->communityImageCount <= 0) {
         $this->setAttribute('isOk', 1);
         return 'Community_Gardener_PhotoCommitOk';
     }
     $applyHistory = Bll_Community_CommunityGardener::getBrokerUnfinishedApply($this->communityId, static::$intBrokerID);
     $history = array();
     if (!empty($applyHistory['applyData'])) {
         $history = json_decode($applyHistory['applyData'], true);
     }
     if ($action == 'save') {
         $image = array();
         foreach ($params as $key => $val) {
             $kName = explode('_', $key);
             if (isset($kName[1]) && in_array($kName[0], array('host', 'hash', 'content'))) {
                 if ($kName[0] == 'content') {
                     $val = Util_PublicMethods::cutStr($val, 50);
                 }
                 $image[$kName[1]][$kName[0]] = $val;
             } else {
                 continue;
             }
         }
         if ($image && count($image) >= $this->communityImageCount) {
             $history['images'] = array_values($image);
             Bll_Community_CommunityGardener::storeApplyCommunityCorrectData($this->communityId, static::$intBrokerID, $this->communityInfo['baseInfo']['cityId'], $history, Model_Community_GardenerApply::APPLY_STATUS_NOT_COMPLETE);
             if (Bll_Community_CommunityGardener::setCheckGardener($this->communityId, static::$intBrokerID)) {
                 $this->setAttribute('isOk', 1);
             } else {
                 $this->setAttribute('isOk', 2);
             }
         } else {
             $this->setAttribute('isOk', 2);
         }
         return 'Community_Gardener_PhotoCommitOk';
     }
     $hasCorrectPhoto = !empty($history['images']);
     $this->setAttribute('hasCorrectPhoto', $hasCorrectPhoto);
     $this->setAttribute('brokerId', static::$intBrokerID);
     return 'Community_Gardener_PhotoCommit';
 }
 public function handle_request_abs()
 {
     $visible = 0;
     $params = $this->getParameters();
     /** 如果地图已经锁定则直接跳转到 上传照片 */
     if ($this->isLockMap) {
         $this->redirect(Bll_Community_CommunityGardener::buildGardenerPhotoCommit($this->communityId, array(self::VERIFY => $this->verifyCode)));
     }
     $communityInfo = $this->getCommunityCorrectInfo($this->communityInfo);
     $applyHistory = Bll_Community_CommunityGardener::getBrokerUnfinishedApply($this->communityId, static::$intBrokerID);
     $history = array();
     if (!empty($applyHistory['applyData'])) {
         $history = json_decode($applyHistory['applyData'], true);
     }
     $MapInfo = $this->communityInfo['mapInfo'];
     /** 如果没有小区的地图坐标信息就用板块的坐标 */
     if (empty($MapInfo) || $MapInfo['lat'] == 0 || $MapInfo['lng'] == 0) {
         $visible = 1;
         $areaCode = $this->communityInfo['baseInfo']['areaCode'];
         $blockId = Bll_Community_CommunityGardener::getBrokerIdFromAreaCode($areaCode);
         $MapInfo = Bll_Community_CommunityGardener::getBlockMapInfo($blockId);
         if (empty($MapInfo) || $MapInfo['lat'] == 0 || $MapInfo['lng'] == 0) {
             $areaId = Bll_Community_CommunityGardener::getAreaIdFromAreaCode($areaCode);
             $MapInfo = Bll_Community_CommunityGardener::getBlockMapInfo($areaId);
             if (empty($MapInfo) || $MapInfo['lat'] == 0 || $MapInfo['lng'] == 0) {
                 $cityId = Bll_Community_CommunityGardener::getCityIdFromAreaCode($areaCode);
                 $MapInfo = Bll_Community_CommunityGardener::getBlockMapInfo($cityId);
             }
         }
     }
     $communityInfo['Lat'] = $MapInfo['lat'];
     $communityInfo['Lng'] = $MapInfo['lng'];
     $communityInfo['Zoom'] = $MapInfo['zoom'];
     /** 保存经纪人提交的小区地图信息 */
     $action = $this->getParameter(self::ACTION);
     if ($action == 'save') {
         $defaultLat = sprintf("%f", $communityInfo['Lat']);
         $defaultLng = sprintf("%f", $communityInfo['Lng']);
         /** 保存地图纠错信息,地图是可以不纠错的 */
         if (!empty($params[self::MODIFY_LAT]) || !empty($params[self::MODIFY_LNG])) {
             $modifyLat = $params[self::MODIFY_LAT];
             $modifyLng = $params[self::MODIFY_LNG];
             if ($defaultLat != $modifyLat || $defaultLng != $modifyLng) {
                 $history['map']['Lat'] = $modifyLat;
                 $history['map']['Lng'] = $modifyLng;
                 $history['map']['Zoom'] = $communityInfo['Zoom'] ? $communityInfo['Zoom'] : 16;
                 Bll_Community_CommunityGardener::storeApplyCommunityCorrectData($this->communityId, static::$intBrokerID, $this->communityInfo['baseInfo']['cityId'], $history);
             }
         }
         if ($this->communityImageCount <= 0) {
             if (Bll_Community_CommunityGardener::setCheckGardener($this->communityId, static::$intBrokerID)) {
                 $this->setAttribute('isOk', 1);
             } else {
                 $this->setAttribute('isOk', 2);
             }
             return 'Community_Gardener_PhotoCommitOk';
         }
         $this->redirect(Bll_Community_CommunityGardener::buildGardenerPhotoCommit($this->communityId, array(self::VERIFY => $this->verifyCode)));
     }
     $areaInfo = Bll_Community_CommunityGardener::getAreaInfo($this->communityInfo['baseInfo']['areaCode']);
     $hasCorrectMap = !empty($history['map']);
     $this->setAttribute('hasCorrectMap', $hasCorrectMap);
     $this->setAttribute('history', $history);
     $this->setAttribute('visible', $visible);
     $this->setAttribute('commInfo', $communityInfo);
     $this->setAttribute('brokerid', static::$intBrokerID);
     $this->setAttribute('areaInfo', $areaInfo);
     return 'Community_Gardener_CorrectMap';
 }
 public function handle_request_abs()
 {
     $action = $this->getParameter(static::ACTION);
     $this->setAttribute('show_searchbar', false);
     /** 小区可以纠错的信息 */
     $communityInfo = $this->getCommunityCorrectInfo($this->communityInfo);
     /**
      * 所有字段都锁定(除小区别名)的情况下,直接跳到下一步,第一步基础详情纠错不展示
      */
     if ($this->baseInfoIsLocked) {
         if ($this->isLockMap) {
             if ($this->communityImageCount <= 0) {
                 if (Bll_Community_CommunityGardener::setCheckGardener($this->communityId, static::$intBrokerID)) {
                     $this->setAttribute('isOk', 1);
                 } else {
                     $this->setAttribute('isOk', 2);
                 }
                 return 'Community_Gardener_PhotoCommitOk';
             }
             $this->redirect(Bll_Community_CommunityGardener::buildGardenerPhotoCommit($this->communityId, array(self::VERIFY => $this->verifyCode)));
         } else {
             $this->redirect(Bll_Community_CommunityGardener::buildGardenerCorrectMap($this->communityId, array(self::VERIFY => $this->verifyCode)));
         }
     }
     /** 获取 物业类型 */
     $typeList = Model_Community_UseType::getUseTypeByCityId($communityInfo['cityId']);
     /** 小区锁定字段信息 */
     $communityWikiLockInfo = Bll_Community_CommunityGardener::getCommunityWikiInfo($this->communityId);
     /** 经纪人未完成的记录 */
     $applyHistory = Bll_Community_CommunityGardener::getBrokerUnfinishedApply($this->communityId, static::$intBrokerID);
     if ($action == 'save') {
         //用于保存小区基本信息的纠错
         $a = $this->checkAndSaveCorrectData(static::$intBrokerID, $communityWikiLockInfo, $this->getParameters(), $typeList, $applyHistory['applyData']);
         // if ($a || !empty($applyHistory['applyData']) || $this->communityGardenerId == 0) {
         if ($a) {
             if ($this->isLockMap) {
                 if ($this->communityImageCount <= 0) {
                     if (Bll_Community_CommunityGardener::setCheckGardener($this->communityId, static::$intBrokerID)) {
                         $this->setAttribute('isOk', 1);
                     } else {
                         $this->setAttribute('isOk', 2);
                     }
                     return 'Community_Gardener_PhotoCommitOk';
                 }
                 $this->redirect(Bll_Community_CommunityGardener::buildGardenerPhotoCommit($this->communityId, array(self::VERIFY => $this->verifyCode)));
             } else {
                 $this->redirect(Bll_Community_CommunityGardener::buildGardenerCorrectMap($this->communityId, array(self::VERIFY => $this->verifyCode)));
             }
         } else {
             $this->redirect(Bll_Community_CommunityGardener::buildGardenerCorrectInfo($this->communityId, array(self::VERIFY => $this->verifyCode)));
         }
     }
     $hasCorrectInfo = false;
     if (!empty($applyHistory['applyData'])) {
         $applyData = json_decode($applyHistory['applyData'], true);
         unset($applyData['map'], $applyData['images']);
         $hasCorrectInfo = !empty($applyData);
     }
     $this->setAttribute('typeList', $typeList);
     $this->setAttribute('applyHistory', $applyHistory);
     $this->setAttribute('hasCorrectInfo', $hasCorrectInfo);
     $this->setAttribute('commInfo', $communityInfo);
     $this->setAttribute('infoLock', $communityWikiLockInfo);
     $this->setAttribute('brokerid', static::$intBrokerID);
     $this->setAttribute('existGardener', $this->communityGardenerId > 0);
     $this->setAttribute('fields', self::$fields);
     $this->setAttribute('facilities', self::$facilities);
     return 'Community_Gardener_CorrectInfo';
 }