<?php $identity_id = $identity->getId();?>
<div class="user-summary roundcorner clearfix">
  <div class="user-images">
    <div class="user-image">
<?php   if ($user_image = $identity->getImage()):?>
      <img src="<?php echo $user_image;?>" alt="<?php _h($identity->getUsername());?>" />
<?php   endif;?>
<?php   if ($this->User->hasPermission('user image edit any') || ($identity_id == $this->User->getId() && $this->User->hasPermission('user image edit own'))):?>
      <span class="user-image-edit"><a href="<?php echo $this->URL->create(array('path' => '/' . $identity_id . '/edit_image'));?>"><?php $this->_e('Edit image');?></a></span>
<?php   endif;?>
      <ul class="user-stat">
        <li><span class="user-stat-label"><?php $this->_e('User since: ');?></span><?php echo $this->Time->ago($identity->getTimeCreated(), true);?></li>
        <li><span class="user-stat-label"><?php $this->_e('Last login: ');?></span><?php if ($identity_stat && ($last_login = $identity_stat->get('last_login'))): echo $this->Time->ago($last_login, true); else: $this->_e('N/A'); endif;?></li>
      </ul>  
    </div> 
    <div class="user-status-point"></div>
    <div class="user-status">
      <div id="plugg-user-statusform"></div>
      <div id="plugg-user-status" class="clearfix">
<?php   if ($identity_status) echo $identity_status_text = $identity_status->get('text_filtered');?>
<?php   if ($is_owner || $this->User->hasPermission('user status edit any')):?> 
<?php     if (!$identity_status || empty($identity_status_text)):?>
        <p><?php $this->_e('Enter your message here');?></p>
<?php     endif;?>
        <div class="user-status-edit"><?php $this->HTML->linkToRemote($this->_('Edit'), 'plugg-user-statusform', array('path' => '/' . $identity_id . '/edit_status'), array(), array('other' => "jQuery('#plugg-user-status').hide(); jQuery('#plugg-user-statusform').show();"), array('title' => $this->_('Edit')));?></div>
<?php   else:?>
<?php     if (!$identity_status || empty($identity_status_text)):?>
        <p>...</p>
<?php     endif;?>  
<?php   endif;?>
      </div>
    </div>
    <div class="user-widgets-mini"> 
<?php   if (!empty($widgets[1])):?>
<?php     foreach ($widgets[1] as $widget):?>
      <div class="user-widget">
<?php       echo $widget['content'];?>
      </div>
<?php     endforeach;?>
<?php   endif;?>
    </div>
  </div>
  <div class="user-widgets">
<?php   if (!empty($widgets[0])): $widget = array_shift($widgets[0]);?>
    <div class="user-widget user-widget-top">
<?php     echo $widget['content'];?>
    </div>
<?php     foreach ($widgets[0] as $widget):?>
    <div class="user-widget">
<?php       echo $widget['content'];?>
    </div>
<?php     endforeach;?>
<?php   endif;?>
  </div>
</div>