예제 #1
0
 /**
  * @param $actionId
  * @return string
  */
 private static function _itemUrl($actionId)
 {
     if ($actionId > 0) {
         /** @var AdminAction $adminAction */
         $adminAction = AdminAction::preload($actionId);
         if (!empty($adminAction)) {
             /** @var AdminController $adminController */
             $adminController = AdminController::preload($adminAction->controller_id);
             $routeName = 'coaster.admin.' . $adminController->controller . ($adminAction->action == 'index' ? '' : '.' . $adminAction->action);
             if (strpos(Request::route()->getName(), $routeName) === 0) {
                 //self::$_setActive = true;
             }
             return route($routeName);
         }
     }
     return '#';
 }
예제 #2
0
 private function _print_pages($parent)
 {
     $pages_li = '';
     foreach ($this->_child_pages[$parent] as $child_page) {
         $page_lang = PageLang::preload($child_page->id);
         $sub_pages = "";
         if ($child_page->group_container > 0) {
         } elseif (!empty($this->_child_pages[$child_page->id])) {
             $sub_pages = $this->_print_pages($child_page->id);
         }
         $page_actions = AdminAction::where('controller_id', '=', 2)->where('inherit', '=', 0)->where('edit_based', '=', 0)->get();
         $edit_actions = [];
         foreach ($page_actions as $action) {
             if ($action->action == 'index') {
                 $edit_actions['pages'] = false;
             } else {
                 $edit_actions['pages.' . $action->action] = false;
             }
         }
         if (!config('coaster::admin.publishing')) {
             unset($edit_actions['pages.version-publish']);
         }
         $actions = $this->_role_permissions->processed_actions(['page_id' => $child_page->id]);
         $actions = array_merge($edit_actions, array_intersect_key($actions, $edit_actions));
         $page_actions = [];
         foreach ($actions as $action => $value) {
             if ($action == 'pages') {
                 $page_actions['index'] = $value;
             } else {
                 $page_actions[str_replace('pages.', '', $action)] = $value;
             }
         }
         $pages_li .= View::make('coaster::partials.roles.pages.li', array('page_lang' => $page_lang, 'sub_pages' => $sub_pages, 'actions' => $page_actions))->render();
     }
     return View::make('coaster::partials.roles.pages.ul', array('pages_li' => $pages_li));
 }
예제 #3
0
 private function _edit_allowed_action($action_id, $set = true, $page_id)
 {
     $action = AdminAction::preload($action_id);
     $controller = AdminController::preload($action->controller_id);
     $action_name = $controller->controller . '.' . $action->action;
     // add action id and controller_action as keys so both can be checked
     $this->_processed_actions[$page_id][$action->id] = $set;
     $this->_processed_actions[$page_id][$action_name] = $set;
     if ($action->action == 'index') {
         $this->_processed_actions[$page_id][$controller->controller] = $set;
     }
 }