[SPIP][PLUGINS] v3.0-->v3.2
[lhc/web/www.git] / www / plugins / odt2spip_32 / odt2spip_pipelines.php
1 <?php
2 /**
3 * Créer un article à partir d'un fichier au format odt
4 *
5 * @author cy_altern
6 * @license GNU/LGPL
7 *
8 * @package plugins
9 * @subpackage odt2spip
10 * @category import
11 *
12 *
13 */
14 if (!defined('_ECRIRE_INC_VERSION')) {
15 return;
16 }
17
18 /**
19 * Ajout une boite de creation d'un article à partir d'un fichier odt
20 * dans la colonne gauche des pages exec=rubrique
21 * ou
22 * ajout d'une boite de remplacement du contenu de l'article à partir d'un fichier odt
23 * dans la colonne de gauche des pages exec=article
24 *
25 * @internal à l'aide du pipeline {@link affiche_gauche}
26 * @param Array $flux Le code de la colonne gauche
27 * @return Array Le code modifié
28 */
29 function odt2spip_affiche_gauche($flux) {
30 if (
31 $flux['args']['exec'] == 'rubrique'
32 and $id_rubrique = $flux['args']['id_rubrique']
33 and autoriser('ecrire')
34 ) {
35 $out = recuperer_fond(
36 'prive/squelettes/inclure/document2spip',
37 array(
38 'objet' => 'rubrique',
39 'id_objet' => $id_rubrique,
40 'creer_objet' => 'article'
41 )
42 );
43 $flux['data'] .= $out;
44 } elseif (
45 $flux['args']['exec'] == 'article'
46 and $id_article = $flux['args']['id_article']
47 and autoriser('modifier', 'article', $id_article)
48 ) {
49 $out = recuperer_fond(
50 'prive/squelettes/inclure/document2spip',
51 array(
52 'objet' => 'article',
53 'id_objet' => $id_article
54 )
55 );
56 $flux['data'] .= $out;
57 }
58 return $flux;
59 }