source: sipes/modules_contrib/data_export_import/data_export_import.module @ ef72343

stableversion-3.0
Last change on this file since ef72343 was 177a560, checked in by José Gregorio Puentes <jpuentes@…>, 8 años ago

se agrego el directorio de modulos contribuidos de drupal

  • Propiedad mode establecida a 100755
File size: 2.7 KB
Línea 
1<?php
2/**
3 * @file
4 * This module can export and import datasets.
5 *
6 * It will have several clearly defined sections and will be
7 * extended by  plugins or include files.
8 *
9 * The sections are:
10 * Help
11 * Permissions
12 * hook_menu
13 * calbacks
14 * forms
15 * submit
16 * validation
17 */
18
19// Here we will loop through the profile files and include them so
20// their functions are available.
21$directory = drupal_get_path('module', 'data_export_import') . '/includes/profiles';
22$mask = '.\.inc$';
23$files = file_scan_directory($directory, $mask);
24
25foreach ($files as $file) {
26
27  module_load_include('inc', 'data_export_import', 'includes/profiles/' . $file->name);
28}
29
30/**
31 * Implements hook_help().
32 */
33function data_export_import_help($path, $arg) {
34
35  $output = '';
36
37  switch ($path) {
38    case "admin/help#data_export_import":
39      $output = '<p>' . t("Exports datasets as files which can then imported into other Drupal instances.") . '</p>';
40      break;
41  }
42  return $output;
43}
44
45/**
46 * Implements hook_perm().
47 */
48function data_export_import_perm() {
49  return array('access data export import');
50}
51
52/**
53 * Implements hook_menu().
54 */
55function data_export_import_menu() {
56
57  $items = array();
58
59  $items['admin/content/data_export_import'] = array(
60    'title' => 'Data export import',
61    'page callback' => 'data_export_import_callback_overview',
62    'access arguments' => array('access data export import'),
63    'description' => 'Data export import',
64    'type' => MENU_NORMAL_ITEM,
65  );
66
67  // This 'tab' inherits from MENU_NORMAL_ITEM
68  $items['admin/content/data_export_import/overview'] = array(
69    'title' => 'Overview',
70    'weight' => 0,
71    'description' => 'Data export import introduction',
72    'type' => MENU_DEFAULT_LOCAL_TASK,
73  );
74
75  // Here we will loop through the profile files and call funtions
76  // which will add the items to the menu.
77  $directory = drupal_get_path('module', 'data_export_import') . '/includes/profiles';
78  $mask = '.\.inc$';
79  $files = file_scan_directory($directory, $mask);
80
81  foreach ($files as $file) {
82
83    module_load_include('inc', 'data_export_import', 'includes/profiles/' . $file->name);
84
85    $function_to_run = "data_export_import_" . $file->name . "_add_items_to_menu";
86    $function_to_run($items);
87  }
88
89  return $items;
90}
91
92/**
93 * Callback function for the overview tab.
94 *
95 * @return string
96 *   Initial overview text and basic instructions.
97 */
98function data_export_import_callback_overview() {
99
100  // This is a simple display of some instructions.  The main point of
101  // having this standard initial tab is to have a default tab - the
102  // tabs provided by the profiles are then added as extra tabs.
103  return t("Please click on one of the profile tabs to export or import data.");
104}
Nota: Vea TracBrowser para ayuda de uso del navegador del repositorio.