本文整理匯總了PHP中models\SiteModel::setIsRequestAccessAllowed方法的典型用法代碼示例。如果您正苦於以下問題:PHP SiteModel::setIsRequestAccessAllowed方法的具體用法?PHP SiteModel::setIsRequestAccessAllowed怎麽用?PHP SiteModel::setIsRequestAccessAllowed使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類models\SiteModel
的用法示例。
在下文中一共展示了SiteModel::setIsRequestAccessAllowed方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: index
function index(Request $request, Application $app)
{
$form = $app['form.factory']->create(new NewSiteForm());
if ('POST' == $request->getMethod()) {
$form->bind($request);
$data = $form->getData();
$siteRepository = new SiteRepository();
$site = $siteRepository->loadBySlug($data['slug']);
if ($site) {
$form->addError(new FormError('That address is already taken'));
}
if ($form->isValid()) {
$userRepo = new UserAccountRepository();
$user = $userRepo->loadByEmail($data['email']);
if ($user) {
$data = $form->getData();
$site = new SiteModel();
$site->setSlug($data['slug']);
$site->setTitle($data['title']);
if ($data['read'] == 'public') {
$site->setIsListedInIndex(true);
$site->setIsWebRobotsAllowed(true);
} else {
$site->setIsListedInIndex(false);
$site->setIsWebRobotsAllowed(false);
}
if ($data['write'] == 'public') {
$site->setIsAllUsersEditors(true);
$site->setIsRequestAccessAllowed(false);
} else {
$site->setIsAllUsersEditors(false);
$site->setIsRequestAccessAllowed(true);
}
$site->setIsFeatureCuratedList($app['config']->newSiteHasFeatureCuratedList);
$site->setIsFeatureImporter($app['config']->newSiteHasFeatureImporter);
$site->setIsFeatureMap($app['config']->newSiteHasFeatureMap);
$site->setIsFeatureVirtualEvents($app['config']->newSiteHasFeatureVirtualEvents);
$site->setIsFeaturePhysicalEvents($app['config']->newSiteHasFeaturePhysicalEvents);
$site->setIsFeatureGroup($app['config']->newSiteHasFeatureGroup);
$site->setPromptEmailsDaysInAdvance($app['config']->newSitePromptEmailsDaysInAdvance);
$site->setIsFeatureTag($app['config']->newSiteHasFeatureTag);
$countryRepository = new CountryRepository();
$siteQuotaRepository = new SiteQuotaRepository();
$siteRepository->create($site, $user, array($countryRepository->loadByTwoCharCode("GB")), $siteQuotaRepository->loadByCode($app['config']->newSiteHasQuotaCode));
return $app->redirect("/sysadmin/site/" . $site->getId());
} else {
$app['flashmessages']->addError('Existing user not found!');
}
}
}
return $app['twig']->render('sysadmin/sitenew/index.html.twig', array('form' => $form->createView()));
}