users_export.module in Users Export 7.2
Same filename and directory in other branches
Base module file for users_export.
users_export Users Export
File
users_export.moduleView source
<?php
/**
* @file
* Base module file for users_export.
*
* @defgroup users_export Users Export
*/
define('USERS_EXPORT_DEFAULT_DATE_FORMAT', 'Y-m-d H:i:s');
/**
* Implements hook_menu().
*/
function users_export_menu() {
$items = array();
$items['admin/people/export'] = array(
'title' => 'Export',
'description' => 'Export users in various formats.',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'users_export_form',
),
'file' => 'includes/users_export.admin.inc',
'access arguments' => array(
'administer users',
),
'type' => MENU_LOCAL_TASK,
);
return $items;
}
/**
* Implements hook_views_api().
*/
function users_export_views_api($module, $api) {
if ($module == 'views' && $api == 'views_default') {
return array(
'path' => drupal_get_path('module', 'users_export') . '/includes',
'version' => 2,
);
}
}
/**
* Implements hook_permission().
*/
function users_export_permission() {
$perms = array();
if (module_exists('loft_data_grids')) {
foreach (loft_data_grids_export_info() as $info) {
$perms['users_export:export as ' . $info['id']] = array(
'title' => t('Export as @name', array(
'@name' => $info['name'],
)),
'description' => check_plain($info['description']),
);
}
}
return $perms;
}
/**
* Implements hook_theme().
*/
function users_export_theme($existing, $type, $theme, $path) {
return array(
'users_export_flatfile' => array(
'variables' => array(
'header' => NULL,
'rows' => NULL,
'type' => NULL,
'html' => FALSE,
'prefix' => '',
'suffix' => '',
),
'file' => 'includes/users_export.admin.inc',
),
);
}
/**
* Implements hook_users_export_row_alter().
*/
function users_export_users_export_row_alter(&$row, $uid, $context) {
$settings = $context['settings'];
// We'll assume we don't want this column unless the status is mixed.
if ($settings['users_export_user_status'] <= 1) {
unset($row['status']);
}
}
/**
* Implements hook_help().
*/
function users_export_help($path, $args) {
switch ($path) {
case 'admin/help#users_export':
$output = '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('Provides a turn-key solution for exporting users in several different formats included Excel, CSV, JSON, tab-delimitted, and XML.') . '</p>';
$output .= '<h3>' . t('Use') . '</h3>';
$output .= '<dl>';
$output .= '<dt>- <i>' . t('Exporting') . '</i></dt>';
$output .= '<dd>' . t('Visit <a href="@url_export">admin/people/export</a>, adjust your settings and click Download File.', array(
'@url_export' => url('admin/people/export'),
)) . '</dd>';
$output .= '<dt>- <i>' . t('API') . '</i></dt>';
$output .= '<dd>' . t('Refer to <a href="@url_code" target="blank">users_export.api.php</a> for api functions and hooks.', array(
'@url_code' => 'https://cgit.drupalcode.org/users_export/tree/users_export.api.php?h=7.x-2.x',
)) . '</dd>';
$output .= '</dl>';
return $output;
}
}
Functions
Name | Description |
---|---|
users_export_help | Implements hook_help(). |
users_export_menu | Implements hook_menu(). |
users_export_permission | Implements hook_permission(). |
users_export_theme | Implements hook_theme(). |
users_export_users_export_row_alter | Implements hook_users_export_row_alter(). |
users_export_views_api | Implements hook_views_api(). |
Constants
Name | Description |
---|---|
USERS_EXPORT_DEFAULT_DATE_FORMAT |