<?php 

$this->breadcrumbs = array(
    'Fast Assign' => url('auth/fastassign'),
    'Role' => '',
    $role->description => ''
);

?>
<script type="text/javascript">
<!--
function selectAllChecks(state)
{
  $("input[id*='asscheck']").each(function (i, el) {
    el.checked = state;
  });
}
function switchCheck(id)
{
  $("input[id='"+id+"']").each(function (i, ctrl) {
    ctrl.checked = !ctrl.checked;
  });
}
//-->
</script>
<h1>Assignments for <?php echo($role->description); ?></h1>
<form method="post">
<a onclick="selectAllChecks(true);">Select All</a> - <a onclick="selectAllChecks(false);">Deselect All</a><br>
<input type="submit" value="Assign!">
<ul>
<?php
$checkID = 0;
foreach($items as $item)
{
  echo("<input name=\"original[".$item["name"]."]\" type=\"hidden\" value=".($item["found"]?"\"1\"":"\"0\"").">\n");
  echo("<li title=\"".$item["name"]."\"><input id=\"asscheck$checkID\" name=\"assign[".$item["name"]."]\" type=\"checkbox\" ".($item["found"]?"checked=\"checked\"":"")." value=\"1\">");
  echo("<a onclick=\"switchCheck('asscheck$checkID');\">");
  echo($item["description"]." (".$item["type"].")</a></li>\n");    
  $checkID++;
}
?>
</ul>
<input type="submit" value="Assign!">
</form>

