<?php
$text = (strlen($data->usersMessages[0]->message) > 50 ? mb_substr($data->usersMessages[0]->message, 0, 47, 'utf-8').'...' : $data->usersMessages[0]->message);
$is_new = ($data->usersMessages[0]->id_user == $data->id_subuser && $data->usersMessages[0]->status == 1 ? true : false);
?>
<a href="<?php echo $this->createUrl('/mail/list/', array('id' => $data->id_subuser));?>" class="dialogs_block">
    <div class="dialogs_block-user">
        <div class="pull-left"><?php echo $is_new  ? '[Новое]' : '';?> <?php echo Users::getFullLogin($data->id_subuser); ?></div>:
        <div class="pull-right">
            <?php echo FuncHelper::time($data->usersMessages[0]->time); ?>
        </div>
        <div class="clearfix"></div>
    </div>
    <div class="dialogs_block-message">
        <?php if (RoleCategories::checkRoleForAdmins($data->usersMessages[0]->idUser->idRole->id_cat_role)): ?>
            <span class="text-success"><?php echo FuncHelper::outputText($text); ?></span>
        <?php else: ?>
            <?php echo FuncHelper::outputText($text, true, true, true, false, false); ?>
        <?php endif; ?>
    </div>
</a>