/** * btn select 生成器 * @param string field 字段 * @param any default 默认值 * @param array $arr 列表表 [{title:xxx,value:xxx}],分类 会将 value 取 id * @return html */ function ui_btn_select($field = false, $default = false, $arr = false) { if ($field === false or $arr === false or $default === false) { return false; } $tmp = '<select name="' . $field . '" id="' . $field . '" class="bselect">'; // 保证array中有 title ,value foreach ($arr as $k => $v) { // 针对分类 if (isset($v['id'])) { $value = $v['id']; } else { $value = $v['value']; } // 对深度支持 $depth = ''; $more = ''; if (isset($v['depth'])) { $depth = 'data-option-depth="' . $v['depth'] . '"'; } if (isset($v['more'])) { $more = 'data-option-more="' . $v['more'] . '"'; } $tmp .= '<option value="' . $value . '"' . $depth . $more . set_switch($field, $value, $default, ' selected="selected" class="option-select" ', '') . '>' . $v['title'] . '</option>'; } $tmp .= '</select>'; return $tmp; }
function set_checked($field = '', $value = false, $default = false, $str = false, $str2 = '') { if ($str === false) { $str = ' checked="checked" '; } return set_switch($field, $value, $default, $str, $str2); }
</div> <?php //TODO:权限禁用 ?> <div class="control-group"> <label class="control-label" for="status">用户状态</label> <div class="controls"> <div class='btn-group btn-switch'> <a href="#" data-value="1" class="btn <?php echo set_switch('status', 1, 1, 'btn-primary'); ?> "> 正常 </a> <a href="#" data-value="0" class="btn <?php echo set_switch('status', 0, 1, 'btn-primary'); ?> "> 禁用</a> </div> <input type="hidden" id="status" name="status" value="<?php echo set_value('status', 1); ?> "> </div> </div> <div class="control-group"> <label class="control-label" for="email">邮箱</label> <div class="controls"> <input type="text" id="email" name="email" value="<?php echo set_value('email');
</div> </div> <div class="control-group"> <div class="input-prepend"> <span class="add-on"><i class="fa fa-lock"></i></span> <input type="password" name="pwd" id="pwd" placeholder="<?php echo lang('password'); ?> " required /> </div> </div> <div class="control-group"> <label class="checkbox"> <input type="checkbox" name="rember" value="1" id="rember" class="select-it" <?php echo set_switch('rember', '1'); ?> > <?php echo lang('remberme'); ?> </label> </div> </div> <div class="boxed-footer"> <input id='submit' type="submit" value="<?php echo lang('login'); ?> " class="btn btn-primary"> <a id="btn-lostpass" href="#" class="pull-right" style="padding-top:5px;" > <?php echo lang('password_lost');
//TODO:权限禁用 ?> <?php if ($this->session->userdata('gid') == 1) { ?> <div class="control-group"> <label class="control-label" for="status">用户状态</label> <div class="controls"> <div class='btn-group btn-switch'> <a href="#" data-value="1" class="btn <?php echo set_switch('status', 1, $it['status'], 'btn-primary'); ?> "> 正常 </a> <a href="#" data-value="0" class="btn <?php echo set_switch('status', 0, $it['status'], 'btn-primary'); ?> "> 禁用</a> </div> <input type="hidden" id="status" name="status" value="<?php echo set_value('status', $it['status']); ?> "> </div> </div> <?php } ?> <div class="control-group"> <label class="control-label" for="email">邮箱</label>