PowerKiKi /
mqueue
| 1 | <?php |
||
| 2 | |||
| 3 | use mQueue\Model\MovieMapper; |
||
| 4 | use mQueue\Model\StatusMapper; |
||
| 5 | use mQueue\Model\UserMapper; |
||
| 6 | |||
| 7 | class ActivityController extends Zend_Controller_Action |
||
| 8 | { |
||
| 9 | 3 | public function init(): void |
|
| 10 | { |
||
| 11 | // Init the Context Switch Action helper |
||
| 12 | 3 | $contextSwitch = $this->_helper->contextSwitch(); |
|
| 13 | |||
| 14 | // Add the new context |
||
| 15 | 3 | $contextSwitch->setContexts([ |
|
| 16 | 3 | 'rss' => ['suffix' => 'rss'], |
|
| 17 | ]); |
||
| 18 | |||
| 19 | 3 | $contextSwitch->addActionContext('index', 'rss')->initContext(); |
|
| 20 | 3 | } |
|
| 21 | |||
| 22 | 3 | public function indexAction(): void |
|
| 23 | { |
||
| 24 | // By default we show overall activity |
||
| 25 | 3 | $item = null; |
|
| 26 | 3 | $this->view->title = $this->view->translate('Overall activity'); |
|
| 27 | |||
| 28 | // Try to show user's activity |
||
| 29 | 3 | if ($this->getRequest()->getParam('user')) { |
|
| 30 | 1 | $item = UserMapper::find($this->getRequest()->getParam('user')); |
|
| 31 | 1 | if ($item) { |
|
|
0 ignored issues
–
show
introduced
by
Loading history...
|
|||
| 32 | 1 | $this->view->title = $this->view->translate('Activity for %s', [$item->nickname]); |
|
|
0 ignored issues
–
show
The property
nickname does not exist on mQueue\Model\User. Since you implemented __get, consider adding a @property annotation.
Loading history...
|
|||
| 33 | } |
||
| 34 | } |
||
| 35 | |||
| 36 | // Try to show movie's activity |
||
| 37 | 3 | if ($this->getRequest()->getParam('movie')) { |
|
| 38 | 1 | $item = MovieMapper::find($this->getRequest()->getParam('movie')); |
|
| 39 | 1 | if ($item) { |
|
|
0 ignored issues
–
show
|
|||
| 40 | 1 | $this->view->title = $this->view->translate('Activity for %s', [$item->getTitle()]); |
|
| 41 | } |
||
| 42 | } |
||
| 43 | |||
| 44 | 3 | $this->view->activity = $this->_helper->createPaginator(StatusMapper::getActivityQuery($item)); |
|
| 45 | 3 | } |
|
| 46 | } |
||
| 47 |