X-Git-Url: http://git.cyclocoop.org/?p=velocampus%2Fweb%2Fwww.git;a=blobdiff_plain;f=www%2Fecrire%2Finc%2Fgrouper_mots.php;fp=www%2Fecrire%2Finc%2Fgrouper_mots.php;h=7a69591b030088df25ca105d3ea1221cbfbda427;hp=0000000000000000000000000000000000000000;hb=80b4d3e85f78d402ed2e73f8f5d1bf4c19962eed;hpb=aaf970bf4cdaf76689ecc10609048e18d073820c diff --git a/www/ecrire/inc/grouper_mots.php b/www/ecrire/inc/grouper_mots.php new file mode 100644 index 0000000..7a69591 --- /dev/null +++ b/www/ecrire/inc/grouper_mots.php @@ -0,0 +1,161 @@ + $select, 'FROM' => 'spip_mots', 'WHERE' => "id_groupe=$id_groupe", 'ORDER BY' => 'multi'); + + $tableau = array(); + $occurrences = calculer_liens_mots($id_groupe); + if ($connect_statut=="0minirezo") { + $styles = array(array('arial11'), array('arial1', 100), array('arial1', 130)); + } else { + $styles = array(array('arial11'), array('arial1', 100)); + } + return $presenter_liste($requete, 'presenter_groupe_mots_boucle', $tableau, array($occurrences, $total, $deb_aff), false, $styles, $tmp_var, '', '', $url); +} + +// http://doc.spip.org/@afficher_groupe_mots_boucle +function presenter_groupe_mots_boucle($row, $own) +{ + global $connect_statut; + $puce_statut = charger_fonction('puce_statut', 'inc'); + + list($occurrences, $total, $deb_aff) = $own; + $id_mot = $row['id_mot']; + $id_groupe = $row['id_groupe']; + $titre = typo($row['titre']); + $descriptif = entites_html($row['descriptif']); + $droit = autoriser('modifier', 'mot', $id_mot, null, array('id_groupe' => $id_groupe)); + + if ($droit OR $occurrences['articles'][$id_mot] > 0) { + $h = generer_url_ecrire('mots_edit', "id_mot=$id_mot&redirect=" . generer_url_retour('mots_tous') . "#editer_mots-$id_groupe"); + if ($descriptif) $descriptif = " title=\"$descriptif\""; + $cle = $puce_statut($id_mot, 'publie', $id_groupe, 'mot'); + $titre = "$cle $titre"; + } + $vals = array($titre); + + $texte_lie = array(); + + $na = isset($occurrences['articles'][$id_mot]) ? $occurrences['articles'][$id_mot] : 0; + if ($na == 1) + $texte_lie[] = _T('info_1_article'); + else if ($na > 1) + $texte_lie[] = $na." "._T('info_articles_02'); + + $nb = isset($occurrences['breves'][$id_mot]) ? $occurrences['breves'][$id_mot] : 0; + if ($nb == 1) + $texte_lie[] = _T('info_1_breve'); + else if ($nb > 1) + $texte_lie[] = $nb." "._T('info_breves_03'); + + $ns = isset($occurrences['syndic'][$id_mot]) ? $occurrences['syndic'][$id_mot] : 0; + if ($ns == 1) + $texte_lie[] = _T('info_1_site'); + else if ($ns > 1) + $texte_lie[] = $ns." "._T('info_sites'); + + $nr = isset($occurrences['rubriques'][$id_mot]) ? $occurrences['rubriques'][$id_mot] : 0; + if ($nr == 1) + $texte_lie[] = _T('info_une_rubrique_02'); + else if ($nr > 1) + $texte_lie[] = $nr." "._T('info_rubriques_02'); + + $texte_lie = pipeline('afficher_nombre_objets_associes_a',array('args'=>array('objet'=>'mot','id_objet'=>$id_mot),'data'=>$texte_lie)); + $texte_lie = join($texte_lie,", "); + + $vals[] = $texte_lie; + + if ($droit) { + $clic = '' + ._T('info_supprimer_mot') + . " " + . ''; + + if ($nr OR $na OR $ns OR $nb) + $href = "$clic"; + else { + $href = generer_supprimer_mot($id_mot, $id_groupe, $clic, $total, $deb_aff); + } + + $vals[] = "