Commit c8d990ead38f59f24ac9016d5351bfdc7c8ac5bb

Authored by Michael Joseph
1 parent 97c8f44b

removing for re-addition- bad filename case


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@1416 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/documentmanagement/MetaData.Inc deleted
1   -<?php
2   -/**
3   -*
4   -* Class DocumentType
5   -*
6   -* Represents a MetaData as per the database document_types_lookup table
7   -*
8   -* @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
9   -* @date 19 January 2003
10   -* @package lib.documentmanagement
11   -*/
12   -
13   -class MetaData {
14   -
15   - /** primary key value */
16   - var $iId;
17   - //document field id
18   - var $iDocFieldId;
19   - /** MetaData name */
20   - var $sName;
21   -
22   - /**
23   - * Default constructor
24   - *
25   - * @param Name of MetaData
26   - * @param MetaData data type
27   - *
28   - */
29   - function MetaData($iNewDocFieldID,$sNewName) {
30   - //object not created yet
31   - $this->iId = -1;
32   - $this->iDocFieldID = $iNewDocFieldID;
33   - $this->sName = $sNewName;
34   -
35   - }
36   -
37   - /**
38   - * Get the MetaData's primary key value
39   - *
40   - * @return int MetaData's primary key value
41   - *
42   - */
43   - function getID() {
44   - return $this->iId;
45   - }
46   -
47   - /**
48   - * Get the MetaData's name
49   - *
50   - * @return String MetaData's name
51   - *
52   - */
53   - function getName() {
54   - return $this->sName;
55   - }
56   -
57   -
58   - /**
59   - * Set the MetaData's name
60   - *
61   - * @param MetaData's new name
62   - *
63   - */
64   - function setName($sNewValue) {
65   - $this->sName = $sNewValue;
66   - }
67   - /**
68   - * Set the MetaData's docField
69   - *
70   - * @param MetaData's new name
71   - *
72   - */
73   - function setDocFieldID($sNewValue) {
74   - $this->iDocFieldID = $sNewValue;
75   - }
76   -
77   - /**
78   - * Get the MetaData's docfield
79   - *
80   - * @return String MetaData's name
81   - *
82   - */
83   - function getDocFieldID() {
84   - return $this->iDocFieldID;
85   - }
86   -
87   -
88   -
89   - /**
90   - * Store the current object in the database
91   - *
92   - * @return boolean on successful store, false otherwise and set $_SESSION["errorMessage"]
93   - *
94   - */
95   - function create() {
96   - global $default, $lang_err_database, $lang_err_object_exists;
97   - //if the object hasn't been created
98   - if ($this->iId < 0) {
99   - //check to see if name exsits
100   - $sql = $default->db;
101   - $query = "SELECT name FROM ". $default->owl_metadata_table ." WHERE name = '" . $this->sName . "' and document_field_id = '". $this->iDocFieldID . "'";
102   - $sql->query($query);
103   - $rows = $sql->num_rows($sql);
104   -
105   - if ($rows > 0){
106   - // duplicate username
107   - $_SESSION["errorMessage"] = "MetaData::TheMetaData name " . $this->sName . " for the specfic field exists already!";
108   - return false;
109   -
110   - }else{
111   - $sql = $default->db;
112   - $result = $sql->query("INSERT INTO " . $default->owl_metadata_table . " (document_field_id,name) VALUES ('". $this->iDocFieldID . "','" . addslashes($this->sName) . "')");
113   - if ($result) {
114   - $this->iId = $sql->insert_id();
115   - return true;
116   - }
117   - $_SESSION["errorMessage"] = $lang_err_database;
118   - return false;
119   - }
120   - }
121   -
122   - $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = document_types";
123   - return false;
124   - }
125   -
126   - /**
127   - * Update the values in the database table with the object's current values
128   - *
129   - * @return boolean true on successful update, false otherwise and set $_SESSION["errorMessage"]
130   - *
131   - */
132   - function update() {
133   - global $default, $lang_err_database, $lang_err_object_key;
134   - //only update if the object has been stored
135   - if ($this->iId > 0) {
136   - $sql = $default->db;
137   - $result = $sql->query("UPDATE " . $default->owl_metadata_table. " SET name = '" . addslashes($this->sName) . "' WHERE id = $this->iId");
138   - if ($result) {
139   - return true;
140   - }
141   - $_SESSION["errorMessage"] = $lang_err_database;
142   - return false;
143   - }
144   - $_SESSION["errorMessage"] = $lang_err_object_key;
145   - return false;
146   - }
147   -
148   - /**
149   - * Delete the current object from the database
150   - *
151   - * @return boolean true on successful deletion, false otherwise and set $_SESSION["errorMessage"]
152   - *
153   - */
154   - function delete() {
155   - global $default, $lang_err_database, $lang_err_object_key;
156   - //only delete the object if it exists in the database
157   - if ($this->iId >= 0) {
158   - $sql = $default->db;
159   - $result = $sql->query("DELETE FROM " . $default->owl_metadata_table. " WHERE id = $this->iId");
160   - if ($result) {
161   - return true;
162   - }
163   - $_SESSION["errorMessage"] = $lang_err_database;
164   - return false;
165   - }
166   - $_SESSION["errorMessage"] = $lang_err_object_key;
167   - return false;
168   - }
169   -
170   - /**
171   - * Static function.
172   - * Given a document_fields primary key it will create a
173   - *MetaDatas object and populate it with the
174   - * corresponding database values
175   - *
176   - * @returnMetaData populatedMetaData object on successful query, false otherwise and set $_SESSION["errorMessage"]
177   - */
178   - function & get($iMetaDataID) {
179   - global $default;
180   - $sql = $default->db;
181   - $result = $sql->query("SELECT * FROM ". $default->owl_metadata_table." WHERE id = $iMetaDataID");
182   - if ($result) {
183   - if ($sql->next_record()) {
184   - $oDocumentType = & new MetaData($sql->f("document_field_id"),stripslashes($sql->f("name")));
185   - $oDocumentType->iId = $sql->f("id");
186   - return $oDocumentType;
187   - }
188   - $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iDocumentID . " table = document_types";
189   - return false;
190   - }
191   - $_SESSION["errorMessage"] = $lang_err_database;
192   - return false;
193   - }
194   -
195   -
196   -
197   -
198   -/*
199   - * static function
200   - *
201   - * sets the id of the groupunit using their groupid
202   - *
203   - * @param String
204   - * The unit_ID
205   - *
206   - */
207   -
208   - function setMetaDataID($iDocFieldID, $sMetaDataName)
209   - {
210   - global $default;
211   - $sql = $default->db;
212   - $result = $sql->query("SELECT id FROM $default->owl_metadata_table WHERE document_field_id = $iDocFieldID and name = '" . $sMetaDataName . "' ");
213   - if ($result) {
214   - if ($sql->next_record()) {
215   - $id = $sql->f("id");
216   -
217   - }else{
218   - $_SESSION["errorMessage"] = $lang_err_database;
219   - return false;
220   - }
221   -
222   - }else{
223   - $_SESSION["errorMessage"] = $lang_err_database;
224   - return false;
225   - }
226   -
227   - $this->iId = $id;
228   -
229   - }
230   -
231   -}
232   -/**
233   -* Static function
234   -*
235   -* Creates a MetaData object from an array
236   -*
237   -* @param Array Array of parameters. Must match order of parameters in constructor
238   -*
239   -* @return User user object
240   -*/
241   -function & metadataCreateFromArray($aParameters) {
242   - $oMetaData = & new MetaData($aParameters[0], $aParameters[1], $aParameters[2], $aParameters[3], $aParameters[4], $aParameters[5], $aParameters[6], $aParameters[7], $aParameters[8], $aParameters[9], $aParameters[10]);
243   - return $oMetaData;
244   -}
245   -
246   -?>