Commit 5c61e9bb417e91c6daaf56365a52b24a0ec6c0dc

Authored by Michael Joseph
1 parent e7c61114

removed old archiving settings classes


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2234 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/archiving/ArchivingDateSettings.inc deleted
1   -<?php
2   -
3   -/**
4   - * $Id$
5   - *
6   - * Represents archive date settings for a document
7   - *
8   - * Licensed under the GNU GPL. For full terms see the file COPYING.
9   - *
10   - * @version $Revision$
11   - * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa
12   - * @package lib.archiving
13   - */
14   -
15   -class ArchivingDateSettings {
16   -
17   - /**
18   - * The primary key
19   - */
20   - var $iId;
21   - /**
22   - * The expiration date
23   - */
24   - var $dExpirationDate;
25   - /**
26   - * The expiration time period
27   - */
28   - var $iTimePeriodID;
29   -
30   - /**
31   - * Constructs an archive date settings instance
32   - *
33   - * @param date the expiration date
34   - * @param integer the expiration time period id
35   - */
36   - function ArchivingDateSettings($dNewExpirationDate, $iNewTimePeriodID) {
37   - global $default;
38   -
39   - // primary key not set as this is not stored yet
40   - $this->iId = -1;
41   - $this->setExpirationDate($dNewExpirationDate);
42   - $this->iTimePeriodID = $iNewTimePeriodID;
43   - }
44   -
45   - /**
46   - * Gets the primary key
47   - */
48   - function getID(){
49   - return $this->iId;
50   - }
51   -
52   - /**
53   - * Gets the expiration date
54   - */
55   - function getExpirationDate() {
56   - return ($this->dExpirationDate == "NULL" ? "" : $this->dExpirationDate);
57   - }
58   -
59   - /**
60   - * Sets the expiration date
61   - *
62   - * @param date the new expiration date
63   - */
64   - function setExpirationDate($dNewExpirationDate){
65   - $this->dExpirationDate = strlen($dNewExpirationDate) == 0 ? "NULL" : $dNewExpirationDate;
66   - }
67   -
68   - /**
69   - * Gets the time period id
70   - */
71   - function getTimePeriodID(){
72   - return $this->iTimePeriodID;
73   - }
74   -
75   - /**
76   - * Sets the time period id
77   - *
78   - * @param integer the new time period id
79   - */
80   - function setTimePeriodID($iNewTimePeriodID){
81   - $this->iTimePeriodID = $iNewTimePeriodID;
82   - }
83   -
84   - /**
85   - * Inserts the archive date settings into the database
86   - *
87   - * @return boolean true on successful update, false otherwise
88   - */
89   - function create(){
90   - global $default;
91   - //if the id >= 0, then the object has already been created
92   - if ($this->iId < 0) {
93   - $sql = $default->db;
94   - $sQuery = "INSERT INTO $default->owl_archiving_date_settings_table (expiration_date, time_period_id) " .
95   - "VALUES (" . $this->addQuotes($this->dExpirationDate) . ", $this->iTimePeriodID)";
96   - $result = $sql->query($sQuery);
97   - $default->log->info($sQuery);
98   - if ($result) {
99   - //set the current primary key
100   - $this->iId = $sql->insert_id();
101   - return true;
102   - }
103   - return false;
104   - }
105   - return false;
106   - }
107   - function addQuotes($sDate) {
108   - if ($sDate == "NULL") {
109   - return $sDate;
110   - } else {
111   - return "'$sDate'";
112   - }
113   - }
114   -
115   - /**
116   - * Update the archive date settings current values in the database
117   - *
118   - * @return boolean true on successful update, false otherwise
119   - */
120   - function update(){
121   - global $default;
122   - if ($this->iId >= 0) {
123   - $sql = $default->db;
124   - $sQuery = "UPDATE $default->owl_archiving_date_settings_table SET " .
125   - "expiration_date = " . $this->addQuotes($this->dExpirationDate) . ", " .
126   - "time_period_id = $this->iTimePeriodID " .
127   - "WHERE id = $this->iId";
128   - $default->log->info($sQuery);
129   - $result = $sql->query($sQuery);
130   - if ($result) {
131   - return true;
132   - }
133   - return false;
134   - }
135   - return false;
136   - }
137   -
138   - /**
139   - * Delete the current archive date settings from the database. Set the primary key to -1
140   - * on successful deletion
141   - *
142   - * @return boolean true and reset id to -1 on successful deletion, false otherwise
143   - */
144   - function delete() {
145   - global $default;
146   - if ($this->iId >= 0) {
147   - $sql = $default->db;
148   - $result = $sql->query("DELETE FROM $default->owl_archiving_date_settings_table WHERE id = $this->iId");
149   - if ($result) {
150   - $this->iId = -1;
151   - return true;
152   - }
153   - return false;
154   - }
155   - return false;
156   - }
157   -
158   - /**
159   - * Static function. Given a news item primary key will create
160   - * a ArchivingDateSettings object and populate it with the corresponding
161   - * database values
162   - *
163   - * @return ArchivingDateSettings populated ArchivingDateSettings object on success, false otherwise
164   - */
165   - function & get($iArchivingDateSettingsID) {
166   - global $default;
167   - $sql = $default->db;
168   - $sql->query("SELECT * FROM $default->owl_archiving_date_settings_table WHERE id = $iArchivingDateSettingsID");
169   - if ($sql->next_record()) {
170   - $oArchivingDateSettings = & new ArchivingDateSettings($sql->f("expiration_date"), $sql->f("time_period_id"));
171   - $oArchivingDateSettings->iId = $iArchivingDateSettingsID;
172   - return $oArchivingDateSettings;
173   - }
174   - return false;
175   - }
176   -
177   - /**
178   - * Static function
179   - * Get a list of ArchivingDateSettings objects
180   - *
181   - * @param String Where clause (optional)
182   - * @return Array array of ArchivingDateSettings objects, false otherwise
183   - */
184   - function getList($sWhereClause = null) {
185   - global $default;
186   - $aArchivingDateSettingsArray = array();
187   - $sql = $default->db;
188   - $result = $sql->query("SELECT * FROM $default->owl_archiving_date_settings_table " . (isset($sWhereClause) ? " WHERE " . $sWhereClause : ""));
189   - if ($result) {
190   - $iCount = 0;
191   - while ($sql->next_record()) {
192   - $oArchivingDateSettings = & ArchivingDateSettings::get($sql->f("id"));
193   - $aArchivingDateSettingsArray[$iCount++] = $oArchivingDateSettings;
194   - }
195   - return $aArchivingDateSettingsArray;
196   - }
197   - return false;
198   - }
199   -}
200 0 \ No newline at end of file
lib/archiving/ArchivingUtilisationSettings.inc deleted
1   -<?php
2   -
3   -/**
4   - * $Id$
5   - *
6   - * Represents archive utilisation settings for a document
7   - *
8   - * Licensed under the GNU GPL. For full terms see the file COPYING.
9   - *
10   - * @version $Revision$
11   - * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa
12   - * @package lib.archiving
13   - */
14   -
15   -class ArchivingUtilisationSettings {
16   -
17   - /**
18   - * The primary key
19   - */
20   - var $iId;
21   - /**
22   - * The document transaction id
23   - */
24   - var $iDocumentTransactionID;
25   - /**
26   - * The expiration time period
27   - */
28   - var $iTimePeriodID;
29   -
30   - /**
31   - * Constructs an archive utilisation settings instance
32   - *
33   - * @param date the expiration date
34   - * @param integer the expiration time period id
35   - */
36   - function ArchivingUtilisationSettings($iNewDocumentTransactionID, $iNewTimePeriodID) {
37   - global $default;
38   -
39   - // primary key not set as this is not stored yet
40   - $this->iId = -1;
41   - $this->iDocumentTransactionID = $iNewDocumentTransactionID;
42   - $this->iTimePeriodID = $iNewTimePeriodID;
43   - }
44   -
45   - /**
46   - * Gets the primary key
47   - */
48   - function getID(){
49   - return $this->iId;
50   - }
51   -
52   - /**
53   - * Gets the document transaction id
54   - */
55   - function getDocumentTransactionID() {
56   - return $this->iDocumentTransactionID;
57   - }
58   -
59   - /**
60   - * Sets the document transaction id
61   - *
62   - * @param integer the new document transaction id
63   - */
64   - function setDocumentTransactionID($iNewDocumentTransactionID){
65   - $this->iDocumentTransactionID = $iNewDocumentTransactionID;
66   - }
67   -
68   - /**
69   - * Gets the time period id
70   - */
71   - function getTimePeriodID(){
72   - return $this->iTimePeriodID;
73   - }
74   -
75   - /**
76   - * Sets the time period id
77   - *
78   - * @param integer the new time period id
79   - */
80   - function setTimePeriodID($iNewTimePeriodID){
81   - $this->iTimePeriodID = $iNewTimePeriodID;
82   - }
83   -
84   - /**
85   - * Inserts the archive utilisation settings into the database
86   - *
87   - * @return boolean true on successful update, false otherwise
88   - */
89   - function create(){
90   - global $default;
91   - //if the id >= 0, then the object has already been created
92   - if ($this->iId < 0) {
93   - $sql = $default->db;
94   - $result = $sql->query("INSERT INTO $default->owl_archiving_utilisation_settings_table (document_transaction_id, time_period_id) " .
95   - "VALUES ($this->iDocumentTransactionID, $this->iTimePeriodID)");
96   - if ($result) {
97   - //set the current primary key
98   - $this->iId = $sql->insert_id();
99   - return true;
100   - }
101   - return false;
102   - }
103   - return false;
104   - }
105   -
106   - /**
107   - * Update the archive utilisation settings current values in the database
108   - *
109   - * @return boolean true on successful update, false otherwise
110   - */
111   - function update(){
112   - global $default;
113   - if ($this->iId >= 0) {
114   - $sql = $default->db;
115   - $sQuery = "UPDATE $default->owl_archiving_utilisation_settings_table SET " .
116   - "document_transaction_id = $this->iDocumentTransactionID, " .
117   - "time_period_id = $this->iTimePeriodID " .
118   - "WHERE id = $this->iId";
119   - $result = $sql->query($sQuery);
120   - if ($result) {
121   - return true;
122   - }
123   - return false;
124   - }
125   - return false;
126   - }
127   -
128   - /**
129   - * Delete the current archive utilisation settings from the database. Set the primary key to -1
130   - * on successful deletion
131   - *
132   - * @return boolean true and reset id to -1 on successful deletion, false otherwise
133   - */
134   - function delete() {
135   - global $default;
136   - if ($this->iId >= 0) {
137   - $sql = $default->db;
138   - $result = $sql->query("DELETE FROM $default->owl_archiving_utilisation_settings_table WHERE id = $this->iId");
139   - if ($result) {
140   - $this->iId = -1;
141   - return true;
142   - }
143   - return false;
144   - }
145   - return false;
146   - }
147   -
148   - /**
149   - * Static function. Given a news item primary key will create
150   - * a ArchivingUtilisationSettings object and populate it with the corresponding
151   - * database values
152   - *
153   - * @return ArchivingUtilisationSettings populated ArchivingUtilisationSettings object on success, false otherwise
154   - */
155   - function & get($iArchivingUtilisationSettingsID) {
156   - global $default;
157   - $sql = $default->db;
158   - $sql->query("SELECT * FROM $default->owl_archiving_utilisation_settings_table WHERE id = $iArchivingUtilisationSettingsID");
159   - if ($sql->next_record()) {
160   - $oArchivingUtilisationSettings = & new ArchivingUtilisationSettings($sql->f("document_transaction_id"), $sql->f("time_period_id"));
161   - $oArchivingUtilisationSettings->iId = $iArchivingUtilisationSettingsID;
162   - return $oArchivingUtilisationSettings;
163   - }
164   - return false;
165   - }
166   -
167   - /**
168   - * Static function
169   - * Get a list of ArchivingUtilisationSettings objects
170   - *
171   - * @param String Where clause (optional)
172   - * @return Array array of ArchivingUtilisationSettings objects, false otherwise
173   - */
174   - function getList($sWhereClause = null) {
175   - global $default;
176   - $aArchivingUtilisationSettingsArray = array();
177   - $sql = $default->db;
178   - $result = $sql->query("SELECT * FROM $default->owl_archiving_utilisation_settings_table " . (isset($sWhereClause) ? " WHERE " . $sWhereClause : ""));
179   - if ($result) {
180   - $iCount = 0;
181   - while ($sql->next_record()) {
182   - $oArchivingUtilisationSettings = & ArchivingUtilisationSettings::get($sql->f("id"));
183   - $aArchivingUtilisationSettingsArray[$iCount++] = $oArchivingUtilisationSettings;
184   - }
185   - return $aArchivingUtilisationSettingsArray;
186   - }
187   - return false;
188   - }
189   -}
190 0 \ No newline at end of file