41 lines
1.3 KiB
PHP
41 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace Cadoles\CoreBundle\Repository;
|
|
|
|
class Niveau01Repository extends \Doctrine\ORM\EntityRepository
|
|
{
|
|
/* Affectation des attributs calculés */
|
|
public function calculateNiveau01($attruser)
|
|
{
|
|
$niveau01s = $this->_em->getRepository('CadolesCoreBundle:Niveau01')->findAll();
|
|
foreach($niveau01s as $niveau01) {
|
|
if($niveau01->getAttributes()) {
|
|
|
|
$attniveau=json_decode($niveau01->getAttributes(),true);
|
|
|
|
foreach($attniveau as $key => $value) {
|
|
if(array_key_exists($key,$attruser)) {
|
|
if(is_array($attruser[$key])) {
|
|
foreach($attruser[$key] as $val) {
|
|
if($value=="*")
|
|
return $niveau01;
|
|
elseif($val==$value)
|
|
return $niveau01;
|
|
}
|
|
}
|
|
else {
|
|
if($value=="*")
|
|
return $niveau01;
|
|
elseif($value==$attruser[$key])
|
|
return $niveau01;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
}
|