$uid));
}
$rolliParing = db_query("SELECT ur.uid FROM {users_roles} ur WHERE ur.rid = 6 AND ur.uid=%d", $uid);
$rolliParinguVastus = db_fetch_object($rolliParing);
if($uid==$rolliParinguVastus->uid){
$block_content .= '
';
$blogiPostiParing = db_query(("SELECT * FROM {node} n WHERE n.status = 1 AND n.type = 'blog' AND n.uid = %d ORDER BY n.changed DESC LIMIT 5"), $uid);
if(mysql_num_rows($blogiPostiParing)!=0){
$block_content .= '
';
while ($blogiPostiId = db_fetch_object($blogiPostiParing)){
$nameAlone = $blogiPostiId->title;
$nameLength = strlen($nameAlone);
if($nameLength<=14){
$newName=$nameAlone;
} else {
$newName = substr($nameAlone, 0, 14);
$newName .= '...';
}
$block_content .= '-
'.$newName.'
['.date('d.m.Y', $blogiPostiId->created).']';
}
$block_content .= '
';
} else {
$block_content .= 'Pole';
}
$block_content .= '
';
}
// the block view
if ($block_content == '') {
// no content
$block['subject'] = 'Viimased postitused';
$block['content'] = '';
return $block;
}
// set up the block
$block['subject'] = 'Viimased postitused';
$block['content'] = $block_content;
return $block;
}
}