3 * Copyright (C) 2003-2004 Polytechnique.org
4 * http://opensource.polytechnique.org/
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 * This class is used to handle the preferences for a barrel.
25 * Upon construction these preferences are read from database. It is also
26 * possible to update the value of the preferences and write the new value
29 * @see Diogenes_Barrel
31 class Diogenes_Barrel_Options
33 /** The barrel we are operating on */
36 /** The table holding the options */
37 var $table_option = 'diogenes_option';
39 /** The site's title */
42 /** The site's description */
43 var $description = "";
45 /** The relative url to the site's favicon (PNG) */
48 /** The site's keywords */
51 /** Hide the Diogenes-generated menu entries */
52 var $menu_hide_diogenes = 0;
54 /** Minimum menu level (0 means fully expanded) */
55 var $menu_min_level = 0;
57 /** Menu style (0=classical, 1=phpLayersMenu) */
61 var $menu_theme = "gorilla";
63 /** Site-wide default template */
66 /** Directory that hold the site's template */
67 var $template_dir = "";
69 /** The constructor, reads the current preferences from database.
71 function Diogenes_Barrel_Options($alias)
73 $this->barrel
= $alias;
78 /** Read options from database.
80 function readOptions() {
83 // we only accept options which already exist in this class
84 $res = $globals->db
->query("select name,value from {$this->table_option} where barrel='{$this->barrel}'");
85 while (list($key,$value) = mysql_fetch_row($res)) {
86 if (isset($this->$key) && ($key != "table_option"))
89 mysql_free_result($res);
94 /** Update an option's value and write the new value to database.
96 function updateOption($name, $value) {
99 $this->$name = stripslashes($value);
100 $globals->db
->query("replace into {$this->table_option} set barrel='{$this->barrel}',name='$name',value='$value'");