Файл: monst/core/pag/dialog/index.php
Строк: 40
<?
//$_dialog -> remove();
//$_dialog_mess -> remove();
//
//echo 'ok';
//exit;
$on_page = 10;
$find = $_dialog -> find(
[
// 'user' => $user['id'],
'$or' => [
[
'user1' => $user['id']
],
[
'user2' => $user['id']
]
],
]
);
$find -> limit($on_page);
$find -> sort(
[
'last_upd' => -1
]
);
$count = $find -> count();
$nav = nav($on_page);
if ( $count == 0 ) {
?>
<div class='padding'>
<?=$lang['dialog.php']['no_dialogs']?>
</div>
<?
}
foreach ( $find as $f ) {
if ( $f['user1'] == $user['id'] ) {
$dialog_user = $f['user2'];
} else {
$dialog_user = $f['user1'];
}
$find2 = $_dialog_mess -> find(
[
'dialog_id' => $f['id'],
// 'user' => $user['id']
]
);
$find2 -> sort(
[
'time' => -1
]
);
$last_mess_array = 0;
foreach ( $find2 as $f2 ) {
$last_mess_array = $f2;
break;
}
$last_mess = '';
$last_mess_color = 'indianred';
if ( $last_mess_array['user_id'] == $user['id'] ) {
$last_mess .= '<img src="'.av($last_mess_array['user_id']).'" alt="" width="20"/>';
$last_mess_color = 'steelblue';
}
$mess_min = $last_mess_array['mess'];
if ( mb_strlen($mess_min, 'UTF-8') > 50 ) {
$mess_min = mb_substr($mess_min, 0, 50, 'UTF-8') . ' ....';
}
$last_mess .= $mess_min;
if ( !$last_mess_array['read'] ) {
$last_mess = '<span style="color: '.$last_mess_color.';">'.$last_mess.'</span>';
} else {
$last_mess = '<span style="color: #ccc;">'.$last_mess.'</span>';
}
?>
<a href='/dialog/view/<?=$f['id']?>'>
<div style='background: #111; padding: 10px; margin-top: 2px;'>
<img src='<?=av($dialog_user)?>' alt='' width='50' style='float: left; margin-right: 10px;' class='av'/>
<?=Name($dialog_user)?>
<br/>
<?=$last_mess?>
<div style='clear: both;'></div>
</div>
</a>
<?
}
?>
<?
print $nav;