<div class="blocktitle">Users List</div>  
 <div class="tar borb"> 
    <?php echo $this->Html->link('Add User',array('controller'=>'networks','action'=>'addUser',$this->params['pass'][0]),array('escape'=>false,'class'=>'btn btn-mini'));?>
</div> 

<div style="clear: both;"></div>
<div class="w99p pdl10">
    <?php if($this->params['pass'][1]){?>
        <?php echo $this->params['pass'][1];}else{?>
    <div class="row-fluid searchForm">
    	<div style="margin-top: 20px">
    		<?php  
            echo $this->Form->create('Networkjoin', array('type' => 'file'),array('controller'=>'networks','action'=>'users',$this->params['pass'][0]));  
            echo '<div class="col-md-3">';
            echo $this->Form->input('join_id', array('type' => 'text','label'=>false,'class'=>'form-control','placeholder'=>'User Key'));
            echo '</div>';
            echo '<div class="col-md-3">';
            echo $this->Form->input('name', array('label'=>false,'placeholder'=>'Name','type' => 'text','class'=>'form-control'));
            echo '</div>';
            echo '<div class="col-md-3">';
            echo $this->Form->input('email', array('label'=>false,'placeholder'=>'Email','type' => 'text','class'=>'form-control'));
            echo '</div>'; 
            echo '<div class="col-md-3">';
            echo '<button type="submit" class="btn btn-mini">Search</button>';
            echo '<button type="reset" class="btn btn-mini ml5">Clear</button>';
            echo '</div>'; 
            echo $this->Form->end();  
            ?>
    	</div>
		<div style="clear: both;"></div>
    	<table  class="table table-condensed" style="width: 100%;font-size:14px;">
    		<thead>
    			<tr>
    				<th>#</th>
    				<th>Name</th>
	    			<th>Email</th>
	    			<th>Join Date</th>
    			</tr> 
    		</thead>
    		<tbody>
    		<?php foreach($networkjoins as $key => $user):?>
    			<tr>
    				<td><?= $key+1 ?></td>
                    <?php if($user['Networkjoin']['profile_id'] == null):?>
                    <td>
                        <?php $name = $user['Networkjoin']['user_name'];
                        echo $this->Html->link($name,array('controller'=>'networks','action'=>'users',$this->params['pass'][0],base64_encode($user['Networkjoin']['id'])),array('escape'=>false));
                        ?>
                        
                    </td>  
                    <td><?= $user['Networkjoin']['user_email']?></td>  
                    <?php else:?>
                    <td> 
                        <?php
                        $name = $user['Profile']['fname'].' '.$user['Profile']['lname'];
                        echo $this->Html->link($name,array('controller'=>'networks','action'=>'users',$this->params['pass'][0],base64_encode($user['Networkjoin']['id'])),array('escape'=>false));
                        ?>
                    </td>  
                    <td><?= $user['Profile']['User']['username']?></td>   
                    <?php endif;?>
                    <td><?= date('Y-m-d',strtotime($user['Networkjoin']['created']))?></td>
                </tr>
            <?php endforeach;?>
    		</tbody>   
        </table>
	</div>
<?php }?>
</div>
<style type="text/css">
    .searchForm input{
        height: 30px !important;
    }
</style>