70a0afaeb14db0c776a81cc8401a095c2a43f8d6
[acontent.git] / docs / include / classes / DAO / MailQueueDAO.class.php
1 <?php
2 /************************************************************************/
3 /* AContent                                                             */
4 /************************************************************************/
5 /* Copyright (c) 2010                                                   */
6 /* Inclusive Design Institute                                           */
7 /*                                                                      */
8 /* This program is free software. You can redistribute it and/or        */
9 /* modify it under the terms of the GNU General Public License          */
10 /* as published by the Free Software Foundation.                        */
11 /************************************************************************/
12
13 /**
14 * DAO for "mail_queue" table
15 * @access       public
16 * @author       Cindy Qi Li
17 * @package      DAO
18 */
19
20 if (!defined('TR_INCLUDE_PATH')) exit;
21
22 require_once(TR_INCLUDE_PATH. 'classes/DAO/DAO.class.php');
23
24 class MailQueueDAO extends DAO {
25
26         /**
27         * Create a record
28         * @access  public
29         * @param   infos
30         * @return  mail_queue_id: if success
31         *          false: if unsuccess
32         * @author  Cindy Qi Li
33         */
34         function Create($to_email, $to_name, $from_email, $from_name, $subject, $body, $charset)
35         {
36                 $sql = "INSERT INTO ".TABLE_PREFIX."mail_queue 
37                                                 VALUES (NULL, '$to_email', '$to_name', '$from_email', '$from_name', '$charset', '$subject', '$body')";
38                 
39                 if ($this->execute($sql))
40                 {
41                         return mysql_insert_id($this->db);
42                 }
43                 else
44                 {
45                         return false;                   
46                 }
47         }
48
49         /**
50         * Return all records
51         * @access  public
52         * @param   none
53         * @return  table rows
54         * @author  Cindy Qi Li
55         */
56         function GetAll()
57         {
58                 $sql = "SELECT * FROM ".TABLE_PREFIX."mail_queue"; 
59                 
60                 return $this->execute($sql);
61         }
62
63         /**
64         * Delete a record by mail ids
65         * @access  public
66         * @param   $mids : mail IDs, for example: "1, 2, 3"
67         * @return  true: if successful
68         *          false: if unsuccessful
69         * @author  Cindy Qi Li
70         */
71         function DeleteByIDs($mids)
72         {
73                 $sql = "DELETE FROM ".TABLE_PREFIX."mail_queue WHERE mail_id IN (".$mids.")";
74                 
75                 return $this->execute($sql);
76         }
77
78 }
79 ?>