'; $abi=''; $paring = db_query("SELECT a.data, a.operation FROM {activity} a WHERE a.type='club' ORDER BY a.created DESC LIMIT 2"); while ($tulemus = db_fetch_object($paring)){ preg_match_all('|s:(.*):"node-id";s:(.*):"(.*)";|U', $tulemus->data, $liitumine); if($abi=='' or $abi!=$liitumine[3][0]){ $paringKlubi = db_query("SELECT n.title, oguid.created, oguid.nid, og.og_description, ctc.field_klubipilt_fid FROM {og_uid} oguid INNER JOIN {node} n ON oguid.nid=n.nid INNER JOIN {content_type_club} ctc ON ctc.nid=oguid.nid INNER JOIN {og} ON og.nid=oguid.nid WHERE oguid.nid=%d AND oguid.is_active=1 ORDER BY oguid.changed DESC LIMIT 1", $liitumine[3][0]); $klubi = db_fetch_object($paringKlubi); if($klubi->field_klubipilt_fid==''){ $aadress=''; } else { $paringPilt = db_query("SELECT f.filepath FROM {files} f WHERE f.fid=%d", $klubi->field_klubipilt_fid); $tulemus2 = db_fetch_object($paringPilt); $aadress=''; } $block_content .= '
'.$aadress.'
'.$klubi->title.'
'; $kasutajateArvuParing = db_query("SELECT ou.uid FROM {og_uid} ou WHERE ou.nid=%d AND is_active=1", $klubi->nid); $kasutajateArv = mysql_num_rows($kasutajateArvuParing); $block_content .= 'Lühkirjeldus: '.$klubi->og_description.'
Liikmeid: '.$kasutajateArv.'
Loodud: '.date('d.m.Y', $klubi->created).'
'; } $abi=$liitumine[3][0]; } $block_content .= '
'; if ($block_content == '
') { $block['subject'] = ''; $block['content'] = ''; return $block; } $block['subject'] = 'Viimati aktiivsed klubid'; $block['content'] = $block_content; return $block; } }