1 | <?php |
---|
2 | /*############################################################## |
---|
3 | * ExportCSV |
---|
4 | * Export des articles / rubriques SPIP en fichiers CSV. |
---|
5 | * |
---|
6 | * Auteur : |
---|
7 | * Stéphanie De Nadaï |
---|
8 | * webdesigneuse.net |
---|
9 | * © 2008 - Distribué sous licence GNU/GPL |
---|
10 | * |
---|
11 | ##############################################################*/ |
---|
12 | |
---|
13 | if (!defined('_DIR_PLUGIN_EXPORTCSV')){ |
---|
14 | $p=explode(basename(_DIR_PLUGINS)."/",str_replace('\\','/',realpath(dirname(__FILE__)))); |
---|
15 | define('_DIR_PLUGIN_EXPORTCSV',(_DIR_PLUGINS.end($p))."/"); |
---|
16 | } |
---|
17 | // répertoire images |
---|
18 | if (!defined("_DIR_IMG_EXPORTCSV")) { |
---|
19 | define('_DIR_IMG_EXPORTCSV', _DIR_PLUGIN_EXPORTCSV.'img_pack/'); |
---|
20 | } |
---|
21 | // prefixe du plugin |
---|
22 | if (!defined("_PLUGIN_NAME_EXPORTCSV")) { |
---|
23 | define('_PLUGIN_NAME_EXPORTCSV', 'exportcsv'); |
---|
24 | } |
---|
25 | |
---|
26 | function exportcsv_ajouter_boutons($boutons_admin) { |
---|
27 | // si on est admin ou admin-restreint |
---|
28 | if ($GLOBALS['connect_statut'] == "0minirezo" |
---|
29 | AND $GLOBALS["options"]=="avancees" AND |
---|
30 | (!isset($GLOBALS['meta']["activer_exportcsv"]) OR $GLOBALS['meta']["activer_exportcsv"]!="non")) { |
---|
31 | |
---|
32 | // on voit le bouton dans la barre "naviguer" (édition) |
---|
33 | $boutons_admin['naviguer']->sousmenu["exportcsv_tous"]= new Bouton( |
---|
34 | _DIR_IMG_EXPORTCSV."exportcsv-24.png", // icone |
---|
35 | _T("exportcsv:extract_data") //titre |
---|
36 | ); |
---|
37 | } |
---|
38 | return $boutons_admin; |
---|
39 | } |
---|
40 | function exportcsv_affiche_gauche($flux){ |
---|
41 | if (_request('exec') == 'articles' OR _request('exec') == 'controle_petition') { |
---|
42 | if ($GLOBALS['connect_statut'] == "0minirezo" |
---|
43 | AND $GLOBALS["options"] == "avancees" AND |
---|
44 | (!isset($GLOBALS['meta']["activer_exportcsv"]) OR $GLOBALS['meta']["activer_exportcsv"]!="non")) { |
---|
45 | include_spip('inc/exportcsv_petition'); |
---|
46 | $flux['data'] .= exportcsv_afficher_petition($flux['args']['id_article']); |
---|
47 | } |
---|
48 | } |
---|
49 | return $flux; |
---|
50 | } |
---|
51 | // css privé |
---|
52 | function exportcsv_header_prive($flux) { |
---|
53 | $flux .= "\n".'<link rel="stylesheet" type="text/css" href="'._DIR_PLUGIN_EXPORTCSV.'exportcsv_styles.css" />'."\n"; |
---|
54 | return $flux; |
---|
55 | } |
---|
56 | ?> |
---|