/**
  * @param string $htmlContent
  * @param string $language
  * @param string $routePattern
  *
  * @return Node
  */
 protected function generateNodeGlobal($htmlContent, $language, $routePattern)
 {
     $nodeError503Block = new Block();
     $nodeError503Block->setLabel('Wysiwyg');
     $nodeError503Block->setComponent(TinyMCEWysiwygStrategy::NAME);
     $nodeError503Block->setAttributes(array("htmlContent" => $htmlContent));
     $nodeError503Block = $this->generateBlock($nodeError503Block);
     $main = new Area();
     $main->addBlock($nodeError503Block);
     $header = $this->createHeader();
     $footer = $this->createFooter();
     $nodeError503 = $this->createBaseNode();
     $nodeError503->setArea('main', $main);
     $nodeError503->setArea('footer', $footer);
     $nodeError503->setArea('header', $header);
     $nodeError503->setNodeType(NodeInterface::TYPE_ERROR);
     $nodeError503->setLanguage($language);
     $nodeError503->setNodeId(NodeInterface::ERROR_503_NODE_ID);
     $nodeError503->setName('Error 503');
     $nodeError503->setCreatedBy('fake_admin');
     $nodeError503->setParentId(NodeInterface::ROOT_PARENT_ID);
     $nodeError503->setRoutePattern($routePattern);
     $nodeError503->setInFooter(false);
     $nodeError503->setInMenu(false);
     $nodeError503->setOrder(-1);
     return $nodeError503;
 }
 /**
  * @param string $htmlContent
  * @param string $name
  * @param string $language
  * @param string $routePattern
  *
  * @return Node
  */
 protected function generateNodeGlobal($htmlContent, $name, $language, $routePattern)
 {
     $nodeAutoPublishBlock = new Block();
     $nodeAutoPublishBlock->setLabel('Wysiwyg');
     $nodeAutoPublishBlock->setComponent(TinyMCEWysiwygStrategy::NAME);
     $nodeAutoPublishBlock->setAttributes(array("htmlContent" => $htmlContent));
     $nodeAutoPublishBlock = $this->generateBlock($nodeAutoPublishBlock);
     $main = new Area();
     $main->addBlock($nodeAutoPublishBlock);
     $header = $this->createHeader();
     $footer = $this->createFooter();
     $nodeAutoPublish = $this->createBaseNode();
     $nodeAutoPublish->setArea('main', $main);
     $nodeAutoPublish->setArea('footer', $footer);
     $nodeAutoPublish->setArea('header', $header);
     $nodeAutoPublish->setNodeId('fixture_auto_unpublish');
     $nodeAutoPublish->setName($name);
     $nodeAutoPublish->setLanguage($language);
     $nodeAutoPublish->setParentId(NodeInterface::ROOT_NODE_ID);
     $nodeAutoPublish->setOrder(15);
     $nodeAutoPublish->setRoutePattern($routePattern);
     $nodeAutoPublish->setInFooter(false);
     $nodeAutoPublish->setInMenu(false);
     return $nodeAutoPublish;
 }
Ejemplo n.º 3
0
 /**
  * @param string        $name
  * @param string        $language
  * @param ObjectManager $manager
  * @param string        $htmlBody
  * @param string        $pattern
  *
  * @return NodeInterface
  */
 public function generateSimpleNode($name, $language, ObjectManager $manager, $htmlBody = null, $pattern = null)
 {
     $areaHeader = $this->generateHeaderArea();
     $areaContent = $this->generateContentArea();
     $areaFooter = $this->generateFooterArea();
     $titleBlock = new Block();
     $titleBlock->setClass('block-body-header');
     $titleBlock->setComponent(TinyMCEWysiwygStrategy::TINYMCEWYSIWYG);
     $titleBlock->setAttributes(array('htmlContent' => '<h1>' . $name . '</h1>'));
     $contentBlock = new Block();
     $contentBlock->setClass('block-body');
     $contentBlock->setComponent(TinyMCEWysiwygStrategy::TINYMCEWYSIWYG);
     $contentBlock->setAttributes(array('htmlContent' => $htmlBody));
     $areaContent->addBlock(array('nodeId' => 0, 'blockId' => 0));
     $areaContent->addBlock(array('nodeId' => 0, 'blockId' => 1));
     $node = $this->generateNode($name, NodeInterface::ROOT_NODE_ID, $pattern, $name, $language);
     $node->addArea($areaHeader);
     $node->addArea($areaContent);
     $node->addArea($areaFooter);
     $node->addBlock($titleBlock);
     $node->addBlock($contentBlock);
     $node->setInMenu(true);
     $routes = $this->updateRoute->createForNode($node);
     foreach ($routes as $route) {
         $manager->persist($route);
     }
     $manager->persist($node);
 }
 /**
  * @param string $htmlContent
  * @param string $language
  * @param string $routePattern
  *
  * @return Node
  */
 protected function generateNodeGlobal($htmlContent, $language, $routePattern)
 {
     $nodeHomeBlock = new Block();
     $nodeHomeBlock->setLabel('Wysiwyg');
     $nodeHomeBlock->setComponent(TinyMCEWysiwygStrategy::NAME);
     $nodeHomeBlock->setAttributes(array("htmlContent" => $htmlContent));
     $nodeHomeBlock = $this->generateBlock($nodeHomeBlock);
     $main = new Area();
     $main->addBlock($nodeHomeBlock);
     $header = $this->createHeader();
     $header->addBlock($this->fixture->getReference('Language list'));
     $footer = $this->createFooter();
     $nodeHome = $this->createBaseNode();
     $keyReference = "node-" . NodeInterface::ROOT_NODE_ID . '-' . $language . '-' . $this->version;
     if ($this->fixture->hasReference($keyReference)) {
         $nodeHome = $this->fixture->getReference($keyReference);
     }
     $nodeHome->setArea('main', $main);
     $nodeHome->setArea('footer', $footer);
     $nodeHome->setArea('header', $header);
     $nodeHome->setLanguage($language);
     $nodeHome->setNodeId(NodeInterface::ROOT_NODE_ID);
     $nodeHome->setCreatedBy('fake_admin');
     $nodeHome->setParentId(NodeInterface::ROOT_PARENT_ID);
     $nodeHome->setOrder(0);
     $nodeHome->setRoutePattern($routePattern);
     $nodeHome->setInFooter(false);
     $nodeHome->setInMenu(true);
     $nodeHome->setSitemapChangefreq('hourly');
     $nodeHome->setSitemapPriority('0.8');
     $nodeHome->setName('Orchestra ?');
     $nodeHome->setVersion($this->version);
     $nodeHome->setStatus($this->fixture->getReference($this->status));
     if ('status-published' == $this->status) {
         $nodeHome->setCurrentlyPublished(true);
     }
     return $nodeHome;
 }
 /**
  * @param string $blockType
  * @param string $id
  *
  * @return Block
  */
 protected function generateBlock($blockType)
 {
     $block = new Block();
     $block->setComponent($blockType);
     static::$kernel->getContainer()->get('object_manager')->persist($block);
     static::$kernel->getContainer()->get('object_manager')->flush();
     return $block;
 }
 /**
  * @param string $component
  * @param array  $value
  *
  * @dataProvider provideComponentAndDataAndTransformedValue
  */
 public function testMultipleBlockWithDataTransformation($component, $value)
 {
     $block = new Block();
     $block->setComponent($component);
     $formType = static::$kernel->getContainer()->get('open_orchestra_backoffice.generate_form_manager')->getFormType($block);
     $form = $this->formFactory->create($formType, $block, array('csrf_protection' => false));
     $submittedValue = array_merge(array('style' => 'default'), $value);
     $value['contentSearch']['keywords'] = $this->replaceKeywordLabelById($value['contentSearch']['keywords']);
     $form->submit($submittedValue);
     $this->assertTrue($form->isSynchronized());
     /** @var BlockInterface $data */
     $data = $form->getConfig()->getData();
     $this->assertBlock($data);
     foreach ($value as $key => $receivedData) {
         $this->assertSame($receivedData, $data->getAttribute($key));
     }
 }
 /**
  * @param string $htmlContent
  * @param string $name
  * @param string $language
  * @param string $routePattern
  *
  * @return Node
  */
 protected function generateNodeGlobal($htmlContent, $name, $language, $routePattern)
 {
     $nodeCommunityBlock = new Block();
     $nodeCommunityBlock->setLabel('Wysiwyg');
     $nodeCommunityBlock->setComponent(TinyMCEWysiwygStrategy::NAME);
     $nodeCommunityBlock->setAttributes(array("htmlContent" => $htmlContent));
     $nodeCommunityBlock = $this->generateBlock($nodeCommunityBlock);
     $main = new Area();
     $main->addBlock($nodeCommunityBlock);
     $header = $this->createHeader();
     $footer = $this->createFooter();
     $nodeCommunity = $this->createBaseNode();
     $nodeCommunity->setArea('main', $main);
     $nodeCommunity->setArea('footer', $footer);
     $nodeCommunity->setArea('header', $header);
     $nodeCommunity->setNodeId('fixture_page_community');
     $nodeCommunity->setLanguage($language);
     $nodeCommunity->setName($name);
     $nodeCommunity->setParentId(NodeInterface::ROOT_NODE_ID);
     $nodeCommunity->setOrder(3);
     $nodeCommunity->setRoutePattern($routePattern);
     $nodeCommunity->setTheme('themePresentation');
     $nodeCommunity->setInFooter(false);
     $nodeCommunity->setInMenu(true);
     return $nodeCommunity;
 }
    /**
     * @param ObjectManager $manager
     */
    protected function generateGlobalBlock(ObjectManager $manager)
    {
        $siteBlockLogo = new Block();
        $siteBlockLogo->setLabel('Wysiwyg logo');
        $siteBlockLogo->setStyle('default');
        $siteBlockLogo->setComponent(TinyMCEWysiwygStrategy::NAME);
        $orchestraTitle = "Open Orchestra";
        if ($this->hasReference('logo-orchestra')) {
            $orchestraTitle = '[media=original]' . $this->getReference('logo-orchestra')->getId() . '[/media]';
        }
        $siteBlockLogo->setAttributes(array("htmlContent" => '<a href="/" id="myLogo">' . $orchestraTitle . '</a>'));
        $this->generateBlock($manager, $siteBlockLogo);
        $siteBlockMainMenu = new Block();
        $siteBlockMainMenu->setLabel('Menu');
        $siteBlockMainMenu->setComponent('menu');
        $siteBlockMainMenu->setStyle('default');
        $this->generateBlock($manager, $siteBlockMainMenu);
        $siteBlockFooter = new Block();
        $siteBlockFooter->setLabel('Wysiwyg footer');
        $siteBlockFooter->setComponent(TinyMCEWysiwygStrategy::NAME);
        $siteBlockFooter->setAttributes(array("htmlContent" => <<<EOF
<div class='footer-networks'>
    <h4>Networks</h4>
    <ul>
        <li><a href="http://www.businessdecision.fr/">http://www.businessdecision.fr/</a></li>
        <li><a href="http://www.interakting.com/">http://www.interakting.com/</a></li>
    </ul>
</div>
<div class="footer-contact">
    <h4>Contact</h4>
    <ul>
        <li>Interakting</li>
        <li>153 Rue de Courcelles</li>
        <li>75017 Paris France</li>
        <li>01 56 21 21 21</li>
        <li><a href='/node/fixture_page_contact'>contact@interakting.com</a></li>
    </ul>
</div>
EOF
));
        $this->generateBlock($manager, $siteBlockFooter);
        $siteBlockFooterMenu = new Block();
        $siteBlockFooterMenu->setLabel('footer menu');
        $siteBlockFooterMenu->setStyle('default');
        $siteBlockFooterMenu->setComponent(FooterStrategy::NAME);
        $this->generateBlock($manager, $siteBlockFooterMenu);
        $siteBlockContact = new Block();
        $siteBlockContact->setLabel('Contact');
        $siteBlockContact->setComponent('contact');
        $siteBlockContact->setStyle('default');
        $this->generateBlock($manager, $siteBlockContact);
        $siteBlockLanguage = new Block();
        $siteBlockLanguage->setLabel('Language list');
        $siteBlockLanguage->setComponent(LanguageListStrategy::NAME);
        $this->generateBlock($manager, $siteBlockLanguage);
    }