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


PHP SiteRepository::editSlug方法代码示例

本文整理汇总了PHP中Repositories\SiteRepository::editSlug方法的典型用法代码示例。如果您正苦于以下问题:PHP SiteRepository::editSlug方法的具体用法?PHP SiteRepository::editSlug怎么用?PHP SiteRepository::editSlug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Repositories\SiteRepository的用法示例。


在下文中一共展示了SiteRepository::editSlug方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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


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