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


PHP content::setContentType方法代码示例

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


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

示例1: submitAction

 /**
  * @param Request $request
  * @param Request $securekey
  * @param Request $redirect
  * @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
  */
 public function submitAction(Request $request, $securekey, $redirect)
 {
     $locale = $request->getLocale();
     $mode = "module-submission";
     $em = $this->getDoctrine()->getManager();
     $cs = $this->get('ssone.cms.content');
     $fieldsRepository = $this->getFieldsRepository();
     $blockService = $this->get('ssone.cms.block');
     $contentType = $this->getDoctrine()->getRepository('SSoneCMSBundle:ContentType')->findBySecurekey($securekey);
     $content = new content();
     $content->setContentType($contentType);
     $blockService->contentBlockManager($content);
     $form = $this->createForm(new ContentTYPE($mode, $fieldsRepository, $cs, $locale), $content);
     $form->handleRequest($request);
     print $contentType->getName();
     print $form->isValid();
     if ($form->isValid()) {
         $auditor = $this->get('ssone.cms.recordauditor');
         $auditor->auditRecord($content);
         //Audit blocks and fields
         foreach ($content->getBlocks() as $block) {
             $auditor->auditRecord($block);
             foreach ($block->getBlockFields() as $blockField) {
                 $auditor->auditRecord($blockField);
             }
         }
         //handle file uploads
         $uploader = $this->get('ssone.cms.fileuploader');
         foreach ($form['blocks'] as $block) {
             foreach ($block['blockFields'] as $blockField) {
                 foreach ($blockField['fieldContent'] as $input) {
                     if (strpos($input->getName(), '_fileupload') !== false) {
                         $params = explode("_", $input->getName());
                         $fieldSettings = $fieldsRepository->findBySecurekey($params[2])->getFieldTypeSettings();
                         if ($fp = $uploader->contentFileUpload($input->getData(), $fieldSettings['fileupload']['fileuploadfolder'])) {
                             //Get current field content
                             $blockFieldObj = $blockField->getData();
                             $blockFieldContents = $blockFieldObj->getFieldContent();
                             $blockFieldContents[$params[0]] = $fp;
                             unset($blockFieldContents[$input->getName()]);
                             $blockFieldObj->setFieldContent($blockFieldContents);
                         }
                     }
                 }
             }
         }
         $em->persist($content);
         $em->flush();
         $storedContent = $cs->findSecureKeyById($content->getId());
         $this->cacheContent($content->getId(), $cs, $em);
         return $this->redirect($this->generateUrl('ssone_cms_frontend', array('uri' => $redirect)));
     }
     return $this->render('SSoneCMSBundle:Content:crud.html.twig', array('form' => $form->createView(), 'contentTitle' => $content->getName(), 'mode' => $mode, 'locale' => $locale));
 }
开发者ID:ssone,项目名称:cms-bundle,代码行数:60,代码来源:ModuleContentSubmissionController.php


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