Advertisement
fermiiii

binalik

May 21st, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.28 KB | None | 0 0
  1.  
  2. function makeSideNav($main,$sub,$pageIn,$access){
  3. // echo $pageIn;
  4. // echo "<br>";
  5. // echo "<br>";
  6.  
  7. $side = "";
  8. $CI =& get_instance();
  9. $CI->load->helper('page_helper');
  10. $page = getPage($pageIn);
  11. if($page['type'] == "top"){
  12. $in = $pageIn;
  13. $inParent = $pageIn;
  14. }
  15. else{
  16. if($page['type']=="sub"){
  17. $inParent = getLinkParent($page['parent']);
  18. $in = $page['parent'];
  19. }
  20. else{
  21. $inParent= $page['parent'];
  22. $in = $page['parent'];
  23. }
  24. }
  25. $act = $page['id'];
  26. $active = "";
  27.  
  28. foreach($main as $mKey=>$mVal){
  29.  
  30. // var_dump($mVal);
  31. // echo "<br>";
  32. // echo "<br>";
  33.  
  34. // foreach ($sub as $key => $value) {
  35. // ======================================================
  36. // * maraming laman ung $sub pero ung tama lang dun ung type => "sub"
  37. // * ung iba is for validation
  38. // * tapos to know kung san gagamitin ung sub na un check mo ung parent nya
  39. // * ung current value nung parent is si $pageIn or si $act dun sa taas
  40. // * =================================================
  41.  
  42. // if ($value["type"] == "sub" && $value["parent"] == $mVal["id"]) {
  43. // var_dump($value);
  44. // echo "<br>";
  45. // }
  46. // }
  47. // echo "<hr>";
  48.  
  49.  
  50. if($mVal['parent'] == $inParent){
  51.  
  52. if($mVal['path'] != ""){
  53. if(in_array($mVal['id'],$access) || count($access) == 0){
  54. $side .= "<li class=".$active."><a href='".base_url()."".$mVal['path']."' class='nav-header pagesLinks' ref='".$mVal['id']."'>".$mVal['icon']."".ucwords($mVal['title'])."</a></li>";
  55. }
  56. }
  57. else{
  58. if(in_array($mVal['id'],$access) || count($access) == 0){
  59. $side .= "
  60. <li class='treeview ".$active."'><a href='#'>".$mVal['icon']." ".ucwords($mVal['title'])."<i class='fa pull-right fa-angle-left'></i> </a>
  61. <ul class='treeview-menu'>";
  62.  
  63. $sParent = $mVal['id'];
  64. foreach($sub as $sKey=>$sVal){
  65. if($sParent == $sVal['parent']){
  66.  
  67. if(in_array($sVal['id'],$access) || count($access) == 0){
  68. $side .="<li class='noline' ><a href='".base_url()."".$sVal['path']."' class='pagesLinks' ref='".$sVal['id']."' ><i class='fa fa-circle-o'></i>".ucwords($sVal['title'])." </a></li>";
  69. }
  70. }
  71. }
  72. $side .="</ul></li>";
  73. }
  74. }
  75. }
  76. }
  77. // die();
  78. return $side;
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement