Example #1
0
 private function ajaxSub($id = 0)
 {
     if (!Groups::check('site', Groups::getAuth('site', 'update_full_admin'))) {
         return;
     }
     $group = Groups::findOrCreate('id', $id);
     $get = [];
     foreach (Groups::$authorization as $k => $v) {
         if (!isset($get[$k])) {
             $get[$k] = [];
         }
         $name = "auth_{$k}";
         foreach ($v as $key => $value) {
             $get[$k][$key] = $this->isActive($k, $key, $group->{$name});
         }
         $this->set($k, $get[$k]);
     }
     if ($group->id == 0) {
         $url = Router::url('admin:group.insert');
     } else {
         $url = Router::url('admin:group.update', ['id' => $group->id]);
     }
     $this->set(['group' => $group, 'url' => $url]);
     $this->render('admin/groups_spec');
 }