Changeset 59887 in spip-zone
- Timestamp:
- Mar 28, 2012, 6:05:26 PM (9 years ago)
- Location:
- _plugins_/contacts_et_organisations/branches/v1
- Files:
-
- 1 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
_plugins_/contacts_et_organisations/branches/v1/contacts_fonctions.php
r51678 r59887 117 117 } 118 118 119 120 121 // -------------- 122 123 /** 124 * 125 * Cette balise retourne un tableau listant toutes les id_rubrique d'une branche. 126 * L'identifiant de la branche (id_rubrique) est pris dans la boucle 127 * la plus proche sinon dans l'environnement. 128 * 129 * On ne peut pas l'utiliser dans un {critere IN #IDS_BRANCHE} en 1.8.3 :( 130 * 131 */ 132 function balise_IDS_ORGANISATION_BRANCHE_dist($p) { 133 134 // parcours de tous les identifiants recus en parametre 135 $n = 0; 136 $ids = array(); 137 while ($id_org = interprete_argument_balise(++$n,$p)) { 138 if ($id_org = trim(trim($id_org), "'")) { // vire les guillements pour accepter soit un terme soit un nombre 139 $ids = array_merge($ids, array($id_org)); // ... les merge avec id 140 } 141 } 142 143 // pas d'identifiant, on prend la boucle la plus proche 144 if (!$ids) { 145 $ids = champ_sql('id_organisation', $p); 146 $p->code = "explode(',', calcul_organisation_branche_in($ids))"; // 200 147 } else { 148 $p->code = "explode(',', calcul_organisation_branche_in(" . var_export($ids, true) . "))"; // 200 149 } 150 151 return $p; 152 } 153 154 155 156 /** 157 * Calcul d'une branche 158 * (liste des id_organisation contenues dans une organisation donnee) 159 * 160 * @param string|int|array $id 161 * @return string 162 */ 163 function calcul_organisation_branche_in($id) { 164 static $b = array(); 165 166 // normaliser $id qui a pu arriver comme un array, comme un entier, ou comme une chaine NN,NN,NN 167 if (!is_array($id)) $id = explode(',',$id); 168 $id = join(',', array_map('intval', $id)); 169 if (isset($b[$id])) 170 return $b[$id]; 171 172 // Notre branche commence par l'organisation de depart 173 $branche = $r = $id; 174 175 // On ajoute une generation (les filles de la generation precedente) 176 // jusqu'a epuisement 177 while ($filles = sql_allfetsel( 178 'id_organisation', 179 'spip_organisations', 180 sql_in('id_parent', $r)." AND ". sql_in('id_organisation', $r, 'NOT') 181 )) { 182 $r = join(',', array_map('array_shift', $filles)); 183 $branche .= ',' . $r; 184 } 185 186 # securite pour ne pas plomber la conso memoire sur les sites prolifiques 187 if (strlen($branche)<10000) 188 $b[$id] = $branche; 189 return $branche; 190 } 191 119 192 ?> -
_plugins_/contacts_et_organisations/branches/v1/plugin.xml
r57310 r59887 29 29 <prefix>contacts</prefix> 30 30 31 <version>1.13. 4</version>31 <version>1.13.5</version> 32 32 <version_base>1.7.1</version_base> 33 33 -
_plugins_/contacts_et_organisations/branches/v1/prive/style_prive_plugin_contacts.html
r47056 r59887 15 15 #HTTP_HEADER{Vary: Accept-Encoding} 16 16 17 .contact_logo {padding-#LANG_RIGHT:6px; float:#LANG_LEFT;} 17 .contact_logo {padding-#LANG_RIGHT:6px; float:#LANG_LEFT;} 18 18 .presentation_contenu {padding:6px; border:1px solid #dfdfdf; background:white;} 19 19 .presentation_contenu .champ {clear:both; border-bottom:1px solid #eee; padding:2px;}
Note: See TracChangeset
for help on using the changeset viewer.