FrameBeurk File
Fmbk/Module/Rhum/Section/helpersSection.php
<?php //FrameBeurk V0.65 Copyright ToolOscope 2016. Licence CeCILL-C.
function Rhum_carteSection($result, $sufxCss, $Archivees, $topDansListe, $topAffichDonnees = true) {
if (list($IdSection, $Section, $NbrSujets, $NbrArchives, $IdCreateur, $User, $TsCRE, $TsMajElements, $IdEtatSection, $Donnees, $Import) = db_FETCH_ROW($result)) {
$EtatSection = Beurk_terminal($IdEtatSection);
//vérification présence import
$topafficheimport = false;
if (! $topDansListe && ($Import != '')) {
if (file_exists(INSTALL_PATH . '/prive/' . $Import))
$topafficheimport = true;
else
Beurk_messageEtape('Import inconnu', true);
}
//titre
$titre = '<a href="' . Beurk_URL(array('ActVue' => 'detail', 'IdVue' => $IdSection)) .'" data-ajax="Page">'
. Beurk_DB2HTML($Section) . '</a>';
//IdCreateur
$createur = '<a href="' . Beurk_URL(array('ActVue' => 'detail', 'IdVue' => $IdCreateur)) . '" data-ajax="Page" rel="author">'
. $User . '</a>, '
. Beurk_traduit('il y a %s', 'Kom1', Kom1_formateTempsRelatif($TsCRE)) . '<br />'
. (($TsMajElements) ? Beurk_traduit('Dernière contribution il y a %s', 'Kom1', Kom1_formateTempsRelatif($TsMajElements)) : '');
//infos
$infos = Beurk_traduit('Section %s', 'Rhum', Rhum_libelleEtatSection($IdEtatSection)) . '<br />'
. Kom1_traduitQuantite('%d sujet%s', 'Rhum', $NbrSujets)
. (($NbrArchives > 0) ? (' + <a href="' . Beurk_URL(array('ActVue' => 'detail', 'IdVue' => $IdSection, 'Archivees' => 'archives')) . '" data-ajax="Page">'
. Kom1_traduitQuantite('%d archivé%s', 'Rhum', $NbrArchives) . '</a>')
: '');
//section
$section = Kom1_DB2HTML_BB($Donnees, $topDansListe); // en abrégé si dans une liste
// liste des pages
if ($topDansListe) {
if ($Archivees == 'archives')
$pages = Kom1_listePages($NbrArchives, 0, array('ActVue' => 'detail', 'IdVue' => $IdSection, 'Archivees' => 'archives'));
else
$pages = Kom1_listePages($NbrSujets, 0, array('ActVue' => 'detail', 'IdVue' => $IdSection));
} else $pages = '';
// liste des majs (fermer, réactiver, censurer)
$tabAdresse = array_merge(Beurk_clefVuePage(), array('IdMaj' => $IdSection));
$majs = Kom1_actionVueMaj('Editer', array('ActVue' => 'modifie', 'IdVue' => $IdSection));
if ($topDansListe)
$majs .= Kom1_actionMaj('Remonter', $tabAdresse, 'monte')
. Kom1_actionMaj('Descendre', $tabAdresse, 'descend');
if ($EtatSection == 'V')
$majs .= Kom1_actionMaj('Fermer', $tabAdresse, 'ferme');
elseif ($EtatSection == 'F')
$majs .= Kom1_actionMaj('Réactiver', $tabAdresse, 'reactive')
. Kom1_actionVueMaj('Censurer',array('ActVue' => 'censure', 'IdVue' => $IdSection));
Kom1_carteEntite('Section', $IdSection, $sufxCss, $titre, $createur, $infos, $section, $pages, $majs, $topAffichDonnees);
echo Beurk_flushDivsAccueil(); // sortie des divs d'accueil
//affichage Import
if ($topafficheimport)
include(INSTALL_PATH . '/prive/' . $Import);
return array($IdEtatSection, $NbrSujets, $NbrArchives, $Section); //ok
} else return false; //pas ou plus de section
}
function Rhum_carteSectionTrouvee($sufxCss, $IdSection, $Section, $IdCreateur, $User, $TsCRE, $NbrSujets, $NbrSujetsArchives, $Donnees, $unused, $score) {
Kom1_carteEntite('Section', $IdSection, $sufxCss,
'<a href="' . Beurk_URL(array('ActVue' => 'detail', 'IdVue' => $IdSection)) . '" data-ajax="Page">' . Beurk_DB2HTML($Section) . '</a>
', Beurk_traduit('Section créée par %s, il y a %s', 'Rhum', $User, Kom1_formateTempsRelatif($TsCRE)),
Beurk_traduit('Pertinence = %s', 'Kom1', round($score, 2))
. '<br />' . Kom1_traduitQuantite('%d sujet%s', 'Rhum', $NbrSujets) . ' + ' . Kom1_traduitQuantite('%d archivé%s', 'Rhum', $NbrSujetsArchives),
Kom1_DB2HTML_BB($Donnees, true),
'', '', -1);
}
function Rhum_libelleEtatSection($IdEtat) {
$Etat = Beurk_terminal($IdEtat); // accepte une id ou un terminal d'état
if ($Etat == 'V')
return Beurk_traduit('ouverte', 'Kom1');
elseif ($Etat == 'C')
return Beurk_traduit('cachée', 'Kom1');
elseif ($Etat == 'F')
return Beurk_traduit('fermée', 'Kom1');
else
return Beurk_traduit('Etat ?', 'Kom1');
}