Created
July 4, 2011 15:26
-
-
Save adahhane/1063488 to your computer and use it in GitHub Desktop.
OtherGroups
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function others(){ | |
$group=new Groups(); | |
$allGroups=$group->fetchAll(); | |
$groups=array(); | |
$idGroups=array(); | |
$detailGroups=new GroupDetails(); | |
$dGroups=$detailGroups->fetchall(); | |
$detailGroups->setMember($this->get("Security")->getUser()->getId()); | |
$memberGroup=$detailGroups->fetch(); | |
foreach($memberGroup as $gm){ | |
foreach($dGroups as $gr){ | |
if($gm->getGroups()==$gr->getGroups() and $gr->getMember()==$this->get("Security")->getUser()->getId()){ | |
$idGroups[]= $gr->getGroups(); | |
} | |
} | |
} | |
var_dump($idGroups); | |
for($i=0;$i<count($idGroups);$i++){ | |
foreach($allGroups as $group){ | |
if(!in_array($group->getId(),$idGroups)){ | |
$groups[]=$group; | |
} | |
} | |
} | |
$this->view('groups','others',compact('groups')); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment