private function action($place, $userId, $customizeMode, $customizeRouts, $componentTemplate, $responderController = null) { $userCustomizeAllowed = (bool) $this->componentAdminService->findPlace($place)->editableByUser; if (!$userCustomizeAllowed && $customizeMode) { $this->redirect($customizeRouts['normal']); } $schemeList = $this->componentAdminService->findSchemeList(); $state = $this->componentAdminService->findCache($place); if (empty($state)) { $state = array(); $state['defaultComponents'] = $this->componentAdminService->findPlaceComponentList($place); $state['defaultPositions'] = $this->componentAdminService->findAllPositionList($place); $state['defaultSettings'] = $this->componentAdminService->findAllSettingList(); $state['defaultScheme'] = (array) $this->componentAdminService->findSchemeByPlace($place); $this->componentAdminService->saveCache($place, $state); } $defaultComponents = $state['defaultComponents']; $defaultPositions = $state['defaultPositions']; $defaultSettings = $state['defaultSettings']; $defaultScheme = $state['defaultScheme']; if ($userCustomizeAllowed) { $userCache = $this->componentEntityService->findEntityCache($place, $userId); if (empty($userCache)) { $userCache = array(); $userCache['userComponents'] = $this->componentEntityService->findPlaceComponentList($place, $userId); $userCache['userSettings'] = $this->componentEntityService->findAllSettingList($userId); $userCache['userPositions'] = $this->componentEntityService->findAllPositionList($place, $userId); $this->componentEntityService->saveEntityCache($place, $userId, $userCache); } $userComponents = $userCache['userComponents']; $userSettings = $userCache['userSettings']; $userPositions = $userCache['userPositions']; } else { $userComponents = array(); $userSettings = array(); $userPositions = array(); } if (empty($defaultScheme) && !empty($schemeList)) { $defaultScheme = reset($schemeList); } $componentPanel = new BASE_CMP_DragAndDropEntityPanel($place, $userId, $defaultComponents, $customizeMode, $componentTemplate, $responderController); $componentPanel->setAdditionalSettingList(array('entityId' => $userId, 'entity' => 'user')); if (!empty($customizeRouts)) { $componentPanel->allowCustomize($userCustomizeAllowed); $componentPanel->customizeControlCunfigure($customizeRouts['customize'], $customizeRouts['normal']); } $componentPanel->setSchemeList($schemeList); $componentPanel->setPositionList($defaultPositions); $componentPanel->setSettingList($defaultSettings); $componentPanel->setScheme($defaultScheme); /* * This feature was disabled for users * if ( !empty($userScheme) ) { $componentPanel->setEntityScheme($userScheme); } */ if (!empty($userComponents)) { $componentPanel->setEntityComponentList($userComponents); } if (!empty($userPositions)) { $componentPanel->setEntityPositionList($userPositions); } if (!empty($userSettings)) { $componentPanel->setEntitySettingList($userSettings); } $this->assign('componentPanel', $componentPanel->render()); }