TYPO3.CMS 7.6 Schnipsel: Unterschied zwischen den Versionen

Aus Vosp.info
Wechseln zu:Navigation, Suche
Zeile 7: Zeile 7:
 
$ncmail = $objectManager->get('Netzcoop\Extension\Services\Ncmail');
 
$ncmail = $objectManager->get('Netzcoop\Extension\Services\Ncmail');
 
</source>
 
</source>
 +
 +
=== logout / login ===
 +
<source lang=php>
 +
protected function login($ncfeuserid) {
 +
$user = $this->userRepository->findByUid($ncfeuserid);
 +
$GLOBALS['TSFE']->fe_user->createUserSession($user->_getProperties());
 +
}
 +
 +
protected function logout() {
 +
$GLOBALS['TSFE']->fe_user->logoff();
 +
}
 +
</source>
 +
 
== Controller ==
 
== Controller ==
 
=== Url/Link erstellen ===
 
=== Url/Link erstellen ===

Version vom 16. Dezember 2015, 20:49 Uhr

extbase (php)

Generell

$objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Extbase\Object\ObjectManager');
$ncmail = $objectManager->get('Netzcoop\Extension\Services\Ncmail');

logout / login

	protected function login($ncfeuserid) {		
		$user = $this->userRepository->findByUid($ncfeuserid);
		$GLOBALS['TSFE']->fe_user->createUserSession($user->_getProperties());
	}
		
	protected function logout() {
		$GLOBALS['TSFE']->fe_user->logoff();
	}

Controller

Url/Link erstellen

			$uriBuilder = $this->controllerContext->getUriBuilder();
			$uriBuilder->reset();
			$uriBuilder->setArguments(array(
			  strtolower($this->extensionName) => array(
				'param1' => $user->getUid(),
				 'param2' => 'test',
				  
			  )
			));
			$uri = $uriBuilder->build();