<div class="container"  style="padding-top:42px;">
	<div class="row">
	   <div class="span12"><div class="page-header">
			<h1><i class="icon-user icon-large"></i> 用户列表<div class="pull-right btn-group"><a href="" id="form" class="btn btn-primary"><i class="icon-plus-sign icon-white"></i> 添加用户</a></div></h1>
		</div>
		<div id="form-content" style="display:none">
			<form class="form-horizontal" method="post" action="?c=emailsystem&m=users_add">
				<h4>添加用户</h4>
				<div class="control-group">
          			<label class="control-label" for="name">用户名</label>
          				<div class="controls">
            				<input type="text" class="input-xlarge" id="name" name="name">
          				</div>
        		</div>
				<div class="control-group">
          			<label class="control-label" for="email">电子邮箱</label>
          			<div class="controls">
            			<input type="email" class="input-xlarge" id="email" name="email">
          			</div>
        		</div>
				<div class="control-group">
          			<label class="control-label" for="group">分组</label>
            		<div class="controls">
            			<select name="group" value="<?php echo $group[0]->id; ?>">
		                   <?php
		                   		foreach($group as $key=>$val){
		                   			echo "<option value=\"{$val->id}\">{$val->name}</option>";
		                   		}
		                   ?>
            			</select>
            		</div>
				</div>
				<div class="form-actions">
					<button type="submit" class="btn btn-primary">保存</button>
				</div>
			</form>
		</div>
	<div class="btn-group">
		<a class="btn btn-small btn-inverse" data-toggle="dropdown" href="javascript:void(0);" style="">分组<span class="caret"></span></a>
		<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
			<li><a href='?c=emailsystem&m=users&users=all' ><i class="icon-random"></i> 所有分组 </a></li>
			<li class="dropdown-submenu">
				<a tabindex="-1" href="#">选择分组</a>
                    <ul class="dropdown-menu">
                    	<?php
                    		foreach($group as $key=>$val){
                    			echo "<li><a href=\"?c=emailsystem&m=users&users=all&group={$val->id}\"><i class=\"icon-angle-right\"></i> {$val->name}</a></li>";
							}
                    	?>
                    </ul>
 			</li>
		</ul>
		<?php
			echo $spstr;
		?>
		<a href="#" class='btn btn-small btn-inverse disabled'>总数: <span class="label label-info"><?php echo $count; ?></span></a>
	</div>
	<hr/>
    <br>
	<table class="table table-bordered table-striped">
		<thead>
			<tr>
				<th class="span1">##</th>
				<th class="span2">所属分组</th>
				<th class="span2">电子邮箱</th>
				<th>用户名称 </th>
				<th class="span1">操作</th>  
			</tr>
		</thead>
		<tbody>
			<?php
				foreach($users as $key=>$val){
			?>
				<tr>
					<td><?php echo $val->id; ?></td>
					<td><?php echo $val->gname; ?></td>
					<td><ul style="list-style:none; margin:0px; padding:0px"><li><?php echo $val->email; ?></li></ul></td>
					<td><?php echo $val->user; ?></td>
					<td>
						<div class="btn-group">
							<a class="btn btn-primary dropdown-toggle" data-toggle="dropdown" href="#">操作<span class="caret"></span></a>
								<ul class="dropdown-menu">
	                                      <!-- dropdown menu links -->
									<li><a href="<?php echo base_url('index.php/emailsystem/edit_users') ?>/<?php echo $val->id; ?>" title="Edit" ><i class="icon-pencil"></i> 编辑</a></li>
									<li class="divider"></li>
									<li><a href="<?php echo base_url('index.php/emailsystem/del_users') ?>/<?php echo $val->id; ?>" onClick="return confirm('你确定要删除该用户?');"><i class="icon-remove-sign"></i> 删除</a></li>
								</ul>
						</div>
					</td>
				</tr>
			<?php
				}
			?>                     
			</tbody>
		</table>
	<div class="pagination pagination-centered">
		<?php if(isset($this->paginationres)){$this->paginationres->show();} ?>
	</div>
	<hr/>
</div>
</div>
</div>
<script>
	$('#form').click(function() {
					$('#form-content').slideToggle('fast');
					return false;
	});	
</script>
</body>
</html>
