public static function navigationdata() { $testlist = array(); $returndata = array(); $navheader = Header::order_by('step', 'asc')->get(); foreach ($navheader as $key => $value) { $returndata[$key]['header'] = $value->navheader; $returndata[$key]['moduleid'] = $value->navheaderid; $testlist = Header::find($value->navheaderid)->navpages()->order_by('parentstep', 'asc')->get(); foreach ($testlist as $ckey => $cvalue) { $parent = Page::find($cvalue->modulpageid); if (!empty($parent) && $cvalue->parentid == NULL) { $returndata[$key]['parent'][$ckey]['alias'] = $parent->actionalias; $returndata[$key]['parent'][$ckey]['pageid'] = $cvalue->navpageid; $returndata[$key]['parent'][$ckey]['path'] = $parent->modul . '/' . $parent->controller . '/' . $parent->action; $child = Link::where('parentid', '=', $cvalue->navpageid)->get(); if (!empty($child)) { foreach ($child as $childkey => $childvalue) { $childpage = Page::find($childvalue->modulpageid); $returndata[$key]['parent'][$ckey]['child'][$childkey]['alias'] = $childpage->actionalias; $returndata[$key]['parent'][$ckey]['child'][$childkey]['childid'] = $childvalue->navpageid; $returndata[$key]['parent'][$ckey]['child'][$childkey]['path'] = $childpage->controller . '/' . $childpage->action; } } } } } return $returndata; }
public function post_deletemodule() { $input = Input::get(); $header = Header::find($input['id']); $head = $header->navheader; $header->delete(); $desc = Link::where('navheaderid', '=', $input['id'])->get(); Link::where('navheaderid', '=', $input['id'])->delete(); Log::write('System', 'Delete Navigation Module ' . $head . ' by ' . Auth::user()->username); foreach ($desc as $key => $value) { $page = Page::find($value->modulpageid)->actionalias; Log::write('System', 'Delete Navigation Page ' . $head . '/' . $page . ' by ' . Auth::user()->username); } return Menu::navTree(); }
public static function navTree() { $data = Header::navigationdata(); $view = ''; foreach ($data as $key => $content) { $view .= '<li ><ul class="nav nav-list">'; $view .= '<li class="nav-header" style="height:30px"><i class="icon-hdd"></i> ' . Str::upper($content['header']); $view .= '<div class="form-inline pull-right" >'; $view .= '<a href="#" onclick="deleteModule(' . $content['moduleid'] . ')" style="margin-bottom:10px;margin-left:5px;"><i class="icon-remove alert-error"></i></a>'; //<em><small>Remove Module</small></em> $view .= '</div>'; $view .= Form::hidden('module[]', $content['moduleid']); $view .= '</li>'; if (!empty($content['parent']) || isset($content['parent'])) { $view .= '<li ><ul id="sortparent" class="nav nav-list connectedparent" style="padding-right:0px">'; foreach ($content['parent'] as $parentkey => $parentcontent) { $view .= '<li style="height:30px" ><i class="icon-arrow-right"></i> ' . Str::title($parentcontent['alias']); $view .= '<div class="form-inline pull-right">'; $view .= '<a href="#" onclick="addchildpages(' . $parentcontent['pageid'] . ')" data-toggle="modal" style="margin-bottom:10px;margin-left:5px;"><i class="icon-plus"></i></a>'; //<em><small>Add Sub Page</small></em> $view .= '<a href="#" onclick="deletePage(' . $parentcontent['pageid'] . ')" style="margin-bottom:10px;margin-left:5px;"><i class="icon-remove alert-error"></i></a>'; //<em><small>Remove Page</small></em> $view .= '</div>'; $view .= Form::hidden('parent[]', $parentcontent['pageid']); $view .= '</li>'; if (!empty($parentcontent['child'])) { $view .= '<li ><ul id="sortchild" class="nav nav-list connectedchild" style="padding-right:0px">'; foreach ($parentcontent['child'] as $childkey => $childvalue) { $view .= '<li style="height:30px" ><i class="icon-arrow-right"></i> ' . Str::title($childvalue['alias']); $view .= '<div class="form-inline pull-right">'; $view .= '<a href="#" onclick="deletePage(' . $childvalue['childid'] . ')" style="margin-bottom:10px;margin-left:5px;"><i class="icon-remove alert-error"></i></a>'; //<em><small>Remove Sub Page</small></em> $view .= '</div>'; $view .= '</li>'; } $view .= '</ul></li>'; } } $view .= '</ul></li>'; } $view .= '</ul></li>'; } return $view; }