Exemplo n.º 1
0
 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;
 }
Exemplo n.º 2
0
 public function get_resetnavdata()
 {
     $input = Input::get();
     $id = isset($input['stepid']) ? $input['stepid'] : NULL;
     $data['page'] = $listpage = Page::listSteppages($id);
     return json_encode($data);
 }
Exemplo n.º 3
0
 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();
 }
Exemplo n.º 4
0
 public static function composer()
 {
     $arc = new Crapcrush();
     // $structures = $arc->getadmin();
     $structures = Crapcrush::getstructures();
     $ctrArr = 1;
     foreach ($structures as $modul => $content) {
         foreach ($content as $submodul => $subcontent) {
             $submodulExisted = Page::where('controller', '=', $submodul)->get();
             if (!$submodulExisted) {
                 $modulModel = new Page();
                 $modulModel->modul = $modul;
                 $modulModel->controller = $submodul;
                 $modulModel->visible = 1;
                 $modulModel->auth = 1;
                 $modulModel->arrangement = $ctrArr;
                 $modulModel->header = 1;
                 $modulModel->save();
             }
             $actArr = 1;
             foreach ($subcontent as $action) {
                 $actionExisted = Page::where('controller', '=', $submodul)->where('action', '=', $action)->get();
                 if (!$actionExisted) {
                     $modulModel = new Page();
                     $modulModel->modul = $modul;
                     $modulModel->controller = $submodul;
                     $modulModel->action = $action;
                     $modulModel->visible = 1;
                     $modulModel->auth = 1;
                     $modulModel->arrangement = $actArr;
                     $modulModel->header = 1;
                     $modulModel->save();
                 }
                 $actArr++;
             }
             $ctrArr++;
         }
     }
 }
Exemplo n.º 5
0
 public static function page()
 {
     $arc = new Crapcrush();
     $totalStruct = $arc->getstructures();
     $structModeling = Page::getRegPages();
     $view = '<ul class="nav nav-list">';
     foreach ($totalStruct as $modul => $content) {
         if (!empty($structModeling[$modul])) {
             $view .= '<li class="nav-header alert alert-info"><i class="icon-hdd"></i>&nbsp;' . Str::upper($modul) . '</li>';
             $view .= Form::hidden($modul . '[id]');
             $registered = !empty($structModeling[$modul]) ? 'alert alert-success' : 'alert';
             $view .= '<li class="' . $registered . '">';
             $idiv = count($content);
             foreach ($content as $submodul => $subcontent) {
                 if (isset($structModeling[$modul][$submodul])) {
                     $view .= '<ul class="nav nav-list">';
                     $view .= '<li style="height:30px" ><i class="icon-folder-close"></i>&nbsp;' . Str::title($submodul);
                     $submodulID = isset($structModeling[$modul][$submodul]) ? $structModeling[$modul][$submodul]['modulpageid'] : null;
                     $view .= Form::hidden($modul . '[' . $submodul . '][id]', $submodulID);
                     $view .= '</li>';
                     $arrayBal = array();
                     $view .= '<li ><ul class="nav nav-list">';
                     foreach ($subcontent as $action) {
                         $registered = !isset($structModeling[$modul][$submodul][$action]) ? 'class ="alert" style="border:none;background-color:transparent;padding:0px;height:30px;margin-bottom:0px;" ' : 'style="height:30px" ';
                         $view .= '<li ' . $registered . '>';
                         $view .= '<i class="icon-list-alt "></i>&nbsp;' . Str::title($action) . '&nbsp;<em><small>' . Str::title($modul . '/' . $submodul . '/' . $action) . '</small></em>';
                         $actionID = isset($structModeling[$modul][$submodul][$action]) ? $structModeling[$modul][$submodul][$action]['modulpageid'] : null;
                         $view .= Form::hidden($modul . '[' . $submodul . '][' . $action . '][id]', $actionID);
                         $view .= '<div class="span6 form-inline pull-right" >';
                         $actionArrg = isset($structModeling[$modul][$submodul][$action]) ? $structModeling[$modul][$submodul][$action]['arrangement'] : null;
                         $view .= Form::mini_text($modul . '[' . $submodul . '][' . $action . '][arrangement]', $actionArrg, array('class' => 'input-small', 'style' => 'height:10px;width:10px', 'placeholder' => '#'));
                         $actionAlias = isset($structModeling[$modul][$submodul][$action]) ? $structModeling[$modul][$submodul][$action]['actionalias'] : '';
                         $view .= Form::mini_text($modul . '[' . $submodul . '][' . $action . '][actionalias]', $actionAlias, array('class' => 'input-small', 'style' => 'height:10px;font-size:12px;', 'placeholder' => 'Alias'));
                         $view .= '&nbsp;';
                         $actionVisible = isset($structModeling[$modul][$submodul][$action]) ? $structModeling[$modul][$submodul][$action]['visible'] : 0;
                         $actionVisibleChecked = $actionVisible == 1 ? array('checked') : array();
                         $view .= Form::labelled_checkbox($modul . '[' . $submodul . '][' . $action . '][show]', '<em><small>Show</small></em>', null, $actionVisibleChecked);
                         $view .= '&nbsp;';
                         $actionAuth = isset($structModeling[$modul][$submodul][$action]) ? $structModeling[$modul][$submodul][$action]['auth'] : 0;
                         $actionAuthChecked = $actionAuth == 1 ? array('checked') : array();
                         $view .= Form::labelled_checkbox($modul . '[' . $submodul . '][' . $action . '][auth]', '<em><small>Auth</small></em>', null, $actionAuthChecked);
                         $view .= '&nbsp;';
                         $actionAdmin = isset($structModeling[$modul][$submodul][$action]) ? $structModeling[$modul][$submodul][$action]['admin'] : 0;
                         $actionAdminChecked = $actionAdmin == 1 ? array('checked') : array();
                         $view .= Form::labelled_checkbox($modul . '[' . $submodul . '][' . $action . '][admin]', '<em><small>Admin Only</small></em>', null, $actionAdminChecked);
                         $view .= '&nbsp;';
                         $view .= '</div>';
                         $view .= '</li>';
                         unset($structModeling[$modul][$submodul][$action]);
                     }
                     $view .= '</ul></li>';
                     $idiv--;
                     if ($idiv != 0) {
                         $view .= '<li class="divider"></li>';
                     }
                     unset($structModeling[$modul][$submodul]['modulpageid']);
                     unset($structModeling[$modul][$submodul]['arrangement']);
                     unset($structModeling[$modul][$submodul]['controlleralias']);
                     unset($structModeling[$modul][$submodul]['visible']);
                     unset($structModeling[$modul][$submodul]['auth']);
                     unset($structModeling[$modul][$submodul]['admin']);
                     unset($structModeling[$modul][$submodul]['header']);
                     unset($structModeling[$modul][$submodul]['footer']);
                     if (!empty($structModeling[$modul][$submodul])) {
                         $view .= '<li class="alert-error">';
                         foreach ($structModeling[$modul][$submodul] as $deletedaction => $deletedcontent) {
                             $view .= '<ul class="nav nav-list">';
                             $view .= '<li>';
                             $view .= '<i class="icon-remove"></i>&nbsp;' . Str::title($deletedcontent['actionalias']) . '&nbsp;<em>' . $modul . '/' . $submodul . '/' . $deletedaction . '</em>';
                             $view .= Form::hidden($modul . '[' . $submodul . '][' . $deletedaction . '][id]', $deletedcontent['modulpageid']);
                             $view .= '<div class="span6 form-inline pull-right" >';
                             $view .= Form::labelled_checkbox($modul . '[' . $submodul . '][' . $deletedaction . '][remove]', '<em><small>Remove</small></em>');
                             $view .= '</div>';
                             $view .= '</li>';
                             $view .= '</ul >';
                             unset($structModeling[$modul][$submodul][$deletedaction]);
                         }
                         $view .= '</li>';
                     }
                     $view .= '</ul>';
                     if (empty($structModeling[$modul][$submodul])) {
                         unset($structModeling[$modul][$submodul]);
                         unset($structModeling[$modul]['modulalias']);
                     }
                 }
             }
             $view .= '</li>';
             if (empty($structModeling[$modul])) {
                 unset($structModeling[$modul]);
             }
         }
     }
     if (!empty($structModeling)) {
         $view .= '<li class="divider"></li>';
         foreach ($structModeling as $modulDeleted => $contentDeleted) {
             $view .= '<li class="nav-header alert alert-error"><i class="icon-hdd"></i>&nbsp;' . Str::upper($modulDeleted) . '</li>';
             unset($contentDeleted['modulalias']);
             $view .= '<li class="alert alert-error">';
             $view .= '<ul class="nav nav-list">';
             foreach ($contentDeleted as $submodulDeleted => $subcontentDeleted) {
                 $view .= '<li  style="height:30px;">';
                 $view .= '<i class="icon-remove"></i>&nbsp;' . Str::title($subcontentDeleted['controlleralias']) . '&nbsp;<em>' . $modulDeleted . '/' . $submodulDeleted . '</em>';
                 $view .= Form::hidden($modulDeleted . '[' . $submodulDeleted . '][id]', $subcontentDeleted['modulpageid']);
                 $view .= '<div class="span6 form-inline pull-right" >';
                 $view .= Form::labelled_checkbox($modulDeleted . '[' . $submodulDeleted . '][remove]', '<em><small>Remove</small></em>');
                 $view .= '</div>';
                 $view .= '</li>';
                 unset($subcontentDeleted['controlleralias']);
                 unset($subcontentDeleted['visible']);
                 unset($subcontentDeleted['auth']);
                 unset($subcontentDeleted['admin']);
                 unset($subcontentDeleted['header']);
                 unset($subcontentDeleted['footer']);
                 unset($subcontentDeleted['arrangement']);
                 unset($subcontentDeleted['modulpageid']);
                 $view .= '<li >';
                 $view .= '<ul class="nav nav-list">';
                 foreach ($subcontentDeleted as $deletedaction => $deletedcontent) {
                     $view .= '<li style="height:30px;">';
                     $view .= '<i class="icon-remove"></i>&nbsp;' . Str::title($deletedcontent['actionalias']) . '&nbsp;<em>' . $modulDeleted . '/' . $submodulDeleted . '/' . $deletedaction . '</em>';
                     $view .= Form::hidden($modulDeleted . '[' . $submodulDeleted . '][' . $deletedaction . '][id]', $deletedcontent['modulpageid']);
                     $view .= '<div class="span6 form-inline pull-right" >';
                     $view .= Form::labelled_checkbox($modulDeleted . '[' . $submodulDeleted . '][' . $deletedaction . '][remove]', '<em><small>Remove</small></em>');
                     $view .= '</div>';
                     $view .= '</li>';
                     unset($structModeling[$modulDeleted][$submodulDeleted][$deletedaction]);
                 }
                 $view .= '</ul >';
                 $view .= '</li>';
             }
             $view .= '</ul>';
             $view .= '</li>';
         }
     }
     $view .= '</ul>';
     return $view;
 }