social_lms_integrator-1.0.0-beta4/modules/social_lms_integrator_iteration_enrollments_export/social_lms_integrator_iteration_enrollments_export.module

modules/social_lms_integrator_iteration_enrollments_export/social_lms_integrator_iteration_enrollments_export.module
<?php

/**
 * @file
 * The Social LMS Integrator Iteration Enrollments Export module.
 */

use Drupal\Core\StreamWrapper\StreamWrapperManager;

/**
 * Implements hook_file_download().
 */
function social_lms_integrator_iteration_enrollments_export_file_download($uri) {
  $scheme = StreamWrapperManager::getScheme($uri);
  $target = \Drupal::service('stream_wrapper_manager')->getTarget($uri);
  $access = \Drupal::currentUser()->hasPermission('administer users');

  if ($scheme === 'private' && preg_match('/^csv\/export-iteration-enrollments-([a-f0-9]{12})\.csv$/i', $target) && $access) {
    return [
      'Content-disposition' => 'attachment; filename="' . basename($target) . '"',
    ];
  }
}

/**
 * Implements hook_social_lms_integrator_iteration_managers_action_ACTION_ID_finish().
 */
function social_lms_integrator_iteration_enrollments_export_social_lms_integrator_iteration_managers_action_social_lms_integrator_iteration_enrollments_export_enrollments_action_finish($success) {
  if ($success) {
    return [
      'singular' => '1 selected enrollee has been exported successfully',
      'plural' => '@count selected enrollees have been exported successfully',
    ];
  }

  return [
    'singular' => '1 selected enrollee has not been exported successfully',
    'plural' => '@count selected enrollees have not been exported successfully',
  ];
}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc