Changeset 90553 in spip-zone
- Timestamp:
- Jun 27, 2015, 9:50:59 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
_plugins_/reservation_evenement/trunk/reservation_evenement_pipelines.php
r90552 r90553 11 11 12 12 if (!defined('_ECRIRE_INC_VERSION')) 13 13 return; 14 14 15 15 //Afficher les box infos et téléchargement des réservations 16 16 function reservation_evenement_affiche_gauche($flux) { 17 18 19 20 21 22 23 24 25 26 27 28 include_spip('inc/reservation_evenements'); 29 30 $config=lire_config('reservation_evenement/rubrique_reservation');31 32 33 34 $contexte['id_evenement'] = intval($flux['args']['id_evenement']) ? $flux['args']['id_evenement'] : ''; 35 $id=$contexte['id_'.$exec];36 $rubrique_reservation=picker_selected($config,'rubrique');37 $zone=rubrique_reservation($id,$exec,$rubrique_reservation);38 39 40 if($zone){41 42 43 44 17 include_spip('inc/presentation'); 18 $exec = $flux['args']['exec']; 19 $objets_affichage = array( 20 'rubrique', 21 'article', 22 'evenement' 23 ); 24 25 if (in_array($exec, $objets_affichage)) { 26 include_spip('inc/config'); 27 include_spip('formulaires/selecteur/generique_fonctions'); 28 include_spip('inc/reservation_evenements'); 29 30 $config = lire_config('reservation_evenement/rubrique_reservation'); 31 $contexte = array(); 32 $contexte['id_article'] = intval($flux['args']['id_article']) ? $flux['args']['id_article'] : ''; 33 $contexte['id_rubrique'] = intval($flux['args']['id_rubrique']) ? $flux['args']['id_rubrique'] : ''; 34 $contexte['id_evenement'] = intval($flux['args']['id_evenement']) ? $flux['args']['id_evenement'] : ''; 35 $id = $contexte['id_' . $exec]; 36 $rubrique_reservation = picker_selected($config, 'rubrique'); 37 $zone = rubrique_reservation($id, $exec, $rubrique_reservation); 38 39 //Si l'objet se trouve dans la zone Reservation Evènement, on affiche 40 if ($zone) { 41 $flux['data'] .= recuperer_fond('inclure/reservations', $contexte); 42 } 43 } 44 return $flux; 45 45 } 46 46 … … 53 53 */ 54 54 function reservation_evenement_affiche_auteurs_interventions($flux) { 55 56 57 58 59 60 61 62 63 55 if ($id_auteur = intval($flux['args']['id_auteur'])) { 56 57 $flux['data'] .= '<br class="nettoyeur"/>' . recuperer_fond('prive/objets/liste/reservations', array( 58 'id_auteur' => $id_auteur, 59 'titre' => _T('reservation:info_reservations_auteur') 60 ), array('ajax' => true)); 61 62 } 63 return $flux; 64 64 } 65 65 66 66 function reservation_evenement_affiche_milieu($flux) { 67 68 69 70 71 72 73 74 75 76 77 67 $e = trouver_objet_exec($flux['args']['exec']); 68 // reservations sur les evenements 69 if (!$e['edition'] AND in_array($e['type'], array('evenement'))) { 70 $contexte = calculer_contexte(); 71 $contexte['id_evenement'] = _request('id_evenement'); 72 $contexte['par'] = 'id_evenement'; 73 $texte .= recuperer_fond('prive/objets/liste/reservations_details', $contexte, array('ajax' => 'oui')); 74 $flux['data'] .= $texte; 75 } 76 77 return $flux; 78 78 } 79 79 80 80 // Définitions des notifications pour https://github.com/abelass/notifications_archive 81 81 function reservation_evenement_notifications_archive($flux) { 82 83 84 85 86 87 88 89 90 82 $flux = array_merge($flux, array( 83 'reservation_client' => array( 84 'activer' => 'on', 85 'duree' => '180' 86 ), 87 'reservation_vendeur' => array('duree' => '180') 88 )); 89 90 return $flux; 91 91 } 92 92 … … 96 96 97 97 function reservation_evenement_taches_generales_cron($taches) { 98 include_spip('inc/config'); 99 $config = lire_config('reservation_evenement', array()); 100 if (isset($config['cron'])) { 101 //La périodicité 102 if (isset($config['periodicite_cron']) AND $config['periodicite_cron'] >= 600) 103 $periodicite = $config['periodicite_cron']; 104 else 105 $periodicite = 24 * 3600; 106 107 $taches['reservation_evenement_cloture'] = $periodicite; 108 } 109 return $taches; 110 } 111 112 function reservation_evenement_formulaire_charger($flux){ 113 $form = $flux['args']['form']; 114 $forms=array('editer_article','editer_evenement'); 115 $contexte = $flux['data']; 116 117 //Charger les valeurs par défaut 118 if (in_array($form,$forms)){ 119 $action_cloture=$contexte['action_cloture']; 120 $id_evenement=isset($contexte['id_evenement'])?$contexte['id_evenement']:'0'; 121 if($form==$forms[1] AND (!$action_cloture OR $action_cloture==0) AND $form=='editer_evenement' AND intval($contexte['id_parent'])){ 122 $action_cloture=sql_getfetsel('action_cloture','spip_articles','id_article='.$contexte['id_parent']); 123 } 124 125 if($action_cloture) $flux['data']['action_cloture'] = $action_cloture; 126 } 127 128 129 return $flux; 130 } 131 132 function reservation_evenement_formulaire_traiter($flux){ 133 $form = $flux['args']['form']; 134 $forms=array('editer_article','editer_evenement'); 135 if (in_array($form,$forms)){ 136 list($edit,$objet)=explode('_',$form); 137 sql_updateq('spip_'.$objet.'s',array('action_cloture'=>_request('action_cloture')),'id_'.$objet.'='.$flux['data']['id_'.$objet]); 138 } 139 140 return $flux; 141 } 142 143 144 function reservation_evenement_recuperer_fond($flux){ 145 $fond=$flux['args']['fond']; 146 147 $contexte=$flux['data']['contexte']; 148 $fonds=array( 149 'formulaires/editer_article'=>'article', 150 'formulaires/editer_evenement'=>'evenement' 151 ); 152 //Ajouter le champ action_cloture 153 if (isset($fonds[$fond])){ 154 155 include_spip('inc/config'); 156 include_spip('formulaires/selecteur/generique_fonctions'); 157 include_spip('inc/reservation_evenements'); 158 $config=lire_config('reservation_evenement',array()); 159 160 $type=$fonds[$fond]; 161 $rubrique_reservation=isset($config['rubrique_reservation'])?picker_selected($config['rubrique_reservation'],'rubrique'):''; 162 $id=_request('id_'.$type); 163 $zone=rubrique_reservation($id,$type,$rubrique_reservation); 164 $cron=isset($config['cron'])?$config['cron']:''; 165 //Si cron activé et l'objet se trouve dans la zone Reservation Evènement, on affiche 166 if($cron AND $zone){ 167 $action_cloture='<ul>'.recuperer_fond('formulaires/inc-action_cloture',$contexte).'</ul>'; 168 $flux['data']['texte'] = str_replace('<!--extra-->',$action_cloture. '<!--extra-->',$flux['data']['texte']); 169 } 170 } 171 return $flux; 98 include_spip('inc/config'); 99 $config = lire_config('reservation_evenement', array()); 100 if (isset($config['cron'])) { 101 //La périodicité 102 if (isset($config['periodicite_cron']) AND $config['periodicite_cron'] >= 600) 103 $periodicite = $config['periodicite_cron']; 104 else 105 $periodicite = 24 * 3600; 106 107 $taches['reservation_evenement_cloture'] = $periodicite; 108 } 109 return $taches; 110 } 111 112 function reservation_evenement_formulaire_charger($flux) { 113 $form = $flux['args']['form']; 114 $forms = array( 115 'editer_article', 116 'editer_evenement' 117 ); 118 $contexte = $flux['data']; 119 120 //Charger les valeurs par défaut 121 if (in_array($form, $forms)) { 122 $action_cloture = $contexte['action_cloture']; 123 $id_evenement = isset($contexte['id_evenement']) ? $contexte['id_evenement'] : '0'; 124 if ($form == $forms[1] AND (!$action_cloture OR $action_cloture == 0) AND $form == 'editer_evenement' AND intval($contexte['id_parent'])) { 125 $action_cloture = sql_getfetsel('action_cloture', 'spip_articles', 'id_article=' . $contexte['id_parent']); 126 } 127 128 if ($action_cloture) 129 $flux['data']['action_cloture'] = $action_cloture; 130 } 131 132 return $flux; 133 } 134 135 function reservation_evenement_formulaire_traiter($flux) { 136 $form = $flux['args']['form']; 137 $forms = array( 138 'editer_article', 139 'editer_evenement' 140 ); 141 if (in_array($form, $forms)) { 142 list($edit, $objet) = explode('_', $form); 143 sql_updateq('spip_' . $objet . 's', array('action_cloture' => _request('action_cloture')), 'id_' . $objet . '=' . $flux['data']['id_' . $objet]); 144 } 145 146 return $flux; 147 } 148 149 function reservation_evenement_recuperer_fond($flux) { 150 $fond = $flux['args']['fond']; 151 152 $contexte = $flux['data']['contexte']; 153 $fonds = array( 154 'formulaires/editer_article' => 'article', 155 'formulaires/editer_evenement' => 'evenement' 156 ); 157 //Ajouter le champ action_cloture 158 if (isset($fonds[$fond])) { 159 160 include_spip('inc/config'); 161 include_spip('formulaires/selecteur/generique_fonctions'); 162 include_spip('inc/reservation_evenements'); 163 $config = lire_config('reservation_evenement', array()); 164 165 $type = $fonds[$fond]; 166 $rubrique_reservation = isset($config['rubrique_reservation']) ? picker_selected($config['rubrique_reservation'], 'rubrique') : ''; 167 $id = _request('id_' . $type); 168 $zone = rubrique_reservation($id, $type, $rubrique_reservation); 169 $cron = isset($config['cron']) ? $config['cron'] : ''; 170 //Si cron activé et l'objet se trouve dans la zone Reservation Evènement, on affiche 171 if ($cron AND $zone) { 172 $action_cloture = '<ul>' . recuperer_fond('formulaires/inc-action_cloture', $contexte) . '</ul>'; 173 $flux['data']['texte'] = str_replace('<!--extra-->', $action_cloture . '<!--extra-->', $flux['data']['texte']); 174 } 175 } 176 return $flux; 172 177 } 173 178 174 179 // ajouter le champ action_cloture 175 function reservation_evenement_afficher_contenu_objet($flux){ 176 $type=$flux['args']['type']; 177 $types=array('article','evenement'); 178 179 180 if (in_array($type,$types)) { 181 include_spip('inc/config'); 182 include_spip('formulaires/selecteur/generique_fonctions'); 183 include_spip('inc/reservation_evenements'); 184 185 $config=lire_config('reservation_evenement',array()); 186 $rubrique_reservation=isset($config['rubrique_reservation'])?picker_selected($config['rubrique_reservation'],'rubrique'):''; 187 $id=_request('id_'.$type); 188 $zone=rubrique_reservation($id,$type,$rubrique_reservation); 189 $cron=isset($config['cron'])?$config['cron']:''; 190 191 //Si cron activé et l'objet se trouve dans la zone Reservation Evènement, on affiche 192 if($cron AND $zone){ 193 $etats=array( 194 1=>_T('item:oui'), 195 2=>_T('item:non'), 196 3=>_T('reservation:evenement_cloture') 197 ); 198 199 $action_cloture=sql_getfetsel('action_cloture','spip_'.$type.'s','id_'.$type.'='.$type=$flux['args']['id_objet']); 200 if($action_cloture!=0)$contexte['cloture_etat']=$etats[$action_cloture]; 201 $action_cloture = recuperer_fond('prive/objets/contenu/inc-action_cloture',$contexte); 202 $flux['data'] .= "\n".$action_cloture; 203 } 204 205 } 206 return $flux; 207 } 180 function reservation_evenement_afficher_contenu_objet($flux) { 181 $type = $flux['args']['type']; 182 $types = array( 183 'article', 184 'evenement' 185 ); 186 187 if (in_array($type, $types)) { 188 include_spip('inc/config'); 189 include_spip('formulaires/selecteur/generique_fonctions'); 190 include_spip('inc/reservation_evenements'); 191 192 $config = lire_config('reservation_evenement', array()); 193 $rubrique_reservation = isset($config['rubrique_reservation']) ? picker_selected($config['rubrique_reservation'], 'rubrique') : ''; 194 $id = _request('id_' . $type); 195 $zone = rubrique_reservation($id, $type, $rubrique_reservation); 196 $cron = isset($config['cron']) ? $config['cron'] : ''; 197 198 //Si cron activé et l'objet se trouve dans la zone Reservation Evènement, on affiche 199 if ($cron AND $zone) { 200 $etats = array( 201 1 => _T('item:oui'), 202 2 => _T('item:non'), 203 3 => _T('reservation:evenement_cloture') 204 ); 205 206 $action_cloture = sql_getfetsel('action_cloture', 'spip_' . $type . 's', 'id_' . $type . '=' . $type = $flux['args']['id_objet']); 207 if ($action_cloture != 0) 208 $contexte['cloture_etat'] = $etats[$action_cloture]; 209 $action_cloture = recuperer_fond('prive/objets/contenu/inc-action_cloture', $contexte); 210 $flux['data'] .= "\n" . $action_cloture; 211 } 212 213 } 214 return $flux; 215 }
Note: See TracChangeset
for help on using the changeset viewer.