Commit 24ed72dc2783cb1ef4828f8a75e8117311012a6a

Authored by Neil Blakey-Milner
1 parent 5ad9f9a2

Remove unused DefaultLookup.inc


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@5251 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 0 additions and 111 deletions
lib/DefaultLookup.inc deleted
1 -<?php  
2 -/**  
3 - * $Id$  
4 - *  
5 - * Represents the base class for any table in the database that ends in a _lookup  
6 - * i.e. any tables containing only an ID and name column  
7 - *  
8 - * Copyright (c) 2006 Jam Warehouse http://www.jamwarehouse.com  
9 - *  
10 - * This program is free software; you can redistribute it and/or modify  
11 - * it under the terms of the GNU General Public License as published by  
12 - * the Free Software Foundation; using version 2 of the License.  
13 - *  
14 - *  
15 - * This program is distributed in the hope that it will be useful,  
16 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
17 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
18 - * GNU General Public License for more details.  
19 - *  
20 - * You should have received a copy of the GNU General Public License  
21 - * along with this program; if not, write to the Free Software  
22 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA  
23 - *  
24 - * @version $Revision$  
25 - * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa  
26 - * @package lib  
27 - */  
28 -class DefaultLookup extends KTEntity {  
29 -  
30 - /** database table name */  
31 - var $sTableName;  
32 - /** primary key */  
33 - var $iId;  
34 - /** name value */  
35 - var $sName;  
36 -  
37 - function DefaultLookup($sNewTableName, $sNewName) {  
38 - //object not stored yed  
39 - $this->iId = -1;  
40 - $this->sTableName = $sNewTableName;  
41 - $this->sName = $sNewName;  
42 - }  
43 -  
44 - /**  
45 - * Get the primary key for this object  
46 - *  
47 - * @return int primary key for this object  
48 - *  
49 - */  
50 - function getID() {  
51 - return $this->iId;  
52 - }  
53 -  
54 - /**  
55 - * Get the name value for this object  
56 - *  
57 - * @return String name value for this object  
58 - *  
59 - */  
60 - function getName() {  
61 - return $this->sName;  
62 - }  
63 -  
64 - /**  
65 - * Set the name value for this object  
66 - *  
67 - * @param New name value  
68 - *  
69 - */  
70 - function setName($sNewValue) {  
71 - $this->sName = $sNewValue;  
72 - }  
73 -  
74 - function _fieldValues () {  
75 - return array(  
76 - 'name' => $this->sName,  
77 - );  
78 -  
79 - }  
80 -  
81 - function _table () {  
82 - return $this->sTableName;  
83 - }  
84 -  
85 - /**  
86 - * Static function.  
87 - * Given a primary key and a tablename, will create  
88 - * the corresponding lookup object  
89 - *  
90 - * @param Database table to query  
91 - * @param Primary key of object to retrieve  
92 - *  
93 - * @return Lookup lookup object populated with relevant values  
94 - */  
95 - function & get($sTableName, $iId) {  
96 - $sql = $default->db;  
97 - $result = $sql->query(array("SELECT * FROM $sTableName WHERE id = ?", $iId));/*ok*/  
98 - if ($result) {  
99 - if ($sql->next_record()) {  
100 - $oLookup = & new DefaultLookup($sTableName, $sql->f("name"));  
101 - $oLookup->iId = $iId;  
102 - return $oLookup;  
103 - }  
104 - return false;  
105 - }  
106 - return false;  
107 - }  
108 -  
109 -}  
110 -  
111 -?>