Guest User

Untitled

a guest
Feb 19th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. <?php
  2. public function others(){
  3. $group=new Groups();
  4. $allGroups=$group->fetchAll();
  5. $groups=array();
  6. $idGroups=array();
  7. $detailGroups=new GroupDetails();
  8. $dGroups=$detailGroups->fetchall();
  9. $detailGroups->setMember($this->get("Security")->getUser()->getId());
  10. $memberGroup=$detailGroups->fetch();
  11. foreach($memberGroup as $gm){
  12. foreach($dGroups as $gr){
  13. if($gm->getGroups()==$gr->getGroups() and $gr->getMember()==$this->get("Security")->getUser()->getId()){
  14. $idGroups[]= $gr->getGroups();
  15. }
  16. }
  17. }
  18. var_dump($idGroups);
  19. for($i=0;$i<count($idGroups);$i++){
  20. foreach($allGroups as $group){
  21. if(!in_array($group->getId(),$idGroups)){
  22. $groups[]=$group;
  23.  
  24. }
  25. }
  26. }
  27.  
  28.  
  29. $this->view('groups','others',compact('groups'));
  30. }
  31. ?>
Add Comment
Please, Sign In to add comment