<?php
/* @var $this UserController */
/* @var $model User */
//$this->breadcrumbs = array(
//    'Users' => array('index'),
//    $model->id,
//);
$userStatus = Yii::app()->user->getState('__statusAdmin');
$user_id = Yii::app()->user->getState('__userid');


if ($userStatus == 'Admin') {
//    $this->menu = array(
//	array('label'=>'List User', 'url'=>array('index')),
//        array('label' => 'Create Company', 'url' => array('/company/createusercompany/', 'user_id' => $model->id)),
//	array('label'=>'Update User', 'url'=>array('update', 'id'=>$model->id)),
//	array('label'=>'Delete User', 'url'=>'#', 'linkOptions'=>array('submit'=>array('delete','id'=>$model->id),'confirm'=>'Are you sure you want to delete this item?')),
//	array('label'=>'Manage User', 'url'=>array('admin')),
//    );
} else {
    $this->menu = array(
        array('label' => 'Edit Profile', 'url' => array('/user/update/' . Yii::app()->user->getState('__userid'))),
            //array('label' => 'Create Company', 'url' => array('/company/createusercompany/', 'user_id' => $model->id)),
            //array('label' => 'Upload Company', 'url' => array('/user/uploadcompany/')),
            //array('label' => 'Manage Company', 'url' => array('/company/useradmin/', 'id' => $user_id)),
    );
}
?>

<h4> My Profile <?php //echo $model->username;   ?></h4>

<?php
$this->widget('zii.widgets.CDetailView', array(
    'data' => $model,
    'attributes' => array(
        'id',
        'username',
        'password',
        'phone',
        'email',
        'created_at',
        'lastvisit_at',
//        'superuser',
//        'status',
    ),
));
?>

<hr>
<?php
$count = 1;
foreach ($company_model as $value) {
    print '<h4>Company # ' . $count . '</h4>';
    print '<table id="yw0" class="detail-view">';
    print '  <tbody>';
    print ' <tr class="even">';
    print ' <td>Name</td>';
    print ' <td>  ' . $value->name . '</td>';
    print ' </td>';
    print ' <tr class="odd">';
    print ' <td>Address</td>';
    print ' <td>  ' . $value->adress . '</td>';
    print ' </td>';
    print ' </tbody>';
    print '</table>';
    $count++;
}

if ($userStatus == 'Admin') {
    echo CHtml::submitButton('Back', array('submit' => array('/user/admin/'), 'class' => 'btn btn-secondary'));
}
//echo CHtml::submitButton('Back', array('submit' => array('/user/admin/'), 'class' => 'btn btn-secondary')); 
?>
