/** * 递归select中的option下拉表单,用于权限增加和编辑 * * @param array $datas 数据源 * @param mixed $prefix 下拉表单的线,只能传false * @return html 返回组装好的option代码 */ public function acllist(array $datas, $pid, $prefix = false) { $html = ''; if (!$this->son) { $this->son = \App\Services\Admin\Tree::getSonKey(); } foreach ($datas as $key => $value) { if ($prefix === false) { if ($pid != $value['id'] && $pid != 'all') { continue; } } $line = ($prefix === false ? '' : $prefix) . '┆┄'; $html .= view('admin.acl.list', compact('value', 'prefix')); if (isset($value[$this->son]) && is_array($value[$this->son])) { $html .= $this->acllist($value[$this->son], $pid, $line); } } return $html; }
/** * 返回内容区域的菜单 */ protected function getContentMenu() { $this->list = SC::getUserPermissionSession(); foreach ($this->list as $key => $value) { if ($value['display'] == self::DISABLE_NONE) { unset($this->list[$key]); } } $this->menuTree = (array) Tree::genTree($this->list); $son = \App\Services\Admin\Tree::getSonKey(); $mcaName = \App\Services\Admin\MCAManager::MAC_BIND_NAME; $MCA = app()->make($mcaName); foreach ($this->menuTree as $key => $value) { if (isset($value[$son]) and is_array($value[$son])) { foreach ($value[$son] as $skey => $svalue) { if (!$MCA->matchSecondMenu($svalue['module'], $svalue['class'], $svalue['action'])) { continue; } if (isset($svalue[$son]) and is_array($svalue[$son])) { return $svalue[$son]; } } } } return []; }