Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

base-outbox.inc.php

Go to the documentation of this file.
00001 <?
00009 class BaseOutbox extends MyManager
00010 {
00016     public function __construct($class = 'Message')
00017     {
00018         parent::__construct($class);
00019     }
00020     
00024     public function initSearchPage()
00025     {
00026         $this->assertLogin();
00027         
00028         parent::initSearchPage();
00029 
00030         $this->pageTitle = 'Outbox';
00031     }
00032     
00038     protected function getSearchFrom($params)
00039     {
00040         $from = "FROM {$this->object->outboxTable} b\n";
00041         $from .= "INNER JOIN {$this->object->tableName} o\n";
00042         $from .= "ON o.id = b.message_id\n";
00043 
00044         return $from;
00045     }
00046     
00052     protected function getSearchWhere($params)
00053     {
00054         global $me;
00055 
00056         $where = parent::getSearchWhere($params);
00057         $where .= " AND b.user_id = '$me->id'\n";
00058 
00059         return $where;
00060     }
00061     
00069     public function drawRows($rs)
00070     {
00071         if (count($rs))
00072         {
00073             echo "<form id=\"deleteAll\" method=\"post\" action=\"" . $this->getUrl(array('page' => 'delete')) . "\">\n";
00074             echo "<table class=\"InOutBox\">";
00075             $this->object->drawHeaderRow('outbox');
00076             foreach ($rs AS $ob)
00077             {
00078                 $on = !$on;
00079                 $ob->drawRow('outbox', $on);
00080             }
00081             echo "</table>";
00082 
00083             echo "<input type=\"submit\" name=\"submit\" value=\"Delete Selected\"/>\n";
00084             echo "</form>\n";
00085         }
00086     }
00087     
00093     public function getPagesXml()
00094     {
00095         $xml = parent::getPagesXml();
00096 
00097         $xml .= "<page name=\"delete\" description=\"delete outbox messages.\"/>\n";
00098 
00099         return $xml;
00100     }
00101 
00105     public function initDeletePage()
00106     {
00107         global $me;
00108         
00109         $this->pageTitle = 'Delete Outbox Messages';
00110 
00111         $this->assertLogin();
00112         
00113         if (!count($_POST['message']))
00114             throw new PageError('You must select at least 1 message to delete.');
00115         else
00116         {
00117             foreach ($_POST['message'] AS $messageId)
00118             {
00119                 dbExecute("
00120                     DELETE FROM {$this->object->outboxTable}
00121                     WHERE user_id = '$me->id'
00122                         AND message_id = '$messageId'
00123                 ");
00124             }
00125 
00126             Util::redirect($this->getUrl(".main"));
00127         }
00128     }
00129 
00133     public function drawDeletePage()
00134     {
00135         echo 'Messages deleted.';
00136     }
00137 }
00138 ?>

Generated on Fri Oct 27 12:26:40 2006 for BaseJumper by doxygen 1.3.9.1