Skip to content

Commit a2cb897

Browse files
Merge pull request #147 from gregorybesson/develop
userLog
2 parents 6a91b3f + 6f1f244 commit a2cb897

File tree

2 files changed

+35
-5
lines changed

2 files changed

+35
-5
lines changed

src/Form/LoginFilter.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@ class LoginFilter extends \ZfcUser\Form\LoginFilter
99
{
1010
public function __construct(AuthenticationOptionsInterface $options)
1111
{
12-
$this->add(array(
13-
'name' => 'remember_me',
14-
'required' => false,
15-
'allowEmpty' => true,
16-
));
12+
$this->add(
13+
array(
14+
'name' => 'remember_me',
15+
'required' => false,
16+
'allowEmpty' => true,
17+
)
18+
);
1719

1820
parent::__construct($options);
1921
}

src/Service/User.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,6 +1014,34 @@ public function getCSV($array)
10141014
return ob_get_clean(); // ... then return it as a string!
10151015
}
10161016

1017+
1018+
public function getUserActions()
1019+
{
1020+
$config = $this->serviceManager->get('config');
1021+
$logFrontendUser = ($config['playgrounduser']['log_frontend_user']) ? $config['playgrounduser']['log_frontend_user'] : false;
1022+
$routes = [];
1023+
1024+
// echo '$controllerClass : ' . $controllerClass . '<br/>';
1025+
// echo '$moduleName : ' .$moduleName. '<br/>';
1026+
// echo '$routeName : '.$routeName. '<br/>';
1027+
// echo '$areaName : '.$areaName. '<br/>';
1028+
// echo '$controllerName : ' .$controllerName. '<br/>';
1029+
// echo '$actionName : ' . $actionName. '<br/>';
1030+
if ($logFrontendUser) {
1031+
$em = $this->getServiceManager()->get('doctrine.entitymanager.orm_default');
1032+
$emConfig = $em->getConfiguration();
1033+
$emConfig->addCustomStringFunction('SUBSTRING_INDEX', '\DoctrineExtensions\Query\Mysql\SubstringIndex');
1034+
$query = $em->createQuery(
1035+
"select DISTINCT CONCAT(SUBSTRING_INDEX(ul.controllerClass, '\\', -1), '/', ul.actionName) as path from PlaygroundUser\Entity\UserLog ul
1036+
WHERE SUBSTRING_INDEX(ul.uri, '.', -1) NOT IN ('jpg','svg','gif','png','css','js')
1037+
AND ul.areaName = 'frontend'"
1038+
);
1039+
$routes = $query->getResult();
1040+
}
1041+
1042+
return $routes;
1043+
}
1044+
10171045
public function findAll()
10181046
{
10191047
return $this->getUserMapper()->findAll();

0 commit comments

Comments
 (0)