<?php   
$question = Zend_Locale::getQuestion(); 
?>
<div class="hastable">
    <table class="table table-striped table-bordered table-condensed">
        <thead>
            <tr>
                <td colspan="5">
                    <span class="pull-right">
                        <a href="<?php echo $this->url( array( 'action' => 'save' ) ); ?>" class="btn btn-primary">
                            <span class="fa fa-plus"></span>
                            <?php echo $this->translate( '#create#' ); ?>
                        </a>
                    </span>

                    <?php echo $this->paginationControl( $this->paginator ); ?>
                </td>
            </tr>
            <tr>
                <th><?php echo $this->translate( '#name#' ); ?></th>
                <th><?php echo $this->translate( '#email#' ); ?></th>
                <th><?php echo $this->translate( '#type#' ); ?></th>
                <th><?php echo $this->translate( '#visible#' ); ?></th>
                <th width="100"></th>
            </tr>
            <form id="searchForm">
            <tr class="search-row">
            	<td><?= $this->formText('name',$this->search['name'],array('style'=>'width:96%'))?></td>
            	<td><?= $this->formText('email',$this->search['email'],array('style'=>'width:96%'),$this->memberList)?></td>
            	<td><?= $this->formSelect('type',$this->search['type'],array('style'=>'width:96%'), array( '' => '') + Contact_Model_Contact_Table::$types ) ?></td>
            	<td><?= $this->formSelect('isPublic',$this->search['isPublic'],array('style'=>'width:96%'),array(''=>'',0=>$question['no'],1=> $question['yes']))?></td>
            	<td>
                    <button class="btn btn-default" title="<?= $this->translate('#search#') ?>"><i class="fa fa-search"></i></button>
                </td>
            </tr>
            </form>
        </thead>

        <tbody>
<?php   
		if ( count( $this->paginator ) ) {
			foreach ( $this->paginator as $item ) { ?>
            <tr>
                <td><?php echo empty( $item->nickname ) ? $item->name .' '. $item->firstname : $item->nickname; ?></td>

                <td><?php echo $item->email; ?></td>

               
			    <td><?php echo $item->type; ?></td>
				<td><?= $item->isPublic==0?$question['no']:$question['yes'] ?></td>
                <td>
                    <span  class="actions btn-group">
                    <a href="<?php echo $this->url( array( 'action' => 'save', 'id' => $item->id ) ); ?>" class="btn btn-default btn-small" title="<?php echo $this->translate( '#edit#' ); ?>"><i class="fa fa-pencil-square-o"></i></a>

                    <a href="<?php echo $this->url( array( 'action' => 'delete', 'id' => $item->id ) ); ?>" class="btn btn-small btn-danger" title=" <?php echo $this->translate( '#delete#' ); ?>">
                        <i class="fa fa-trash-o"></i></a>
                    </span>
                </td>
            </tr>
<?php       } 
		} else { ?>
    	<tr><td colspan="5"><?php echo $this->translate( '#this list is empty#' ); ?></td></tr>
<?php   } ?>
        </tbody>

        <tfoot>
            <tr>
                <td colspan="5">
                    <span class="pull-right">
                        <a href="<?php echo $this->url( array( 'action' => 'save' ) ); ?>" class="btn btn-primary">
                            <span class="fa fa-plus"></span>
                            <?php echo $this->translate( '#create#' ); ?>
                        </a>
                    </span>

                    <?php echo $this->paginationControl( $this->paginator ); ?>
                </td>
            </tr>
        </tfoot>
    </table>
</div>
