<?
/*
* $name описание действий объекта 
*/
if ($type == 'notes' && $post['avtor'] != $user['id']) // дневники
{
	  $name = 'создал' . ($avtor['pol'] == 1 ? null : "а") . ' новую запись';
}

/*
* Вывод блока с содержимым 
*/
if ($type  ==  'notes')
{
    $diary = mysql_fetch_assoc(mysql_query("
                  SELECT n.*, 
                    (SELECT COUNT(*) FROM notes_komm AS k WHERE k.id_notes = n.id) AS comments,
                    (SELECT COUNT(*) FROM notes_count AS c WHERE c.id_notes = n.id) AS view,
                    (SELECT COUNT(*) FROM notes_like AS l WHERE l.id_notes = n.id AND l.like = '1') AS 'like',
                    (SELECT COUNT(*) FROM notes_like AS l WHERE l.id_notes = n.id AND l.like = '0') AS 'dlike'
                  FROM notes AS n WHERE n.id = " . $post['id_file']));
    
    if (isset($diary['id'])) {
        ?>
        <div class="list-post">
        <?
          if ($diary['attachments']) {  
              $attach = unserialize($diary['attachments']);
          } else {
              $attach = array();
          }
          ?>
          <div class="list-post-item">
            <div class="list-post-header">
              <span class="list-post-time">
              <?= Diary::vremja($diary['time'])?>
              </span>
              
              <?= $avtor['avatar']?> <?= $avtor['icon']?> <?= $avtor['nick']?> <?= $avtor['online']?> 
              <a href="user.settings.php?id=<?= $avtor['id']?>">[!]</a>
              <a href="/plugins/diary?f=diary&amp;s=n&amp;id=<?= $diary['id']?>"><?= Diary::get_name($diary['name'], $diary['msg'])?></a>
            </div>
            
            <div class="list-post-item-text">
              <?= Diary::get_name(null, $diary['msg'], 220)?>..
            </div>
            
            <? if (isset($attach['photo'])) { ?>
              <div class="attach">
                <? foreach($attach['photo'] AS $file) { ?>
                  <img src="/user/attachments/download/photo/<?= $file['fileSize']?>_50/<?= $file['fileId']?>/<?= $file['fileNameSend']?>" />
                <? 
                break;
                } ?>
              </div>      
            <? } ?>
            
            <div class="list-post-item-panel">
              <div class="list-post-info">
                <span class="pull-left">
                  <img src="/style/icons/views_num_gray.png" /> <?= $diary['view']?> 
                  <img src="/style/icons/comm_num_gray.png" /> <?= $diary['comments']?> 
                </span>
                <span class="pull-right">
                  <img src="/style/icons/vote_up.png" /> <?= $diary['like']?> 
                  <img src="/style/icons/vote_down.png" /> <?= $diary['dlike']?> 
                </span>
              </div>
              
              <a href="/plugins/diary?f=diary&amp;s=u&amp;r=user&amp;u=<?= $diary['id_user']?>&amp;id=<?= $diary['id']?>&amp;zsort=<?= $user['sort']?>#page-up">
                <i class="icpb icpb-comments"></i> <?= __('Обсудить')?>
              </a>  
            </div>
          </div>
        <?
    }
}
?>