Google
Web alhem.net
Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

ForumsForm Class Reference

#include <ForumsForm.h>

Inheritance diagram for ForumsForm:

Inheritance graph
[legend]
Collaboration diagram for ForumsForm:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ForumsForm (Web *)
 ~ForumsForm ()
void Process ()
void Display (long)
void Select (const std::string &)
void List ()

Detailed Description

File ......... ForumsForm.h Published .... 2004-07-09 Author ....... grymse@alhem.net

Definition at line 31 of file ForumsForm.h.


Constructor & Destructor Documentation

ForumsForm::ForumsForm Web *  w  ) 
 

File ......... ForumsForm.cpp Published .... 2004-07-09 Author ....... grymse@alhem.net

Definition at line 32 of file ForumsForm.cpp.

References ForumsForm().

Referenced by ForumsForm().

00032 : BaseForm(w, "ForumsForm") 00033 { 00034 }

ForumsForm::~ForumsForm  ) 
 

Definition at line 37 of file ForumsForm.cpp.

00038 { 00039 }


Member Function Documentation

void ForumsForm::Display long   ) 
 

Definition at line 61 of file ForumsForm.cpp.

References Display().

Referenced by Display(), and IWeb::GenerateDocument().

00062 { 00063 IWeb *pWeb = static_cast<IWeb *>(GetWeb()); 00064 Database& db = pWeb -> GetDatabase(); 00065 Query q(db); 00066 Query q2(db); 00067 Query q3(db); 00068 char sql[1000]; 00069 00070 // printf("<h3>Forums</h3>"); 00071 Navigator(); 00072 printf("</td><td align=right>"); 00073 // printf("<div align=right>"); 00074 printf("[ <a href=\"%s?page=2\">settings</a> ",GetCgiName().c_str()); 00075 printf("| <a href=\"%s?logout=1\">logout</a> ",GetCgiName().c_str()); 00076 // printf("]</div>"); 00077 printf("]</td></tr></table>"); 00078 printf("</div>"); 00079 00080 q.get_result("select * from forum where deleted=0 order by updated desc"); 00081 printf("<table cellpadding=\"0\" cellspacing=\"0\" class=forums width=\"100%%\">"); 00082 printf("<tr>"); 00083 printf("<th class=forums align=left>Forum</th>"); 00084 printf("<th class=forums align=left>Topics</th>"); 00085 printf("<th class=forums align=left>Messages</th>"); 00086 printf("<th class=forums align=left>Last</th>"); 00087 printf("</tr>"); 00088 while (q.fetch_row()) 00089 { 00090 db::Forum x(&db, &q); 00091 db::Account account(db, x.updated_by); 00092 long qthreads = 0; 00093 long qmessages = 0; 00094 00095 sprintf(sql,"select num from thread where forum=%ld and deleted=0",x.num); 00096 q2.get_result(sql); 00097 while (q2.fetch_row()) 00098 { 00099 long num = q2.getval(); 00100 sprintf(sql,"select count(*) from message where thread=%ld and deleted=0",num); 00101 qmessages += q3.get_count(sql); 00102 qthreads++; 00103 } 00104 q2.free_result(); 00105 00106 printf("<tr>"); 00107 printf("<td class=forums><a href=\"%s?ForumsForm=select&forum=%ld\">%s</a></td>", 00108 GetCgiName().c_str(),x.num,x.name.c_str()); 00109 printf("<td class=forums align=right width=\"1%%\">%ld</td>",qthreads); 00110 printf("<td class=forums align=right width=\"1%%\">%ld</td>",qmessages); 00111 printf("<td class=forums width=\"1%%\">"); 00112 printf("%s<br>",GetAccountName(account).c_str()); 00113 nbprintf("%s</td>", x.updated.c_str()); 00114 printf("</tr>"); 00115 } 00116 printf("</table>"); 00117 q.free_result(); 00118 }

void ForumsForm::List  )  [inline]
 

Definition at line 40 of file ForumsForm.h.

00040 {}

void ForumsForm::Process  ) 
 

Definition at line 42 of file ForumsForm.cpp.

00043 { 00044 IWeb *pWeb = static_cast<IWeb *>(GetWeb()); 00045 // Database& db = pWeb -> GetDatabase(); 00046 char action[200]; 00047 00048 // <input type="submit" name="ForumsForm" value="action" ... 00049 if (GetForm() -> getvalue( (char *)GetFormName().c_str(), action, 200) && *action) 00050 { 00051 if (!strcmp(action,"select")) 00052 { 00053 long nr = atol(GetForm() -> getvalue("forum").c_str()); 00054 pWeb -> SetForum( nr ); 00055 pWeb -> SetPage( 4 ); 00056 } 00057 } 00058 }

void ForumsForm::Select const std::string &   )  [inline]
 

Definition at line 39 of file ForumsForm.h.

References Select().

Referenced by Select().

00039 {}


The documentation for this class was generated from the following files:
Generated on Sat Feb 12 00:14:57 2005 for IBank by doxygen 1.3.7