MyXoops Forum

Re: Sortierfunktion im Posteingang [Entwicklung allgemein] - myXOOPS German Support

raggamuffin

"myXOOPs"-Neuling
Gepostet am:29.03.2004 15:41
raggamuffin
raggamuffin Offline (Show more)
"myXOOPs"-Neuling
Posts: 32
Since: 02.11.2002
#3

Re: Sortierfunktion im Posteingang

Hier für Euch schreibfaules Volk...
Hab meine Antwort auf der Xoops.org gefunden und will sie Euch nicht vorenthalten...
Inhalt der viewpmsg.php
<?php
// $Id: viewpmsg.php,v 1.9 2003/03/29 19:25:04 w4z004 Exp $
//  ------------------------------------------------------------------------ //
//                XOOPS - PHP Content Management System                      //
//                    Copyright (c) 2000 XOOPS.org                           //
//                       <http://www.xoops.org/>   ... nbsp;   //
//  ------------------------------------------------------------------------ //
//  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";

if ( !
$xoopsUser ) {
 
$errormessage _PM_SORRY."<br />"._PM_PLZREG."";
     
redirect_header("user.php",2,$errormessage);
} else {
  
$pm_handler =& xoops_gethandler('privmessage');
 if (isset(
$HTTP_POST_VARS['delete_messages']) && isset($HTTP_POST_VARS['msg_id'])) {
    
$size count($HTTP_POST_VARS['msg_id']);
   
$msg =& $HTTP_POST_VARS['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';
  
// Modification By Ackbarr to swap sort order
 //$pm_arr =& $pm_handler->getObjects(new Criteria('to_userid', $xoopsUser->getVar('uid')));
 
$criteria = new CriteriaCompo(new Criteria('to_userid'$xoopsUser->getVar('uid')));
  
$criteria->setSort('msg_time');
 
$criteria->setOrder('desc');
  
$pm_arr =& $pm_handler->getObjects($criteria);
  
// End Modification
 
$total_messages count($pm_arr);
 echo 
"<h4 style='text-align:center;'>"_PM_PRIVATEMESSAGE ."</h4><br /><a href='userinfo.php?uid="$xoopsUser->getVar("uid")."'>"_PM_PROFILE ."</a>&nbsp;<span style='font-weight:bold;'>»»</span>&nbsp;"_PM_INBOX ."&nbsp;<span style='font-weight:bold;'>»» $total_messages Nachrichten in Deinem Postfach</span>&nbsp;"."<br /><br /><table border='0' cellspacing='1' cellpadding='4' width='100%' class='outer'>n";
  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><img src='images/download.gif' alt='' border='0' /></th><th>&nbsp;</th><th>"_PM_FROM ."</th><th>"_PM_SUBJECT ."</th><th align='center'>"_PM_DATE ."</th></tr>n";
  if ( 
$total_messages == ) {
   echo 
"<tr><td class='even' colspan='6' align='center'>"._PM_YOUDONTHAVE."</td></tr> ";
    
$display0;
  } else {

    
$display 1;
 }
    for (
$i 0$i $total_messages$i++) {
   
// Modification By Ackbarr to swap sort order
   
$current $total_messages - ($i 1);
    
// End Modification
   
$class = ($i == 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'><img src='images/noread.gif' alt='Bereits gelesen' /></td>n";
    } else {
      echo 
"<td valign='top' width='5%' align='center'><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='readpmsg.php?start=$current&total_messages=$total_messages'>".$postername."</a>";
    } else {
      echo 
$xoopsConfig['anonymous'];
   }
   echo 
"</td>n";
    
// Modification By Ackbarr to swap sort order
   //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'><a href='readpmsg.php?start=$current&total_messages=$total_messages'>".$pm_arr[$i]->getVar("subject")."</a></td>";
    
// End Modification
   
echo "<td valign='middle' align='center' width='20%'>".formatTimestamp($pm_arr[$i]->getVar("msg_time"))."</td></tr>";
 }

 if ( 
$display == ) {
    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."' /></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>";
  include 
"footer.php";
}
?>


Bildchen für gelesen und nicht-gelesen könnt Ihr Euch selber basteln (sollten read.gif und noread.gif heißen)

PEACE!

raggamuffin

"myXOOPs"-Neuling
Gepostet am:29.03.2004 11:47
raggamuffin
raggamuffin Offline (Show more)
"myXOOPs"-Neuling
Posts: 32
Since: 02.11.2002
#2

Re: Sortierfunktion im Posteingang

Also ich hätt´ gern wenigsten die Reihenfolge umgekehrt, also daß die neuen Nachrichten oben stehen...
Wenn ich die for-Schleife umstricke, die die Tabelle aufbaut (viewpmsg.php - Zeile 62 !?)
for ($i = 0; $i < $total_messages; $i++)
zu
for ($i = $total_messages; $i >= 0 ; $i--)
dann passiert auf einmal gar nix mehr...

Warum nur ???

Advertisement

Gepostet am:0
Advertisement (Show more)
Posts: 0
Since: 0


Hier könnten Sie Ihre Anzeige aufgeben!
Bitte kontaktieren Sie uns, um mehr darüber zu erfahren.

raggamuffin

"myXOOPs"-Neuling
Gepostet am:28.03.2004 20:18
raggamuffin
raggamuffin Offline (Show more)
"myXOOPs"-Neuling
Posts: 32
Since: 02.11.2002
#1

Sortierfunktion im Posteingang

Könnte mir jemand helfen bzw. ein paar Tipps geben wie ich den Posteingang tunen kann um Nachrichten nach Absender/Datum/gelesen etc zu sortieren...
Halt ähnlich so wie Outlook funktioniert...

Danke!
Diesen Thread durchsuchen:  1 Anonyme Benutzer

Aktuell aus dem Forum

Forum Thema Antworten Views Letzter Beitrag
OffOffTopic [Wichtig] Übernahme myXOOPS 0 596 11.12.2023 18:57
alfred Gehe zum letzten Beitrag
Die Installation und Administration von XOOPS 2.5.X [Offen] Upgrade 2.5.11 3 2341 07.05.2023 07:03
Goffy Gehe zum letzten Beitrag