Darathor
Citation :
But : Ajoute des boutons dans viewforum permettant de choisir l'ordonnancement des sujets.
Prérequis :
- [Sous-MOD] Images utiles (A).
- [MOD] XHTML Validity.
Auteur : Darathor (darathor@free.fr)
Version du MOD : 1.0 (28/07/2005)
Compatibilité phpBB : 2.0.17
Validité HTML : XHTML 1.1
Dans "includes/constants.php"
Code :
#
# Trouver
#
?>
#
# Ajouter avant
#
// DEBUT MOD Ordonancement des topics au choix
define('ORTC_TOPIC_TITLE_ASC', 1);
define('ORTC_TOPIC_TITLE_DESC', 4);
define('ORTC_TOPIC_START_ASC', 3);
define('ORTC_TOPIC_START_DESC', 2);
define('ORTC_TOPIC_END_ASC', 5);
define('ORTC_TOPIC_END_DESC', 6);
define('ORTC_TOPIC_AUTHOR_ASC', 7);
define('ORTC_TOPIC_AUTHOR_DESC', 8);
define('ORTC_TOPIC_REPLIES_ASC', 9);
define('ORTC_TOPIC_REPLIES_DESC', 10);
define('ORTC_TOPIC_VIEWS_ASC', 11);
define('ORTC_TOPIC_VIEWS_DESC', 12);
// FIN MOD Ordonancement des topics au choix
Dans "viewforum.php"
Code :
#
# Trouver
#
//
// End initial var setup
//
#
# Ajouter avant
#
// DEBUT MOD Ordonancement des topics au choix
$order = (isset($HTTP_POST_VARS['order']) ? intval($HTTP_POST_VARS['order']) : intval($HTTP_GET_VARS['order']));
switch($order)
{
case ORTC_TOPIC_TITLE_ASC : $order_mode = 't.topic_title ASC'; $ascdesc = 'ASC'; break;
case ORTC_TOPIC_TITLE_DESC : $order_mode = 't.topic_title DESC'; $ascdesc = 'DESC'; break;
case ORTC_TOPIC_START_ASC : $order_mode = 't.topic_time ASC'; $ascdesc = 'ASC'; break;
case ORTC_TOPIC_START_DESC : $order_mode = 't.topic_time DESC'; $ascdesc = 'DESC'; break;
case ORTC_TOPIC_END_ASC : $order_mode = 't.topic_last_post_id ASC'; $ascdesc = 'ASC'; break;
case ORTC_TOPIC_END_DESC : $order_mode = 't.topic_last_post_id DESC'; break;
case ORTC_TOPIC_AUTHOR_ASC : $order_mode = 'u.username ASC'; $ascdesc = 'ASC'; break;
case ORTC_TOPIC_AUTHOR_DESC : $order_mode = 'u.username DESC'; $ascdesc = 'DESC'; break;
case ORTC_TOPIC_REPLIES_ASC : $order_mode = 't.topic_replies ASC'; $ascdesc = 'ASC'; break;
case ORTC_TOPIC_REPLIES_DESC : $order_mode = 't.topic_replies DESC'; $ascdesc = 'DESC'; break;
case ORTC_TOPIC_VIEWS_ASC : $order_mode = 't.topic_views ASC'; $ascdesc = 'ASC'; break;
case ORTC_TOPIC_VIEWS_DESC : $order_mode = 't.topic_views DESC'; $ascdesc = 'DESC'; break;
default : $order_mode = 't.topic_last_post_id DESC'; $ascdesc = 'DESC'; break;
}
// FIN MOD Ordonancement des topics au choix
#
# Trouver
#
//
// All announcement data, this keeps announcements
// on each viewforum page ...
//
#
# Ajouter après
#
// COMMENTAIRE MOD Ordonancement des topics au choix : La requête qui suit a été modifiée.
// -- DEBUT Enlevé
// ORDER BY t.topic_last_post_id DESC ";
// -- FIN Enlévé
// -- DEBUT Remplacé par
// ORDER BY $order_mode, t.topic_last_post_id $ascdesc ";
// -- FIN Remplacé par
#
# Trouver
#
ORDER BY t.topic_last_post_id DESC ";
#
# Remplacer par
#
ORDER BY $order_mode, t.topic_last_post_id $ascdesc ";
#
# Trouver
#
//
// Grab all the basic data (all topics except announcements)
// for this forum
//
#
# Ajouter après
#
// COMMENTAIRE MOD Ordonancement des topics au choix : La requête qui suit a été modifiée.
// -- DEBUT Enlevé
// ORDER BY t.topic_type DESC, t.topic_last_post_id DESC
// -- FIN Enlévé
// -- DEBUT Remplacé par
// ORDER BY t.topic_type DESC, $order_mode, t.topic_last_post_id $ascdesc
// -- FIN Remplacé par
#
# Trouver
#
ORDER BY t.topic_type DESC, t.topic_last_post_id DESC
#
# Remplacer par
#
ORDER BY t.topic_type DESC, $order_mode, t.topic_last_post_id $ascdesc
#
# Trouver
#
'U_VIEW_FORUM' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL ."=$forum_id"),
#
# Remplacer par
#
// DEBUT MOD Ordonancement des topics au choix
// -- DEBUT Enlevé
// 'U_VIEW_FORUM' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL ."=$forum_id"),
// -- FIN Enlevé
'U_VIEW_FORUM' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL ."=$forum_id&order=$order"),
'U_ORDER_BY_SUJET_ASC' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL ."=$forum_id&order=" . ORTC_TOPIC_TITLE_ASC),
'U_ORDER_BY_AUTEUR_ASC' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL ."=$forum_id&order=" . ORTC_TOPIC_AUTHOR_ASC),
'U_ORDER_BY_LECTURES_ASC' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL ."=$forum_id&order=" . ORTC_TOPIC_VIEWS_ASC),
'U_ORDER_BY_REPONSES_ASC' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL ."=$forum_id&order=" . ORTC_TOPIC_REPLIES_ASC),
'U_ORDER_BY_PREMIER_ASC' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL ."=$forum_id&order=" . ORTC_TOPIC_START_ASC),
'U_ORDER_BY_DERNIER_ASC' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL ."=$forum_id&order=" . ORTC_TOPIC_END_ASC),
'U_ORDER_BY_SUJET_DESC' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL ."=$forum_id&order=" . ORTC_TOPIC_TITLE_DESC),
'U_ORDER_BY_AUTEUR_DESC' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL ."=$forum_id&order=" . ORTC_TOPIC_AUTHOR_DESC),
'U_ORDER_BY_LECTURES_DESC' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL ."=$forum_id&order=" . ORTC_TOPIC_VIEWS_DESC),
'U_ORDER_BY_REPONSES_DESC' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL ."=$forum_id&order=" . ORTC_TOPIC_REPLIES_DESC),
'U_ORDER_BY_PREMIER_DESC' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL ."=$forum_id&order=" . ORTC_TOPIC_STERT_DESC),
'U_ORDER_BY_DERNIER_DESC' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL ."=$forum_id&order=" . ORTC_TOPIC_END_DESC),
'I_HAUT' => $images['I_haut'],
'I_BAS' => $images['I_bas'],
'L_CROISSANT' => $lang['Sort_Ascending'],
'L_DECROISSANT' => $lang['Sort_Descending'],
// FIN MOD Ordonancement des topics au choix
#
# Trouver
#
'PAGINATION' => generate_pagination("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id&topicdays=$topic_days", $topics_count, $board_config['topics_per_page'], $start),
#
# Remplacer par
#
// DEBUT MOD Ordonancement des topics au choix
// -- DEBUT Enlevé
// 'PAGINATION' => generate_pagination("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id&topicdays=$topic_days", $topics_count, $board_config['topics_per_page'], $start),
// -- FIN Enlevé
'PAGINATION' => generate_pagination("viewforum.$phpEx?order=$order&" . POST_FORUM_URL . "=$forum_id&topicdays=$topic_days", $topics_count, $board_config['topics_per_page'], $start),
// FIN MOD Ordonancement des topics au choix
Dans "template/subsilver/viewforum_body.tpl"
Code :
#
# Trouver
#
<th colspan="2" align="center" height="25" class="thCornerL" nowrap="nowrap"> {L_TOPICS} </th>
<th width="50" align="center" class="thTop" nowrap="nowrap"> {L_REPLIES} </th>
<th width="100" align="center" class="thTop" nowrap="nowrap"> {L_AUTHOR} </th>
<th width="50" align="center" class="thTop" nowrap="nowrap"> {L_VIEWS} </th>
<th align="center" class="thCornerR" nowrap="nowrap"> {L_LASTPOST} </th>
#
# Remplacer par
#
<!-- DEBUT MOD Ordonancement des topics au choix -->
<!--
<th colspan="2" align="center" height="25" class="thCornerL" nowrap="nowrap"> {L_TOPICS} </th>
<th width="50" align="center" class="thTop" nowrap="nowrap"> {L_REPLIES} </th>
<th width="100" align="center" class="thTop" nowrap="nowrap"> {L_AUTHOR} </th>
<th width="50" align="center" class="thTop" nowrap="nowrap"> {L_VIEWS} </th>
<th align="center" class="thCornerR" nowrap="nowrap"> {L_LASTPOST} </th>
-->
<th colspan="2" align="center" class="thCornerL" nowrap="nowrap">{L_TOPICS} <a href="{U_ORDER_BY_SUJET_ASC}"><img src="{I_HAUT}" width="11" height="11" title="{L_CROISSANT}" alt="{L_CROISSANT}" /></a><a href="{U_ORDER_BY_SUJET_DESC}"><img src="{I_BAS}" width="11" height="11" title="{L_DECROISSANT}" alt="{L_DECROISSANT}" /></a></th>
<th width="100" align="center" class="thTop" nowrap="nowrap">{L_REPLIES} <a href="{U_ORDER_BY_REPONSES_ASC}"><img src="{I_HAUT}" width="11" height="11" title="{L_CROISSANT}" alt="{L_CROISSANT}" /></a><a href="{U_ORDER_BY_REPONSES_DESC}"><img src="{I_BAS}" width="11" height="11" title="{L_DECROISSANT}" alt="{L_DECROISSANT}" /></a></th>
<th width="120" align="center" class="thTop" nowrap="nowrap">{L_AUTHOR} <a href="{U_ORDER_BY_AUTEUR_ASC}"><img src="{I_HAUT}" width="11" height="11" title="{L_CROISSANT}" alt="{L_CROISSANT}" /></a><a href="{U_ORDER_BY_AUTEUR_DESC}"><img src="{I_BAS}" width="11" height="11" title="{L_DECROISSANT}" alt="{L_DECROISSANT}" /></a></th>
<th width="75" align="center" class="thTop" nowrap="nowrap">{L_VIEWS} <a href="{U_ORDER_BY_LECTURES_ASC}"><img src="{I_HAUT}" width="11" height="11" title="{L_CROISSANT}" alt="{L_CROISSANT}" /></a><a href="{U_ORDER_BY_LECTURES_DESC}"><img src="{I_BAS}" width="11" height="11" title="{L_DECROISSANT}" alt="{L_DECROISSANT}" /></a></th>
<th align="center" class="thCornerR" nowrap="nowrap">{L_LASTPOST} <a href="{U_ORDER_BY_DERNIER_ASC}"><img src="{I_HAUT}" width="11" height="11" title="{L_CROISSANT}" alt="{L_CROISSANT}" /></a><a href="{U_ORDER_BY_DERNIER_DESC}"><img src="{I_BAS}" width="11" height="11" title="{L_DECROISSANT}" alt="{L_DECROISSANT}" /></a></th>
<!-- FIN MOD Ordonancement des topics au choix -->