<script type="text/javascript">
function checkall(checker)
{
    $('input').each(function()
    {
        $(this).attr("checked", checker.checked)
    });
}

function submitDone(){
    alert("设置成功");
    //window.location.reload();
}
//-->
</script>
<div class="form">
<?php $form=$this->beginWidget('CActiveForm', array(
    'id'=>'author-form',
    'enableAjaxValidation'=>false,
));
?>

<fieldset>
<legend><?php echo $title;?></legend>
<label>
    <?php echo CHtml::hiddenField('name', $name);?>
    <?php echo '权限名:'.$name ?>
</label>
<br>

<label>
   用户列表:
</label>
<table class="widefat post" id="roles">
<tr>
<?php foreach ($users as $user):?>
<td width="200px">
<label>
<input type="checkbox" name="assign[]" <?php if (is_array($hasuser) && in_array($user, $hasuser)):?> checked="checked" <?php endif;?> value="<?php echo $user;?>">
 <?php echo $user;?>
</label>
 </td>
<?php if((++$i)%6==0):?>
 </tr>
  <tr>
 <?php endif;?>
 <?php endforeach;?>
  </tr>
</table>

<br>
<input type='checkbox' onclick='checkall(this)' />全选
<?php echo CHtml::ajaxSubmitButton('提交',array('authorityassign'),array('success'=>'submitDone()'));?>
 </fieldset>
 <?php $this->endWidget();?>
</div>
