fa197f91d743a46cd62caa13ac89d81ace594543
[acontent.git] / docs / include / classes / DAO / ThemesDAO.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 "themes" 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 ThemesDAO extends DAO {
25
26         /**
27         * Return all theme' information
28         * @access  public
29         * @param   none
30         * @return  table rows
31         * @author  Cindy Qi Li
32         */
33         function getAll()
34         {
35     $sql = 'SELECT * FROM '.TABLE_PREFIX.'themes ORDER BY dir_name';
36     return $this->execute($sql);
37   }
38
39         /**
40         * Return theme by theme dir name
41         * @access  public
42         * @param   dirName : theme dir name
43         * @return  table rows
44         * @author  Cindy Qi Li
45         */
46         function getByID($dirName)
47         {
48     $sql = "SELECT * FROM ".TABLE_PREFIX."themes WHERE dir_name='".$dirName."'";
49     if ($rows = $this->execute($sql))
50         return $rows[0];
51   }
52
53         /**
54         * Return all default themes
55         * @access  public
56         * @param   none
57         * @return  table rows
58         * @author  Cindy Qi Li
59         */
60         function getDefaultTheme()
61         {
62     $sql = "SELECT * FROM ".TABLE_PREFIX."themes WHERE status=".TR_STATUS_DEFAULT;
63     return $this->execute($sql);
64   }
65
66         /**
67         * Return all enabled themes
68         * @access  public
69         * @param   none
70         * @return  table rows
71         * @author  Cindy Qi Li
72         */
73         function getEnabledTheme()
74         {
75     $sql = "SELECT * FROM ".TABLE_PREFIX."themes WHERE status in (".TR_STATUS_ENABLED.", ".TR_STATUS_DEFAULT.")";
76     return $this->execute($sql);
77   }
78
79 }
80 ?>