From eb06a51daed3e76b5840df902ff0b74e27f13a14 Mon Sep 17 00:00:00 2001 From: jmontoya Date: Tue, 20 May 2014 00:10:23 +0200 Subject: [PATCH] Removing unused files. --- main/pages/.htaccess | 8 - main/pages/index.php | 166 ------------------ main/timeline/index.php | 6 +- .../Middleware/CourseMiddleware.php | 17 -- tests/phpunit/BaseWebTestCase.php | 29 --- 5 files changed, 3 insertions(+), 223 deletions(-) delete mode 100755 main/pages/.htaccess delete mode 100755 main/pages/index.php delete mode 100644 src/ChamiloLMS/CoreBundle/Middleware/CourseMiddleware.php delete mode 100644 tests/phpunit/BaseWebTestCase.php diff --git a/main/pages/.htaccess b/main/pages/.htaccess deleted file mode 100755 index a0db644dbb..0000000000 --- a/main/pages/.htaccess +++ /dev/null @@ -1,8 +0,0 @@ - - Options -MultiViews - - RewriteEngine On - #RewriteBase /path/to/app - RewriteCond %{REQUEST_FILENAME} !-f - RewriteRule ^ index.php [L] - \ No newline at end of file diff --git a/main/pages/index.php b/main/pages/index.php deleted file mode 100755 index 15551af9a0..0000000000 --- a/main/pages/index.php +++ /dev/null @@ -1,166 +0,0 @@ -listAction($app, $page); - }*/ - - function addAction(Application $app) { - $request = $app['request']; - $form = $this->getForm($app); - - if ('POST' == $request->getMethod()) { - $form->bindRequest($request); - if ($form->isValid()) { - $page = $form->getData(); - $page->setSlug($page->getTitle()); - $em = $app['orm.em']; - /*$page_data = $form->getData(); - $page->setContent($page_data['content']); - $page->setSlug($page_data['slug']); - $page->setTitle($page_data['title']); - $em->persist($page);*/ - $em->persist($page); - $em->flush(); - return $app->redirect($app['url_generator']->generate('show', array('id'=> $page->getId())), 201); - } - } - return $app['template']->render_template('pages/add.tpl', array('form' => $form->createView())); - } - - function editAction(Application $app, $id) { - $request = $app['request']; - $page = $app['orm.em']->find('ChamiloLMS\Entity\Pages', $id); - - if (empty($page)) { - $app->abort(404, "Page $id does not exist."); - } - $form = $this->getForm($app, $page); - - if ('POST' == $request->getMethod()) { - $form->bind($request); - if ($form->isValid()) { - $em = $app['orm.em']; - //$page = $form->getData(); - $page->setTitle($page->getTitle()); - $em->persist($page); - $em->flush(); - return $app->redirect($app['url_generator']->generate('show', array('id'=> $page->getId())), 201); - } - } - return $app['template']->render_template('pages/add.tpl', array('form' => $form->createView())); - } - - function showAction(Application $app, $id) { - $page = $app['orm.em']->find('ChamiloLMS\Entity\Pages', $id); - $actions = Display::url(Display::return_icon('list.png', get_lang('Listing'), array(), ICON_SIZE_MEDIUM), $app['url_generator']->generate('index')); - return $app['template']->render_template('pages/show.tpl', array( - 'page' => $page, - 'actions' => $actions, - )); - } - - function deleteAction(Application $app, $id) { - $em = $app['orm.em']; - $page = $em->find('ChamiloLMS\Entity\Pages', $id); - $em->remove($page); - $em->flush(); - return $app->redirect($app['url_generator']->generate('index'), 201); - } - - function listAction(Application $app, $page = 1) { - /* - $source = new Entity('ChamiloLMS\Entity\Pages'); - $grid = new Grid(); - - // Attach the source to the grid - $grid->setSource($source); - - // Return the response of the grid to the template - //return $grid->getGridResponse('MyProjectMyBundle::myGrid.html.twig'); - */ - - $em = $app['orm.em']; - $dql = 'SELECT a FROM ChamiloLMS\Entity\Pages a'; - $query = $em->createQuery($dql)->setFirstResult(0)->setMaxResults(100); - - //or using the repository - // - //$query = $em->getRepository('ChamiloLMS\Entity\Pages')->getLatestPages(); - - $adapter = new DoctrineORMAdapter($query); - $pagerfanta = new Pagerfanta($adapter); - - $routeGenerator = function($page) use ($app) { - return $app['url_generator']->generate('list', array('page' => $page)); - }; - $page = intval($app['request']->get('page')); - - $pagerfanta->setMaxPerPage(2); // 10 by default - $pagerfanta->setCurrentPage($page); - - //$view = new DefaultView(); - $view = new TwitterBootstrapView(); - - $pagination = $view->render($pagerfanta, $routeGenerator, array( - 'proximity' => 3, - )); - - $actions = Display::url(Display::return_icon('add.png', get_lang('Add'), array(), ICON_SIZE_MEDIUM), $app['url_generator']->generate('add')); - //$paginator = new Paginator($query, $fetchJoinCollection = true); - - return $app['template']->render_template('pages/listing.tpl', array( - //'pages' => $paginator->getIterator(), - 'pages' => $pagerfanta, - 'pagination' => $pagination, - 'actions' => $actions - )); - } - - function getForm(Application $app, $entity = null) { - if (empty($entity)) { - $entity = new ChamiloLMS\Entity\Pages(); - } - $form = $app['form.factory']->createBuilder('form', $entity); - $form->add('title', 'text', array( - 'constraints' => array(new Assert\NotBlank(), new Assert\MinLength(5)) - )); - $form->add('slug', 'text', array( - //'constraints' => array(new Assert\NotBlank()) - )); - $form->add('content', 'textarea', array( - // 'constraints' => array() - )); - return $form->getForm(); - } -} - -$app->get('/', 'pages.controller:listAction')->bind('index'); - -$app->get('/page', 'pages.controller:listAction')->bind('list'); - -$app->get('/show/{id}', 'pages.controller:showAction') - ->bind('show') - ->assert('id', '\d+'); -$app->get('/delete/{id}', 'pages.controller:deleteAction') - ->bind('delete') - ->assert('id', '\d+'); -$app->match('/edit/{id}', 'pages.controller:editAction', 'GET|POST') - ->bind('edit') - ->assert('id', '\d+'); -$app->match('/add', 'pages.controller:addAction', 'GET|POST')->bind('add'); -$app->run(); diff --git a/main/timeline/index.php b/main/timeline/index.php index 8ba3abbeb7..221fb791fd 100644 --- a/main/timeline/index.php +++ b/main/timeline/index.php @@ -4,13 +4,13 @@ require_once '../inc/global.inc.php'; use Silex\Application; use Symfony\Component\HttpFoundation\Response; -use ChamiloLMS\Entity\CTimeline; +use ChamiloLMSCoreBundle:CTimeline; class TimeLineController { function indexAction(Application $app) { - $timeline_query = $app['orm.em']->getRepository('ChamiloLMS\Entity\CTimeline')->findAll(); - $timeline_query = $app['orm.em']->createQuery('SELECT a FROM ChamiloLMS\Entity\CTimeline a'); + $timeline_query = $app['orm.em']->getRepository('ChamiloLMSCoreBundle:CTimeline')->findAll(); + $timeline_query = $app['orm.em']->createQuery('SELECT a FROM ChamiloLMSCoreBundle:CTimeline a'); $paginator = new Doctrine\ORM\Tools\Pagination\Paginator($timeline_query, $fetchJoinCollection = true); $c = count($paginator); diff --git a/src/ChamiloLMS/CoreBundle/Middleware/CourseMiddleware.php b/src/ChamiloLMS/CoreBundle/Middleware/CourseMiddleware.php deleted file mode 100644 index dc78019f64..0000000000 --- a/src/ChamiloLMS/CoreBundle/Middleware/CourseMiddleware.php +++ /dev/null @@ -1,17 +0,0 @@ -assign('course', $course); - } -} diff --git a/tests/phpunit/BaseWebTestCase.php b/tests/phpunit/BaseWebTestCase.php deleted file mode 100644 index d6f979ff1a..0000000000 --- a/tests/phpunit/BaseWebTestCase.php +++ /dev/null @@ -1,29 +0,0 @@ -disable(); - - // Setting session obj for old libraries - \ChamiloSession::setSession($app['session']); - \UserManager::setEntityManager($app['orm.em']); - - //$app['monolog'] = $this->getMock('Monolog\Logger'); - return $app; - } -}