<?php
$userList = array('' => '') + $this->dao->select('account, realname')->from(TABLE_USER)->where('deleted')->eq('0')->andWhere('parent')->eq('')->fetchPairs();
unset($userList[$user->account]);
$userList = html::select('parent', $userList, $user->parent, "class='form-control'");
$unofficialChecked = $user->unofficial ? "checked='checked'" : '';
$noSalaryChecked   = $user->noSalary ? "checked='checked'" : '';
$html = <<<EOT
<tr>
  <th>{$lang->user->parent}</th>
  <td>
    <div class='input-group'>
      {$userList}
      <span class='input-group-addon'>
        <label class='checkbox-inline'>
          <input type='checkbox' name='unofficial' id='unofficial' value='1' {$unofficialChecked} /> {$lang->user->unofficial}
        </label>
      </span>
      <span class='input-group-addon'>
        <label class='checkbox-inline'>
          <input type='checkbox' name='noSalary' id='noSalary' value='1' {$noSalaryChecked} /> {$lang->user->noSalary}
        </label>
      </span>
    </div>
  </td>
</tr>
EOT;
?>
<script>
$('fieldset.fieldset-primary table tbody').append(<?php echo helper::jsonEncode($html);?>);
$('#parent').chosen();
</script>
