Fork me on GitHub




« 1 (2)


Re: Module de message
Xoops accro
Inscrit: 15/07/2004 11:16
Messages: 4763
Pour ceux qui veulent avoir cette liste, en dessous de leurs PM, il faut éditer le fichier viewpmsg.php à la racine du site.


Puis ajouter le code suivant, juste avant :

include "footer.php";


echo "<br /><br />Liste des PM envoyés<br /><br />";

$limit_mess_aff 3//changer le chiffre par le nombre de messages que l'on veut afficher - indiquer 0 pour afficher tous les PM
$pm_order "desc"//desc = plus récent au plus ancien – asc = plus ancien au plus récent

    
$pm_handler =& xoops_gethandler('privmessage');
    
$criteria = new CriteriaCompo(new Criteria('from_userid'$xoopsUser->getVar('uid')));
    
$criteria->setSort('msg_time');
    
$criteria->setOrder($pm_order);
    
$pm_arr =& $pm_handler->getObjects($criteria);

    echo 
"<table border='0' cellspacing='1' width='100%' class='outer'>n";
    
$total_messages count($pm_arr);
    if ( 
$total_messages == ) {
        echo 
"<tr><td class='even' align='center'>Aucun message envoyé</td></tr> ";
} else {
    echo 
"<tr align='center' class='$class'><th>Non lu</th><th>"_PM_TO ."</th><th>"_PM_SUBJECT ."</th><th align='center'>"_PM_DATE ."</th></tr>n";
    }

if (
$limit_mess_aff != 0)
{
if (
$total_messages >$limit_mess_aff
    {
    
$max_messages $total_messages-($total_messages -$limit_mess_aff); 
    }
else {
$max_messages $total_messages;}
}
else {
$max_messages $total_messages;}


    for (
$i 0$i $max_messages$i++) {
    
$class = ($i == 0) ? 'even' 'odd';
        if (
$pm_arr[$i]->getVar('read_msg') == 1) {
            echo 
"<tr align='left' class='$class'><td valign='top' width='5%' align='center'>&nbsp;</td>n";
        } else {
            echo 
"<tr align='left' class='$class'><td valign='top' width='5%' align='center'><img src=".XOOPS_URL."/images/read.gif alt='"._PM_NOTREAD."' /></td>n";
        }

        
$postername XoopsUser::getUnameFromId($pm_arr[$i]->getVar("to_userid"));
        echo 
"<td valign='middle' width='10%'>";
        if (
$postername) {
            echo 
"<a href=".XOOPS_URL."/userinfo.php?uid=".$pm_arr[$i]->getVar("to_userid").">".$postername."</a>";
        } else {
            echo 
$xoopsConfig['anonymous'];
        }
        echo 
"</td>n";
        echo 
"<td valign='middle'>".$pm_arr[$i]->getVar("subject")."</td>";
        echo 
"<td valign='middle' align='center' width='30%'>".formatTimestamp($pm_arr[$i]->getVar("msg_time"))."</td></tr>";
    }
    echo 
"</table>";


Avec cette modif', la page de Pm ressemble à ça :

Open in new window

Posté le : 11/03/2006 16:16

Edité par blueteen sur 11/03/2006 19:06:30
Edité par blueteen sur 11/03/2006 19:09:38
Edité par blueteen sur 11/03/2006 19:20:52
Partager Twitter Partagez cette article sur GG+
Re: Module de message
Supporter Xoops
Inscrit: 07/06/2003 14:31
Messages: 572
non,tu ne reve pas

il existe un hack comme le tien sur xoops-germany,mais je jamais reuissi de le faire bien marché ce hack.

hack nr.1:
http://downloads.myxoops.de/modules/w ... lefile.php?cid=17&lid=404
hack nr.2:
http://downloads.myxoops.de/modules/w ... lefile.php?cid=17&lid=490

Tout facon hack reste hack est ce pas un module.Donc ca devien penible a force de hacké sont site pour les maj de xoops.
Personellmnt je suis de ce idee,si ton xoops est en intranet, tu ten fiche de la taille de la base.Car ce pas important niv la restauration.

Je ne jamais compris pkoi ca exciste pas un module comme ca pour xoops.Car si xoops ce veut integré pour les entreprises,il faudrait absolument une messagerie interne.
Comme envoi de messages multiples user avec piece jointes et accuse de reception de message et ....
Bah comme un outlook&co

Posté le : 11/03/2006 16:25
Partager Twitter Partagez cette article sur GG+
Re: Module de message
Semi pro
Inscrit: 08/03/2006 21:08
Messages: 1176
Merci bcp pour ce code, c'est super!

Je vous donne le code du fichier "viewpmsg.php" que j'ai modifié avec le code de blueteen:



<?php
// $Id: viewpmsg.php,v 1.13 2005/06/26 15:38:21 mithyt2 Exp $
// ------------------------------------------------------------------------ //
// XOOPS - PHP Content Management System //
// Copyright (c) 2000 XOOPS.org //
// <http://www.xoops.org/> //
// ------------------------------------------------------------------------ //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation; either version 2 of the License, or //
// (at your option) any later version. //
// //
// You may not change or alter any portion of this comment or credits //
// of supporting developers from this source code or any supporting //
// source code which is considered copyrighted (c) material of the //
// original comment or credit authors. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program; if not, write to the Free Software //
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
// ------------------------------------------------------------------------ //

$xoopsOption['pagetype'] = "pmsg";
include_once "mainfile.php";

global $xoopsUser;
global $xoopsConfig;
$xoopsOption['pagetype'] = "pmsg";
$limit_mess_aff = 0; //changer le chiffre par le nombre de messages que l'on veut afficher - indiquer 0 pour afficher tous les PM
$pm_order = "desc"; //desc = plus récent au plus ancien – asc = plus ancien au plus récent
include_once XOOPS_ROOT_PATH."/language/".$xoopsConfig['language']."/pmsg.php";
include_once XOOPS_ROOT_PATH."/mainfile.php";




if (!is_object($xoopsUser)) {
$errormessage = _PM_SORRY."<br />"._PM_PLZREG."";
redirect_header("user.php",2,$errormessage);
} else {
$pm_handler =& xoops_gethandler('privmessage');
if (isset($_POST['delete_messages']) && isset($_POST['msg_id'])) {
if (!$GLOBALS['xoopsSecurity']->check()) {
echo implode('<br />', $GLOBALS['xoopsSecurity']->getErrors());
exit();
}
$size = count($_POST['msg_id']);
$msg =& $_POST['msg_id'];
for ( $i = 0; $i < $size; $i++ ) {
$pm =& $pm_handler->get($msg[$i]);
if ($pm->getVar('to_userid') == $xoopsUser->getVar('uid')) {
$pm_handler->delete($pm);
}
unset($pm);
}
redirect_header("viewpmsg.php",1,_PM_DELETED);
exit();
}
include XOOPS_ROOT_PATH.'/header.php';
$pm_arr =& $pm_handler->getObjects(new Criteria('to_userid', $xoopsUser->getVar('uid')));
$total_messages = count($pm_arr);
echo "<h3 style='text-align:center;'>". _PM_PRIVATEMESSAGE ."</h3><br /><a href='userinfo.php?uid=". $xoopsUser->getVar("uid")."'>". _PM_PROFILE ."</a>&nbsp;<span style='font-weight:bold;'>»»</span>&nbsp;". _PM_INBOX ."<br /><br /><table border='0' cellspacing='1' cellpadding='4' width='100%' class='outer'>\n";
echo "<tr><th align='center' valign='middle' colspan='5'>Boîte de réception (".$total_messages.")</th></tr> ";
echo "<form name='prvmsg' method='post' action='viewpmsg.php'>";
echo "<tr align='center' valign='middle'><th><input name='allbox' id='allbox' onclick='xoopsCheckAll(\"prvmsg\", \"allbox\");' type='checkbox' value='Check All' /></th><th>Etats</th><th>". _PM_FROM ."</th><th>". _PM_SUBJECT ."</th><th align='center'>". _PM_DATE ."</th></tr>\n";
if ( $total_messages == 0 ) {
echo "<tr><td class='even' colspan='5' align='center'>"._PM_YOUDONTHAVE."</td></tr> ";
$display= 0;
} else {

$display = 1;
}
for ($i = 0; $i < $total_messages; $i++) {
$class = ($i % 2 == 0) ? 'even' : 'odd';
echo "<tr align='left' class='$class'><td valign='top' width='2%' align='center'><input type='checkbox' id='msg_id[]' name='msg_id[]' value='".$pm_arr[$i]->getVar("msg_id")."' /></td>\n";
if ($pm_arr[$i]->getVar('read_msg') == 1) {
echo "<td valign='top' width='5%' align='center'><font color=#009900><b>Lu</b></font></td>\n";
} else {
echo "<td valign='top' width='5%' align='center'><font color=#ff0000><b>Att.</b></font></td>\n";
//<img src='images/read.gif' alt='"._PM_NOTREAD."' /></td>\n";
}
//echo "<td valign='top' width='5%' align='center'><img src='images/subject/".$pm_arr[$i]->getVar("msg_image", "E")."' alt='' /></td>\n";
$postername = XoopsUser::getUnameFromId($pm_arr[$i]->getVar("from_userid"));
echo "<td valign='middle' width='10%'>";
// no need to show deleted users
if ($postername) {
//echo "<a href='userinfo.php?uid=".$pm_arr[$i]->getVar("from_userid")."'>".$postername."</a>";
echo " ".$postername." ";
} else {
echo $xoopsConfig['anonymous'];
}
echo "</td>\n";
echo "<td valign='middle'><a href='readpmsg.php?start=$i&total_messages=$total_messages'>".$pm_arr[$i]->getVar("subject")."</a></td>";
echo "<td valign='middle' align='center' width='20%'>".formatTimestamp($pm_arr[$i]->getVar("msg_time"))."</td></tr>";
}

if ( $display == 1 ) {
echo "<tr class='foot' align='left'><td colspan='6' align='left'><input type='button' class='formButton' onclick='javascript:openWithSelfMain(\"".XOOPS_URL."/pmlite.php?send=1\",\"pmlite\",450,380);' value='"._PM_SEND."' />&nbsp;<input type='submit' class='formButton' name='delete_messages' value='"._PM_DELETE."' />".$GLOBALS['xoopsSecurity']->getTokenHTML()."</td></tr></form>";
} else {
echo "<tr class='bg2' align='left'><td colspan='6' align='left'><input type='button' class='formButton' onclick='javascript:openWithSelfMain(\"".XOOPS_URL."/pmlite.php?send=1\",\"pmlite\",450,380);' value='"._PM_SEND."' /></td></tr></form>";
}
echo "</table>";
}

// Nouveaux--------------------------

echo "<br /><br /><br /><br />";
if (!is_object($xoopsUser)) {
$errormessage = _PM_SORRY."<br />"._PM_PLZREG."";
redirect_header(XOOPS_URL."/user.php",2,$errormessage);
} else {
$pm_handler =& xoops_gethandler('privmessage');
$criteria = new CriteriaCompo(new Criteria('from_userid', $xoopsUser->getVar('uid')));
$criteria->setSort('msg_time');
$criteria->setOrder($pm_order);
$pm_arr =& $pm_handler->getObjects($criteria);
$total_messages = count($pm_arr);
echo "<table border='0' cellspacing='1' width='100%' class='outer'>\n";
echo "<tr><th align='center' valign='middle' colspan='4'>Messages envoyés (".$total_messages.")</th></tr> ";
if ( $total_messages == 0 ) {
echo "<tr><td class='even' align='center'>Aucun message envoyé</td></tr> ";
} else {
echo "<tr align='center' valign='middle'><th>". _PM_TO ."</th><th>Etats</th><th>". _PM_SUBJECT ."</th><th align='center'>". _PM_DATE ."</th></tr>\n";
}
if ($limit_mess_aff != 0){
if ($total_messages >$limit_mess_aff){
$max_messages = $total_messages-($total_messages -$limit_mess_aff);
} else {
$max_messages = $total_messages;
}
} else {
$max_messages = $total_messages;
}
for ($i = 0; $i < $max_messages; $i++) {
$postername = XoopsUser::getUnameFromId($pm_arr[$i]->getVar("to_userid"));
$class = ($i % 2 == 0) ? 'even' : 'odd';
echo "<tr align='left' class='$class'><td valign='middle' width='10%'>";
// no need to show deleted users
if ($postername) {
echo "<a href=".XOOPS_URL."/userinfo.php?uid=".$pm_arr[$i]->getVar("to_userid").">".$postername."</a>";
} else {
echo $xoopsConfig['anonymous'];
}
if ($pm_arr[$i]->getVar('read_msg') == 1) {
echo "<td valign='top' width='10%' align='center'><font color=#009900><b>Lu</b></font></td>\n";
} else {
echo "<td valign='top' width='10%' align='center'><font color=#ff0000><b>Att.</b></font></td>\n";
}
echo "</td>\n";
echo "<td valign='middle'>".$pm_arr[$i]->getVar("subject")."</td>";
echo "<td valign='middle' align='center' width='20%'>".formatTimestamp($pm_arr[$i]->getVar("msg_time"))."</td></tr>";
}
echo "</table>";
}
include "footer.php";

?>

Posté le : 12/03/2006 20:39
Partager Twitter Partagez cette article sur GG+

 Haut   Précédent   Suivant
« 1 (2)



Vous pouvez voir les sujets.
Vous ne pouvez pas débuter de nouveaux sujets.
Vous ne pouvez pas répondre aux contributions.
Vous ne pouvez pas éditer vos contributions.
Vous ne pouvez pas effacez vos contributions.
Vous ne pouvez pas ajouter de nouveaux sondages.
Vous ne pouvez pas voter en sondage.
Vous ne pouvez pas attacher des fichiers à vos contributions.
Vous ne pouvez pas poster sans approbation.

Propulsé avec XOOPS | Graphisme adapté par Tatane, Grosdunord, Montuy337513

25 Personne(s) en ligne (21 Personne(s) connectée(s) sur Forum) | Utilisateur(s): 0 | Invité(s): 25 | Plus ...