<?php 

$this->breadcrumbs = array(
    'Fast Assign' => url('auth/fastassign'),
    'User' => '',
    $user->fullName => ''
);

?>
<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($user->fullName); ?></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"]."</a>\n");
    switch($item["type"])
  {
    case 'Role':
      echo(" ----- (<a href=\"".url("auth/fastassign/role",array('role'=>$item["name"]))."\">".$item["type"]."</a>)\n");
    break;
    case 'Task':
      echo(" ----- (<a href=\"".url("auth/fastassign/task",array('task'=>$item["name"]))."\">".$item["type"]."</a>)\n");
    break;
    default:
      echo(" (".$item["type"].")\n");
    break;
  }    
  echo("</li>\n");
  $checkID++;
}
?>
</ul>
<input type="submit" value="Assign!">
</form>

