Skip to content

Commit

Permalink
Thoth to Roger
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabrice Bernhard committed Oct 22, 2011
1 parent 2f9cc9e commit 1907e57
Show file tree
Hide file tree
Showing 109 changed files with 501 additions and 481 deletions.
26 changes: 13 additions & 13 deletions Controller/Backend/LayoutController.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<?php

/*
* This file is part of the Thoth CMS Bundle
* This file is part of the Roger CMS Bundle
*
* (c) Theodo <[email protected]>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/

namespace Theodo\ThothCmsBundle\Controller\Backend;
namespace Theodo\RogerCmsBundle\Controller\Backend;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Theodo\ThothCmsBundle\Form\LayoutType;
use Theodo\RogerCmsBundle\Form\LayoutType;

class LayoutController extends Controller
{
Expand All @@ -27,9 +27,9 @@ class LayoutController extends Controller
*/
public function indexAction()
{
$layouts = $this->get('thoth.content_repository')->findAll('layout');
$layouts = $this->get('roger.content_repository')->findAll('layout');

return $this->render('TheodoThothCmsBundle:Layout:index.html.twig',
return $this->render('TheodoRogerCmsBundle:Layout:index.html.twig',
array('layouts' => $layouts)
);
}
Expand All @@ -49,7 +49,7 @@ public function editAction($id)
{
$layout = null;
if ($id) {
$layout = $this->get('thoth.content_repository')->findOneById($id, 'layout');
$layout = $this->get('roger.content_repository')->findOneById($id, 'layout');
}

$form = $this->createForm(new LayoutType(), $layout);
Expand All @@ -61,14 +61,14 @@ public function editAction($id)
if ($form->isValid()) {
// remove twig cached file
if ($layout) {
$this->get('thoth.caching')->invalidate('layout:'.$layout->getName());
$this->get('roger.caching')->invalidate('layout:'.$layout->getName());
}

// save layout
$layout = $form->getData();
$this->get('thoth.content_repository')->save($layout);
$this->get('roger.content_repository')->save($layout);

$this->get('thoth.caching')->warmup('layout:'.$layout->getName());
$this->get('roger.caching')->warmup('layout:'.$layout->getName());

// Set redirect route
$redirect = $this->redirect($this->generateUrl('layout_list'));
Expand All @@ -80,7 +80,7 @@ public function editAction($id)
}
}

return $this->render('TheodoThothCmsBundle:Layout:edit.html.twig',
return $this->render('TheodoRogerCmsBundle:Layout:edit.html.twig',
array(
'layout' => $layout,
'form' => $form->createView(),
Expand All @@ -99,16 +99,16 @@ public function editAction($id)
*/
public function removeAction($id)
{
$layout = $this->get('thoth.content_repository')->findOneById($id, 'layout');
$layout = $this->get('roger.content_repository')->findOneById($id, 'layout');

$request = $this->get('request');
if ($request->getMethod() == 'POST') {
$this->get('thoth.content_repository')->remove($layout);
$this->get('roger.content_repository')->remove($layout);

return $this->redirect($this->generateUrl('layout_list'));
}

return $this->render('TheodoThothCmsBundle:Layout:remove.html.twig',
return $this->render('TheodoRogerCmsBundle:Layout:remove.html.twig',
array(
'layout' => $layout
));
Expand Down
22 changes: 11 additions & 11 deletions Controller/Backend/MediaController.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<?php

/*
* This file is part of the Thoth CMS Bundle
* This file is part of the Roger CMS Bundle
*
* (c) Theodo <[email protected]>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/

namespace Theodo\ThothCmsBundle\Controller\Backend;
namespace Theodo\RogerCmsBundle\Controller\Backend;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Theodo\ThothCmsBundle\Form\MediaType;
use Theodo\RogerCmsBundle\Form\MediaType;

class MediaController extends Controller
{
Expand All @@ -26,9 +26,9 @@ class MediaController extends Controller
*/
public function indexAction()
{
$medias = $this->get('thoth.content_repository')->findAll('media');
$medias = $this->get('roger.content_repository')->findAll('media');

return $this->render('TheodoThothCmsBundle:Media:index.html.twig',
return $this->render('TheodoRogerCmsBundle:Media:index.html.twig',
array('medias' => $medias)
);
}
Expand All @@ -48,7 +48,7 @@ public function editAction($id)
{
$media = null;
if ($id) {
$media = $this->get('thoth.content_repository')->findOneById($id, 'media');
$media = $this->get('roger.content_repository')->findOneById($id, 'media');
}
$form = $this->createForm(new MediaType(), $media);
$request = $this->get('request');
Expand All @@ -64,7 +64,7 @@ public function editAction($id)
{
$media->setPath(null);
}
$this->get('thoth.content_repository')->save($media);
$this->get('roger.content_repository')->save($media);

// Set redirect route
$redirect = $this->redirect($this->generateUrl('media_list'));
Expand All @@ -77,7 +77,7 @@ public function editAction($id)
}
}

return $this->render('TheodoThothCmsBundle:Media:edit.html.twig',
return $this->render('TheodoRogerCmsBundle:Media:edit.html.twig',
array(
'media' => $media,
'form' => $form->createView(),
Expand All @@ -96,16 +96,16 @@ public function editAction($id)
*/
public function removeAction($id)
{
$media = $media = $this->get('thoth.content_repository')->findOneById($id, 'media');
$media = $media = $this->get('roger.content_repository')->findOneById($id, 'media');

$request = $this->get('request');
if ($request->getMethod() == 'POST') {
$media = $this->get('thoth.content_repository')->remove($media);
$media = $this->get('roger.content_repository')->remove($media);

return $this->redirect($this->generateUrl('media_list'));
}

return $this->render('TheodoThothCmsBundle:Media:remove.html.twig',
return $this->render('TheodoRogerCmsBundle:Media:remove.html.twig',
array(
'media' => $media
));
Expand Down
16 changes: 8 additions & 8 deletions Controller/Backend/NavigationController.php
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<?php

/*
* This file is part of the Thoth CMS Bundle
* This file is part of the Roger CMS Bundle
*
* (c) Theodo <[email protected]>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/

namespace Theodo\ThothCmsBundle\Controller\Backend;
namespace Theodo\RogerCmsBundle\Controller\Backend;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Yaml\Yaml;
use Symfony\Component\Config\Exception\FileLoaderLoadException;

use Theodo\ThothCmsBundle\Form\LayoutType;
use Theodo\RogerCmsBundle\Form\LayoutType;

class NavigationController extends Controller
{
Expand All @@ -27,22 +27,22 @@ class NavigationController extends Controller
*/
public function menuComponentAction($request)
{
// Build thoth.menu.yml file path
$path = $this->get('kernel')->getRootDir().DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'thoth.menu.yml';
// Build roger.menu.yml file path
$path = $this->get('kernel')->getRootDir().DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'roger.menu.yml';

// Check file exists
if (!file_exists($path)) {
throw new FileLoaderLoadException(sprintf(
"File \"%s\" can not be found!\nPlease create file from ThothCmsBundle/config/menu.yml",
"File \"%s\" can not be found!\nPlease create file from RogerCmsBundle/config/menu.yml",
$path
));
}

// Load thoth.menu.yml file
// Load roger.menu.yml file
$menu = Yaml::parse($path);

return $this->render(
'TheodoThothCmsBundle:Navigation:menu-component.html.twig',
'TheodoRogerCmsBundle:Navigation:menu-component.html.twig',
array(
'menu' => $menu,
'request' => $request
Expand Down
42 changes: 21 additions & 21 deletions Controller/Backend/PageController.php
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<?php

/*
* This file is part of the Thoth CMS Bundle
* This file is part of the Roger CMS Bundle
*
* (c) Theodo <[email protected]>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/

namespace Theodo\ThothCmsBundle\Controller\Backend;
namespace Theodo\RogerCmsBundle\Controller\Backend;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Theodo\ThothCmsBundle\Repository\PageRepository;
use Theodo\ThothCmsBundle\Form\PageType;
use Theodo\ThothCmsBundle\Entity\Page;
use Theodo\RogerCmsBundle\Repository\PageRepository;
use Theodo\RogerCmsBundle\Form\PageType;
use Theodo\RogerCmsBundle\Entity\Page;

class PageController extends Controller
{
Expand All @@ -30,9 +30,9 @@ class PageController extends Controller
public function indexAction()
{
// Retrieve pages
$pages = $this->get('thoth.content_repository')->getFirstTwoLevelPages();
$pages = $this->get('roger.content_repository')->getFirstTwoLevelPages();

return $this->render('TheodoThothCmsBundle:Page:index.html.twig', array('pages' => $pages));
return $this->render('TheodoRogerCmsBundle:Page:index.html.twig', array('pages' => $pages));
}


Expand All @@ -53,7 +53,7 @@ public function editAction($id = null, $parent_id = null)
// new page
if (!$id) {
$page = new Page();
$parent_page = $this->get('thoth.content_repository')->findOneById($parent_id);
$parent_page = $this->get('roger.content_repository')->findOneById($parent_id);
// Create the homepage
if ($parent_page) {
$page->setParentId($parent_page->getId());
Expand All @@ -65,12 +65,12 @@ public function editAction($id = null, $parent_id = null)
}
// update page
else {
$page = $this->get('thoth.content_repository')->findOneById($id);
$page = $this->get('roger.content_repository')->findOneById($id);
$parent_page = $page->getParent();
}

// Get all layout
$layouts = $this->get('thoth.content_repository')->findAll('layout');
$layouts = $this->get('roger.content_repository')->findAll('layout');

$page_content = $page->getContent();

Expand Down Expand Up @@ -108,12 +108,12 @@ public function editAction($id = null, $parent_id = null)
if ($form->isValid())
{
// remove twig cached file
$this->get('thoth.caching')->invalidate('page:'.$page->getName());
$this->get('roger.caching')->invalidate('page:'.$page->getName());

$page = $form->getData();
$this->get('thoth.content_repository')->save($page);
$this->get('roger.content_repository')->save($page);

$this->get('thoth.caching')->warmup('page:'.$page->getName());
$this->get('roger.caching')->warmup('page:'.$page->getName());

// Set redirect route
$redirect = $this->redirect($this->generateUrl('page_list'));
Expand All @@ -131,7 +131,7 @@ public function editAction($id = null, $parent_id = null)
}

return $this->render(
'TheodoThothCmsBundle:Page:edit.html.twig',
'TheodoRogerCmsBundle:Page:edit.html.twig',
array(
'form' => $form->createView(),
'page' => $page,
Expand Down Expand Up @@ -159,18 +159,18 @@ public function removeAction($id)
$request = $this->getRequest();

// Retrieve page
$page = $this->get('thoth.content_repository')->findOneById($id);
$page = $this->get('roger.content_repository')->findOneById($id);

// Request is post
if ($request->getMethod() == 'POST') {
// Delete page
$this->get('thoth.content_repository')->remove($page);
$this->get('roger.content_repository')->remove($page);

return $this->redirect($this->generateUrl('page_list'));
}

return $this->render(
'TheodoThothCmsBundle:Page:remove.html.twig',
'TheodoRogerCmsBundle:Page:remove.html.twig',
array(
'page' => $page
)
Expand All @@ -192,10 +192,10 @@ public function expandAction($id)
$request = $this->getRequest();

// Retrieve page childrens
$pages = $this->get('thoth.content_repository')->findOneById($id)->getChildren();
$pages = $this->get('roger.content_repository')->findOneById($id)->getChildren();

return $this->render(
'TheodoThothCmsBundle:Page:page-list.html.twig',
'TheodoRogerCmsBundle:Page:page-list.html.twig',
array(
'pages' => $pages,
'level' => $request->get('level')
Expand All @@ -218,10 +218,10 @@ public function siteMapComponentAction($from_id)
$request = $this->getRequest();

// Retrieve page
$page = $this->get('thoth.content_repository')->findOneById($from_id);
$page = $this->get('roger.content_repository')->findOneById($from_id);

return $this->render(
'TheodoThothCmsBundle:Page:site-map-component.html.twig',
'TheodoRogerCmsBundle:Page:site-map-component.html.twig',
array(
'page' => $page,
'level' => 0
Expand Down
Loading

0 comments on commit 1907e57

Please sign in to comment.