Я создал на основе views (выборок) таблицу пользователей сайта.
<?php
$view = new view;
$view->name = 'user_list';
$view->description = 'User list';
$view->tag = 'users';
$view->view_php = '';
$view->base_table = 'users';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'User list', 'default');
$handler->override_option('fields', array(
'picture' => array(
'id' => 'picture',
'table' => 'users',
'field' => 'picture',
),
'name' => array(
'label' => 'Name',
'link_to_user' => 1,
'exclude' => 0,
'id' => 'name',
'table' => 'users',
'field' => 'name',
'relationship' => 'none',
),
'created' => array(
'label' => 'Created date',
'date_format' => 'custom',
'custom_date_format' => 'Y-m-d',
'exclude' => 0,
'id' => 'created',
'table' => 'users',
'field' => 'created',
'relationship' => 'none',
'override' => array(
'button' => 'Override',
),
),
'access' => array(
'label' => 'Last access',
'date_format' => 'time ago',
'custom_date_format' => '',
'exclude' => 0,
'id' => 'access',
'table' => 'users',
'field' => 'access',
'relationship' => 'none',
'override' => array(
'button' => 'Override',
),
),
'edit_node' => array(
'id' => 'edit_node',
'table' => 'users',
'field' => 'edit_node',
),
'delete_node' => array(
'id' => 'delete_node',
'table' => 'users',
'field' => 'delete_node',
),
));
$handler->override_option('sorts', array(
'created' => array(
'order' => 'DESC',
'granularity' => 'second',
'id' => 'created',
'table' => 'users',
'field' => 'created',
'relationship' => 'none',
),
));
$handler->override_option('filters', array(
'status' => array(
'operator' => '=',
'value' => 1,
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'status',
'table' => 'users',
'field' => 'status',
'relationship' => 'none',
),
));
$handler->override_option('access', array(
'type' => 'none',
'role' => array(),
'perm' => '',
));
$handler->override_option('title', 'User list');
$handler->override_option('items_per_page', 25);
$handler->override_option('style_plugin', 'table');
$handler->override_option('style_options', array(
'grouping' => '',
'override' => 1,
'sticky' => 0,
'order' => 'desc',
'columns' => array(
'picture' => 'picture',
'name' => 'name',
'created' => 'created',
'access' => 'access',
'edit_node' => 'edit_node',
'delete_node' => 'delete_node',
),
'info' => array(
'picture' => array(
'sortable' => 0,
'separator' => '',
),
'name' => array(
'sortable' => 1,
'separator' => '',
),
'created' => array(
'sortable' => 1,
'separator' => '',
),
'access' => array(
'sortable' => 1,
'separator' => '',
),
'edit_node' => array(
'separator' => '',
),
'delete_node' => array(
'separator' => '',
),
),
'default' => 'created',
));
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('path', 'user_list');
$handler->override_option('menu', array(
'type' => 'normal',
'title' => 'User list',
'weight' => '0',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'weight' => 0,
));
?>
$view = new view;
$view->name = 'user_list';
$view->description = 'User list';
$view->tag = 'users';
$view->view_php = '';
$view->base_table = 'users';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'User list', 'default');
$handler->override_option('fields', array(
'picture' => array(
'id' => 'picture',
'table' => 'users',
'field' => 'picture',
),
'name' => array(
'label' => 'Name',
'link_to_user' => 1,
'exclude' => 0,
'id' => 'name',
'table' => 'users',
'field' => 'name',
'relationship' => 'none',
),
'created' => array(
'label' => 'Created date',
'date_format' => 'custom',
'custom_date_format' => 'Y-m-d',
'exclude' => 0,
'id' => 'created',
'table' => 'users',
'field' => 'created',
'relationship' => 'none',
'override' => array(
'button' => 'Override',
),
),
'access' => array(
'label' => 'Last access',
'date_format' => 'time ago',
'custom_date_format' => '',
'exclude' => 0,
'id' => 'access',
'table' => 'users',
'field' => 'access',
'relationship' => 'none',
'override' => array(
'button' => 'Override',
),
),
'edit_node' => array(
'id' => 'edit_node',
'table' => 'users',
'field' => 'edit_node',
),
'delete_node' => array(
'id' => 'delete_node',
'table' => 'users',
'field' => 'delete_node',
),
));
$handler->override_option('sorts', array(
'created' => array(
'order' => 'DESC',
'granularity' => 'second',
'id' => 'created',
'table' => 'users',
'field' => 'created',
'relationship' => 'none',
),
));
$handler->override_option('filters', array(
'status' => array(
'operator' => '=',
'value' => 1,
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'status',
'table' => 'users',
'field' => 'status',
'relationship' => 'none',
),
));
$handler->override_option('access', array(
'type' => 'none',
'role' => array(),
'perm' => '',
));
$handler->override_option('title', 'User list');
$handler->override_option('items_per_page', 25);
$handler->override_option('style_plugin', 'table');
$handler->override_option('style_options', array(
'grouping' => '',
'override' => 1,
'sticky' => 0,
'order' => 'desc',
'columns' => array(
'picture' => 'picture',
'name' => 'name',
'created' => 'created',
'access' => 'access',
'edit_node' => 'edit_node',
'delete_node' => 'delete_node',
),
'info' => array(
'picture' => array(
'sortable' => 0,
'separator' => '',
),
'name' => array(
'sortable' => 1,
'separator' => '',
),
'created' => array(
'sortable' => 1,
'separator' => '',
),
'access' => array(
'sortable' => 1,
'separator' => '',
),
'edit_node' => array(
'separator' => '',
),
'delete_node' => array(
'separator' => '',
),
),
'default' => 'created',
));
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('path', 'user_list');
$handler->override_option('menu', array(
'type' => 'normal',
'title' => 'User list',
'weight' => '0',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'weight' => 0,
));
?>
Для полей ФИО сделал два варианта:
1. в профиле пользователя добавляем необходимые поля
2. с помощью ССК и content_profile
Как организовать поиск и вывод информации на основе views?
или
нужно писать всё самому?
Вложение | Размер |
---|---|
PrtSc.png | 95.97 КБ |
Комментарии
Круто! надо будет тоже поизвращатся