- Prijavite se ili registrirajte da možete objavljivati komentare
Uto, 29/12/2009 - 11:40
Ako netko ima iskustva ili ideju kako napraviti listu zadnjih attachmenta koje je user postavio na stranicu. Lista attachmenta trebala bi se nalaziti u korisničkom profilu kao dodatni tab. Nešto slično kao nodovi kojima je autor upravo taj korisnik čiji profil pregledavamo.
Ili druga mogućnost da se filtriraju nodovi koji sadrže attachment.
Mislim da bi Views modul tu mogao odraditi posao, bolje nego ugradnja dodatnog modula.
Eto, ukratko, ako netko zna kako.... bio bih zahvalan za bilo kakav hint.
Ned, 03/01/2010 - 02:41
#2
Hvala bas.
- Prijavite se ili registrirajte da možete objavljivati komentare

Evo jedno riješenje s viewsima (pa nek netko kaže da nisu moćni!) :) Ključ je u Views Relationshipsima.
Ovo radi al ako misliš radit nešto za tisuće fileova i korisnika onda ti je jedino riješnje custom modul :)
Evo na pastebinu export kojeg možeš importat kod sebe: http://drupal.pastebin.com/fde445e1
Evo još jednom tu ispod:
$view = new view;
$view->name = 'user_attachments';
$view->description = 'Prikaz korisnikovih attachmenta';
$view->tag = '';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE;
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('relationships', array(
'upload_fid' => array(
'id' => 'upload_fid',
'table' => 'node',
'field' => 'upload_fid',
),
'uid' => array(
'label' => 'korisnik',
'required' => 0,
'id' => 'uid',
'table' => 'node_revisions',
'field' => 'uid',
'relationship' => 'none',
),
));
$handler->override_option('fields', array(
'fid' => array(
'label' => 'File ID',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 1,
'empty_zero' => 0,
'link_to_file' => 0,
'exclude' => 0,
'id' => 'fid',
'table' => 'files',
'field' => 'fid',
'relationship' => 'upload_fid',
),
'filename' => array(
'label' => 'Naziv',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'link_to_file' => 0,
'exclude' => 0,
'id' => 'filename',
'table' => 'files',
'field' => 'filename',
'relationship' => 'upload_fid',
),
'filepath' => array(
'id' => 'filepath',
'table' => 'files',
'field' => 'filepath',
'relationship' => 'upload_fid',
),
'filesize' => array(
'id' => 'filesize',
'table' => 'files',
'field' => 'filesize',
),
'timestamp' => array(
'label' => 'Upload date',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'date_format' => 'small',
'custom_date_format' => '',
'exclude' => 0,
'id' => 'timestamp',
'table' => 'files',
'field' => 'timestamp',
'relationship' => 'upload_fid',
),
));
$handler->override_option('filters', array(
'fid' => array(
'operator' => 'not empty',
'value' => array(
'value' => '',
'min' => '',
'max' => '',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'fid',
'table' => 'files',
'field' => 'fid',
'relationship' => 'upload_fid',
),
'uid_current' => array(
'operator' => '=',
'value' => '1',
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'uid_current',
'table' => 'users',
'field' => 'uid_current',
'relationship' => 'uid',
),
));
$handler->override_option('access', array(
'type' => 'none',
));
$handler->override_option('cache', array(
'type' => 'none',
));
$handler->override_option('use_pager', '0');
$handler->override_option('distinct', 1);
$handler->override_option('style_plugin', 'table');
$handler->override_option('style_options', array(
'grouping' => '',
'override' => 1,
'sticky' => 0,
'order' => 'asc',
'columns' => array(
'fid' => 'fid',
'filename' => 'filename',
'filepath' => 'filepath',
),
'info' => array(
'fid' => array(
'sortable' => 0,
'separator' => '',
),
'filename' => array(
'sortable' => 0,
'separator' => '',
),
'filepath' => array(
'sortable' => 0,
'separator' => '',
),
),
'default' => '-1',
));
$handler = $view->new_display('page', 'Stranica', 'page_1');
$handler->override_option('path', 'user/%/attachmenti');
$handler->override_option('menu', array(
'type' => 'tab',
'title' => 'Attachmenti',
'description' => '',
'weight' => '0',
'name' => 'navigation',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
));