Changeset 93641 in spip-zone for _core_/plugins/grenier/inc/presentation.php
- Timestamp:
- Dec 13, 2015, 2:41:19 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
_core_/plugins/grenier/inc/presentation.php
r92726 r93641 20 20 21 21 if (!function_exists('afficher_objets')) { 22 function afficher_objets($type, $titre_table, $requete,$formater='',$force=false){23 $afficher_objets = charger_fonction('afficher_objets', 'inc');24 return $afficher_objets($type, $titre_table, $requete,$formater,$force);22 function afficher_objets($type, $titre_table, $requete, $formater = '', $force = false) { 23 $afficher_objets = charger_fonction('afficher_objets', 'inc'); 24 return $afficher_objets($type, $titre_table, $requete, $formater, $force); 25 25 } 26 26 } … … 30 30 // 31 31 // http://code.spip.net/@afficher_onglets_pages 32 function afficher_onglets_pages($ordre, $onglets){32 function afficher_onglets_pages($ordre, $onglets) { 33 33 static $onglet_compteur = 0; 34 34 $res = ""; … … 66 66 // Voir en ligne, ou apercu, ou rien (renvoie tout le bloc) 67 67 // http://code.spip.net/@voir_en_ligne 68 function voir_en_ligne ($type, $id, $statut=false, $image='racine-24.png', $af = true, $inline=true) {68 function voir_en_ligne($type, $id, $statut = false, $image = 'racine-24.png', $af = true, $inline = true) { 69 69 70 70 $en_ligne = $message = ''; 71 71 switch ($type) { 72 72 case 'article': 73 if ($statut == "publie" AND$GLOBALS['meta']["post_dates"] == 'non') {73 if ($statut == "publie" and $GLOBALS['meta']["post_dates"] == 'non') { 74 74 $n = sql_fetsel("id_article", "spip_articles", "id_article=$id AND date<=NOW()"); 75 75 if (!$n) $statut = 'prop'; … … 77 77 if ($statut == 'publie') 78 78 $en_ligne = 'calcul'; 79 else 79 elseif ($statut == 'prop') 80 80 $en_ligne = 'preview'; 81 81 break; … … 91 91 if ($statut == 'publie') 92 92 $en_ligne = 'calcul'; 93 else 93 elseif ($statut == 'prop') 94 94 $en_ligne = 'preview'; 95 95 break; … … 107 107 if ($en_ligne == 'calcul') 108 108 $message = _T('icone_voir_en_ligne'); 109 else 110 ANDautoriser('previsualiser'))109 elseif ($en_ligne == 'preview' 110 and autoriser('previsualiser')) 111 111 $message = _T('previsualiser'); 112 112 else … … 117 117 return $inline 118 118 ? icone_inline($message, $h, $image, "", $GLOBALS['spip_lang_left']) 119 : icone_horizontale($message, $h, $image, "", $af);119 : icone_horizontale($message, $h, $image, "", $af); 120 120 121 121 } 122 122 123 123 // http://code.spip.net/@icone_inline 124 function icone_inline($texte, $lien, $fond, $fonction ="", $align="", $ajax=false, $javascript=''){124 function icone_inline($texte, $lien, $fond, $fonction = "", $align = "", $ajax = false, $javascript = '') { 125 125 // cas d'ajax_action_auteur: faut defaire le boulot 126 126 // (il faudrait fusionner avec le cas $javascript) 127 if (preg_match(",^<a\shref='([^']*)'([^>]*)>(.*)</a>$,i", $lien,$r)) {128 list($x, $lien,$atts,$texte)= $r;127 if (preg_match(",^<a\shref='([^']*)'([^>]*)>(.*)</a>$,i", $lien, $r)) { 128 list($x, $lien, $atts, $texte) = $r; 129 129 $javascript .= $atts; 130 130 } … … 132 132 // l'ajax de l'espace prive made in php 133 133 if ($ajax) 134 $javascript .= ' onclick=' . ajax_action_declencheur($lien, $ajax);135 136 return icone_base($lien, $texte, $fond, $fonction, "verticale $align",$javascript);134 $javascript .= ' onclick=' . ajax_action_declencheur($lien, $ajax); 135 136 return icone_base($lien, $texte, $fond, $fonction, "verticale $align", $javascript); 137 137 } 138 138 139 139 140 140 // http://code.spip.net/@navigation_pagination 141 function navigation_pagination($num_rows, $nb_aff =10, $href=null, $debut, $tmp_var=null, $on='') {141 function navigation_pagination($num_rows, $nb_aff = 10, $href = null, $debut, $tmp_var = null, $on = '') { 142 142 143 143 $texte = ''; … … 149 149 150 150 // Pagination : si on est trop loin, on met des '...' 151 if (abs($deb -$deb_aff)>101) {152 if ($deb <$deb_aff) {151 if (abs($deb - $deb_aff) > 101) { 152 if ($deb < $deb_aff) { 153 153 if (!isset($premiere)) { 154 154 $premiere = '0 ... '; … … 168 168 if ($deb > 1) 169 169 $texte .= " |\n"; 170 if ($deb_aff + 1 >= $deb AND$deb_aff + 1 <= $fin) {170 if ($deb_aff + 1 >= $deb and $deb_aff + 1 <= $fin) { 171 171 $texte .= "<b>$deb</b>"; 172 172 } 173 173 else { 174 $script = parametre_url($self, $tmp_var, $deb -1);175 if ($on) $on = generer_onclic_ajax($href, $tmp_var, $deb -1);174 $script = parametre_url($self, $tmp_var, $deb - 1); 175 if ($on) $on = generer_onclic_ajax($href, $tmp_var, $deb - 1); 176 176 $texte .= "<a href=\"$script\"$on>$deb</a>"; 177 177 } … … 198 198 199 199 // http://code.spip.net/@afficher_hierarchie 200 function afficher_hierarchie($id_parent, $editable =true,$id_objet=0,$type='',$id_secteur=0,$restreint='') {200 function afficher_hierarchie($id_parent, $editable = true, $id_objet = 0, $type = '', $id_secteur = 0, $restreint = '') { 201 201 $out = recuperer_fond('prive/squelettes/hierarchie/dist', 202 202 array( 203 'id_parent' =>$id_parent,204 'objet' =>$type,205 'id_objet' =>$id_objet,206 'deplacer' =>_request('deplacer')?'oui':'',207 'id_secteur' =>$id_secteur,208 'restreint' =>$restreint,209 'editable' =>$editable?' ':'',210 ), array('ajax'=>true));211 $out = pipeline('affiche_hierarchie', array('args'=>array(212 'id_parent' =>$id_parent,213 'id_objet' =>$id_objet,214 'objet' =>$type,215 'id_secteur' =>$id_secteur,216 'restreint' =>$restreint,217 'editable' =>$editable?' ':'',203 'id_parent' => $id_parent, 204 'objet' => $type, 205 'id_objet' => $id_objet, 206 'deplacer' => _request('deplacer')?'oui':'', 207 'id_secteur' => $id_secteur, 208 'restreint' => $restreint, 209 'editable' => $editable?' ':'', 210 ), array('ajax' => true)); 211 $out = pipeline('affiche_hierarchie', array('args' => array( 212 'id_parent' => $id_parent, 213 'id_objet' => $id_objet, 214 'objet' => $type, 215 'id_secteur' => $id_secteur, 216 'restreint' => $restreint, 217 'editable' => $editable?' ':'', 218 218 ), 219 'data' =>$out));219 'data' => $out)); 220 220 221 221 return $out; … … 224 224 225 225 // http://code.spip.net/@debut_cadre_formulaire 226 function debut_cadre_formulaire($style =''){return "\n<div class='cadre-formulaire'" .(!$style ? "" : " style='$style'") .">";}226 function debut_cadre_formulaire($style = '') {return "\n<div class='cadre-formulaire'" .(!$style ? "" : " style='$style'") .">";} 227 227 // http://code.spip.net/@fin_cadre_formulaire 228 function fin_cadre_formulaire($return =false){return "</div>\n";}228 function fin_cadre_formulaire($return = false) {return "</div>\n";} 229 229 230 230 // Pour construire des menu avec SELECTED 231 231 // http://code.spip.net/@mySel 232 function mySel($varaut, $variable, $option = NULL) {233 $res = ' value="'.$varaut.'"' . (($variable ==$varaut) ? ' selected="selected"' : '');232 function mySel($varaut, $variable, $option = null) { 233 $res = ' value="'.$varaut.'"' . (($variable == $varaut) ? ' selected="selected"' : ''); 234 234 return (!isset($option) ? $res : "<option".$res.">$option</option>\n"); 235 235 } … … 244 244 245 245 // http://code.spip.net/@bouton_radio 246 function bouton_radio($nom, $valeur, $titre, $actif = false, $onClick ="") {246 function bouton_radio($nom, $valeur, $titre, $actif = false, $onClick = "") { 247 247 static $id_label = 0; 248 248 … … 267 267 return "\n".join($sep, $choix); 268 268 } 269 ?>
Note: See TracChangeset
for help on using the changeset viewer.