本文整理匯總了PHP中models\SiteModel::setPromptEmailsDaysInAdvance方法的典型用法代碼示例。如果您正苦於以下問題:PHP SiteModel::setPromptEmailsDaysInAdvance方法的具體用法?PHP SiteModel::setPromptEmailsDaysInAdvance怎麽用?PHP SiteModel::setPromptEmailsDaysInAdvance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類models\SiteModel
的用法示例。
在下文中一共展示了SiteModel::setPromptEmailsDaysInAdvance方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: 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->setPromptEmailsDaysInAdvance($app['config']->newSitePromptEmailsDaysInAdvance);
$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));
}
示例2: 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()));
}
示例3: testIsGroupRunningOutOfFutureEvents
function testIsGroupRunningOutOfFutureEvents()
{
\TimeSource::mock(2014, 1, 1, 1, 1, 1);
$user = new UserAccountModel();
$user->setEmail("test@jarofgreen.co.uk");
$user->setUsername("test");
$user->setPassword("password");
$userRepo = new UserAccountRepository();
$userRepo->create($user);
$site = new SiteModel();
$site->setTitle("Test");
$site->setSlug("test");
$site->setPromptEmailsDaysInAdvance(28);
$siteRepo = new SiteRepository();
$siteRepo->create($site, $user, array(), $this->getSiteQuotaUsedForTesting());
$group = new GroupModel();
$group->setTitle("test");
$group->setDescription("test test");
$group->setUrl("http://www.group.com");
$groupRepo = new GroupRepository();
$groupRepo->create($group, $site, $user);
$event = new EventModel();
$event->setSummary("test");
$event->setDescription("test test");
$event->setStartAt(getUTCDateTime(2014, 4, 1, 19, 0, 0, 'Europe/London'));
$event->setEndAt(getUTCDateTime(2014, 4, 1, 21, 0, 0, 'Europe/London'));
$eventRepository = new EventRepository();
$eventRepository->create($event, $site, $user, $group);
### TEST
\TimeSource::mock(2014, 2, 1, 1, 1, 1);
$this->assertEquals(0, $groupRepo->isGroupRunningOutOfFutureEvents($group, $site));
### TEST
\TimeSource::mock(2014, 2, 15, 1, 1, 1);
$this->assertEquals(0, $groupRepo->isGroupRunningOutOfFutureEvents($group, $site));
### TEST
\TimeSource::mock(2014, 3, 1, 1, 1, 1);
$this->assertEquals(0, $groupRepo->isGroupRunningOutOfFutureEvents($group, $site));
### TEST
\TimeSource::mock(2014, 3, 2, 1, 1, 1);
$this->assertEquals(0, $groupRepo->isGroupRunningOutOfFutureEvents($group, $site));
### TEST
\TimeSource::mock(2014, 3, 3, 1, 1, 1);
$this->assertEquals(0, $groupRepo->isGroupRunningOutOfFutureEvents($group, $site));
### TEST
\TimeSource::mock(2014, 3, 4, 1, 1, 1);
$this->assertEquals(0, $groupRepo->isGroupRunningOutOfFutureEvents($group, $site));
### TEST
\TimeSource::mock(2014, 3, 5, 1, 1, 1);
$this->assertEquals(1, $groupRepo->isGroupRunningOutOfFutureEvents($group, $site));
### TEST
\TimeSource::mock(2014, 3, 6, 1, 1, 1);
$this->assertEquals(1, $groupRepo->isGroupRunningOutOfFutureEvents($group, $site));
### TEST
\TimeSource::mock(2014, 3, 7, 1, 1, 1);
$this->assertEquals(1, $groupRepo->isGroupRunningOutOfFutureEvents($group, $site));
### TEST
\TimeSource::mock(2014, 3, 20, 1, 1, 1);
$this->assertEquals(1, $groupRepo->isGroupRunningOutOfFutureEvents($group, $site));
### TEST
\TimeSource::mock(2014, 4, 1, 1, 1, 1);
$this->assertEquals(1, $groupRepo->isGroupRunningOutOfFutureEvents($group, $site));
### TEST
\TimeSource::mock(2014, 4, 15, 1, 1, 1);
$this->assertEquals(2, $groupRepo->isGroupRunningOutOfFutureEvents($group, $site));
### TEST
\TimeSource::mock(2014, 5, 1, 1, 1, 1);
$this->assertEquals(2, $groupRepo->isGroupRunningOutOfFutureEvents($group, $site));
}
示例4: testPromptEmailsDaysInAdvance
/**
* @dataProvider providerPromptEmailsDaysInAdvance
*/
function testPromptEmailsDaysInAdvance($in, $out)
{
$site = new SiteModel();
$site->setPromptEmailsDaysInAdvance($in);
$this->assertEquals($out, $site->getPromptEmailsDaysInAdvance());
}
示例5: die
$slug = $argv[1];
$email = $argv[2];
if (!$slug || !$email) {
die("Slug and Email?\n\n");
}
if (!SiteModel::isSlugValid($slug, $CONFIG)) {
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->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);