Beispiel #1
0
 public function editContentAction(Request $request, Application $app, $contentId)
 {
     $db = new DbRepository($app['dbh']);
     $content = $db->showOne($contentId);
     $args_array = array('user' => $app['session']->get('user'), 'content' => $content);
     $templateName = '_editContentForm';
     return $app['twig']->render($templateName . '.html.twig', $args_array);
 }
Beispiel #2
0
 /**
  * display one articles.
  *
  * renders a template with one articles.
  *
  * @param Request
  * @param Application
  *
  * @return an article template.
  */
 public function oneArticleAction(Request $request, Application $app, $pageRoute, $contentId)
 {
     $db = new DbRepository($app['dbh']);
     $result = $db->showOne($contentId);
     $allContent = $db->getAllPagesContent();
     $args_array = array('allContent' => $allContent, 'contentId' => $result->getContentId(), 'pageName' => $result->getPageName(), 'title' => $result->getContentitemtitle(), 'article' => $result->getContentitem(), 'image' => $result->getImagePath(), 'created' => $result->getCreated());
     $templateName = 'onearticle';
     return $app['twig']->render($templateName . '.html.twig', $args_array);
 }
Beispiel #3
0
 /**
  * A controller for adding images to an article.
  *
  * @param request object
  * @param app object
  *
  * @return twig template
  */
 public function addImageAction(Request $request, Application $app)
 {
     $db = new DbRepository($app['dbh']);
     $contentId = $app['request']->get('contentId');
     $imagePath = $app['request']->get('imagePath');
     $result = $db->addImage($imagePath, $contentId);
     $content = $db->showOne($contentId);
     $args_array = array('user' => $app['session']->get('user'), 'image' => $content->getImagePath(), 'contentitemtitle' => $content->getContentItemTitle(), 'contentitem' => $content->getContentItem(), 'created' => $content->getCreated(), 'contentid' => $content->getContentId(), 'result' => $result);
     $templateName = '_singleContent';
     return $app['twig']->render($templateName . '.html.twig', $args_array);
 }
Beispiel #4
0
 public function userAction(Request $request, Application $app, $contentId)
 {
     $db = new DbRepository($app['dbh']);
     $content = $db->showOne($contentId);
     $user = $app['session']->get('user');
     if ($user == false) {
         $allContent = $db->getAllPagesContent();
         $args_array = array('allContent' => $allContent, 'contentId' => $content->getContentId(), 'pageName' => $content->getPageName(), 'title' => $content->getContentitemtitle(), 'article' => $content->getContentitem(), 'image' => $content->getImagePath(), 'created' => $content->getCreated());
         $templateName = 'onearticle';
         return $app['twig']->render($templateName . '.html.twig', $args_array);
     } else {
         $args_array = array('user' => $app['session']->get('user'), 'pagename' => $content->getPageName(), 'contentitemtitle' => $content->getContentItemTitle(), 'contentitem' => $content->getContentItem(), 'created' => $content->getCreated(), 'contentid' => $content->getContentId());
         $templateName = '_singleContent';
         return $app['twig']->render($templateName . '.html.twig', $args_array);
     }
 }