Changeset 94524 in spip-zone
- Timestamp:
- Jan 10, 2016, 8:03:47 AM (5 years ago)
- Location:
- _plugins_/selection_objets/trunk
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
_plugins_/selection_objets/trunk/action/editer_selection_objet.php
r93562 r94524 129 129 if ($err = objet_modifier_champs('selection_objet', $id_selection_objet, 130 130 array( 131 'data' => $set,132 131 'nonvide' => array( 133 132 -
_plugins_/selection_objets/trunk/base/selection_objet.php
r93483 r94524 27 27 $tables['spip_selection_objets'] = array( 28 28 'type' => 'selection_objet', 29 'principale' => "oui", 30 'table_objet_surnoms' => array('selectionobjet'), // table_objet('selection_objet') => 'selection_objets' 29 'principale' => "oui", 30 'table_objet_surnoms' => array('selectionobjet'), // table_objet('selection_objet') => 'selection_objets' 31 31 'field'=> array( 32 32 "id_selection_objet" => "bigint(21) NOT NULL", … … 39 39 "objet_dest" => "varchar(100) NOT NULL", 40 40 "ordre" => "bigint(21) NOT NULL", 41 "ordre_objet" => "bigint(21) NOT NULL", 42 "date" => "datetime NOT NULL DEFAULT '0000-00-00 00:00:00'", 43 "statut" => "varchar(20) DEFAULT '0' NOT NULL", 41 "ordre_objet" => "bigint(21) NOT NULL", 42 "date" => "datetime NOT NULL DEFAULT '0000-00-00 00:00:00'", 43 "statut" => "varchar(20) DEFAULT '0' NOT NULL", 44 44 "lang" => "VARCHAR(10) NOT NULL DEFAULT ''", 45 "langue_choisie" => "VARCHAR(3) DEFAULT 'non'", 46 "type_lien" => "VARCHAR(100) NOT NULL DEFAULT ''", 45 "langue_choisie" => "VARCHAR(3) DEFAULT 'non'", 46 "type_lien" => "VARCHAR(100) NOT NULL DEFAULT ''", 47 47 "maj" => "TIMESTAMP" 48 48 ), 49 49 'key' => array( 50 "PRIMARY KEY" => "id_selection_objet", 51 52 "KEY id_objet_dest" => "id_objet_dest", 53 "KEY objet" => "objet", 54 "KEY objet_dest" => "objet_dest", 55 "KEY lang" => "lang", 50 "PRIMARY KEY" => "id_selection_objet", 51 "KEY id_objet" => "id_objet", 52 "KEY id_objet_dest" => "id_objet_dest", 53 "KEY objet" => "objet", 54 "KEY objet_dest" => "objet_dest", 55 "KEY lang" => "lang", 56 56 "KEY statut" => "statut", 57 57 58 58 ), 59 59 'titre' => "titre AS titre, lang AS lang", … … 73 73 'publie' => 'publie', 74 74 'previsu' => 'publie,prop', 75 'post_date' => 'date', 75 'post_date' => 'date', 76 76 'exception' => array('statut','tout') 77 77 ) 78 78 ), 79 'texte_changer_statut' => 'selection_objet:texte_changer_statut_objet', 79 'texte_changer_statut' => 'selection_objet:texte_changer_statut_objet', 80 81 80 82 ); 81 83 … … 83 85 } 84 86 87 88 89 ?> -
_plugins_/selection_objets/trunk/formulaires/bouton_objet.php
r93488 r94524 3 3 if (!defined("_ECRIRE_INC_VERSION")) return; 4 4 5 function formulaires_bouton_objet_charger_dist($id_objet, $objet, $langue, $lang='', $objet_dest = 'rubrique') { 6 include_spip('inc/config'); 7 include_spip('inc/presentation'); 8 include_spip('inc/layer'); 5 function formulaires_bouton_objet_charger_dist($id_objet,$objet,$langue,$lang='',$objet_dest='rubrique') { 6 include_spip('inc/config'); 7 include_spip('inc/presentation'); 8 include_spip('inc/layer'); 9 10 //Les objets destinataires choisies 11 $special=array('article','rubrique'); 12 if(in_array($objet_dest,$special)) $choisies= picker_selected(lire_config('selection_objet/selection_'.$objet_dest.'_dest',array()),$objet_dest); 13 else $choisies=lire_config('selection_objet/selection_'.$objet_dest.'_dest',array()); 14 15 $lang=$langue?explode(',',$langue):''; 9 16 10 // Les objets destinataires choisies 11 $special = array('article','rubrique'); 12 if (in_array($objet_dest, $special)) { 13 $choisies = picker_selected(lire_config('selection_objet/selection_'.$objet_dest.'_dest', array()), $objet_dest); 14 } else { 15 $choisies = lire_config('selection_objet/selection_'.$objet_dest.'_dest', array()); 16 } 17 //On garde l'objet original pour la détection des données de l'objet 18 $objet_dest_original=$objet_dest; 17 19 18 $lang = $langue?explode(',',$langue):'';20 $e = trouver_objet_exec($objet_dest); 19 21 20 //On garde l'objet original pour la détection des données de l'objet 21 $objet_dest_original=$objet_dest; 22 $objet_dest=$e['type']?$e['type']:$objet_dest; 23 24 // Les information des objets destinataires 25 $table_dest = table_objet_sql($objet_dest); 26 $tables=lister_tables_objets_sql(); 27 $titre_objet_dest=_T($tables[$table_dest]['texte_objet']); 28 29 //Préparer la requette 30 $where=array(); 31 if(isset($tables[$table_dest]['statut'][0]['publie']))$statut=$tables[$table_dest]['statut'][0]['publie']; 32 if($objet=='auteur') $where[]='statut !='.sql_quote('5poubelle'); 33 elseif($statut AND $objet_dest !='rubrique') $where[]='statut='.sql_quote($statut); 34 if($choisies)$where[]='id_'.$objet_dest.' IN ('.implode(',',$choisies).')'; 35 if($tables[$table_dest]['field']['lang'] and $lang){ 36 if($objet_dest!='rubrique')$where[]='lang IN ('.sql_quote($lang).')'; 37 elseif(test_plugin_actif('tradrub'))$where[]='lang IN ('.sql_quote($lang).')'; 38 } 22 39 23 $e = trouver_objet_exec($objet_dest); 24 $objet_dest=$e['type']?$e['type']:$objet_dest; 40 $objets_choisies=tableau_objet($objet_dest_original,'','*',$where); 41 42 //Les types liens pour l'objet concerné 43 if(!$types=lire_config('selection_objet/type_liens_'.$objet_dest_original,array()))$types=lire_config('selection_objet/type_liens',array()); 44 45 $types_lien=array(); 46 foreach($types as $cle => $valeur){ 47 if($valeur)$types_lien[$cle]=_T($valeur); 48 } 25 49 26 // Les information des objets destinataires 27 $table_dest = table_objet_sql($objet_dest); 28 $tables = lister_tables_objets_sql(); 29 $titre_objet_dest = _T($tables[$table_dest]['texte_objet']); 50 $valeurs = array( 51 "id_objet" => $id_objet, 52 "objet" => $objet, 53 "langue" => $langue, 54 "objet_dest"=>$objet_dest, 55 "objet_dest_original"=>$objet_dest_original, 56 "id_objet_dest"=>$id_objet_dest, 57 "table_dest"=>$table_dest, 58 "titre_objet_dest"=>$titre_objet_dest, 59 'objets_choisies'=>$objets_choisies, 60 'types_lien' =>$types_lien, 61 ); 62 63 $valeurs['_hidden'] .= "<input type='hidden' name='id_objet' value='$id_objet' />"; 64 $valeurs['_hidden'] .= "<input type='hidden' name='objet' value='$objet' />"; 65 $valeurs['_hidden'] .= "<input type='hidden' name='lang' value='$langue' />"; 66 $valeurs['_hidden'] .= "<input type='hidden' name='objet_dest' value='$objet_dest' />"; 30 67 31 //Préparer la requette 32 $where = array(); 33 if (isset($tables[$table_dest]['statut'][0]['publie'])) { 34 $statut=$tables[$table_dest]['statut'][0]['publie']; 35 } 36 37 if ($objet=='auteur') { 38 $where[]='statut !='.sql_quote('5poubelle'); 39 } elseif ($statut AND $objet_dest !='rubrique') { 40 $where[]='statut='.sql_quote($statut); 41 } 42 43 if ($choisies) { 44 $where[] = sql_in(id_table_objet($objet_dest), $choisies); 45 } 46 47 if (isset($tables[$table_dest]['field']['lang']) and $lang) { 48 if ($objet_dest!='rubrique') { 49 $where[] = 'lang IN ('.sql_quote($lang).')'; 50 } elseif(test_plugin_actif('tradrub')) { 51 $where[] = 'lang IN ('.sql_quote($lang).')'; 52 } 53 } 54 55 $objets_choisies = tableau_objet($objet_dest_original,'','*',$where); 56 57 // Les types liens pour l'objet concerné 58 if (!$types = lire_config('selection_objet/type_liens_'.$objet_dest_original, array())) { 59 $types = lire_config('selection_objet/type_liens', array()); 60 } 61 62 $types_lien=array(); 63 foreach ($types as $cle => $valeur){ 64 if ($valeur) { 65 $types_lien[$cle]=_T($valeur); 66 } 67 } 68 69 $valeurs = array( 70 "id_objet" => $id_objet, 71 "objet" => $objet, 72 "langue" => $langue, 73 "objet_dest" => $objet_dest, 74 "objet_dest_original" => $objet_dest_original, 75 "id_objet_dest" => '', //$id_objet_dest, 76 "table_dest" => $table_dest, 77 "titre_objet_dest" => $titre_objet_dest, 78 'objets_choisies' => $objets_choisies, 79 'types_lien' => $types_lien, 80 ); 81 82 $valeurs['_hidden'] = "<input type='hidden' name='id_objet' value='$id_objet' />"; 83 $valeurs['_hidden'] .= "<input type='hidden' name='objet' value='$objet' />"; 84 $valeurs['_hidden'] .= "<input type='hidden' name='lang' value='$langue' />"; 85 $valeurs['_hidden'] .= "<input type='hidden' name='objet_dest' value='$objet_dest' />"; 86 87 return $valeurs; 68 return $valeurs; 88 69 } 89 70 90 71 /* @annotation: Actualisation de la base de donnée */ 91 function formulaires_bouton_objet_traiter_dist($id_objet, $objet, $langue, $lang='',$objet_dest='rubrique'){92 93 94 $instituer_objet=charger_fonction('instituer_objet_selectionne','action/');95 96 72 function formulaires_bouton_objet_traiter_dist($id_objet,$objet,$langue,$lang='',$objet_dest='rubrique'){ 73 $valeurs=array(); 74 $id_objet_dest=_request('id_objet_dest'); 75 $instituer_objet=charger_fonction('instituer_objet_selectionne','action/'); 76 $objet_dest=_request('objet_dest'); 77 $type_lien=_request('type_lien'); 97 78 98 79 99 $id_selection_objet =$instituer_objet($id_objet.'-'.$objet.'-'.$langue.'-'.$lang.'-'.$objet_dest.'-'.$id_objet_dest.'-'.$type_lien);80 $id_selection_objet=$instituer_objet($id_objet.'-'.$objet.'-'.$langue.'-'.$lang.'-'.$objet_dest.'-'.$id_objet_dest.'-'.$type_lien); 100 81 101 if ($id_selection_objet) { 102 $valeurs['message_ok']='ok'; 103 } 82 if($id_selection_objet)$valeurs['message_ok']='ok'; 104 83 105 106 84 return $valeurs; 85 107 86 } 108 87 ?> -
_plugins_/selection_objets/trunk/formulaires/recherche_objets.php
r93488 r94524 3 3 if (!defined("_ECRIRE_INC_VERSION")) return; 4 4 5 function formulaires_recherche_objets_charger_dist($objet_dest='rubrique', $id_objet_dest, $lang='') { 5 function formulaires_recherche_objets_charger_dist($objet_dest='rubrique',$id_objet_dest,$lang='') { 6 7 include_spip('inc/config'); 8 //Les objets destinataires choisies 9 $special=array('article','rubrique'); 10 if(in_array($objet_dest,$special)) $choisies= picker_selected(lire_config('selection_objet/selection_'.$objet_dest.'_dest',array()),$objet_dest); 11 else $choisies=lire_config('selection_objet/selection_'.$objet_dest.'_dest',array()); 12 13 14 //Quelques objets ne sont pas conforme, on adapte 15 $exceptions=charger_fonction('exceptions','inc'); 6 16 7 include_spip('inc/config'); 8 //Les objets destinataires choisies 9 $special=array('article','rubrique'); 10 if (in_array($objet_dest,$special)) { 11 $choisies = picker_selected(lire_config('selection_objet/selection_'.$objet_dest.'_dest',array()),$objet_dest); 12 } else { 13 $choisies = lire_config('selection_objet/selection_'.$objet_dest.'_dest',array()); 14 } 17 //On garde l'objet original pour la détection des données de l'objet 18 $objet_dest_original=$objet_dest; 19 $e = trouver_objet_exec($objet_dest); 20 $objet_dest=$e['type']?$e['type']:$objet_dest; 21 22 23 //Déterminer le bon objet 24 $e = trouver_objet_exec($objet); 25 $objet=$e['type']?$e['type']:$objet; 26 27 //Les types liens pour l'objet concerné 28 if(!$types=lire_config('selection_objet/type_liens_'.$objet_dest_original,array()))$types=lire_config('selection_objet/type_liens',array()); 15 29 30 $types_lien=array(); 31 foreach($types as $cle => $valeur){ 32 if($valeur)$types_lien[$cle]=_T($valeur); 33 } 16 34 17 //Quelques objets ne sont pas conforme, on adapte 18 $exceptions=charger_fonction('exceptions','inc'); 35 $url_recherche=generer_url_public('recherche_objet','langue='.$lang.'&objet_dest='.$objet_dest.'&id_objet_dest='.$id_objet_dest,true); 36 37 $valeurs = array( 38 "id_objet" => $id_objet, 39 "objet" => $objet, 40 "lang" => $lang, 41 "objet_dest"=>$objet_dest, 42 "id_objet_dest"=>$id_objet_dest, 43 'types_lien' =>$types_lien, 44 'type_lien' =>'', 45 'objet_sel' =>'', 46 'label_objet' =>_T('selection_objet:ajouter_objet'), 47 'label_lien' =>_T('selection_objet:selection_type_lien'), 48 'url_recherche'=>$url_recherche 49 ); 19 50 20 //On garde l'objet original pour la détection des données de l'objet 21 $objet_dest_original=$objet_dest; 22 $e = trouver_objet_exec($objet_dest); 23 $objet_dest=$e['type']?$e['type']:$objet_dest; 24 25 //Les types liens pour l'objet concerné 26 if (!$types=lire_config('selection_objet/type_liens_'.$objet_dest_original,array())) { 27 $types=lire_config('selection_objet/type_liens',array()); 28 } 29 30 $types_lien=array(); 31 foreach ($types as $cle => $valeur){ 32 if($valeur) { 33 $types_lien[$cle]=_T($valeur); 34 } 35 } 36 37 $url_recherche=generer_url_public('recherche_objet','langue='.$lang.'&objet_dest='.$objet_dest.'&id_objet_dest='.$id_objet_dest,true); 38 39 $valeurs = array( 40 "id_objet" => '', 41 "objet" => '', 42 "lang" => $lang, 43 "objet_dest"=>$objet_dest, 44 "id_objet_dest"=>$id_objet_dest, 45 'types_lien' =>$types_lien, 46 'type_lien' =>'', 47 'objet_sel' =>'', 48 'label_objet' =>_T('selection_objet:ajouter_objet'), 49 'label_lien' =>_T('selection_objet:selection_type_lien'), 50 'url_recherche'=>$url_recherche 51 ); 52 53 return $valeurs; 51 return $valeurs; 54 52 } 55 53 56 54 function formulaires_recherche_objets_verifier_dist($objet_dest='rubrique',$id_objet_dest,$lang=''){ 57 include_spip('inc/config'); 58 $config=lire_config('selection_objet'); 55 include_spip('inc/config'); 56 $config=lire_config('selection_objet'); 57 58 $erreurs=array(); 59 60 if(!_request('objet_sel'))$erreurs['objet_sel']=_T("info_obligatoire"); 61 else{ 62 list($id_objet,$objet)=explode('-',_request('objet_sel')); 63 $where = array( 64 'id_objet_dest='.$id_objet_dest, 65 'objet_dest='.sql_quote($objet_dest), 66 'objet='.sql_quote($objet), 67 'id_objet='.$id_objet, 68 'lang='.sql_quote($lang), 69 ); 70 if(!isset($config['choix_illimite']) AND $id=sql_getfetsel('id_selection_objet','spip_selection_objets',$where))$erreurs['objet_sel']=_T("selection_objet:erreur_deja_selectionne"); 59 71 60 $erreurs=array(); 61 62 if (!_request('objet_sel')) { 63 $erreurs['objet_sel']=_T("info_obligatoire"); 64 } else { 65 list($id_objet, $objet) = explode('-', _request('objet_sel')); 66 $where = array( 67 'id_objet_dest='.$id_objet_dest, 68 'objet_dest='.sql_quote($objet_dest), 69 'objet='.sql_quote($objet), 70 'id_objet='.$id_objet, 71 'lang='.sql_quote($lang), 72 ); 73 if (!isset($config['choix_illimite']) AND $id = sql_getfetsel('id_selection_objet', 'spip_selection_objets', $where)) { 74 $erreurs['objet_sel']=_T("selection_objet:erreur_deja_selectionne"); 75 } 76 } 77 78 return $erreurs; 72 } 73 74 return $erreurs; 79 75 } 80 76 -
_plugins_/selection_objets/trunk/inc/exceptions.php
r93483 r94524 18 18 } 19 19 20 ?> -
_plugins_/selection_objets/trunk/inc/verifier_ordre.php
r93483 r94524 22 22 } 23 23 24 ?> -
_plugins_/selection_objets/trunk/lang/paquet-selection_objet.xml
r93415 r94524 1 1 <traduction module="paquet-selection_objet" gestionnaire="salvatore" url="http://trad.spip.net" source="svn://zone.spip.org/spip-zone/_plugins_/selection_objets/trunk/lang/" reference="fr"> 2 <langue code="en" url="http://trad.spip.net/tradlang_module/paquet-selection_objet?lang_cible=en" total="3" traduits=" 0" relire="0" modifs="3" nouveaux="0" pourcent="0.00">2 <langue code="en" url="http://trad.spip.net/tradlang_module/paquet-selection_objet?lang_cible=en" total="3" traduits="2" relire="0" modifs="1" nouveaux="0" pourcent="66.67"> 3 3 <traducteur nom="Benitron" lien="http://trad.spip.net/auteur/benitron" /> 4 4 </langue> -
_plugins_/selection_objets/trunk/lang/paquet-selection_objet_en.php
r94257 r94524 4 4 // ** ne pas modifier le fichier ** 5 5 6 if (!defined('_ECRIRE_INC_VERSION')) { 7 return; 8 } 6 if (!defined('_ECRIRE_INC_VERSION')) return; 9 7 10 8 $GLOBALS[$GLOBALS['idx_lang']] = array( … … 12 10 // S 13 11 'selection_objet_description' => 'Plugin inspired by the plugin article selection. 14 Selects spip objects, store them and customize their display depending on the selected section', # MODIF15 'selection_objet_nom' => 'Objects selection', # MODIF12 Selects spip objects, store them and customize their display depending on the selected section', 13 'selection_objet_nom' => 'Objects selection', 16 14 'selection_objet_slogan' => 'List your spip objects' # MODIF 17 15 ); -
_plugins_/selection_objets/trunk/lang/paquet-selection_objet_fr.php
r94257 r94524 2 2 // This is a SPIP language file -- Ceci est un fichier langue de SPIP 3 3 // Fichier source, a modifier dans svn://zone.spip.org/spip-zone/_plugins_/selection_objets/trunk/lang/ 4 if (!defined('_ECRIRE_INC_VERSION')) { 5 return; 6 } 4 if (!defined('_ECRIRE_INC_VERSION')) return; 7 5 8 6 $GLOBALS[$GLOBALS['idx_lang']] = array( -
_plugins_/selection_objets/trunk/lang/selection_objet.xml
r93414 r94524 1 1 <traduction module="selection_objet" gestionnaire="salvatore" url="http://trad.spip.net" source="svn://zone.spip.org/spip-zone/_plugins_/selection_objets/trunk/lang/" reference="fr"> 2 <langue code="de" url="http://trad.spip.net/tradlang_module/selection_objet?lang_cible=de" total="50" traduits="4 8" relire="0" modifs="2" nouveaux="0" pourcent="96.00">2 <langue code="de" url="http://trad.spip.net/tradlang_module/selection_objet?lang_cible=de" total="50" traduits="49" relire="0" modifs="1" nouveaux="0" pourcent="98.00"> 3 3 <traducteur nom="Rainer Müller" lien="http://trad.spip.net/auteur/rainer-muller" /> 4 4 </langue> 5 <langue code="en" url="http://trad.spip.net/tradlang_module/selection_objet?lang_cible=en" total="50" traduits=" 49" relire="0" modifs="1" nouveaux="0" pourcent="98.00">5 <langue code="en" url="http://trad.spip.net/tradlang_module/selection_objet?lang_cible=en" total="50" traduits="50" relire="0" modifs="0" nouveaux="0" pourcent="100.00"> 6 6 <traducteur nom="Benitron" lien="http://trad.spip.net/auteur/benitron" /> 7 7 <traducteur nom="Rainer Müller" lien="http://trad.spip.net/auteur/rainer-muller" /> 8 8 </langue> 9 <langue code="es" url="http://trad.spip.net/tradlang_module/selection_objet?lang_cible=es" total="50" traduits="4 7" relire="0" modifs="1" nouveaux="2" pourcent="94.00">9 <langue code="es" url="http://trad.spip.net/tradlang_module/selection_objet?lang_cible=es" total="50" traduits="48" relire="0" modifs="0" nouveaux="2" pourcent="96.00"> 10 10 <traducteur nom="Rainer Müller" lien="http://trad.spip.net/auteur/rainer-muller" /> 11 11 </langue> -
_plugins_/selection_objets/trunk/lang/selection_objet_de.php
r94256 r94524 4 4 // ** ne pas modifier le fichier ** 5 5 6 if (!defined('_ECRIRE_INC_VERSION')) { 7 return; 8 } 6 if (!defined('_ECRIRE_INC_VERSION')) return; 9 7 10 8 $GLOBALS[$GLOBALS['idx_lang']] = array( … … 59 57 'selection_cible' => 'Ziel Auswahl für', 60 58 'selection_objet' => 'Auswahl', 61 'selection_objet_cible_titre' => 'Auswahl Zielobjekte', # MODIF59 'selection_objet_cible_titre' => 'Auswahl Zielobjekte', 62 60 'selection_objets_pour' => 'Objekt Auswahl für', 63 61 'selection_rubrique_objet' => 'Objekte die ausgewählt werden können', -
_plugins_/selection_objets/trunk/lang/selection_objet_en.php
r94256 r94524 4 4 // ** ne pas modifier le fichier ** 5 5 6 if (!defined('_ECRIRE_INC_VERSION')) { 7 return; 8 } 6 if (!defined('_ECRIRE_INC_VERSION')) return; 9 7 10 8 $GLOBALS[$GLOBALS['idx_lang']] = array( … … 59 57 'selection_cible' => 'Target selection for', 60 58 'selection_objet' => 'Selection', 61 'selection_objet_cible_titre' => 'Selection of target objects', # MODIF59 'selection_objet_cible_titre' => 'Selection of target objects', 62 60 'selection_objets_pour' => 'Object selection for', 63 61 'selection_rubrique_objet' => 'Objects that can be selected', -
_plugins_/selection_objets/trunk/lang/selection_objet_es.php
r94256 r94524 4 4 // ** ne pas modifier le fichier ** 5 5 6 if (!defined('_ECRIRE_INC_VERSION')) { 7 return; 8 } 6 if (!defined('_ECRIRE_INC_VERSION')) return; 9 7 10 8 $GLOBALS[$GLOBALS['idx_lang']] = array( … … 57 55 'selection_cible' => 'Selección de objetos diana para', 58 56 'selection_objet' => 'Selección', 59 'selection_objet_cible_titre' => 'Selección de Objetos Diana', # MODIF57 'selection_objet_cible_titre' => 'Selección de Objetos Diana', 60 58 'selection_objets_pour' => 'Selección objetos para:', 61 59 'selection_rubrique_objet' => 'Objetos que pueden ser seleccionados', -
_plugins_/selection_objets/trunk/lang/selection_objet_fr.php
r94256 r94524 2 2 // This is a SPIP language file -- Ceci est un fichier langue de SPIP 3 3 // Fichier source, a modifier dans svn://zone.spip.org/spip-zone/_plugins_/selection_objets/trunk/lang/ 4 if (!defined('_ECRIRE_INC_VERSION')) { 5 return; 6 } 4 if (!defined('_ECRIRE_INC_VERSION')) return; 7 5 8 6 $GLOBALS[$GLOBALS['idx_lang']] = array( -
_plugins_/selection_objets/trunk/paquet.xml
r94522 r94524 2 2 prefix="selection_objet" 3 3 categorie="edition" 4 version="1.10. 4"4 version="1.10.3" 5 5 etat="test" 6 6 compatibilite="[3.0.5;3.1.*]" … … 11 11 12 12 <nom>Sélection d'objets</nom> 13 14 13 <auteur lien='http://websimple.be'>Rainer Müller</auteur> 15 16 14 <licence>GNU/GPL</licence> 17 18 15 <necessite nom="saisies" compatibilite="[2.0.3;]" /> 19 20 16 <pipeline nom="autoriser" inclure="selection_objet_autorisations.php" /> 21 17 <pipeline nom="declarer_tables_objets_sql" inclure="base/selection_objet.php" /> -
_plugins_/selection_objets/trunk/recherche_objet_fonctions.php
r93488 r94524 1 1 <?php 2 2 3 if (!defined('_ECRIRE_INC_VERSION')) return;4 3 if (!defined('_ECRIRE_INC_VERSION')) 4 return; 5 5 6 6 /*Fournit un tableau avec id_objet=>donnees_objet*/ 7 7 8 function tableau_recherche_objet($objet, $exclus,$lang=''){9 include_spip('inc/pipelines_ecrire'); 8 function tableau_recherche_objet($objet, $exclus, $lang = '') { 9 include_spip('inc/pipelines_ecrire'); 10 10 //Les tables non conforme, faudrait inclure une pipeline 11 $exceptions=charger_fonction('exceptions','inc'); 12 $exception_objet=$exceptions(); 13 if(!$champ_titre=$exception_objet['titre'][$objet]) $champ_titre='titre'; 11 $exceptions = charger_fonction('exceptions', 'inc'); 12 $exception_objet = $exceptions(); 13 if (!$champ_titre = $exception_objet['titre'][$objet]) 14 $champ_titre = 'titre'; 14 15 15 $ancien_objet =$objet;16 $ancien_objet = $objet; 16 17 $e = trouver_objet_exec($objet); 17 $objet =$e['type'];18 $id_table_objet =$e['id_table_objet'];19 if(!$objet){20 $objet=$ancien_objet;21 $id_table_objet='id_'.$objet;22 23 $table = table_objet_sql($objet); 18 $objet = $e['type']; 19 $id_table_objet = $e['id_table_objet']; 20 if (!$objet) { 21 $objet = $ancien_objet; 22 $id_table_objet = 'id_' . $objet; 23 } 24 $table = table_objet_sql($objet); 24 25 25 $tables =lister_tables_objets_sql();26 $tables = lister_tables_objets_sql(); 26 27 27 $traduction_nom_objet =_T($tables[$table]['texte_objet']);28 $traduction_nom_objet = _T($tables[$table]['texte_objet']); 28 29 29 30 $where=array($champ_titre.' LIKE '.sql_quote('%'._request('term').'%')); 31 if($objet=='document'){ 32 $where=array($champ_titre.' LIKE '.sql_quote('%'._request('term').'%').' OR fichier LIKE'.sql_quote('%'._request('term').'%')); 33 $champ_titre='titre,fichier'; 30 $where = array($champ_titre . ' LIKE ' . sql_quote('%' . _request('term') . '%')); 31 if ($objet == 'document') { 32 $where = array($champ_titre . ' LIKE ' . sql_quote('%' . _request('term') . '%') . ' OR fichier LIKE' . sql_quote('%' . _request('term') . '%')); 33 $champ_titre = 'titre,fichier'; 34 34 } 35 35 36 if(isset($tables[$table_dest]['statut'][0]['publie']))$statut=$tables[$table_dest]['statut'][0]['publie']; 37 $exceptions_statut=array('rubrique','document'); 38 if($statut AND !in_array($objet,$exceptions_statut)) $where[]='statut='.sql_quote($statut); 39 if($objet=='auteur') $where[]='statut !='.sql_quote('5poubelle'); 40 if(isset($tables[$table_dest]['field']['lang']) AND $lang) $where[]='lang IN ("'.implode('","',$lang).'")'; 36 if (isset($tables[$table_dest]['statut'][0]['publie'])) 37 $statut = $tables[$table_dest]['statut'][0]['publie']; 38 $exceptions_statut = array( 39 'rubrique', 40 'document' 41 ); 42 if ($statut AND !in_array($objet, $exceptions_statut)) 43 $where[] = 'statut=' . sql_quote($statut); 44 if ($objet == 'auteur') 45 $where[] = 'statut !=' . sql_quote('5poubelle'); 46 if (isset($tables[$table_dest]['field']['lang']) AND $lang) 47 $where[] = 'lang IN ("' . implode('","', $lang) . '")'; 41 48 $d = info_objet($objet, '', $champ_titre . ',' . $id_table_objet, $where); 42 49 43 50 $data = array(); 44 51 if (is_array($d)) { 45 foreach ($d as $r){ 46 if(!$r['titre']) $r['titre']=titre_objet_sel($objet,$r); 47 if(!isset($exclus[$r[$id_table_objet].'-'.$objet]))$data[]=array('label'=>$r[titre].' ('.$traduction_nom_objet.')','value'=>$r[$id_table_objet].'-'.$objet); 52 foreach ($d as $r) { 53 if (!$r['titre']) 54 $r['titre'] = titre_objet_sel($objet, $r); 55 if (!isset($exclus[$r[$id_table_objet] . '-' . $objet])) 56 $data[] = array( 57 'label' => $r[titre] . ' (' . $traduction_nom_objet . ')', 58 'value' => $r[$id_table_objet] . '-' . $objet 59 ); 48 60 } 49 61 } 50 62 return $data; 51 63 } 64 ?> -
_plugins_/selection_objets/trunk/saisies/selection_objets.html
r70761 r94524 1 Unexpected error. File contents could not be restored from local history during undo/redo. 1 [(#ENV{multiple}|oui) 2 [(#SET{valeur,[(#ENV*{valeur}|is_array|?{[(#ENV*{valeur})],[(#ENV*{valeur}|explode{','})]})]})] 3 ] 4 <select name="#ENV{nom}[(#ENV{multiple}|?{\[\]})]" id="champ_[(#ENV{nom}|saisie_nom2classe)]"[ class="(#ENV{class})"][(#ENV{multiple}|oui) multiple="multiple" size="#ENV{size,10}"][ disabled="(#ENV{disable})"]> 5 [(#ENV{cacher_option_intro}|ou{#ENV{multiple}}|non) 6 <option value="">[(#ENV{option_intro})]</option>] 7 <BOUCLE_selection_objets(SELECTION_OBJETS){par num titre, titre}{statut?}{id_objet?}{id_objet_dest?}{recherche?}{tout}> 8 [(#ENV{multiple}|oui) 9 <option value="#ID_OBJET"[(#ID_OBJET|in_array{#ENV{valeur_forcee,#GET{valeur,#ENV{defaut,#ARRAY}}}}|oui) selected="selected"]>#TITRE 1</option>] 10 [(#ENV{multiple}|non) 11 <option value="#ID_OBJET"[(#ID_OBJET|=={#ENV{valeur_forcee,#ENV{valeur,#ENV{defaut}}}}|oui) selected="selected"]>#TITRE</option>] 12 </BOUCLE_selection_objets> 13 </select> -
_plugins_/selection_objets/trunk/selection_objet_administrations.php
r93483 r94524 1 1 <?php 2 2 /** 3 * Plugin S élection d'objets4 * (c) 2012 Rainer Müller3 * Plugin Signaler des abus 4 * (c) 2012 My Chacra 5 5 * Licence GNU/GPL 6 6 */ … … 11 11 /** 12 12 * Fonction d'installation du plugin et de mise à jour. 13 * Vous pouvez : 14 * - créer la structure SQL, 15 * - insérer du pre-contenu, 16 * - installer des valeurs de configuration, 17 * - mettre à jour la structure SQL 13 18 **/ 14 19 function selection_objet_upgrade($nom_meta_base_version, $version_cible) { … … 17 22 $maj['create'] = array(array('maj_tables', array('spip_selection_objets'))); 18 23 $maj['0.1.0'] = array(array('maj_tables', array('spip_selection_objets'))); 19 20 21 22 23 24 25 26 27 28 29 30 31 32 24 $maj['0.2.0'] = array(array('maj_tables', array('spip_selection_objets'))); 25 $maj['0.2.1'] = array(array('maj_tables', array('spip_selection_objets'))); 26 $maj['0.2.2'] = array(array('maj_tables', array('spip_selection_objets'))); 27 $maj['0.2.3'] = array(array('maj_tables', array('spip_selection_objets'))); 28 $maj['0.2.4'] = array(array('maj_tables', array('spip_selection_objets'))); 29 $maj['0.3.0'] = array(array('maj_tables', array('spip_selection_objets'))); 30 $maj['0.4.0'] = array(array('maj_tables', array('spip_selection_objets'))); 31 $maj['0.5.0'] = array(array('maj_tables', array('spip_selection_objets'))); 32 $maj['0.5.1'] = array( 33 array('sql_alter', "TABLE spip_selection_objets ADD KEY (id_objet)"), 34 array('sql_alter', "TABLE spip_selection_objets ADD KEY (id_objet_dest)"), 35 array('sql_alter', "TABLE spip_selection_objets ADD KEY (objet)"), 36 array('sql_alter', "TABLE spip_selection_objets ADD KEY (objet_dest)"), 37 ); 33 38 39 40 34 41 include_spip('base/upgrade'); 35 42 maj_plugin($nom_meta_base_version, $version_cible, $maj); … … 39 46 /** 40 47 * Fonction de désinstallation du plugin. 48 * Vous devez : 49 * - nettoyer toutes les données ajoutées par le plugin et selection_objetn utilisation 50 * - supprimer les tables et les champs créés par le plugin. 41 51 **/ 42 52 function selection_objet_vider_tables($nom_meta_base_version) { 53 # quelques exemples 54 # (que vous pouvez supprimer !) 55 # sql_drop_table("spip_xx"); 56 # sql_drop_table("spip_xx_liens"); 57 43 58 sql_drop_table("spip_selection_objets"); 44 59 45 60 # Nettoyer les versionnages et forums 46 sql_delete("spip_versions", sql_in("objet", array(' selection_objet')));47 sql_delete("spip_versions_fragments", sql_in("objet", array(' selection_objet')));48 sql_delete("spip_forum", sql_in("objet", array(' selection_objet')));61 sql_delete("spip_versions", sql_in("objet", array('abuselection_objetbjet'))); 62 sql_delete("spip_versions_fragments", sql_in("objet", array('abuselection_objetbjet'))); 63 sql_delete("spip_forum", sql_in("objet", array('abuselection_objetbjet'))); 49 64 50 65 effacer_meta($nom_meta_base_version); 51 66 } 52 67 68 ?> -
_plugins_/selection_objets/trunk/selection_objet_autorisations.php
r93483 r94524 1 1 <?php 2 2 /** 3 * Plugin Selection d 'objets3 * Plugin Selection d'objets 4 4 * (c) 2012 Rainer Müller 5 5 * Licence GNU/GPL … … 16 16 function selection_objet_autoriser(){} 17 17 18 19 /* Exemple 20 function autoriser_configurer_selection_objet_dist($faire, $type, $id, $qui, $opt) { 21 // type est un objet (la plupart du temps) ou une chose. 22 // autoriser('configurer', '_selection_objet') => $type = 'selection_objet' 23 // au choix 24 return autoriser('webmestre', $type, $id, $qui, $opt); // seulement les webmestres 25 return autoriser('configurer', '', $id, $qui, $opt); // seulement les administrateurs complets 26 return $qui['statut'] == '0minirezo'; // seulement les administrateurs (même les restreints) 27 // ... 28 } 29 */ 30 18 31 // ----------------- 19 32 // Objet selection_objets 20 33 34 35 36 21 37 // creer 22 function autoriser_ selectionobjet_creer_dist($faire, $type, $id, $qui, $opt) {38 function autoriser_objet_creer_dist($faire, $type, $id, $qui, $opt) { 23 39 return in_array($qui['statut'], array('0minirezo', '1comite')); 24 40 } 25 41 26 42 // voir les fiches completes 27 function autoriser_ selectionobjet_voir_dist($faire, $type, $id, $qui, $opt) {43 function autoriser_objet_voir_dist($faire, $type, $id, $qui, $opt) { 28 44 return true; 29 45 } 30 46 31 47 // modifier 32 function autoriser_ selectionobjet_modifier_dist($faire, $type, $id, $qui, $opt) {48 function autoriser_objet_modifier_dist($faire, $type, $id, $qui, $opt) { 33 49 return $qui['statut'] == '0minirezo'; 34 50 } 35 51 36 52 // supprimer 37 function autoriser_ selectionobjet_supprimer_dist($faire, $type, $id, $qui, $opt) {53 function autoriser_objet_supprimer_dist($faire, $type, $id, $qui, $opt) { 38 54 return $qui['statut'] == '0minirezo' AND !$qui['restreint']; 39 55 } 40 56 41 57 58 59 60 ?> -
_plugins_/selection_objets/trunk/selection_objet_fonctions.php
r93488 r94524 1 1 <?php 2 2 3 if (!defined('_ECRIRE_INC_VERSION')) return; 4 5 6 7 //Applique des filtres sur des champs spéciciques 8 function filtrer_champ($data){ 3 if (!defined('_ECRIRE_INC_VERSION')) 4 return; 5 6 //Applique des filtres sur des champs spéciciques 7 function filtrer_champ($data) { 9 8 include_spip('inc/texte'); 10 $exceptions =charger_fonction('exceptions', 'inc');9 $exceptions = charger_fonction('exceptions', 'inc'); 11 10 $titres = $exceptions('titre'); 12 $titres = array_merge(array(0=>'titre'), $titres); 13 $propres=array('descriptif', 'texte'); 14 $extraire_multi = array_merge($titres, array('descriptif','texte')); 11 $titres = array_merge(array(0 => 'titre'), $titres); 12 $propres = array( 13 'descriptif', 14 'texte' 15 ); 16 $extraire_multi = array_merge($titres, array( 17 'descriptif', 18 'texte' 19 )); 15 20 $filtres = array( 16 21 'extraire_multi' => $extraire_multi, … … 19 24 ); 20 25 21 foreach ($filtres as $filtre => $champ){26 foreach ($filtres as $filtre => $champ) { 22 27 if (is_array($data)) { 23 28 if (is_array($champ)) { 24 foreach($champ as $c) { 25 if (isset($data[$c])) { 26 $data[$c]=$filtre($data[$c]); 27 } 29 foreach ($champ as $c) { 30 if ($data[$c]) 31 $data[$c] = $filtre($data[$c]); 28 32 } 29 33 } 30 } else {31 $data=$filtre($data);32 }34 } 35 else 36 $data = $filtre($data); 33 37 } 34 38 return $data; 39 35 40 } 36 41 37 42 /*Etablit le titre de l'objet*/ 38 function titre_objet_sel($objet, $contexte){ 39 $exceptions = charger_fonction('exceptions','inc'); 43 function titre_objet_sel($objet, $contexte) { 44 45 $exceptions = charger_fonction('exceptions', 'inc'); 40 46 $exception_titre = $exceptions('titre'); 41 47 //Les exceptions du titre 42 $titre = ''; 43 if (isset($exception_titre[$objet]) and isset($contexte[$exception_titre[$objet]])) { 44 $titre = $contexte[$exception_titre[$objet]]; 45 } 46 if (!$titre and isset($contexte['titre'])) { 48 if (!$titre = $contexte[$exception_titre[$objet]] and isset($contexte['titre'])) 47 49 $titre = $contexte['titre']; 48 }49 50 if (!$titre) { 50 51 if ($objet == 'document') { 51 52 $f = explode('/', $contexte['fichier']); 52 53 $titre = $f[1]; 53 } elseif ($objet) { 54 } 55 elseif ($objet) { 54 56 $table_sql = table_objet_sql($objet); 55 57 $tables = lister_tables_objets_sql(); 56 58 $titre_objet = _T($tables[$table_sql]['texte_objet']); 57 if (isset($contexte['id_objet'])) {59 if (isset($contexte['id_objet'])) 58 60 $id = $contexte['id_objet']; 61 if ($objet = 'selection_objet' AND isset($contexte['id_selection_objet'])) 62 $id = $contexte['id_selection_objet']; 63 $titre = $titre_objet . ' ' . $id; 64 } 65 66 } 67 return $titre; 68 } 69 70 /* Fournit les champs désirés d'un objet donné */ 71 function info_objet($objet, $id_objet = '', $champs = '*', $where = array()) { 72 include_spip('inc/filtres'); 73 74 //Les tables non conforme 75 if ($objet) { 76 include_spip('inc/pipelines_ecrire'); 77 $ancien_objet = $objet; 78 $e = trouver_objet_exec($objet); 79 80 $objet = $e['type']; 81 $id_table_objet = $e['id_table_objet']; 82 // Pour les récalcitrants 83 if (!$objet) { 84 $objet = $ancien_objet; 85 $id_table_objet = 'id_' . $objet; 86 } 87 $table = table_objet_sql($objet); 88 89 if ($id_objet) { 90 if (!$where) 91 $where = array($id_table_objet . '=' . $id_objet); 92 if ($champs == '*') 93 $data = sql_fetsel($champs, $table, $where); 94 else 95 $data = sql_getfetsel($champs, $table, $where); 96 $data = filtrer_champ($data); 97 } 98 else { 99 $data = array(); 100 $sql = sql_select($champs, $table, $where); 101 while ($d = sql_fetch($sql)) { 102 103 if ($d) 104 $data[$d[$id_table_objet]] = filtrer_champ($d); 59 105 } 60 if ($objet='selection_objet' AND isset($contexte['id_selection_objet'])) { 61 $id = $contexte['id_selection_objet']; 106 } 107 } 108 else 109 $data = array(); 110 return $data; 111 112 } 113 114 /* Fonction qui fournit le lien d'un objet*/ 115 function url_objet($id_objet, $objet, $titre = '', $url = '') { 116 117 if (!$titre AND !$url) { 118 $objet_sel = sql_fetsel('titre,url', 'spip_selection_objets', 'id_objet=' . $id_objet . ' AND objet=' . sql_quote($objet)); 119 $url = $objet_sel['url']; 120 $titre = $objet_sel['titre']; 121 } 122 123 if (!$titre) 124 $titre = info_objet($objet, $id_objet, 'titre'); 125 if (!$url) 126 $url = generer_url_entite($id_objet, $objet); 127 128 $lien = '<a href="' . $url . '" title="' . $titre . '">' . $titre . '</a>'; 129 return $lien; 130 } 131 132 /*Fournit un tableau avec id_objet=>donnees_objet*/ 133 function tableau_objet($objet, $id_objet = '', $champs = '*', $where = array(), $filtrer = array(), $array_donnes = true) { 134 135 $d = info_objet($objet, $id_objet, $champs, $where); 136 137 //Les tables non conforme, faudrait inclure une pipeline 138 $exceptions = charger_fonction('exceptions', 'inc'); 139 $exception_objet = $exceptions('objet'); 140 if ($exception_objet[$objet]) { 141 $objet = $exception_objet[$objet]; 142 } 143 $data = array(); 144 if (is_array($d)) { 145 foreach ($d as $r) { 146 //déterminer le titre 147 if (!$r['titre']) 148 $r['titre'] = titre_objet_sel($objet, $r); 149 if (!$filtrer) 150 $data[$r['id_' . $objet]] = $r; 151 elseif (is_array($filtrer)) { 152 $donnees = array(); 153 foreach ($filtrer as $c) { 154 if ($r[$c]) 155 $donnees[$c] = $r[$c]; 156 } 157 if ($array_donnes) 158 $data[$r['id_' . $objet]] = $donnees; 159 else 160 $data[$r['id_' . $objet]] = implode(',', $donnees); 62 161 } 63 $titre = $titre_objet.' '.$id; 64 } 65 } 66 return $titre; 67 } 68 69 /* Fournit les champs désirés d'un objet donné */ 70 function info_objet($objet,$id_objet='',$champs='*',$where=array()){ 71 include_spip('inc/filtres'); 72 73 //Les tables non conforme 74 if($objet){ 75 include_spip('inc/pipelines_ecrire'); 76 $ancien_objet=$objet; 77 $e = trouver_objet_exec($objet); 78 79 $objet=$e['type']; 80 $id_table_objet=$e['id_table_objet']; 81 // Pour les récalcitrants 82 if(!$objet){ 83 $objet=$ancien_objet; 84 $id_table_objet='id_'.$objet; 85 } 86 $table = table_objet_sql($objet); 87 88 89 if($id_objet){ 90 if(!$where)$where=array($id_table_objet.'='.$id_objet); 91 if($champs=='*')$data=sql_fetsel($champs,$table,$where); 92 else $data=sql_getfetsel($champs,$table,$where); 93 $data=filtrer_champ($data); 94 } 95 else{ 96 $data=array(); 97 $sql=sql_select($champs,$table,$where); 98 while($d = sql_fetch($sql)){ 99 100 if($d)$data[$d[$id_table_objet]]=filtrer_champ($d); 101 } 102 } 103 } 104 else $data=array(); 162 } 163 } 105 164 return $data; 106 107 } 108 109 /* Fonction qui fournit le lien d'un objet*/ 110 function url_objet($id_objet,$objet,$titre='',$url=''){ 111 112 if(!$titre AND !$url){ 113 $objet_sel=sql_fetsel('titre,url','spip_selection_objets','id_objet='.$id_objet.' AND objet='.sql_quote($objet)); 114 $url=$objet_sel['url']; 115 $titre=$objet_sel['titre']; 116 } 117 118 if(!$titre)$titre=info_objet($objet,$id_objet,'titre'); 119 if(!$url)$url=generer_url_entite($id_objet,$objet); 120 121 $lien = '<a href="'.$url.'" title="'.$titre.'">'.$titre.'</a>'; 122 return $lien; 123 } 124 125 126 /*Fournit un tableau avec id_objet=>donnees_objet*/ 127 function tableau_objet($objet, $id_objet='', $champs='*', $where=array(), $filtrer=array(), $array_donnes=true){ 128 129 $d=info_objet($objet,$id_objet,$champs,$where); 130 131 //Les tables non conforme, faudrait inclure une pipeline 132 $exceptions=charger_fonction('exceptions','inc'); 133 $exception_objet=$exceptions('objet'); 134 if (isset($exception_objet[$objet])) { 135 $objet=$exception_objet[$objet]; 136 } 137 $data=array(); 138 if (is_array($d)) { 139 foreach($d as $r) { 140 $donnees = array(); 141 142 //déterminer le titre 143 if (!$r['titre']) { 144 $r['titre']=titre_objet_sel($objet,$r); 145 } 146 if (!$filtrer) { 147 $data[$r['id_'.$objet]]=$r; 148 } elseif (is_array($filtrer)) { 149 foreach ($filtrer as $c){ 150 if (isset($r[$c]) and $r[$c]) { 151 $donnees[$c]=$r[$c]; 152 } 153 } 154 } 155 156 if ($array_donnes) { 157 $data[$r['id_'.$objet]] = $donnees; 158 } else { 159 $data[$r['id_'.$objet]]=implode(',',$donnees); 160 } 161 } 162 } 163 return $data; 164 } 165 } 166 165 167 /* Assemble les données entre un objet sélectioné et son objet d'origine pour injection dans un modele choisit*/ 166 function generer_modele($id_objet,$objet='article',$fichier='modeles_selection_objet/defaut',$env=array(),$where=''){ 167 include_spip('inc/pipelines_ecrire'); 168 include_spip('inc/utils'); 169 170 //Quelques objets ne sont pas conforme, on adapte 171 $exceptions=charger_fonction('exceptions','inc'); 172 $exception_objet=$exceptions(); 173 174 if($objet){ 175 $ancien_objet=$objet; 176 $e = trouver_objet_exec($objet); 177 $objet=$e['type']; 178 $id_table_objet=$e['id_table_objet']; 179 // Pour les récalcitrants 180 if(!$objet){ 181 $objet=$ancien_objet; 182 $id_table_objet='id_'.$objet; 183 } 184 $table = table_objet_sql($objet); 185 186 if(!$where)$where=$id_table_objet.'='.$id_objet; 187 if(!$contexte=sql_fetsel('*',$table,$where))$contexte=array(); 188 189 } 190 else $contexte=array(); 191 192 //Filtrer les champs vides 193 foreach($env as $k=>$v){ 194 if(!$v)unset($env[$k]); 195 } 196 197 if(!$cont=calculer_contexte())$cont=array(); 198 if(is_array($env))$contexte= array_merge($cont,$contexte,$env); 199 200 $contexte['objet']=$objet; 201 $contexte['id_objet']=$id_objet; 202 203 204 205 //déterminer le titre 206 if(!$contexte['titre'])$contexte['titre']=titre_objet_sel($objet,$contexte); 207 208 //Les exceptions du titre 209 if(!$exception_titre[$objet]){ 210 $contexte['champ_titre']='titre'; 211 } 212 else{ 213 $contexte['champ_titre']=$exception_objet['titre'][$objet]; 214 } 215 216 //Chercher le logo correpsondant 217 //Si il y a un logo Selection Objet 218 $chercher_logo = charger_fonction('chercher_logo', 'inc'); 219 $logo=$chercher_logo($contexte['id_selection_objet'],'id_selection_objet','on'); 220 $contexte['logo_objet']=$logo[0]; 221 //sinon le logo de l'objet sélectionné 222 if(!$contexte['logo_objet']){ 223 $_id_objet=id_table_objet($objet); 224 $logo=$chercher_logo($id_objet,$_id_objet,'on'); 225 $contexte['logo_objet']=$logo[0]; 226 } 227 $fond=recuperer_fond($fichier,$contexte); 228 229 return $fond; 168 function generer_modele($id_objet, $objet = 'article', $fichier = 'modeles_selection_objet/defaut', $env = array(), $where = '') { 169 include_spip('inc/pipelines_ecrire'); 170 include_spip('inc/utils'); 171 172 //Quelques objets ne sont pas conforme, on adapte 173 $exceptions = charger_fonction('exceptions', 'inc'); 174 $exception_objet = $exceptions(); 175 176 if ($objet) { 177 $ancien_objet = $objet; 178 $e = trouver_objet_exec($objet); 179 $objet = $e['type']; 180 $id_table_objet = $e['id_table_objet']; 181 // Pour les récalcitrants 182 if (!$objet) { 183 $objet = $ancien_objet; 184 $id_table_objet = 'id_' . $objet; 185 } 186 $table = table_objet_sql($objet); 187 188 if (!$where) 189 $where = $id_table_objet . '=' . $id_objet; 190 if (!$contexte = sql_fetsel('*', $table, $where)) 191 $contexte = array(); 192 193 } 194 else 195 $contexte = array(); 196 197 //Filtrer les champs vides 198 foreach ($env as $k => $v) { 199 if (!$v) 200 unset($env[$k]); 201 } 202 203 if (!$cont = calculer_contexte()) 204 $cont = array(); 205 if (is_array($env)) 206 $contexte = array_merge($cont, $contexte, $env); 207 208 $contexte['objet'] = $objet; 209 $contexte['id_objet'] = $id_objet; 210 211 //déterminer le titre 212 if (!$contexte['titre']) 213 $contexte['titre'] = titre_objet_sel($objet, $contexte); 214 215 //Les exceptions du titre 216 if (!$exception_titre[$objet]) { 217 $contexte['champ_titre'] = 'titre'; 218 } 219 else { 220 $contexte['champ_titre'] = $exception_objet['titre'][$objet]; 221 } 222 223 //Chercher le logo correpsondant 224 //Si il y a un logo Selection Objet 225 $chercher_logo = charger_fonction('chercher_logo', 'inc'); 226 $logo = $chercher_logo($contexte['id_selection_objet'], 'id_selection_objet', 'on'); 227 $contexte['logo_objet'] = $logo[0]; 228 //sinon le logo de l'objet sélectionné 229 if (!$contexte['logo_objet']) { 230 $_id_objet = id_table_objet($objet); 231 $logo = $chercher_logo($id_objet, $_id_objet, 'on'); 232 $contexte['logo_objet'] = $logo[0]; 233 } 234 $fond = recuperer_fond($fichier, $contexte); 235 236 return $fond; 230 237 } 231 238 232 239 //donnele nom du type de lien 233 function nom_type($type,$objet){ 234 include_spip('inc/config'); 235 if(!$types=lire_config('selection_objet/type_liens_'.$objet,array())) $types=lire_config('selection_objet/type_liens',array()); 236 237 if(!$nom=_T($types[$type]))$nom=$type; 238 239 return $nom; 240 } 240 function nom_type($type, $objet) { 241 include_spip('inc/config'); 242 if (!$types = lire_config('selection_objet/type_liens_' . $objet, array())) 243 $types = lire_config('selection_objet/type_liens', array()); 244 245 if (!$nom = _T($types[$type])) 246 $nom = $type; 247 248 return $nom; 249 } 241 250 ?> -
_plugins_/selection_objets/trunk/selection_objet_pipelines.php
r94522 r94524 5 5 6 6 function selection_objet_header_prive($flux) { 7 $flux .= '<link rel="stylesheet" href="' . _DIR_PLUGIN_SELECTION_OBJET .'css/so_admin.css" type="text/css" media="all" />';7 $flux .= '<link rel="stylesheet" href="' . _DIR_PLUGIN_SELECTION_OBJET . 'css/so_admin.css" type="text/css" media="all" />'; 8 8 return $flux; 9 9 } … … 119 119 $types_lien = lire_config('selection_objet/type_liens', array()); 120 120 $flux['data']['type_liens'] = ''; 121 if (is_array($types_lien)) { 122 foreach ($types_lien as $key => $value) { 123 if ($key) 124 $flux['data']['type_liens'] .= "$key,$value\n"; 125 } 121 foreach ($types_lien as $key => $value) { 122 if ($key) 123 $flux['data']['type_liens'] .= "$key,$value\n"; 126 124 } 127 125 … … 177 175 function types_liaisons2array($type) { 178 176 $tableau = array(); 179 $lignes = array_filter(explode("\n", $type));177 $lignes = explode("\n", $type); 180 178 foreach ($lignes as $l) { 181 179 $donnees = explode(',', $l); … … 188 186 return $tableau; 189 187 } 188 ?>
Note: See TracChangeset
for help on using the changeset viewer.