42 lines
1.1 KiB
PHP
42 lines
1.1 KiB
PHP
<?php
|
|
|
|
|
|
|
|
class stNotificationBackendActions extends autoStNotificationBackendActions
|
|
{
|
|
public function executeProcess()
|
|
{
|
|
$id = $this->getRequestParameter('id');
|
|
|
|
$notification = NotificationPeer::retrieveByPK($id);
|
|
|
|
if (!$notification->getCallCount())
|
|
{
|
|
$notification->setIsMarkedAsRead(true);
|
|
$notification->save();
|
|
}
|
|
|
|
$action = $notification->getAction();
|
|
|
|
if ($action && $this->getRequest()->isXmlHttpRequest())
|
|
{
|
|
return $this->renderJSON(array(
|
|
'action' => $this->getController()->genUrl($action),
|
|
));
|
|
}
|
|
elseif (!$this->getRequest()->isXmlHttpRequest())
|
|
{
|
|
return $this->redirect($action ? $action : $this->getRequest()->getReferer());
|
|
}
|
|
|
|
return $this->renderText($this->getRenderComponent('stNotificationBackend', 'show'));
|
|
}
|
|
|
|
protected function addSortCriteria($c)
|
|
{
|
|
parent::addSortCriteria($c);
|
|
|
|
$c->addDescendingOrderByColumn(NotificationPeer::TYPE);
|
|
$c->addDescendingOrderByColumn(NotificationPeer::CREATED_AT);
|
|
}
|
|
} |