a88c8b9987fb64086963972e614d107cb9d9d94f
[acontent.git] / docs / include / classes / DAO / PatchesFilesActionsDAO.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 "patches_files_actions" 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 PatchesFilesActionsDAO extends DAO {
25
26         /**
27          * Create new row
28          * @access  public
29          * @param   $patches_files_id, $action, $code_from, $code_to
30          * @return  patches_files_actions_id, if successful
31          *          false and add error into global var $msg, if unsuccessful
32          * @author  Cindy Qi Li
33          */
34         public function Create($patches_files_id, $action, $code_from, $code_to)
35         {
36                 global $addslashes;
37
38                 $sql = "INSERT INTO " . TABLE_PREFIX. "patches_files_actions " .
39                                          "(patches_files_id, 
40                                            action,
41                                            code_from,
42                                            code_to)
43                                           VALUES
44                                           (".$patches_files_id.",
45                                            '".$action."',
46                                            '".$addslashes($code_from)."',
47                                            '".$addslashes($code_to)."')";
48                 
49                 if (!$this->execute($sql))
50                 {
51                         $msg->addError('DB_NOT_UPDATED');
52                         return false;
53                 }
54                 else
55                 {
56                         return mysql_insert_id();
57                 }
58         }
59 }
60 ?>