Skip to content

Commit

Permalink
Merge pull request #4 from pixelant/development_new
Browse files Browse the repository at this point in the history
[TASK] code style PSR2, storage support, main JS rebuild
  • Loading branch information
MattiasNilsson authored Apr 11, 2017
2 parents dcdc4d0 + b861ecd commit a740d01
Show file tree
Hide file tree
Showing 68 changed files with 2,398 additions and 1,050 deletions.
6 changes: 4 additions & 2 deletions Classes/Controller/BaseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
/**
* BaseController
*/
class BaseController extends ActionController {
class BaseController extends ActionController
{

/**
* feedRepository
Expand All @@ -49,7 +50,8 @@ class BaseController extends ActionController {
* @param string $label
* @return NULL|string
*/
static public function translate($label = '') {
public static function translate($label = '')
{
return LocalizationUtility::translate($label, 'pxa_social_feed');
}
}
50 changes: 47 additions & 3 deletions Classes/Controller/FeedsController.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Pixelant\PxaSocialFeed\Controller;

/***************************************************************
Expand Down Expand Up @@ -29,18 +30,61 @@
/**
* FeedsController
*/
class FeedsController extends BaseController {
class FeedsController extends BaseController
{

/**
* action list
* List action
*
* @return void
*/
public function listAction() {
public function listAction()
{
$limit = $this->settings['feedsLimit'] ? intval($this->settings['feedsLimit']) : 10;

$feeds = $this->feedRepository->findFeedsByConfig($this->settings['configuration'], $limit);

$this->view->assign('feeds', $feeds);
}

/**
* List ajax action
* Prepare view for later ajax request
*
* @return void
*/
public function listAjaxAction()
{
$this->view->assignMultiple([
'configurations' => $this->settings['configuration'],
'feedsLimit' => $this->settings['feedsLimit'] ? intval($this->settings['feedsLimit']) : 10
]);
}

/**
* Load feed with ajax
*
* @param string $configurations
* @param int $limit
* @return void
*/
public function loadFeedAjaxAction($configurations, $limit = 0)
{
$limit = $limit ? $limit : 10;

$feeds = $this->feedRepository->findFeedsByConfig($configurations, $limit);

$this->view->assign('feeds', $feeds);

header('Content-Type: application/json');

echo json_encode(
[
'success' => true,
'html' => $this->view->render()
]
);

exit(0);
}
}
Loading

0 comments on commit a740d01

Please sign in to comment.