Commit 3d94b9bda3296ac327c2d713adb9ade3183bfece

Authored by rob
1 parent b6495e70

removed dependantdocument.inc


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@1842 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/documentmanagement/DependantDocument.inc deleted
1   -<?php
2   -/**
3   -*
4   -* Class DependantDocument
5   -*
6   -* Represents a dependant document as per the database table dependant_document
7   -* Used to chain documents together in the collaboration process
8   -*
9   -* @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
10   -* @date 14 May 2003
11   -* @package lib.documentmanagement
12   -*/
13   -
14   -
15   -class DepandantDocument {
16   -
17   - /** primary key value */
18   - var $iId;
19   - /** primary key of user responsible for creating document */
20   - var $iUserID;
21   - /** document title name */
22   - var $sDocumentTitle;
23   - /** primary key of document to use as template */
24   - var $iTemplateDocumentID;
25   -
26   - /**
27   - * Default constructor
28   - *
29   - * @param Name of document field
30   - * @param Document field data type
31   - *
32   - */
33   - function DepandantDocument($sNewDocumentTitle, $iUserID, $iNewTemplateDocumentID) {
34   - //object not created yet
35   - global $default;
36   - $this->iID = -1;
37   - $this->iUserID = $iUserID;
38   - $this->iTemplateDocumentID = $iNewTemplateDocumentID;
39   -
40   -
41   - }
42   -
43   - /**
44   - * Get the document field's primary key value
45   - *
46   - * @return int document field's primary key value
47   - *
48   - */
49   - function getID() {
50   - return $this->iId;
51   - }
52   -
53   - /**
54   - * Get the primary key of the user responsbile for new document creation
55   - */
56   - function getUserID() {
57   - return $this->iUserID;
58   - }
59   -
60   - /**
61   - * Set the document field's name
62   - *
63   - * @param Document field's new name
64   - *
65   - */
66   - function setDocumentTitle($sNewValue) {
67   - $this -> sDocumentTitle = $sNewValue;
68   - }
69   -
70   - /**
71   - * Get the depedant document's title
72   - *
73   - * @return String dependant document's title *
74   - */
75   - function getDocumentTitle() {
76   - return $this->sDocumentTitle;
77   - }
78   -
79   -
80   - /**
81   - * Get the primary key of the template document
82   - *
83   - * @return int Primary key of template document
84   - *
85   - */
86   - function getTemplateDocumentID() {
87   - return $this -> iTemplateDocumentID;
88   - }
89   -
90   - /**
91   - * Set the template document's primary key
92   - *
93   - * @param Template document's primary key
94   - *
95   - */
96   - function setHasLookup($sNewValue) {
97   - $this -> iTemplateDocumentID = $sNewValue;
98   - }
99   -
100   - /**
101   - * Store the current object in the database
102   - *
103   - * @return boolean on successful store, false otherwise and set $_SESSION["errorMessage"]
104   - *
105   - */
106   - function create() {
107   - global $default, $lang_err_database, $lang_err_object_exists;
108   - //if the object hasn't been created
109   - if ($this -> iId < 0) {
110   - $sql = $default -> db;
111   - $result = $sql -> query("INSERT INTO $default -> owl_dependant_documents_table (document_title, user_id,template_document_id) VALUES ('" . addslashes($this->sDocumentTitle) . "', $this->iUserID, $this->iTemplateDocumentID)");
112   - if ($result) {
113   - $this -> iId = $sql -> insert_id();
114   - return true;
115   - }
116   - $_SESSION["errorMessage"] = $lang_err_database;
117   - return false;
118   - }
119   - $_SESSION["errorMessage"] = $lang_err_object_exists."id = ".$this -> iId." table = document_fields";
120   - return false;
121   - }
122   -
123   - /**
124   - * Update the values in the database table with the object's current values
125   - *
126   - * @return boolean true on successful update, false otherwise and set $_SESSION["errorMessage"]
127   - *
128   - */
129   - function update() {
130   - global $default, $lang_err_database, $lang_err_object_key;
131   - //only update if the object has been stored
132   - if ($this -> iId > 0) {
133   - $sql = $default -> db;
134   - $result = $sql -> query("UPDATE $default -> owl_dependant_documents SET document_title = '".addslashes($this -> sDocumentTitle)."', user_id = $this->iUserID, template_document_id = $this->iTemplateDocumentID WHERE id = $this->iId");
135   - if ($result) {
136   - return true;
137   - }
138   - $_SESSION["errorMessage"] = $lang_err_database;
139   - return false;
140   - }
141   - $_SESSION["errorMessage"] = $lang_err_object_key;
142   - return false;
143   - }
144   -
145   - /**
146   - * Delete the current object from the database
147   - *
148   - * @return boolean true on successful deletion, false otherwise and set $_SESSION["errorMessage"]
149   - *
150   - */
151   - function delete() {
152   - global $default, $lang_err_database, $lang_err_object_key;
153   - //only delete the object if it exists in the database
154   - if ($this -> iId >= 0) {
155   - $sql = $default -> db;
156   - $result = $sql -> query("DELETE FROM $default->owl_dependant_documents_table WHERE id = $this->iId");
157   - if ($result) {
158   - return true;
159   - }
160   - $_SESSION["errorMessage"] = $lang_err_database;
161   - return false;
162   - }
163   - $_SESSION["errorMessage"] = $lang_err_object_key;
164   - return false;
165   - }
166   -
167   - /**
168   - * Static function.
169   - * Given a dependant_documents primary key it will create a
170   - * DependantDocument object and populate it with the
171   - * corresponding database values
172   - *
173   - * @return DependantDocument populated DependantDocument object on successful query, false otherwise and set $_SESSION["errorMessage"]
174   - */
175   - function & get($iDependantDocumentID) {
176   - global $default;
177   - $sql = $default -> db;
178   - $result = $sql -> query("SELECT * FROM $default->owl_dependant_documents_table WHERE id = $iDependantDocumentID");
179   - if ($result) {
180   - if ($sql -> next_record()) {
181   - $oDependantDocument = & new DependantDocument(stripslashes($sql -> f("document_title")), $sql -> f("user_id"), $sql -> f("template_document_id"));
182   - $oDependantDocument -> iId = $sql -> f("id");
183   - return $oDependantDocument;
184   - }
185   - $_SESSION["errorMessage"] = $lang_err_object_not_exist."id = ".$iDependantDocumentID." table = $default->owl_dependant_documents_table";
186   - return false;
187   - }
188   - $_SESSION["errorMessage"] = $lang_err_database;
189   - return false;
190   - }
191   -}
192   -
193   -?>
194 0 \ No newline at end of file