本文整理汇总了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));
}