<?php
class myBlock extends control
{
    public function printProfileBlock($blockID)
    {
        $block = $this->block->getByID($blockID);
        if(empty($block)) return false;

        $user = $this->loadModel('user')->getByAccount($this->app->user->account);
        $this->app->loadLang('user');

        $html = '<div><table class="table table-form table-borderless"><tr>';

        if(!empty($user->avatar)) $html .= '<td><img class="center-block" style="max-width:50%;clip-path:circle(closest-side);" src="'.$user->avatar.'" /></td>';
        if(empty($user->avatar))  $html .= '<td>'.html::a(helper::createLink('user', 'profile'), "<i class='icon-paint-brush'></i> " . $this->lang->user->goUploadAvatar, "data-toggle='modal' data-id='profile' class='btn btn-primary center-block' style='width:140px;display:block;'").'</td>';

        $html .= '<td><table>';
        $html .= '<tr><td class="text-right"><strong>'.$this->lang->user->email.'</strong></td><td>'.(empty($user->email) ? $this->lang->user->notset : $user->email).'</td></tr>';
        $html .= '<tr><td class="text-right"><strong>'.$this->lang->user->mobile.'</strong></td><td>'.(empty($user->mobile) ? $this->lang->user->notset : $user->mobile).'</td></tr>';
        $html .= '<tr><td class="text-right"><strong>'.$this->lang->user->phone.'</strong></td><td>'.(empty($user->phone) ? $this->lang->user->notset : $user->phone).'</td></tr>';
        $html .= '<tr><td class="text-right"><strong>'.$this->lang->user->qq.'</strong></td><td>'.(empty($user->qq) ? $this->lang->user->notset : $user->qq).'</td></tr>';
        $html .= '<tr><td/><td>'.html::a(helper::createLink('user', 'editself'), "<i class='icon-pencil'></i> " . $this->lang->user->editProfile, "data-toggle='modal' data-id='profile' class='btn btn-primary'").'</td></tr>';
        $html .= '</table></td>';

        $html .= '</tr></table></div>';

        die($html);
    }
}
