1
0
mirror of https://github.com/nerzhul/ocsms.git synced 2025-07-17 06:56:02 +00:00

use a proper URLGenerator in smscontroller

This commit is contained in:
Loic Blot 2015-03-18 09:48:45 +00:00
parent 98933860e8
commit 9fbeddfa9b
2 changed files with 6 additions and 3 deletions

View File

@ -79,6 +79,7 @@ class OcSmsApp extends App {
$c->query('UserId'), $c->query('UserId'),
$c->query('SmsMapper'), $c->query('SmsMapper'),
$c->query('ConfigMapper'), $c->query('ConfigMapper'),
$c->query('ServerContainer')->getURLGenerator(),
$app $app
); );
}); });

View File

@ -32,13 +32,15 @@ class SmsController extends Controller {
private $configMapper; private $configMapper;
private $smsMapper; private $smsMapper;
private $errorMsg; private $errorMsg;
private $urlGenerator;
public function __construct ($appName, IRequest $request, $userId, SmsMapper $mapper, ConfigMapper $cfgMapper, OcSmsApp $app){ public function __construct ($appName, IRequest $request, $userId, SmsMapper $mapper, ConfigMapper $cfgMapper, $urlGenerator, OcSmsApp $app){
parent::__construct($appName, $request); parent::__construct($appName, $request);
$this->app = $app; $this->app = $app;
$this->userId = $userId; $this->userId = $userId;
$this->smsMapper = $mapper; $this->smsMapper = $mapper;
$this->configMapper = $cfgMapper; $this->configMapper = $cfgMapper;
$this->urlGenerator = $urlGenerator;
} }
/** /**
@ -50,12 +52,12 @@ class SmsController extends Controller {
'PNLConversations' => array( 'PNLConversations' => array(
'label' => 'Conversations', 'label' => 'Conversations',
'phoneNumbers' => $this->smsMapper->getAllPeersPhoneNumbers($this->userId), 'phoneNumbers' => $this->smsMapper->getAllPeersPhoneNumbers($this->userId),
'url' => \OCP\Util::linkToAbsolute('index.php', 'apps/ocsms/', array('feed' => 'conversations')) 'url' => $this->urlGenerator->linkToRoute('ocsms.sms.index', ['feed' => 'conversations'])
), ),
'PNLDrafts' => array( 'PNLDrafts' => array(
'label' => 'Drafts', 'label' => 'Drafts',
'phoneNumbers' => array(), 'phoneNumbers' => array(),
'url' => \OCP\Util::linkToAbsolute('index.php', 'apps/ocsms/', array('feed' => 'drafts')) 'url' => $this->urlGenerator->linkToRoute('ocsms.sms.index', ['feed' => 'drafts'])
) )
); );