Skip to content

Instantly share code, notes, and snippets.

@adahhane
Created July 4, 2011 15:26
Show Gist options
  • Save adahhane/1063488 to your computer and use it in GitHub Desktop.
Save adahhane/1063488 to your computer and use it in GitHub Desktop.
OtherGroups
<?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