本文整理匯總了PHP中models\SiteModel::setIsFeatureGroup方法的典型用法代碼示例。如果您正苦於以下問題:PHP SiteModel::setIsFeatureGroup方法的具體用法?PHP SiteModel::setIsFeatureGroup怎麽用?PHP SiteModel::setIsFeatureGroup使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類models\SiteModel
的用法示例。
在下文中一共展示了SiteModel::setIsFeatureGroup方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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()));
}
示例2: setFeaturesOnSite
/**
*
* @deprecated */
public function setFeaturesOnSite(SiteModel $siteModel)
{
if (isset($this->featuresAsTree['org.openacalendar']) && isset($this->featuresAsTree['org.openacalendar']['Map'])) {
$siteModel->setIsFeatureMap($this->featuresAsTree['org.openacalendar']['Map']->isOn());
}
if (isset($this->featuresAsTree['org.openacalendar']) && isset($this->featuresAsTree['org.openacalendar']['Group'])) {
$siteModel->setIsFeatureGroup($this->featuresAsTree['org.openacalendar']['Group']->isOn());
}
if (isset($this->featuresAsTree['org.openacalendar']) && isset($this->featuresAsTree['org.openacalendar']['Tag'])) {
$siteModel->setIsFeatureTag($this->featuresAsTree['org.openacalendar']['Tag']->isOn());
}
if (isset($this->featuresAsTree['org.openacalendar']) && isset($this->featuresAsTree['org.openacalendar']['Importer'])) {
$siteModel->setIsFeatureImporter($this->featuresAsTree['org.openacalendar']['Importer']->isOn());
}
if (isset($this->featuresAsTree['org.openacalendar']) && isset($this->featuresAsTree['org.openacalendar']['PhysicalEvents'])) {
$siteModel->setIsFeaturePhysicalEvents($this->featuresAsTree['org.openacalendar']['PhysicalEvents']->isOn());
}
if (isset($this->featuresAsTree['org.openacalendar']) && isset($this->featuresAsTree['org.openacalendar']['VirtualEvents'])) {
$siteModel->setIsFeatureVirtualEvents($this->featuresAsTree['org.openacalendar']['VirtualEvents']->isOn());
}
if (isset($this->featuresAsTree['org.openacalendar.curatedlists']) && isset($this->featuresAsTree['org.openacalendar.curatedlists']['CuratedList'])) {
$siteModel->setIsFeatureCuratedList($this->featuresAsTree['org.openacalendar.curatedlists']['CuratedList']->isOn());
}
}
示例3: create
function create(Request $request, Application $app)
{
$siteRepository = new SiteRepository();
$form = $app['form.factory']->create(new CreateForm());
if ('POST' == $request->getMethod()) {
$form->bind($request);
$data = $form->getData();
$site = $siteRepository->loadBySlug($data['slug']);
if ($site) {
$form->addError(new FormError('That address is already taken'));
}
if ($form->isValid()) {
$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') {
$isAllUsersEditors = true;
} else {
$isAllUsersEditors = false;
}
$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, $app['currentUser'], array($countryRepository->loadByTwoCharCode("GB")), $siteQuotaRepository->loadByCode($app['config']->newSiteHasQuotaCode), $isAllUsersEditors);
if ($app['config']->hasSSL) {
return $app->redirect("https://" . $site->getSlug() . "." . $app['config']->webSiteDomainSSL);
} else {
return $app->redirect("http://" . $site->getSlug() . "." . $app['config']->webSiteDomain);
}
}
}
$sites = array();
$repo = new SiteRepository();
if (isset($_COOKIE['sitesSeen'])) {
foreach (explode(",", $_COOKIE['sitesSeen']) as $siteID) {
if (intval($siteID) > 0) {
$site = $repo->loadById($siteID);
if ($site && !$site->getIsClosedBySysAdmin() && $site->getSlug() != $app['config']->siteSlugDemoSite) {
$sites[$site->getId()] = $site;
}
}
}
}
$srb = new SiteRepositoryBuilder();
$srb->setIsOpenBySysAdminsOnly(true);
$srb->setUserInterestedIn($app['currentUser']);
foreach ($srb->fetchAll() as $site) {
$sites[$site->getId()] = $site;
}
return $app['twig']->render('index/index/create.html.twig', array('form' => $form->createView(), 'sites' => $sites));
}
示例4: die
die("Slug is not valid!\n\n");
}
print "Slug: " . $slug . "\n";
print "Email: " . $email . "\n";
sleep(10);
print "Starting ...\n";
$userRepository = new UserAccountRepository();
$user = $userRepository->loadByUserNameOrEmail($email);
if (!$user) {
die("Can't load user!\n\n");
}
$site = new SiteModel();
$site->setSlug($slug);
$site->setTitle($slug);
$site->setIsListedInIndex(true);
$site->setIsWebRobotsAllowed(true);
$site->setIsFeatureCuratedList($CONFIG->newSiteHasFeatureCuratedList);
$site->setIsFeatureImporter($CONFIG->newSiteHasFeatureImporter);
$site->setIsFeatureMap($CONFIG->newSiteHasFeatureMap);
$site->setIsFeatureVirtualEvents($CONFIG->newSiteHasFeatureVirtualEvents);
$site->setIsFeaturePhysicalEvents($CONFIG->newSiteHasFeaturePhysicalEvents);
$site->setIsFeatureGroup($CONFIG->newSiteHasFeatureGroup);
$site->setPromptEmailsDaysInAdvance($CONFIG->newSitePromptEmailsDaysInAdvance);
$siteRepository = new SiteRepository();
$countryRepository = new CountryRepository();
$siteQuotaRepository = new SiteQuotaRepository();
$gb = $countryRepository->loadByTwoCharCode("GB");
if (!$gb) {
die("Can't load Country GB - have you loaded static data?\n\n");
}
$siteRepository->create($site, $user, array($gb), $siteQuotaRepository->loadByCode($CONFIG->newSiteHasQuotaCode), false);
示例5: loadLegacyFeaturesOnSite
/** @deprecated */
public function loadLegacyFeaturesOnSite(SiteModel $siteModel)
{
global $DB;
$stat = $DB->prepare("SELECT extension_id,feature_id,is_on FROM site_feature_information WHERE site_id=:site_id AND is_on = '1' ");
$stat->execute(array('site_id' => $siteModel->getId()));
while ($data = $stat->fetch()) {
if ($data['extension_id'] == 'org.openacalendar.curatedlists' && $data['feature_id'] == 'CuratedList') {
$siteModel->setIsFeatureCuratedList(true);
}
if ($data['extension_id'] == 'org.openacalendar' && $data['feature_id'] == 'Importer') {
$siteModel->setIsFeatureImporter(true);
}
if ($data['extension_id'] == 'org.openacalendar' && $data['feature_id'] == 'Map') {
$siteModel->setIsFeatureMap(true);
}
if ($data['extension_id'] == 'org.openacalendar' && $data['feature_id'] == 'VirtualEvents') {
$siteModel->setIsFeatureVirtualEvents(true);
}
if ($data['extension_id'] == 'org.openacalendar' && $data['feature_id'] == 'PhysicalEvents') {
$siteModel->setIsFeaturePhysicalEvents(true);
}
if ($data['extension_id'] == 'org.openacalendar' && $data['feature_id'] == 'Group') {
$siteModel->setIsFeatureGroup(true);
}
if ($data['extension_id'] == 'org.openacalendar' && $data['feature_id'] == 'Tag') {
$siteModel->setIsFeatureTag(true);
}
}
}