本文整理汇总了PHP中Repositories\SiteRepository::edit方法的典型用法代码示例。如果您正苦于以下问题:PHP SiteRepository::edit方法的具体用法?PHP SiteRepository::edit怎么用?PHP SiteRepository::edit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Repositories\SiteRepository
的用法示例。
在下文中一共展示了SiteRepository::edit方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testEventsVanish
function testEventsVanish()
{
## User, Site, Event
\TimeSource::mock(2014, 1, 1, 1, 2, 3);
$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");
$siteRepo = new SiteRepository();
$siteRepo->create($site, $user, array(), $this->getSiteQuotaUsedForTesting());
$event = new EventModel();
$event->setSummary("test");
$event->setDescription("test test");
$event->setStartAt(getUTCDateTime(2014, 5, 10, 19, 0, 0, 'Europe/London'));
$event->setEndAt(getUTCDateTime(2014, 5, 10, 21, 0, 0, 'Europe/London'));
$event->setUrl("http://www.info.com");
$event->setTicketUrl("http://www.tickets.com");
$eventRepository = new EventRepository();
$eventRepository->create($event, $site, $user);
## Event can be found
$erb = new EventRepositoryBuilder();
$erb->setIncludeEventsFromClosedSites(true);
$erb->fetchAll();
$this->assertEquals(1, count($erb->fetchAll()));
$erb = new EventRepositoryBuilder();
$erb->setIncludeEventsFromClosedSites(false);
$erb->fetchAll();
$this->assertEquals(1, count($erb->fetchAll()));
## Close Site
\TimeSource::mock(2014, 2, 1, 1, 2, 3);
$site->setIsClosedBySysAdmin(true);
$site->setClosedBySysAdminreason('Testing');
$siteRepo->edit($site, $user);
## Event can not be found
$erb = new EventRepositoryBuilder();
$erb->setIncludeEventsFromClosedSites(true);
$erb->fetchAll();
$this->assertEquals(1, count($erb->fetchAll()));
$erb = new EventRepositoryBuilder();
$erb->setIncludeEventsFromClosedSites(false);
$erb->fetchAll();
$this->assertEquals(0, count($erb->fetchAll()));
}
示例2: UserAccountModel
function test1()
{
$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");
$siteRepo = new SiteRepository();
\TimeSource::mock(2012, 1, 1, 1, 0, 0);
$siteRepo->create($site, $user, array(), $this->getSiteQuotaUsedForTesting());
$site->setTitle("TEST ME");
\TimeSource::mock(2012, 1, 1, 1, 0, 1);
$siteRepo->edit($site, $user);
$this->checkSiteInTest1($siteRepo->loadBySlug("test"));
}
示例3: show
function show($id, Request $request, Application $app)
{
$this->build($id, $request, $app);
$siteQuotaRepository = new SiteQuotaRepository();
$userRepository = new UserAccountRepository();
$form = $app['form.factory']->create(new ActionForm());
if ('POST' == $request->getMethod()) {
$form->bind($request);
if ($form->isValid()) {
$data = $form->getData();
$action = new ActionParser($data['action']);
$sr = new SiteRepository();
if ($action->getCommand() == 'close') {
$this->parameters['site']->setIsClosedBySysAdmin(true);
$this->parameters['site']->setClosedBySysAdminreason($action->getParam(0));
$sr->edit($this->parameters['site'], $app['currentUser']);
return $app->redirect('/sysadmin/site/' . $this->parameters['site']->getId());
} else {
if ($action->getCommand() == 'open') {
$this->parameters['site']->setIsClosedBySysAdmin(false);
$this->parameters['site']->setClosedBySysAdminreason(null);
$sr->edit($this->parameters['site'], $app['currentUser']);
return $app->redirect('/sysadmin/site/' . $this->parameters['site']->getId());
} else {
if ($action->getCommand() == 'webrobots') {
$this->parameters['site']->setIsWebRobotsAllowed($action->getParamBoolean(0));
$sr->edit($this->parameters['site'], $app['currentUser']);
return $app->redirect('/sysadmin/site/' . $this->parameters['site']->getId());
} else {
if ($action->getCommand() == 'featuremap') {
$this->parameters['site']->setIsFeatureMap($action->getParamBoolean(0));
$sr->edit($this->parameters['site'], $app['currentUser']);
return $app->redirect('/sysadmin/site/' . $this->parameters['site']->getId());
} else {
if ($action->getCommand() == 'featuregroup') {
$this->parameters['site']->setIsFeatureGroup($action->getParamBoolean(0));
$sr->edit($this->parameters['site'], $app['currentUser']);
return $app->redirect('/sysadmin/site/' . $this->parameters['site']->getId());
} else {
if ($action->getCommand() == 'featureimporter') {
$this->parameters['site']->setIsFeatureImporter($action->getParamBoolean(0));
$sr->edit($this->parameters['site'], $app['currentUser']);
return $app->redirect('/sysadmin/site/' . $this->parameters['site']->getId());
} else {
if ($action->getCommand() == 'featurecuratedlist') {
$this->parameters['site']->setIsFeatureCuratedList($action->getParamBoolean(0));
$sr->edit($this->parameters['site'], $app['currentUser']);
return $app->redirect('/site/' . $this->parameters['site']->getId());
} else {
if ($action->getCommand() == 'featurephysicalevents') {
$this->parameters['site']->setIsFeaturePhysicalEvents($action->getParamBoolean(0));
$sr->edit($this->parameters['site'], $app['currentUser']);
return $app->redirect('/sysadmin/site/' . $this->parameters['site']->getId());
} else {
if ($action->getCommand() == 'featurevirtualevents') {
$this->parameters['site']->setIsFeatureVirtualEvents($action->getParamBoolean(0));
$sr->edit($this->parameters['site'], $app['currentUser']);
return $app->redirect('/sysadmin/site/' . $this->parameters['site']->getId());
} else {
if ($action->getCommand() == 'listedinindex') {
$this->parameters['site']->setIsListedInIndex($action->getParamBoolean(0));
$sr->edit($this->parameters['site'], $app['currentUser']);
return $app->redirect('/sysadmin/site/' . $this->parameters['site']->getId());
} else {
if ($action->getCommand() == 'quota') {
$sitequota = $siteQuotaRepository->loadByCode($action->getParam(0));
if ($sitequota) {
$this->parameters['site']->setSiteQuotaId($sitequota->getId());
$sr->editQuota($this->parameters['site'], $app['currentUser']);
return $app->redirect('/sysadmin/site/' . $this->parameters['site']->getId());
}
} else {
if ($action->getCommand() == 'newslug') {
$newslug = $action->getParam(0);
if (ctype_alnum($newslug) && strlen($newslug) > 1) {
$this->parameters['site']->setSlug($newslug);
$sr->editSlug($this->parameters['site'], $app['currentUser']);
return $app->redirect('/sysadmin/site/' . $this->parameters['site']->getId());
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
$this->parameters['form'] = $form->createView();
$this->parameters['sitequota'] = $this->parameters['site']->getSiteQuotaId() ? $siteQuotaRepository->loadById($this->parameters['site']->getSiteQuotaId()) : null;
return $app['twig']->render('sysadmin/site/show.html.twig', $this->parameters);
}
示例4: visibility
function visibility(Request $request, Application $app)
{
$form = $app['form.factory']->create(new AdminVisibilityPublicForm($app['config']), $app['currentSite']);
if ('POST' == $request->getMethod()) {
$form->bind($request);
if ($form->isValid()) {
$siteRepository = new SiteRepository();
$siteRepository->edit($app['currentSite'], $app['currentUser']);
return $app->redirect("/admin/");
}
}
return $app['twig']->render('site/admin/visibilityPublic.html.twig', array('form' => $form->createView()));
}