function list_cols($cols = false, $purs = false) { if ($cols === false) { return "<li>nothing...</li>"; } if ($purs and is_string($purs)) { $purs = explode(",", $purs); } $list = ""; foreach ($cols as $k => $v) { $purview = ""; if (is_array($v['purview']) and $v['purview']) { foreach ($v['purview'] as $pk => $pv) { $checked = false; if ($purs and is_array($purs) and in_array($pv['uri'], $purs)) { $checked = true; } $purview .= '<label class="checkbox">' . form_checkbox('purview[]', $pv['uri'], $checked) . $pv['title'] . '</label>'; } } $more = ""; if ($v['more'] and is_array($v['more'])) { $more .= list_cols($v['more'], $purs); } $list .= '<li data-cid="' . $v['cid'] . '" > ' . '<input type="checkbox" class="checkline" /> <span class="depth' . $v['cdepth'] . '">' . $v['ctitle'] . '</span>' . '<div class="btn-group pull-right form-inline">' . $purview . '</div>' . $more . ' </li>'; } return $list; }
function list_cols($cols = false) { if ($cols === false) { return "<li>nothing...</li>"; } $list = ""; foreach ($cols as $k => $v) { $purview = ""; if (is_array($v['purview']) and $v['purview']) { foreach ($v['purview'] as $pk => $pv) { $status = "badge-success"; if (!$pv['status']) { $status = ""; } $purview .= '<span class="badge ' . $status . '"> ' . '<a href="javascript:void(0)" class="pur" data-status="' . $pv['status'] . '" data-pid="' . $pv['id'] . '">' . $pv['title'] . '</a>' . ' </span>'; } } $more = ""; if ($v['more'] and is_array($v['more'])) { $more .= list_cols($v['more']); } $list .= '<li data-cid="' . $v['cid'] . '" > ' . '<span class="depth' . $v['cdepth'] . '">' . $v['ctitle'] . '</span>' . $purview . $more . ' </li>'; } return $list; }
$checked = true; } $str .= ' <label class="checkbox"> ' . form_checkbox('purview[]', $m['uri'], $checked) . $m['title'] . '</label>'; } $str .= '</div>'; $str .= '</li>'; echo $str; } ?> </ul> <h3> <input type="checkbox" class="checkall" /> 栏目权限 </h3> <ul class="boxed-list"> <?php echo list_cols($cols, $it['purview']); ?> </ul> </div> </div> </div> <!-- end widget body --> <div class="boxed-footer"> <input type="hidden" name="id" value="<?php echo $it['id']; ?> " id="id"> <input type="submit" value=" <?php echo lang('submit'); ?> " class='btn btn-primary'>
$str .= '</span>'; $str .= '<div class="btn-group pull-right form-inline">'; foreach ($v as $m) { $checked = false; $str .= ' <label class="checkbox"> ' . form_checkbox('purview[]', $m['uri']) . $m['title'] . '</label>'; } $str .= '</div>'; $str .= '</li>'; echo $str; } ?> </ul> <h3> <input type="checkbox" class="checkall" /> 栏目权限 </h3> <ul class="boxed-list"> <?php echo list_cols($cols); ?> </ul> </div> </div> </div> <!-- end widget body --> <div class="boxed-footer"> <input type="submit" value=" <?php echo lang('submit'); ?> " class='btn btn-primary'> <input type="reset" value=' <?php echo lang('reset'); ?>