当前位置: 首页>>代码示例>>PHP>>正文


PHP SiteRepository::edit方法代码示例

本文整理汇总了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()));
 }
开发者ID:radical-assembly,项目名称:OpenACalendar-Web-Core,代码行数:48,代码来源:SiteCloseTest.php

示例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"));
 }
开发者ID:radical-assembly,项目名称:OpenACalendar-Web-Core,代码行数:19,代码来源:SiteEditTest.php

示例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);
 }
开发者ID:schlos,项目名称:MeetYourNextMP-Web-Core,代码行数:97,代码来源:SiteController.php

示例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()));
 }
开发者ID:radical-assembly,项目名称:OpenACalendar-Web-Core,代码行数:13,代码来源:AdminController.php


注:本文中的Repositories\SiteRepository::edit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。