~ubuntu-branches/ubuntu/hardy/gallery2/hardy-security

« back to all changes in this revision

Viewing changes to modules/core/classes/interfaces/GalleryToolkitPropertyMap.inc

  • Committer: Bazaar Package Importer
  • Author(s): Michael C. Schultheiss
  • Date: 2006-04-16 16:42:35 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20060416164235-8uy0u4bfjdxpge2o
Tags: 2.1.1-1
* New upstream release (Closes: #362936)
  + Bugfixes for Postgres7 (Closes: #359000, #362152)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?php
2
 
/*
3
 
 * $RCSfile: GalleryToolkitPropertyMap.inc,v $
4
 
 *
5
 
 * Gallery - a web based photo album viewer and editor
6
 
 * Copyright (C) 2000-2005 Bharat Mediratta
7
 
 * 
8
 
 * This program is free software; you can redistribute it and/or modify
9
 
 * it under the terms of the GNU General Public License as published by
10
 
 * the Free Software Foundation; either version 2 of the License, or (at
11
 
 * your option) any later version.
12
 
 * 
13
 
 * This program is distributed in the hope that it will be useful, but
14
 
 * WITHOUT ANY WARRANTY; without even the implied warranty of
15
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
 
 * General Public License for more details.
17
 
 * 
18
 
 * You should have received a copy of the GNU General Public License
19
 
 * along with this program; if not, write to the Free Software
20
 
 * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA  02110-1301, USA.
21
 
 */
22
 
/**
23
 
 * @package GalleryCore
24
 
 * @subpackage ClassInterfaces
25
 
 * @version $Revision: 1.19 $ $Date: 2005/08/23 03:49:04 $
26
 
 * @author Bharat Mediratta <bharat@menalto.com>
27
 
 */
28
 
 
29
 
/**
30
 
 * Interface class for the GalleryToolkitPropertyMap class.
31
 
 * (Class schema version: 1.0)
32
 
 *
33
 
 * This file is automatically generated from XML embedded in the
34
 
 * class, combined with the ClassCode.xsl file.  You should not modify
35
 
 * it by hand, as your changes will be lost next time this file is
36
 
 * rebuilt.  If you want to add more getters/setters, you should add
37
 
 * them in the core class.  If you want to change the format of this
38
 
 * file, then you should edit the XSL template.
39
 
 *
40
 
 * @package GalleryCore
41
 
 * @subpackage Classes
42
 
 */
43
 
class GalleryToolkitPropertyMap extends GalleryToolkitPropertyMap_core {
44
 
  
45
 
    /**
46
 
     * Return the name of this class with the proper mix of uppercase and
47
 
     * lowercase (get_class() always returns lowercase)
48
 
     *
49
 
     * @return string class name
50
 
     */
51
 
    function getClassName() {
52
 
        return 'GalleryToolkitPropertyMap';
53
 
    }
54
 
 
55
 
    /** 
56
 
     * Return the path to the PHP file for this class, relative to the gallery2 dir
57
 
     * 
58
 
     * @return string path
59
 
     */ 
60
 
    function getClassFile() { 
61
 
        return 'modules/' .  
62
 
            basename(dirname(dirname(dirname(__FILE__)))) .  
63
 
            '/classes/GalleryToolkitPropertyMap.class'; 
64
 
    }
65
 
    
66
 
    /**
67
 
     * Get meta information about this class' map 
68
 
     *
69
 
     * @return array map member => type
70
 
     */
71
 
    function getMapInfo() {
72
 
        $info = array();
73
 
        $info['members']['name'] = STORAGE_TYPE_STRING;
74
 
        $info['members']['type'] = STORAGE_TYPE_STRING;
75
 
        $info['members']['description'] = STORAGE_TYPE_STRING;
76
 
        return $info; 
77
 
    }
78
 
 
79
 
    /**
80
 
     * Add an entry to this map
81
 
     *
82
 
     * @param array an associative array of the entry data
83
 
     * @return object GalleryStatus a status code
84
 
     * @static
85
 
     */
86
 
    function addMapEntry($data) {
87
 
        global $gallery;
88
 
        foreach (array('name', 'type', 'description', ) as $key) {
89
 
            if (!array_key_exists($key, $data)) {
90
 
                return GalleryStatus::error(ERROR_BAD_PARAMETER, __FILE__, __LINE__,
91
 
                                            'Missing parameter: ' . $key);
92
 
            }
93
 
        }
94
 
 
95
 
        $storage =& $gallery->getStorage();
96
 
        $ret = $storage->addMapEntry('GalleryToolkitPropertyMap', $data);
97
 
        if ($ret->isError()) {
98
 
            return $ret->wrap(__FILE__, __LINE__);
99
 
        }
100
 
        return GalleryStatus::success();
101
 
    }
102
 
 
103
 
    /**
104
 
     * Remove an entry from this map
105
 
     *
106
 
     * @param array an associative array of the entry data to match and remove
107
 
     * @return object GalleryStatus a status code
108
 
     * @static
109
 
     */
110
 
    function removeMapEntry($data) {
111
 
        global $gallery;
112
 
 
113
 
        if (sizeof($data) == 0) {
114
 
            return GalleryStatus::error(ERROR_BAD_PARAMETER, __FILE__, __LINE__);
115
 
        }
116
 
 
117
 
        $storage =& $gallery->getStorage();
118
 
        $ret = $storage->removeMapEntry('GalleryToolkitPropertyMap', $data);
119
 
        if ($ret->isError()) {
120
 
            return $ret->wrap(__FILE__, __LINE__);
121
 
        }
122
 
        return GalleryStatus::success();
123
 
    }
124
 
 
125
 
    /**
126
 
     * Remove ALL entries from this map.. use with caution!
127
 
     *
128
 
     * @return object GalleryStatus a status code
129
 
     * @static
130
 
     */
131
 
    function removeAllMapEntries() {
132
 
        global $gallery;
133
 
 
134
 
        $storage =& $gallery->getStorage();
135
 
        $ret = $storage->removeAllMapEntries('GalleryToolkitPropertyMap');
136
 
        if ($ret->isError()) {
137
 
            return $ret->wrap(__FILE__, __LINE__);
138
 
        }
139
 
        return GalleryStatus::success();
140
 
    }
141
 
 
142
 
    /**
143
 
     * Update an entry in this map
144
 
     *
145
 
     * @param array the entry to match
146
 
     * @param array the values to change
147
 
     * @return object GalleryStatus a status code
148
 
     * @static
149
 
     */
150
 
    function updateMapEntry($match, $change) {
151
 
        global $gallery;
152
 
 
153
 
        if (sizeof($match) == 0 || sizeof($change) == 0) {
154
 
            return GalleryStatus::error(ERROR_BAD_PARAMETER, __FILE__, __LINE__);
155
 
        }
156
 
 
157
 
        $storage =& $gallery->getStorage();
158
 
        $ret = $storage->updateMapEntry('GalleryToolkitPropertyMap', $match, $change);
159
 
        if ($ret->isError()) {
160
 
            return $ret->wrap(__FILE__, __LINE__);
161
 
        }
162
 
        return GalleryStatus::success();
163
 
    }
164
 
  
165
 
}
166
 
?>