X-Git-Url: http://git.cyclocoop.org/?p=velocampus%2Fweb%2Fwww.git;a=blobdiff_plain;f=www%2Fecrire%2Fexec%2Farticles_tous.php;fp=www%2Fecrire%2Fexec%2Farticles_tous.php;h=802b3439e6ed0b54f0cd40f01a3593f1efb12812;hp=0000000000000000000000000000000000000000;hb=80b4d3e85f78d402ed2e73f8f5d1bf4c19962eed;hpb=aaf970bf4cdaf76689ecc10609048e18d073820c diff --git a/www/ecrire/exec/articles_tous.php b/www/ecrire/exec/articles_tous.php new file mode 100644 index 0000000..802b343 --- /dev/null +++ b/www/ecrire/exec/articles_tous.php @@ -0,0 +1,380 @@ +array('exec'=>'articles_tous'),'data'=>'')); + $commencer_page = charger_fonction('commencer_page', 'inc'); + echo $commencer_page(_T('titre_page_articles_tous'), "accueil", "tout-site"); + + echo http_script('var img_deplierhaut = "'. chemin_image('noeud_plus.gif') .'"; +var img_deplierbas = "'. chemin_image('noeud_moins.gif') . '";'); + + echo http_script('', 'jquery-ui-1.8-drag-drop.min.js'); + echo http_script('', 'articles_tous_edite.js'); + echo http_script('', 'pause.js'); + + echo debut_gauche('', true); + echo formulaire_affiche_tous($aff_art, $aff_statut, $sel_lang); + + echo pipeline('affiche_gauche',array('args'=>array('exec'=>'articles_tous'),'data'=>'')); + echo creer_colonne_droite('', true); + echo pipeline('affiche_droite',array('args'=>array('exec'=>'articles_tous'),'data'=>'')); + echo debut_droite('', true); + + if ($enfant AND $browser_layer) + echo couche_formulaire_tous(); + + $out = "" + . "\n"; + + echo "\n", + redirige_action_post("reorganiser","",'articles_tous', '', $out), + "\n", + fin_gauche(), fin_page(); + } +} + +// http://doc.spip.org/@arbo_articles_tous +function arbo_articles_tous() +{ + + $enfant = array(); + $result = sql_select("id_rubrique, titre, id_parent", "spip_rubriques", '','', '0+titre,titre'); + while ($row = sql_fetch($result)) { + $id_rubrique = $row['id_rubrique']; + if (autoriser('voir','rubrique',$id_rubrique)){ + $id_parent = $row['id_parent']; + $enfant[$id_parent][$id_rubrique] = typo($row['titre']); + } + } + return $enfant; +} + +// http://doc.spip.org/@texte_articles_tous +function texte_articles_tous(&$sel_lang, $flag_trad, $aff_art,$spip_lang_dir){ + global $spip_lang; + + if ($flag_trad) + $langues = explode(',', $GLOBALS['meta']['langues_multilingue']); + else $langues = array(); + + $sel_lang[$spip_lang] = $spip_lang; + + if (autoriser('publierdans', 'rubrique', 0)) + $result = sql_select("id_article, titre, statut, id_rubrique, lang, id_trad, date_modif", "spip_articles", "", "", "date DESC"); + else + $result = sql_select("articles.id_article, articles.titre, articles.statut, articles.id_rubrique, articles.lang, articles.id_trad, articles.date_modif", "spip_articles AS articles LEFT JOIN spip_auteurs_articles AS lien ON articles.id_article=lien.id_article", "articles.statut = 'publie' OR articles.statut = 'prop' OR (articles.statut = 'prepa' AND lien.id_auteur=" . sql_quote($GLOBALS['visiteur_session']['id_auteur']) . ")", "id_article", "articles.date DESC"); + + while($row = sql_fetch($result)) { + $id_rubrique=$row['id_rubrique']; + $id_article = $row['id_article']; + if (autoriser('voir','article',$id_article)){ + $titre = typo($row['titre']); + $statut = $row['statut']; + $lang = $row['lang']; + $id_trad = $row['id_trad']; + $date_modif = $row['date_modif']; + + $aff_statut[$statut] = true; // signale qu'il existe de tels articles + $text_article[$id_article]["titre"] = strlen($titre)?$titre:_T('ecrire:info_sans_titre'); + $text_article[$id_article]["statut"] = $statut; + $text_article[$id_article]["lang"] = $lang; + $text_article[$id_article]["id_trad"] = $id_trad; + $text_article[$id_article]["date_modif"] = $date_modif; + $GLOBALS['langues_utilisees'][$lang] = true; + + if (count($langues) > 1) { + while (list(, $l) = each ($langues)) { + if (in_array($l, $sel_lang)) $text_article[$id_article]["trad"]["$l"] = "$l"; + } + } + + if ($id_trad == $id_article OR $id_trad == 0) { + $text_article[$id_article]["trad"]["$lang"] = "$lang"; + } + + if (in_array($statut, $aff_art)) + $article[$id_rubrique][] = $id_article; + } + } + + if ($text_article) + foreach ($text_article as $id_article => $v) { + $id_trad = $v["id_trad"]; + $lang = $v['lang']; + + + if ($id_trad > 0 AND $id_trad != $id_article AND in_array($lang, $sel_lang)) { + if ($text_article[$id_trad]["date_modif"] < $v["date_modif"]) + $c = 'foncee'; + else + $c = 'claire'; + $text_article[$id_trad]["trad"][$lang] = + "$lang"; + } + } + return array($article,$text_article,$aff_statut); +} + +// checkbox avec image + +// http://doc.spip.org/@http_label_img +function http_label_img($statut, $etat, $var, $img, $texte) { + return + "" . + "
\n"; +} + +// http://doc.spip.org/@formulaire_affiche_tous +function formulaire_affiche_tous($aff_art, $aff_statut,$sel_lang) +{ + global $spip_lang_left, $spip_lang_right, $spip_lang; + + $out = "\n\n" + . ""._T('titre_cadre_afficher_article')." :
\n"; + + if (isset($aff_statut['prepa']) && $aff_statut['prepa']) + $out .= http_label_img('prepa', + in_array('prepa', $aff_art), + 'aff_art', + 'puce-blanche-breve.gif', + _T('texte_statut_en_cours_redaction')); + + if (isset($aff_statut['prop']) && $aff_statut['prop']) + $out .= http_label_img('prop', + in_array('prop', $aff_art), + 'aff_art', + 'puce-orange-breve.gif', + _T('texte_statut_attente_validation')); + + if (isset($aff_statut['publie']) && $aff_statut['publie']) + $out .= http_label_img('publie', + in_array('publie', $aff_art), + 'aff_art', + 'puce-verte-breve.gif', + _T('texte_statut_publies')); + + if (isset($aff_statut['refuse']) && $aff_statut['refuse']) + $out .= http_label_img('refuse', + in_array('refuse', $aff_art), + 'aff_art', + 'puce-rouge-breve.gif', + _T('texte_statut_refuses')); + + if (isset($aff_statut['poubelle']) && $aff_statut['poubelle']) + $out .= http_label_img('poubelle', + in_array('poubelle', $aff_art), + 'aff_art', + 'puce-poubelle-breve.gif', + _T('texte_statut_poubelle')); + + $out .= "\n
"; + + + // GERER LE MULTILINGUISME + if (($GLOBALS['meta']['multi_rubriques'] == 'oui' OR $GLOBALS['meta']['multi_articles'] == 'oui') AND $GLOBALS['meta']['gerer_trad'] == 'oui') { + + // bloc legende + $lf = $GLOBALS['meta']['langue_site']; + $out .= "
\n
"; + $out .= _T('info_tout_site6'); + $out .= "\n
$lf ". _T('info_tout_site5') ."
"; + $out .= "\n
$lf ". _T('info_tout_site2') ."
"; + $out .= "\n
$lf ". _T('info_tout_site3'). "
"; + $out .= "\n
$lf ". _T('info_tout_site4'). "
"; + $out .= "
\n"; + + // bloc choix de langue + $langues = explode(',', $GLOBALS['meta']['langues_multilingue']); + if (count($langues) > 1) { + sort($langues); + $out .= "\n
\n
\n
"; + $out .= "
\n"; + + $out .= "\n
"; + } + } + + $out = debut_boite_info(true) . $out . fin_boite_info(true); + + return generer_form_ecrire('articles_tous', $out); +} + +// http://doc.spip.org/@couche_formulaire_tous +function couche_formulaire_tous() +{ + return "
 
" + . "" + . "" + . _T('lien_tout_deplier') + . "" + . "" + . " | " + . "" + . "" + . _T('lien_tout_replier') + . "" + . "" + . "
 
"; +} + +// http://doc.spip.org/@afficher_contenu_rubrique +function afficher_contenu_rubrique(&$article, &$enfant, &$text_article, $id_rubrique, $flag_trad, $profondeur){ + static $ajax_args=NULL; + $out = ""; + if ($profondeur!=0){ + if (isset($article[$id_rubrique])) + $out .= afficher_article_tous_rubrique($text_article, $article[$id_rubrique], $id_rubrique, $flag_trad); + if (isset($enfant[$id_rubrique])) + $out .= afficher_rubriques_filles($article, $enfant, $text_article, $id_rubrique, $flag_trad, $profondeur); + } + else{ + if (isset($article[$id_rubrique]) || isset($enfant[$id_rubrique])){ + if ($ajax_args==NULL){ + $ajax_args = ""; + if (is_array($aff_art = _request('aff_art'))) + foreach($aff_art as $aff) + $ajax_args.="&aff_art[]=$aff"; + if (is_array($sel_lang = _request('sel_lang'))) + foreach($sel_lang as $sel) + $ajax_args.="&sel_lang[]=$sel"; + } + $out = "
  • "._T('info_tout_site')."
  • "; + } + } + return $out; +} +// http://doc.spip.org/@afficher_rubriques_filles +function afficher_rubriques_filles(&$article, &$enfant, &$text_article, $id_parent, $flag_trad, $profondeur=-1) { + $out = ""; + + if (!$enfant[$id_parent]) return; + $profondeur--; + + while (list($id_rubrique, $titre) = each($enfant[$id_parent]) ) { + $out .= "
  • " . + //$lesenfants?'':'' . + " $titre"; + + $lesenfants = afficher_contenu_rubrique($article, $enfant, $text_article, $id_rubrique, $flag_trad, $profondeur); + if ($lesenfants) + $out .= "\n\n"; + $out .= "
  • \n"; + } + return $out; +} + +// http://doc.spip.org/@afficher_article_tous_rubrique +function afficher_article_tous_rubrique(&$text_article, $tous, $id_rubrique, $flag_trad) +{ + $res = ''; + $puce_statut = charger_fonction('puce_statut', 'inc'); + while(list(,$zarticle) = each($tous) ) { + $attarticle = &$text_article[$zarticle]; + $zelang = $attarticle["lang"]; + unset ($attarticle["trad"][$zelang]); + if ($attarticle["id_trad"] == 0 + OR $attarticle["id_trad"] == $zarticle) { + $auteurs = trouve_auteurs_articles($zarticle); + + $res .= "\n
  • "; + if (count($attarticle["trad"]) > 0) { + ksort($attarticle["trad"]); + $res .= "\n" + . join('',$attarticle["trad"]) + . ""; + } + $res .= "\n" + . " " + . "
    ".$puce_statut($zarticle, $attarticle["statut"], $id_rubrique,'article')."
    " + . "" + . ($flag_trad ? "$zelang " : '') + . "" + . $attarticle["titre"] + . "" + . "
  • "; + } + } + return (!$res ? '' : $res); +} + +// http://doc.spip.org/@trouve_auteurs_articles +function trouve_auteurs_articles($id_article) +{ + return corriger_typo(join(", ", array_map('array_shift', sql_allfetsel("nom", "spip_auteurs AS A LEFT JOIN spip_auteurs_articles AS L ON A.id_auteur=L.id_auteur", "L.id_article=$id_article", "", "nom")))); +} +?>