colly_wyx
2018-05-29 d479d9fbcb37f8b861031c94a83d0e37761210c5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
 
    <section class="content-header">
      <h1>
        用户组管理
      </h1>
      <ol class="breadcrumb">
        <li><a href="/admin/index/index"><i class="fa fa-dashboard"></i> 平台首台</a></li>
        <li><a href="/role/role/list">用户组管理</a></li>
        <li class="active">修改用户组</li>
      </ol>
    </section>
 
    <!-- Main content -->
    <section class="content">
        <div class="box-body pad">
          <!-- general form elements -->
          <div class="box box-primary">
            <div class="box-header with-border">
              <h3 class="box-title">修改用户组</h3>
            </div>
            <!-- /.box-header -->
            <!-- form start -->
            <form role="form" id="validateform">
              <div class="box-body">
                <div class="form-group">
                  <label >用户组名</label>
                  <input type="text" class="form-control" id="name" name="name" placeholder="用户组名" value="<?php echo $role['name']?>">
                </div>
                <div class="form-group">
                  <label >用户组描述</label>
                  <textarea class="form-control" id="description" name="description"><?php echo $role['description']?></textarea>
                </div>
                <div class="form-group">
                  <label >用户组权限</label>
                  <?php
                   $role_auth = explode(',', $role['modules']);
                   $first_modules = array();
                   $second_modules = array();
                   $third_modules = array();
                   foreach ($modules as $key => $module){
                      if($module['level'] == 1){
                        $first_modules[] = $module;
                      }
                      elseif($module['level'] == 2){
                        $second_modules[] = $module;
                      }
                      elseif($module['level'] == 3){
                        $third_modules[] = $module;
                      }
                      unset($modules[$key]);
                   }
                  ?>
                  <?php foreach ($first_modules as  $f_module):?>
                    <div class="checkbox">
                      <label>
                         <input type="checkbox" <?php echo in_array($f_module['_id'], $role_auth)?"checked":"";?> class="minimal module" id="actions" name="actions[]" value="<?php echo $f_module['_id'];?>">
                         <?php echo $f_module['name'];?>
                      </label>
                    
                    <?php foreach ($second_modules as  $s_module):?>
                      <?php if($s_module['parent'] == $f_module['_id']):?>
                      <div class="checkbox">
                      &nbsp; &nbsp;&nbsp; &nbsp;└
                        <label>
                        <input type="checkbox" <?php echo in_array($s_module['_id'], $role_auth)?"checked":"";?> class="minimal module" id="actions" name="actions[]" value="<?php echo $s_module['_id'];?>" >
                         <?php echo $s_module['name'];?>
                        </label>
                      
                      <?php foreach ($third_modules as $t_module):?>
                        <?php if($t_module['parent'] == $s_module['_id']):?>
                        <div class="checkbox">
                        &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;└
                          <label>
                          <input type="checkbox" <?php echo in_array($t_module['_id'], $role_auth)?"checked":"";?> class="minimal module" id="actions" name="actions[]" value="<?php echo $t_module['_id'];?>" >
                           <?php echo $t_module['name'];?>
                          </label>
                        </div>
                        <?php endif;?>
                      <?php endforeach;?>
                      </div>
                      <?php endif;?>
                    <?php endforeach;?>
                    </div>
                  <?php endforeach;?>
                 
                 
 
                </div>
              </div>
              <!-- /.box-body -->
 
              <div class="box-footer">
                <button type="submit" class="btn btn-primary" id="dosubmit">保存</button>
              </div>
            </form>
          </div>
    </div>
  </section>
  <script src="/themes/AdminLTE/bootstrap/js/bootstrapValidator.min.js"></script>
<script type="text/javascript">
  var SITE_URL = '<?php echo Yaf_Registry::get('var')['site_url']; ?>';
  var ID = '<?php echo $role['_id'];?>';
</script>
<script src="/static/<?php echo $route['module']?>/<?php echo $route['controller']?>/js/<?php echo $route['action']?>.js"></script>