<?php $this->pageTitle=Yii::app()->name . ' | '.UserModule::t("Profile");

$this->menu=Yii::app()->controller->getMenu();
/*array(
	((UserModule::isAdmin())
		?array('label'=>UserModule::t('Manage Users'), 'url'=>array('/user/admin'))
		:array()),
    array('label'=>UserModule::t('List User'), 'url'=>array('/user')),
    array('label'=>UserModule::t('Profile'), 'url'=>array('/user/profile'),'itemOptions' => array('class' => ($this->action->id=='profile')?'active':'')),
    array('label'=>UserModule::t('Edit'), 'url'=>array('edit')),
    array('label'=>UserModule::t('Change password'), 'url'=>array('changepassword')),
    array('label'=>UserModule::t('Logout'), 'url'=>array('/user/logout')),
);*/
?>
<?php
$this->beginWidget(
    'booster.widgets.TbPanel',
    array(
        'title' => UserModule::t('Your profile'),
        'headerIcon' => 'user',
        //'htmlOptions' => array('class' => 'well'),
    )
);
?>
<?php if(Yii::app()->user->hasFlash('profileMessage')): ?>
    <div class="alert alert-block alert-success">
        <?php echo Yii::app()->user->getFlash('profileMessage'); ?>
    </div>
<?php endif; ?>

<?php

$profileFields=ProfileField::model()->forOwner()->sort()->findAll();
$detailProfile=array();
if ($profileFields) {
    foreach($profileFields as $field) {
        //echo "<pre>"; print_r($profile); die();
        $item['label'] = UserModule::t($field->title);
        $item['value'] = $profile->getAttribute($field->varname);
        $detailProfile[] = $item;
    }
}

$detailUser = array(
    'username',
    'email',
    'create_at',
    'lastvisit_at',
    array(
        'name'=>'status',
        'value'=>User::itemAlias("UserStatus",$model->status)
    )
);

$detail = array_merge($detailProfile,$detailUser);
$this->widget(
    'booster.widgets.TbDetailView',
    array(
        'type'=>'condensed striped',
        'data' => $model,
        'attributes' => $detail
    )
);
?>

<?php $this->endWidget(); ?>