<?php
if (!$this->isXhr) :

    $title = 'Add - Role';
    $this->headTitle($title);

    $this->inlineScript()->appendFile($this->url('roles/js'));
?>
<div class="page-header">
	<h1>Add Role</h1>
</div>
<?php else : ?>
<div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
    <h4 class="modal-title">Add Role</h4>
</div>
<div class="modal-body">
<?php endif; ?>

<?php
    $form = $this->form;
    $form->setAttribute('method', 'post');
    $form->setAttribute('action', $this->url('roles/add'));
    $form->setAttribute('class', 'form-horizontal');
    $form->setAttribute('id', 'form-add');
    $form->prepare();

    $this->form($form);
    echo $this->form()->openTag($form);

    echo $this->formRow($form->get('id'));
    echo $this->formRow($form->get('name'));
    echo $this->formRow($form->get('privileges'));
?>
<?php if (!$this->isXhr) : ?>
<div class="form-group">
    <div class="col-sm-offset-3 col-sm-9">
        <?php
            echo $this->formButton($form->get('save')) . ' ';
            echo '<a href="' . $this->url('roles') . '" class="btn btn-default"><i class="icon icon-arrow-left"></i> Go Back</a>';
        ?>
    </div>
</div>
<?php echo $this->form()->closeTag(); ?>
<?php else : ?>
<?php echo $this->form()->closeTag(); ?>
</div>
<div class="modal-footer">
    <button type="button" class="btn btn-default" data-dismiss="modal"><i class="fa fa-times"></i> Close</button>
    <button type="button" class="btn btn-primary btn-save"><i class="fa fa-save"></i> Save</button>
</div>
<?php endif;