Commit c3075b61eaea42d1ee5e28387910d51ff4965c06
1 parent
9d35f5ea
Remove libraries that exist to allow interaction with tables that no
longer exist. Remove no-longer-used Dashboard.inc and organisation management. git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@4869 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
10 changed files
with
0 additions
and
1499 deletions
lib/archiving/ArchiveRestorationRequest.inc deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Represents restoration requests for a document. | |
| 6 | - * | |
| 7 | - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com | |
| 8 | - * | |
| 9 | - * This program is free software; you can redistribute it and/or modify | |
| 10 | - * it under the terms of the GNU General Public License as published by | |
| 11 | - * the Free Software Foundation; either version 2 of the License, or | |
| 12 | - * (at your option) any later version. | |
| 13 | - * | |
| 14 | - * This program is distributed in the hope that it will be useful, | |
| 15 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 16 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 17 | - * GNU General Public License for more details. | |
| 18 | - * | |
| 19 | - * You should have received a copy of the GNU General Public License | |
| 20 | - * along with this program; if not, write to the Free Software | |
| 21 | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 22 | - * | |
| 23 | - * @version $Revision$ | |
| 24 | - * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa | |
| 25 | - * @package lib.archiving | |
| 26 | - */ | |
| 27 | -class ArchiveRestorationRequest extends KTEntity { | |
| 28 | - | |
| 29 | - /** | |
| 30 | - * The primary key | |
| 31 | - */ | |
| 32 | - var $iId; | |
| 33 | - /** | |
| 34 | - * The document to be restored | |
| 35 | - */ | |
| 36 | - var $iDocumentID; | |
| 37 | - /** | |
| 38 | - * The user requesting the restoration | |
| 39 | - */ | |
| 40 | - var $iRequestUserID; | |
| 41 | - /** | |
| 42 | - * The administrator to perform the restore | |
| 43 | - */ | |
| 44 | - var $iAdminUserID; | |
| 45 | - /** | |
| 46 | - * Timestamp | |
| 47 | - */ | |
| 48 | - var $dDateTime; | |
| 49 | - | |
| 50 | - /** | |
| 51 | - * Constructs an archive restoration request instance | |
| 52 | - * | |
| 53 | - * @param integer the document id | |
| 54 | - * @param integer the request user id | |
| 55 | - * @param integer the admin user id | |
| 56 | - */ | |
| 57 | - function ArchiveRestorationRequest($iNewDocumentID, $iNewRequestUserID, $iNewAdminUserID, $dNewDateTime = "") { | |
| 58 | - global $default; | |
| 59 | - | |
| 60 | - // primary key not set as this is not stored yet | |
| 61 | - $this->iId = -1; | |
| 62 | - $this->iDocumentID = $iNewDocumentID; | |
| 63 | - $this->iRequestUserID = $iNewRequestUserID; | |
| 64 | - $this->iAdminUserID = $iNewAdminUserID; | |
| 65 | - $this->dDateTime = strlen($dNewDateTime) == 0 ? getCurrentDateTime() : $dNewDateTime; | |
| 66 | - } | |
| 67 | - | |
| 68 | - /** | |
| 69 | - * Gets the primary key | |
| 70 | - */ | |
| 71 | - function getID(){ | |
| 72 | - return $this->iId; | |
| 73 | - } | |
| 74 | - | |
| 75 | - /** | |
| 76 | - * Gets the document id | |
| 77 | - */ | |
| 78 | - function getDocumentID(){ | |
| 79 | - return $this->iDocumentID; | |
| 80 | - } | |
| 81 | - | |
| 82 | - /** | |
| 83 | - * Sets the document id | |
| 84 | - * | |
| 85 | - * @param integer the new document id | |
| 86 | - */ | |
| 87 | - function setDocumentID($iNewDocumentID){ | |
| 88 | - $this->iDocumentID = $iNewDocumentID; | |
| 89 | - } | |
| 90 | - | |
| 91 | - /** | |
| 92 | - * Gets the request user | |
| 93 | - */ | |
| 94 | - function getRequestUserID(){ | |
| 95 | - return $this->iRequestUserID; | |
| 96 | - } | |
| 97 | - | |
| 98 | - /** | |
| 99 | - * Sets the request user | |
| 100 | - * | |
| 101 | - * @param integer the new user id | |
| 102 | - */ | |
| 103 | - function setRequestUserID($iNewRequestUserID){ | |
| 104 | - $this->iRequestUserID = $iNewRequestUserID; | |
| 105 | - } | |
| 106 | - | |
| 107 | - /** | |
| 108 | - * Gets the admin user | |
| 109 | - */ | |
| 110 | - function getAdminUserID(){ | |
| 111 | - return $this->iAdminUserID; | |
| 112 | - } | |
| 113 | - | |
| 114 | - /** | |
| 115 | - * Sets the admin user | |
| 116 | - * | |
| 117 | - * @param integer the new user id | |
| 118 | - */ | |
| 119 | - function setAdminUserID($iNewAdminUserID){ | |
| 120 | - $this->iAdminUserID = $iNewAdminUserID; | |
| 121 | - } | |
| 122 | - | |
| 123 | - /** | |
| 124 | - * Gets the datetime | |
| 125 | - */ | |
| 126 | - function getDateTime(){ | |
| 127 | - return $this->dDateTime; | |
| 128 | - } | |
| 129 | - | |
| 130 | - /** | |
| 131 | - * Sets the datetime | |
| 132 | - * | |
| 133 | - * @param datetime the new date time | |
| 134 | - */ | |
| 135 | - function setDateTime($dNewDateTime){ | |
| 136 | - $this->dDateTime = $dNewDateTime; | |
| 137 | - } | |
| 138 | - | |
| 139 | - function _fieldValues () { | |
| 140 | - return array( | |
| 141 | - 'document_id' => $this->iDocumentID, | |
| 142 | - 'request_user_id' => $this->iRequestUserID, | |
| 143 | - 'admin_user_id' => $this->iAdminUserID, | |
| 144 | - 'datetime' => $this->dDateTime, | |
| 145 | - ); | |
| 146 | - } | |
| 147 | - | |
| 148 | - function _table () { | |
| 149 | - global $default; | |
| 150 | - return $default->archive_restoration_table; | |
| 151 | - } | |
| 152 | - | |
| 153 | - /** | |
| 154 | - * Static function. Given a document primary key will create | |
| 155 | - * a ArchiveRestorationRequest object and populate it with the corresponding | |
| 156 | - * database values | |
| 157 | - * | |
| 158 | - * @return ArchiveRestorationRequest populated ArchiveRestorationRequest object on success, false otherwise | |
| 159 | - */ | |
| 160 | - function & getFromDocumentID($iDocumentID) { | |
| 161 | - global $default; | |
| 162 | - $sql = $default->db; | |
| 163 | - $sql->query(array("SELECT * FROM $default->archive_restoration_table WHERE document_id = ?", $iDocumentID));/*ok*/ | |
| 164 | - if ($sql->next_record()) { | |
| 165 | - $oArchiveRestorationRequest = & new ArchiveRestorationRequest($sql->f("document_id"), $sql->f("request_user_id"), $sql->f("admin_user_id"), $sql->f("datetime")); | |
| 166 | - $oArchiveRestorationRequest->iId = $sql->f("id"); | |
| 167 | - return $oArchiveRestorationRequest; | |
| 168 | - } | |
| 169 | - return false; | |
| 170 | - } | |
| 171 | - | |
| 172 | - /** | |
| 173 | - * Static function. Given a news item primary key will create | |
| 174 | - * a ArchiveRestorationRequest object and populate it with the corresponding | |
| 175 | - * database values | |
| 176 | - * | |
| 177 | - * @return ArchiveRestorationRequest populated ArchiveRestorationRequest object on success, false otherwise | |
| 178 | - */ | |
| 179 | - function & get($iArchiveRestorationRequestID) { | |
| 180 | - global $default; | |
| 181 | - $sql = $default->db; | |
| 182 | - $sql->query(array("SELECT * FROM $default->archive_restoration_table WHERE id = ?", $iArchiveRestorationRequestID));/*ok*/ | |
| 183 | - if ($sql->next_record()) { | |
| 184 | - $oArchiveRestorationRequest = & new ArchiveRestorationRequest($sql->f("document_id"), $sql->f("request_user_id"), $sql->f("admin_user_id"), $sql->f("datetime")); | |
| 185 | - $oArchiveRestorationRequest->iId = $iArchiveRestorationRequestID; | |
| 186 | - return $oArchiveRestorationRequest; | |
| 187 | - } | |
| 188 | - return false; | |
| 189 | - } | |
| 190 | - | |
| 191 | - /** | |
| 192 | - * Static function | |
| 193 | - * Get a list of ArchiveRestorationRequest objects | |
| 194 | - * | |
| 195 | - * @param String Where clause (optional) | |
| 196 | - * @return Array array of ArchiveRestorationRequest objects, false otherwise | |
| 197 | - */ | |
| 198 | - function getList($sWhereClause = null) { | |
| 199 | - return KTEntityUtil::getList(ArchiveRestorationRequest::_table(), 'ArchiveRestorationRequest', $sWhereClause); | |
| 200 | - } | |
| 201 | -} |
lib/archiving/ArchivingSettings.inc deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Represents archive settings for a document. | |
| 6 | - * | |
| 7 | - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com | |
| 8 | - * | |
| 9 | - * This program is free software; you can redistribute it and/or modify | |
| 10 | - * it under the terms of the GNU General Public License as published by | |
| 11 | - * the Free Software Foundation; either version 2 of the License, or | |
| 12 | - * (at your option) any later version. | |
| 13 | - * | |
| 14 | - * This program is distributed in the hope that it will be useful, | |
| 15 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 16 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 17 | - * GNU General Public License for more details. | |
| 18 | - * | |
| 19 | - * You should have received a copy of the GNU General Public License | |
| 20 | - * along with this program; if not, write to the Free Software | |
| 21 | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 22 | - * | |
| 23 | - * @version $Revision$ | |
| 24 | - * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa | |
| 25 | - * @package lib.archiving | |
| 26 | - */ | |
| 27 | - | |
| 28 | -class ArchivingSettings extends KTEntity { | |
| 29 | - | |
| 30 | - /** | |
| 31 | - * The primary key | |
| 32 | - */ | |
| 33 | - var $iId; | |
| 34 | - /** | |
| 35 | - * The archiving method- date or utilisation | |
| 36 | - */ | |
| 37 | - var $iArchivingTypeID; | |
| 38 | - /** | |
| 39 | - * The expiration date | |
| 40 | - */ | |
| 41 | - var $dExpirationDate; | |
| 42 | - /** | |
| 43 | - * The document transaction id | |
| 44 | - */ | |
| 45 | - var $iDocumentTransactionID; | |
| 46 | - /** | |
| 47 | - * The expiration time period | |
| 48 | - */ | |
| 49 | - var $iTimePeriodID; | |
| 50 | - | |
| 51 | - /** | |
| 52 | - * Constructs an archive date settings instance | |
| 53 | - * | |
| 54 | - * @param date the expiration date | |
| 55 | - * @param integer the expiration time period id | |
| 56 | - */ | |
| 57 | - function ArchivingSettings($iNewArchivingTypeID, $dNewExpirationDate, $iNewDocumentTransactionID, $iNewTimePeriodID) { | |
| 58 | - global $default; | |
| 59 | - | |
| 60 | - // primary key not set as this is not stored yet | |
| 61 | - $this->iId = -1; | |
| 62 | - $this->iArchivingTypeID = $iNewArchivingTypeID; | |
| 63 | - $this->setExpirationDate($dNewExpirationDate); | |
| 64 | - $this->iDocumentTransactionID = $iNewDocumentTransactionID; | |
| 65 | - $this->iTimePeriodID = $iNewTimePeriodID; | |
| 66 | - } | |
| 67 | - | |
| 68 | - /** | |
| 69 | - * Gets the primary key | |
| 70 | - */ | |
| 71 | - function getID(){ | |
| 72 | - return $this->iId; | |
| 73 | - } | |
| 74 | - | |
| 75 | - /** | |
| 76 | - * Gets the archiving type | |
| 77 | - */ | |
| 78 | - function getArchivingTypeID(){ | |
| 79 | - return $this->iArchivingTypeID; | |
| 80 | - } | |
| 81 | - | |
| 82 | - /** | |
| 83 | - * Sets the archiving type | |
| 84 | - * | |
| 85 | - * @param integer the new archiving type | |
| 86 | - */ | |
| 87 | - function setArchivingTypeID($iNewArchivingTypeID){ | |
| 88 | - $this->iArchivingTypeID = $iNewArchivingTypeID; | |
| 89 | - } | |
| 90 | - | |
| 91 | - /** | |
| 92 | - * Gets the expiration date | |
| 93 | - */ | |
| 94 | - function getExpirationDate() { | |
| 95 | - return ($this->dExpirationDate == "NULL" ? "" : $this->dExpirationDate); | |
| 96 | - } | |
| 97 | - | |
| 98 | - /** | |
| 99 | - * Sets the expiration date | |
| 100 | - * | |
| 101 | - * @param date the new expiration date | |
| 102 | - */ | |
| 103 | - function setExpirationDate($dNewExpirationDate){ | |
| 104 | - $this->dExpirationDate = strlen($dNewExpirationDate) == 0 ? "NULL" : $dNewExpirationDate; | |
| 105 | - } | |
| 106 | - | |
| 107 | - /** | |
| 108 | - * Gets the document transaction id | |
| 109 | - */ | |
| 110 | - function getDocumentTransactionID() { | |
| 111 | - return $this->iDocumentTransactionID; | |
| 112 | - } | |
| 113 | - | |
| 114 | - /** | |
| 115 | - * Sets the document transaction id | |
| 116 | - * | |
| 117 | - * @param integer the new document transaction id | |
| 118 | - */ | |
| 119 | - function setDocumentTransactionID($iNewDocumentTransactionID){ | |
| 120 | - $this->iDocumentTransactionID = $iNewDocumentTransactionID; | |
| 121 | - } | |
| 122 | - | |
| 123 | - /** | |
| 124 | - * Gets the time period id | |
| 125 | - */ | |
| 126 | - function getTimePeriodID(){ | |
| 127 | - return $this->iTimePeriodID; | |
| 128 | - } | |
| 129 | - | |
| 130 | - /** | |
| 131 | - * Sets the time period id | |
| 132 | - * | |
| 133 | - * @param integer the new time period id | |
| 134 | - */ | |
| 135 | - function setTimePeriodID($iNewTimePeriodID){ | |
| 136 | - $this->iTimePeriodID = $iNewTimePeriodID; | |
| 137 | - } | |
| 138 | - | |
| 139 | - function _fieldValues () { | |
| 140 | - return array( | |
| 141 | - 'archiving_type_id' => $this->iArchivingTypeID, | |
| 142 | - 'expiration_date' => $this->dExpirationDate, | |
| 143 | - 'document_transaction_id' => $this->iDocumentTransactionID, | |
| 144 | - 'time_period_id' => $this->iTimePeriodID, | |
| 145 | - ); | |
| 146 | - } | |
| 147 | - | |
| 148 | - function _table () { | |
| 149 | - global $default; | |
| 150 | - return $default->archiving_settings_table; | |
| 151 | - } | |
| 152 | - | |
| 153 | - function addQuotes($sDate) { | |
| 154 | - if ($sDate == "NULL") { | |
| 155 | - return $sDate; | |
| 156 | - } else { | |
| 157 | - return "'$sDate'"; | |
| 158 | - } | |
| 159 | - } | |
| 160 | - | |
| 161 | - /** | |
| 162 | - * Static function. Given a primary key will create | |
| 163 | - * a ArchivingSettings object and populate it with the corresponding | |
| 164 | - * database values | |
| 165 | - * | |
| 166 | - * @return ArchivingSettings populated ArchivingSettings object on success, false otherwise | |
| 167 | - */ | |
| 168 | - function & get($iArchivingSettingsID) { | |
| 169 | - global $default; | |
| 170 | - $sql = $default->db; | |
| 171 | - $sql->query(array("SELECT * FROM $default->archiving_settings_table WHERE id = ?", $iArchivingSettingsID));/*ok*/ | |
| 172 | - if ($sql->next_record()) { | |
| 173 | - $oArchivingSettings = & new ArchivingSettings($sql->f("archiving_type_id"), | |
| 174 | - $sql->f("expiration_date"), | |
| 175 | - $sql->f("document_transaction_id"), | |
| 176 | - $sql->f("time_period_id")); | |
| 177 | - $oArchivingSettings->iId = $iArchivingSettingsID; | |
| 178 | - return $oArchivingSettings; | |
| 179 | - } | |
| 180 | - return false; | |
| 181 | - } | |
| 182 | - | |
| 183 | - /** | |
| 184 | - * Static function | |
| 185 | - * Get a list of ArchivingSettings objects | |
| 186 | - * | |
| 187 | - * @param String Where clause (optional) | |
| 188 | - * @return Array array of ArchivingSettings objects, false otherwise | |
| 189 | - */ | |
| 190 | - function getList($sWhereClause = null) { | |
| 191 | - return KTEntityUtil::getList(ArchivingSettings::_table(), 'ArchivingSettings', $sWhereClause); | |
| 192 | - } | |
| 193 | -} | |
| 194 | -?> |
lib/archiving/ArchivingType.inc deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Represents archiving types. | |
| 6 | - * | |
| 7 | - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com | |
| 8 | - * | |
| 9 | - * This program is free software; you can redistribute it and/or modify | |
| 10 | - * it under the terms of the GNU General Public License as published by | |
| 11 | - * the Free Software Foundation; either version 2 of the License, or | |
| 12 | - * (at your option) any later version. | |
| 13 | - * | |
| 14 | - * This program is distributed in the hope that it will be useful, | |
| 15 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 16 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 17 | - * GNU General Public License for more details. | |
| 18 | - * | |
| 19 | - * You should have received a copy of the GNU General Public License | |
| 20 | - * along with this program; if not, write to the Free Software | |
| 21 | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 22 | - * | |
| 23 | - * @version $Revision$ | |
| 24 | - * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa | |
| 25 | - * @package lib.archiving | |
| 26 | - */ | |
| 27 | -class ArchivingType extends KTEntity { | |
| 28 | - | |
| 29 | - /** | |
| 30 | - * The primary key | |
| 31 | - */ | |
| 32 | - var $iId; | |
| 33 | - /** | |
| 34 | - * The archiving type | |
| 35 | - */ | |
| 36 | - var $sName; | |
| 37 | - | |
| 38 | - /** | |
| 39 | - * Constructs an archiving type instance | |
| 40 | - * | |
| 41 | - * @param string the archiving type name | |
| 42 | - */ | |
| 43 | - function ArchivingType($sNewName) { | |
| 44 | - global $default; | |
| 45 | - | |
| 46 | - // primary key not set as this is not stored yet | |
| 47 | - $this->iId = -1; | |
| 48 | - $this->sName = $sNewName; | |
| 49 | - } | |
| 50 | - | |
| 51 | - /** | |
| 52 | - * Gets the primary key | |
| 53 | - */ | |
| 54 | - function getID(){ | |
| 55 | - return $this->iId; | |
| 56 | - } | |
| 57 | - | |
| 58 | - /** | |
| 59 | - * Gets the name | |
| 60 | - */ | |
| 61 | - function getName() { | |
| 62 | - return $this->sName; | |
| 63 | - } | |
| 64 | - | |
| 65 | - /** | |
| 66 | - * Sets the name | |
| 67 | - * | |
| 68 | - * @param string the new name | |
| 69 | - */ | |
| 70 | - function setName($sNewName){ | |
| 71 | - $this->sName = $sNewName; | |
| 72 | - } | |
| 73 | - | |
| 74 | - function _fieldValues () { | |
| 75 | - return array( | |
| 76 | - 'name' => $this->sName, | |
| 77 | - ); | |
| 78 | - | |
| 79 | - } | |
| 80 | - | |
| 81 | - function _table () { | |
| 82 | - global $default; | |
| 83 | - return $default->archiving_type_lookup_table; | |
| 84 | - } | |
| 85 | - | |
| 86 | - /** | |
| 87 | - * Static function. Given a news item primary key will create | |
| 88 | - * a ArchivingType object and populate it with the corresponding | |
| 89 | - * database values | |
| 90 | - * | |
| 91 | - * @return ArchivingType populated ArchivingType object on success, false otherwise | |
| 92 | - */ | |
| 93 | - function & get($iArchivingTypeID) { | |
| 94 | - global $default; | |
| 95 | - $sql = $default->db; | |
| 96 | - $sql->query(array("SELECT * FROM $default->archiving_type_lookup_table WHERE id = ?", $iArchivingTypeID));/*ok*/ | |
| 97 | - if ($sql->next_record()) { | |
| 98 | - $oArchivingType = & new ArchivingType($sql->f("name")); | |
| 99 | - $oArchivingType->iId = $iArchivingTypeID; | |
| 100 | - return $oArchivingType; | |
| 101 | - } | |
| 102 | - return false; | |
| 103 | - } | |
| 104 | - | |
| 105 | - /** | |
| 106 | - * Static function | |
| 107 | - * Get a list of ArchivingType objects | |
| 108 | - * | |
| 109 | - * @param String Where clause (optional) | |
| 110 | - * @return Array array of ArchivingType objects, false otherwise | |
| 111 | - */ | |
| 112 | - function getList($sWhereClause = null) { | |
| 113 | - return KTEntityUtil::getList(ArchivingType::_table(), 'ArchivingType', $sWhereClause); | |
| 114 | - } | |
| 115 | -} |
lib/archiving/DocumentArchiveSettingsFactory.inc deleted
| 1 | -<?php | |
| 2 | -require_once(KT_LIB_DIR . '/archiving/DocumentArchiving.inc'); | |
| 3 | -require_once(KT_LIB_DIR . '/archiving/ArchivingSettings.inc'); | |
| 4 | -require_once(KT_LIB_DIR . '/archiving/TimePeriod.inc'); | |
| 5 | -/** | |
| 6 | - * $Id$ | |
| 7 | - * | |
| 8 | - * Business logic for setting document archive settings. | |
| 9 | - * | |
| 10 | - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com | |
| 11 | - * | |
| 12 | - * This program is free software; you can redistribute it and/or modify | |
| 13 | - * it under the terms of the GNU General Public License as published by | |
| 14 | - * the Free Software Foundation; either version 2 of the License, or | |
| 15 | - * (at your option) any later version. | |
| 16 | - * | |
| 17 | - * This program is distributed in the hope that it will be useful, | |
| 18 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 19 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 20 | - * GNU General Public License for more details. | |
| 21 | - * | |
| 22 | - * You should have received a copy of the GNU General Public License | |
| 23 | - * along with this program; if not, write to the Free Software | |
| 24 | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 25 | - * | |
| 26 | - * @version $Revision$ | |
| 27 | - * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa | |
| 28 | - * @package lib.archiving | |
| 29 | - */ | |
| 30 | -class DocumentArchiveSettingsFactory { | |
| 31 | - | |
| 32 | - function handleTimePeriod($iTimeUnitID, $iUnits) { | |
| 33 | - if ($iTimeUnitID && $iUnits) { | |
| 34 | - // search for an existing time period id | |
| 35 | - $aWhereClause = array('time_unit_id = ? AND units = ?', array($iTimeUnitID, $iUnits)); | |
| 36 | - $aTimePeriod = TimePeriod::getList($aWhereClause);/*ok*/ | |
| 37 | - if (count($aTimePeriod) > 0) { | |
| 38 | - $iTimePeriodID = $aTimePeriod[0]->getID(); | |
| 39 | - } else { | |
| 40 | - // create it | |
| 41 | - $oTimePeriod = new TimePeriod($iTimeUnitID, $iUnits); | |
| 42 | - if ($oTimePeriod->create()) { | |
| 43 | - $iTimePeriodID = $oTimePeriod->getID(); | |
| 44 | - } else { | |
| 45 | - $default->log->error("couldn't create time period- " . arrayToString($oTimePeriod)); | |
| 46 | - return false; | |
| 47 | - } | |
| 48 | - } | |
| 49 | - } else { | |
| 50 | - $iTimePeriodID = -1; | |
| 51 | - } | |
| 52 | - return $iTimePeriodID; | |
| 53 | - } | |
| 54 | - | |
| 55 | - function validateDate($dExpirationDate) { | |
| 56 | - if ($dExpirationDate) { | |
| 57 | - $sTime = strtotime($dExpirationDate); | |
| 58 | - // check that its later than today | |
| 59 | - if ($sTime <= time()) { | |
| 60 | - return false; | |
| 61 | - } | |
| 62 | - } | |
| 63 | - return true; | |
| 64 | - } | |
| 65 | - | |
| 66 | - function create($iArchivingTypeID, $iDocumentID, $dExpirationDate, $iDocumentTransactionID, $iTimeUnitID, $iUnits) { | |
| 67 | - global $default; | |
| 68 | - | |
| 69 | - $sArchivingType = lookupName($default->archiving_type_lookup_table, $iArchivingTypeID); | |
| 70 | - | |
| 71 | - // process time period (if any) | |
| 72 | - $iTimePeriodID = $this->handleTimePeriod($iTimeUnitID, $iUnits); | |
| 73 | - | |
| 74 | - // construction strings | |
| 75 | - // XXX: eval?! | |
| 76 | - switch ($sArchivingType) { | |
| 77 | - case "Date" : $sSearchConstruction = "\$aArchiveSettings = ArchivingSettings::getList(\""; | |
| 78 | - $sSearchConstruction .= (isset($dExpirationDate) ? "expiration_date='$dExpirationDate'" : "time_period_id=$iTimePeriodID") . "\");"; | |
| 79 | - $sConstruction = "\$oArchiveSettings = new ArchivingSettings($iArchivingTypeID, \$dExpirationDate, -1, $iTimePeriodID);"; | |
| 80 | - break; | |
| 81 | - case "Utilisation" : $sSearchConstruction = "\$aArchiveSettings = ArchivingSettings::getList(\"document_transaction_id=$iDocumentTransactionID AND time_period_id=$iTimePeriodID\");"; | |
| 82 | - $sConstruction = "\$oArchiveSettings = new ArchivingSettings($iArchivingTypeID, \"NULL\", $iDocumentTransactionID, $iTimePeriodID);"; | |
| 83 | - break; | |
| 84 | - } | |
| 85 | - | |
| 86 | - // search for the settings first | |
| 87 | - eval($sSearchConstruction); | |
| 88 | - if (count($aArchiveSettings) > 0) { | |
| 89 | - $iArchiveSettingsID = $aArchiveSettings[0]->getID(); | |
| 90 | - $default->log->info("looked up archive settings id=$iArchiveSettingsID"); | |
| 91 | - } else { | |
| 92 | - // create them | |
| 93 | - eval($sConstruction); | |
| 94 | - if ($oArchiveSettings->create()) { | |
| 95 | - $iArchiveSettingsID = $oArchiveSettings->getID(); | |
| 96 | - } else { | |
| 97 | - $default->log->error("couldn't create archive settings- " . arrayToString($oArchiveSettings)); | |
| 98 | - return false; | |
| 99 | - } | |
| 100 | - } | |
| 101 | - | |
| 102 | - // now link to the documents | |
| 103 | - $oDocumentArchiving = new DocumentArchiving($iDocumentID, $iArchiveSettingsID); | |
| 104 | - if ($oDocumentArchiving->create()) { | |
| 105 | - return true; | |
| 106 | - } else { | |
| 107 | - $default->log->error("couldn't create document archiving - " . arrayToString($oDocumentArchiving)); | |
| 108 | - return false; | |
| 109 | - } | |
| 110 | - } | |
| 111 | - | |
| 112 | - function update($oDocumentArchiving, $dExpirationDate, $iDocumentTransactionID, $iTimeUnitID, $iUnits) { | |
| 113 | - global $default; | |
| 114 | - | |
| 115 | - // retrieve the settings | |
| 116 | - $oArchiveSettings = ArchivingSettings::get($oDocumentArchiving->getArchivingSettingsID()); | |
| 117 | - if ($oArchiveSettings) { | |
| 118 | - | |
| 119 | - // process time period (if any) | |
| 120 | - $iTimePeriodID = $this->handleTimePeriod($iTimeUnitID, $iUnits); | |
| 121 | - $oArchiveSettings->setTimePeriodID($iTimePeriodID); | |
| 122 | - | |
| 123 | - $sArchivingType = lookupName($default->archiving_type_lookup_table, $oArchiveSettings->getArchivingTypeID()); | |
| 124 | - // update it based on the type | |
| 125 | - switch ($sArchivingType) { | |
| 126 | - case "Date" : $oArchiveSettings->setExpirationDate($dExpirationDate); | |
| 127 | - break; | |
| 128 | - case "Utilisation" : $oArchiveSettings->setDocumentTransactionID($iDocumentTransactionID); | |
| 129 | - break; | |
| 130 | - } | |
| 131 | - if ($oArchiveSettings->update()) { | |
| 132 | - return true; | |
| 133 | - } else { | |
| 134 | - $default->log->error("error updating archive settings for documentID=" . $oArchiveSettings->getDocumentID()); | |
| 135 | - } | |
| 136 | - } else { | |
| 137 | - $default->log->error("couldn't retrieve archive settings"); | |
| 138 | - return false; | |
| 139 | - } | |
| 140 | - } | |
| 141 | -} | |
| 142 | -?> |
lib/archiving/DocumentArchiving.inc deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Represents archive settings for a document. | |
| 6 | - * | |
| 7 | - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com | |
| 8 | - * | |
| 9 | - * This program is free software; you can redistribute it and/or modify | |
| 10 | - * it under the terms of the GNU General Public License as published by | |
| 11 | - * the Free Software Foundation; either version 2 of the License, or | |
| 12 | - * (at your option) any later version. | |
| 13 | - * | |
| 14 | - * This program is distributed in the hope that it will be useful, | |
| 15 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 16 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 17 | - * GNU General Public License for more details. | |
| 18 | - * | |
| 19 | - * You should have received a copy of the GNU General Public License | |
| 20 | - * along with this program; if not, write to the Free Software | |
| 21 | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 22 | - * | |
| 23 | - * @version $Revision$ | |
| 24 | - * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa | |
| 25 | - * @package lib.archiving | |
| 26 | - */ | |
| 27 | - | |
| 28 | -class DocumentArchiving extends KTEntity { | |
| 29 | - /** | |
| 30 | - * The primary key | |
| 31 | - */ | |
| 32 | - var $iId; | |
| 33 | - /** | |
| 34 | - * The document ID | |
| 35 | - */ | |
| 36 | - var $iDocumentID; | |
| 37 | - | |
| 38 | - /** | |
| 39 | - * The archiving settings | |
| 40 | - */ | |
| 41 | - var $iArchivingSettingsID; | |
| 42 | - | |
| 43 | - /** | |
| 44 | - * Constructs an archive settings instance | |
| 45 | - * | |
| 46 | - * @param integer the document id | |
| 47 | - * @param integer the archiving type id | |
| 48 | - * @param integer the archiving settings id | |
| 49 | - */ | |
| 50 | - function DocumentArchiving($iNewDocumentID, $iNewArchivingSettingsID) { | |
| 51 | - global $default; | |
| 52 | - | |
| 53 | - // primary key not set as this is not stored yet | |
| 54 | - $this->iId = -1; | |
| 55 | - $this->iDocumentID = $iNewDocumentID; | |
| 56 | - $this->iArchivingSettingsID = $iNewArchivingSettingsID; | |
| 57 | - } | |
| 58 | - | |
| 59 | - /** | |
| 60 | - * Gets the primary key | |
| 61 | - */ | |
| 62 | - function getID(){ | |
| 63 | - return $this->iId; | |
| 64 | - } | |
| 65 | - | |
| 66 | - /** | |
| 67 | - * Gets the document id | |
| 68 | - */ | |
| 69 | - function getDocumentID(){ | |
| 70 | - return $this->iDocumentID; | |
| 71 | - } | |
| 72 | - | |
| 73 | - /** | |
| 74 | - * Sets the document id | |
| 75 | - * | |
| 76 | - * @param integer the new document id | |
| 77 | - */ | |
| 78 | - function setDocumentID($iNewDocumentID){ | |
| 79 | - $this->iDocumentID = $iNewDocumentID; | |
| 80 | - } | |
| 81 | - | |
| 82 | - /** | |
| 83 | - * Gets the archiving settings | |
| 84 | - */ | |
| 85 | - function getArchivingSettingsID(){ | |
| 86 | - return $this->iArchivingSettingsID; | |
| 87 | - } | |
| 88 | - | |
| 89 | - /** | |
| 90 | - * Sets the archiving settings | |
| 91 | - * | |
| 92 | - * @param integer the new archiving settings | |
| 93 | - */ | |
| 94 | - function setArchivingSettingsID($iNewArchivingSettingsID){ | |
| 95 | - $this->iArchivingSettingsID = $iNewArchivingSettingsID; | |
| 96 | - } | |
| 97 | - | |
| 98 | - function _fieldValues () { | |
| 99 | - return array( | |
| 100 | - 'document_id' => $this->iDocumentID, | |
| 101 | - 'archiving_settings_id' => $this->iArchivingSettingsID, | |
| 102 | - ); | |
| 103 | - } | |
| 104 | - | |
| 105 | - function _table () { | |
| 106 | - global $default; | |
| 107 | - return $default->document_archiving_table; | |
| 108 | - } | |
| 109 | - | |
| 110 | - /** | |
| 111 | - * Static function. Given a document primary key will create | |
| 112 | - * a DocumentArchiving object and populate it with the corresponding | |
| 113 | - * database values | |
| 114 | - * | |
| 115 | - * @return DocumentArchiving populated DocumentArchiving object on success, false otherwise | |
| 116 | - */ | |
| 117 | - function & getFromDocumentID($iDocumentID) { | |
| 118 | - global $default; | |
| 119 | - $sql = $default->db; | |
| 120 | - $sql->query(array("SELECT * FROM $default->document_archiving_table WHERE document_id = ?", $iDocumentID));/*ok*/ | |
| 121 | - if ($sql->next_record()) { | |
| 122 | - $oDocumentArchiving = & new DocumentArchiving($sql->f("document_id"), $sql->f("archiving_settings_id")); | |
| 123 | - $oDocumentArchiving->iId = $sql->f("id"); | |
| 124 | - return $oDocumentArchiving; | |
| 125 | - } | |
| 126 | - return false; | |
| 127 | - } | |
| 128 | - | |
| 129 | - /** | |
| 130 | - * Static function. Given a news item primary key will create | |
| 131 | - * a DocumentArchiving object and populate it with the corresponding | |
| 132 | - * database values | |
| 133 | - * | |
| 134 | - * @return DocumentArchiving populated DocumentArchiving object on success, false otherwise | |
| 135 | - */ | |
| 136 | - function & get($iDocumentArchivingID) { | |
| 137 | - global $default; | |
| 138 | - $sql = $default->db; | |
| 139 | - $sql->query(array("SELECT * FROM $default->document_archiving_table WHERE id = ?", $iDocumentArchivingID));/*ok*/ | |
| 140 | - if ($sql->next_record()) { | |
| 141 | - $oDocumentArchiving = & new DocumentArchiving($sql->f("document_id"), $sql->f("archiving_settings_id")); | |
| 142 | - $oDocumentArchiving->iId = $iDocumentArchivingID; | |
| 143 | - return $oDocumentArchiving; | |
| 144 | - } | |
| 145 | - return false; | |
| 146 | - } | |
| 147 | - | |
| 148 | - /** | |
| 149 | - * Static function | |
| 150 | - * Get a list of DocumentArchiving objects | |
| 151 | - * | |
| 152 | - * @param String Where clause (optional) | |
| 153 | - * @return Array array of DocumentArchiving objects, false otherwise | |
| 154 | - */ | |
| 155 | - function getList($sWhereClause = null) { | |
| 156 | - return KTEntityUtil::getList(DocumentArchiving::_table(), 'DocumentArchiving', $sWhereClause); | |
| 157 | - } | |
| 158 | -} |
lib/dashboard/Dashboard.inc deleted
| 1 | -<?php | |
| 2 | -require_once(KT_LIB_DIR . "/subscriptions/SubscriptionManager.inc"); | |
| 3 | -//require_once(KT_LIB_DIR . "/links/Link.inc"); | |
| 4 | -require_once(KT_LIB_DIR . "/archiving/ArchiveRestorationRequest.inc"); | |
| 5 | -/** | |
| 6 | - * $Id$ | |
| 7 | - * | |
| 8 | - * Contains dashboard helper functions. | |
| 9 | - * | |
| 10 | - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com | |
| 11 | - * | |
| 12 | - * This program is free software; you can redistribute it and/or modify | |
| 13 | - * it under the terms of the GNU General Public License as published by | |
| 14 | - * the Free Software Foundation; either version 2 of the License, or | |
| 15 | - * (at your option) any later version. | |
| 16 | - * | |
| 17 | - * This program is distributed in the hope that it will be useful, | |
| 18 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 19 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 20 | - * GNU General Public License for more details. | |
| 21 | - * | |
| 22 | - * You should have received a copy of the GNU General Public License | |
| 23 | - * along with this program; if not, write to the Free Software | |
| 24 | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 25 | - * | |
| 26 | - * @version $Revision$ | |
| 27 | - * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa | |
| 28 | - * @package lib.dashboard | |
| 29 | - */ | |
| 30 | -class Dashboard { | |
| 31 | - | |
| 32 | - /** | |
| 33 | - * The user id of the user viewing the dashboard | |
| 34 | - */ | |
| 35 | - var $iUserID; | |
| 36 | - | |
| 37 | - /** | |
| 38 | - * Constructs a new instance of the Dashboard | |
| 39 | - * @param integer the user id of the current user | |
| 40 | - */ | |
| 41 | - function Dashboard($iUserID){ | |
| 42 | - $this->iUserID = $iUserID; | |
| 43 | - } | |
| 44 | - | |
| 45 | - /** | |
| 46 | - * Retrieves details of supporting documents that the current user must create | |
| 47 | - */ | |
| 48 | - function getArchiveRestorationRequestDocuments() { | |
| 49 | - return ArchiveRestorationRequest::getList(array("admin_user_id = ?", $this->iUserID));/*ok*/ | |
| 50 | - } | |
| 51 | - | |
| 52 | - /** | |
| 53 | - * Retrieve checked out documents for this user | |
| 54 | - * | |
| 55 | - * @return array of documents | |
| 56 | - */ | |
| 57 | - function getCheckedOutDocuments(){ | |
| 58 | - return Document::getList(array("checked_out_user_id = ?", $this->iUserID));/*ok*/ | |
| 59 | - } | |
| 60 | - | |
| 61 | - /** | |
| 62 | - * Retrieve subscription alerts for this user. | |
| 63 | - * | |
| 64 | - * @return array of subscription alerts | |
| 65 | - */ | |
| 66 | - function getSubscriptionAlerts(){ | |
| 67 | - return SubscriptionManager::listSubscriptionAlerts($this->iUserID); | |
| 68 | - } | |
| 69 | - | |
| 70 | - /** | |
| 71 | - * Retrieve quicklinks | |
| 72 | - * | |
| 73 | - * @return array of link objects | |
| 74 | - */ | |
| 75 | - function getQuickLinks(){ | |
| 76 | - return Link::getList("ORDER BY rank");/*ok*/ | |
| 77 | - } | |
| 78 | - | |
| 79 | - /** | |
| 80 | - * Retrieves Public Folders | |
| 81 | - */ | |
| 82 | - function getPublicFolders() { | |
| 83 | - global $default; | |
| 84 | - $sQuery = array("SELECT id FROM $default->folders_table WHERE is_public = ?", array(true)); | |
| 85 | - $aFolderList = array(); | |
| 86 | - $sql = $default->db; | |
| 87 | - $sql->query($sQuery); | |
| 88 | - while ($sql->next_record()) { | |
| 89 | - $aFolderList[] = & Folder::get($sql->f("id")); | |
| 90 | - } | |
| 91 | - return $aFolderList; | |
| 92 | - } | |
| 93 | - | |
| 94 | - /** | |
| 95 | - * Retrieves Browseable Folders for this user | |
| 96 | - */ | |
| 97 | - function getBrowseableFolders() { | |
| 98 | - return; | |
| 99 | - | |
| 100 | - /* | |
| 101 | - global $default; | |
| 102 | - $sQuery = array("SELECT DISTINCT F.id as folderid, F.parent_id as parentfolderid " . | |
| 103 | - "FROM $default->folders_table F, $default->groups_folders_table GFL, $default->users_groups_table UGL " . | |
| 104 | - "WHERE UGL.user_id=? AND UGL.group_id=GFL.group_id AND GFL.folder_id = F.id AND " . | |
| 105 | - "F.id=F.permission_folder_id AND F.id \!= 1 ORDER BY F.id", $this->iUserID); | |
| 106 | - $aBrowseableList = array(); | |
| 107 | - $aShowedFolderList = array(); | |
| 108 | - $sql = $default->db; | |
| 109 | - $sql->query($sQuery); | |
| 110 | - while ($sql->next_record()) { | |
| 111 | - | |
| 112 | - if (!$aShowedFolderList[$sql->f("parentfolderid")]) { | |
| 113 | - $aBrowseableList[] = & Folder::get($sql->f("folderid")); | |
| 114 | - } | |
| 115 | - $aShowedFolderList[$sql->f("folderid")] = 1; // check the showed folder | |
| 116 | - } | |
| 117 | - return $aBrowseableList; | |
| 118 | - */ | |
| 119 | - } | |
| 120 | - | |
| 121 | -} |
lib/foldermanagement/FolderDocTypeLink.inc deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Represents an entry in the database as per the folder_doctype_link table. | |
| 6 | - * | |
| 7 | - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com | |
| 8 | - * | |
| 9 | - * This program is free software; you can redistribute it and/or modify | |
| 10 | - * it under the terms of the GNU General Public License as published by | |
| 11 | - * the Free Software Foundation; either version 2 of the License, or | |
| 12 | - * (at your option) any later version. | |
| 13 | - * | |
| 14 | - * This program is distributed in the hope that it will be useful, | |
| 15 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 16 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 17 | - * GNU General Public License for more details. | |
| 18 | - * | |
| 19 | - * You should have received a copy of the GNU General Public License | |
| 20 | - * along with this program; if not, write to the Free Software | |
| 21 | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 22 | - * | |
| 23 | - * @version $Revision$ | |
| 24 | - * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa | |
| 25 | - * @package lib.foldermanagement | |
| 26 | - */ | |
| 27 | -class FolderDocTypeLink extends KTEntity { | |
| 28 | - | |
| 29 | - /** primary key of object */ | |
| 30 | - var $iId; | |
| 31 | - /** primary key of folder */ | |
| 32 | - var $iFolderID; | |
| 33 | - /** primary key of document type */ | |
| 34 | - var $iDocumentTypeID; | |
| 35 | - | |
| 36 | - function FolderDocTypeLink($iNewFolderID, $iNewDocumentTypeID) { | |
| 37 | - $this->iId = -1; | |
| 38 | - $this->iFolderID = $iNewFolderID; | |
| 39 | - $this->iDocumentTypeID = $iNewDocumentTypeID; | |
| 40 | - } | |
| 41 | - | |
| 42 | - function _table() { | |
| 43 | - global $default; | |
| 44 | - return $default->folder_doctypes_table; | |
| 45 | - } | |
| 46 | - | |
| 47 | - /** | |
| 48 | - * Create the current folder in the database | |
| 49 | - * | |
| 50 | - * @return boolean true and set $this->iId with new primary key, false otherwise and set $_SESSION["errorMessage"] | |
| 51 | - */ | |
| 52 | - function create() { | |
| 53 | - global $default, $lang_err_database; $lang_err_object_exists; | |
| 54 | - //if the object has not already been stored | |
| 55 | - if ($this->iId < 0) { | |
| 56 | - $sTable = $default->folder_doctypes_table; | |
| 57 | - $aFieldValues = array( | |
| 58 | - 'folder_id' => $this->iFolderID, | |
| 59 | - 'document_type_id' => $this->iDocumentTypeID, | |
| 60 | - ); | |
| 61 | - $id =& DBUtil::autoInsert($sTable, $aFieldValues); | |
| 62 | - | |
| 63 | - if (PEAR::isError($id)) { | |
| 64 | - $_SESSION["errorMessage"] = $id->toString(); | |
| 65 | - return false; | |
| 66 | - } | |
| 67 | - $this->iId = $id; | |
| 68 | - return true; | |
| 69 | - } | |
| 70 | - $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = folders"; | |
| 71 | - return false; | |
| 72 | - } | |
| 73 | - | |
| 74 | - /** | |
| 75 | - * Static function. | |
| 76 | - * Given a folder_doctype_link primary key will create | |
| 77 | - * a FolderDocTypeLink object and populate it with the corresponding | |
| 78 | - * database values | |
| 79 | - * | |
| 80 | - * @param $iFolderDocTypeID Primary key of folder to get | |
| 81 | - * | |
| 82 | - * @return Folder folder object on successful retrieval, false otherwise and set $_SESSION["errorMessage"] | |
| 83 | - */ | |
| 84 | - function get($iFolderDocTypeLinkID) { | |
| 85 | - global $default, $lang_err_object_not_exist; | |
| 86 | - $sql = $default->db; | |
| 87 | - $sql->query(array("SELECT * FROM " . $default->folder_doctypes_table . " WHERE id = ?", $iFolderDocTypeLinkID));/*ok*/ | |
| 88 | - if ($sql->next_record()) { | |
| 89 | - $oFolderDocTypeLink = & new FolderDocTypeLink($sql->f("folder_id"), $sql->f("document_type_id")); | |
| 90 | - $oFolderDocTypeLink->iId = $iFolderDocTypeLinkID; | |
| 91 | - return $oFolderDocTypeLink; | |
| 92 | - } | |
| 93 | - $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iFolderID . " table = folders"; | |
| 94 | - return false; | |
| 95 | - } | |
| 96 | - | |
| 97 | - /** | |
| 98 | - * Static function | |
| 99 | - * Get a list of Documents | |
| 100 | - * | |
| 101 | - * @param String Where clause (not required) | |
| 102 | - * | |
| 103 | - * @return Array array of Documents objects, false otherwise and set $_SESSION["errorMessage"] | |
| 104 | - */ | |
| 105 | - function getList($sWhereClause = null) { | |
| 106 | - return KTEntityUtil::getList(FolderDocTypeLink::_table(), 'FolderDocTypeLink', $sWhereClause); | |
| 107 | - } | |
| 108 | - | |
| 109 | -} | |
| 110 | -?> |
lib/orgmanagement/Organisation.inc deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Represents a organisation as per the database table organisations_lookup. | |
| 6 | - * | |
| 7 | - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com | |
| 8 | - * | |
| 9 | - * This program is free software; you can redistribute it and/or modify | |
| 10 | - * it under the terms of the GNU General Public License as published by | |
| 11 | - * the Free Software Foundation; either version 2 of the License, or | |
| 12 | - * (at your option) any later version. | |
| 13 | - * | |
| 14 | - * This program is distributed in the hope that it will be useful, | |
| 15 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 16 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 17 | - * GNU General Public License for more details. | |
| 18 | - * | |
| 19 | - * You should have received a copy of the GNU General Public License | |
| 20 | - * along with this program; if not, write to the Free Software | |
| 21 | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 22 | - * | |
| 23 | - * @version $Revision$ | |
| 24 | - * @author Mukhtar Dharsey, Jam Warehouse (Pty) Ltd, South Africa | |
| 25 | - * @package lib.orgmanagement | |
| 26 | - */ | |
| 27 | -class Organisation extends KTEntity { | |
| 28 | - /** object's primary key */ | |
| 29 | - var $iId; | |
| 30 | - /** org's name */ | |
| 31 | - var $sName; | |
| 32 | - function Organisation($sNewName) { | |
| 33 | - //object has not been created in database yet | |
| 34 | - $this->iId = -1; | |
| 35 | - $this->sName = $sNewName; | |
| 36 | - } | |
| 37 | - /** | |
| 38 | - * Get the object's primary key | |
| 39 | - * | |
| 40 | - * @return int object's primary key | |
| 41 | - * | |
| 42 | - */ | |
| 43 | - function getID() { | |
| 44 | - return $this->iId; | |
| 45 | - } | |
| 46 | - /** | |
| 47 | - * Get the org's name | |
| 48 | - * | |
| 49 | - * @return String org's name | |
| 50 | - * | |
| 51 | - */ | |
| 52 | - function getName() { | |
| 53 | - return $this->sName; | |
| 54 | - } | |
| 55 | - /** | |
| 56 | - * Set the orgs name | |
| 57 | - * | |
| 58 | - * @param String Unit's name | |
| 59 | - * | |
| 60 | - */ | |
| 61 | - function setName($sNewValue) { | |
| 62 | - $this->sName = $sNewValue; | |
| 63 | - } | |
| 64 | - | |
| 65 | - function _fieldValues () { | |
| 66 | - return array( | |
| 67 | - 'name' => $this->sName, | |
| 68 | - ); | |
| 69 | - } | |
| 70 | - | |
| 71 | - function _table () { | |
| 72 | - global $default; | |
| 73 | - return $default->organisations_table; | |
| 74 | - } | |
| 75 | - | |
| 76 | - /** | |
| 77 | - * Delete the current object from the database | |
| 78 | - * | |
| 79 | - * @return boolean true on successful deletion, false otherwise and set $_SESSION["errorMessage"] | |
| 80 | - * | |
| 81 | - */ | |
| 82 | - function delete() { | |
| 83 | - global $default, $lang_err_database, $lang_err_object_key; | |
| 84 | - //only delete the object if it exists in the database | |
| 85 | - if ($this->iId >= 0) { | |
| 86 | - //check to see if group is linked to a unit | |
| 87 | - $sql = $default->db; | |
| 88 | - $query = "SELECT organisation_id FROM ". $default->units_organisations_table ." WHERE organisation_id = ?";/*ok*/ | |
| 89 | - $aParams = array($this->iId); | |
| 90 | - $sql->query(array($query, $aParams)); | |
| 91 | - $rows = $sql->num_rows($sql); | |
| 92 | - if ($rows > 0) { | |
| 93 | - // duplicate link exists | |
| 94 | - $_SESSION["errorMessage"] = "Group::The Group " . $this->sName . " exits!"; | |
| 95 | - return false; | |
| 96 | - } | |
| 97 | - } | |
| 98 | - return parent::delete(); | |
| 99 | - } | |
| 100 | - /** | |
| 101 | - * Static function. | |
| 102 | - * Given a web_documents primary key it will create a | |
| 103 | - * Unit object and populate it with the | |
| 104 | - * corresponding database values | |
| 105 | - * | |
| 106 | - * @return Unit populated Unit object on successful query, false otherwise and set $_SESSION["errorMessage"] | |
| 107 | - */ | |
| 108 | - function & get($iOrgID) { | |
| 109 | - global $default; | |
| 110 | - $sql = $default->db; | |
| 111 | - $result = $sql->query(array("SELECT * FROM $default->organisations_table WHERE id = ?", $iOrgID));/*ok*/ | |
| 112 | - if ($result) { | |
| 113 | - if ($sql->next_record()) { | |
| 114 | - $oOrg = & new Organisation($sql->f("name")); | |
| 115 | - $oOrg->iId = $iOrgID; | |
| 116 | - return $oOrg; | |
| 117 | - } | |
| 118 | - $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iOrgID . " table = $default->organisations_table"; | |
| 119 | - return false; | |
| 120 | - } | |
| 121 | - $_SESSION["errorMessage"] = $lang_err_database; | |
| 122 | - return false; | |
| 123 | - } | |
| 124 | - /* | |
| 125 | - * static function | |
| 126 | - * | |
| 127 | - * gets the id of a org using their name | |
| 128 | - * | |
| 129 | - * @param String | |
| 130 | - * The username for which we want its ID | |
| 131 | - * | |
| 132 | - */ | |
| 133 | - function getOrgID($name) { | |
| 134 | - global $default; | |
| 135 | - $id = lookupID($default->organisations_table, "name", $name); | |
| 136 | - $this->iId = $id; | |
| 137 | - } | |
| 138 | - /** | |
| 139 | - * Static function | |
| 140 | - * Get a list of web documents | |
| 141 | - * | |
| 142 | - * @param String Where clause (not required) | |
| 143 | - * | |
| 144 | - * @return Array array of org objects, false otherwise and set $_SESSION["errorMessage"] | |
| 145 | - */ | |
| 146 | - function getList($sWhereClause = null) { | |
| 147 | - return KTEntityUtil::getList(Organisation::_table(), 'Organisation', $sWhereClause); | |
| 148 | - } | |
| 149 | -} | |
| 150 | -/** | |
| 151 | -* Static function | |
| 152 | -* | |
| 153 | -* Creates a Org object from an array | |
| 154 | -* | |
| 155 | -* @param Array Array of parameters. Must match order of parameters in constructor | |
| 156 | -* | |
| 157 | -* @return User user object | |
| 158 | -*/ | |
| 159 | -function & organisationCreateFromArray($aParameters) { | |
| 160 | - $oOrg = & new Organisation($aParameters[0], $aParameters[1], $aParameters[2], $aParameters[3], $aParameters[4], $aParameters[5], $aParameters[6], $aParameters[7], $aParameters[8], $aParameters[9], $aParameters[10]); | |
| 161 | - return $oOrg; | |
| 162 | -} | |
| 163 | -?> |
lib/roles/RoleFolderLink.inc deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Represents a role, folder links as per the folders_users_role_link table. | |
| 6 | - * | |
| 7 | - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com | |
| 8 | - * | |
| 9 | - * This program is free software; you can redistribute it and/or modify | |
| 10 | - * it under the terms of the GNU General Public License as published by | |
| 11 | - * the Free Software Foundation; either version 2 of the License, or | |
| 12 | - * (at your option) any later version. | |
| 13 | - * | |
| 14 | - * This program is distributed in the hope that it will be useful, | |
| 15 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 16 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 17 | - * GNU General Public License for more details. | |
| 18 | - * | |
| 19 | - * You should have received a copy of the GNU General Public License | |
| 20 | - * along with this program; if not, write to the Free Software | |
| 21 | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 22 | - * | |
| 23 | - * @version $Revision$ | |
| 24 | - * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa | |
| 25 | - * @package lib.roles | |
| 26 | - */ | |
| 27 | -class RoleFolderLink extends KTEntity { | |
| 28 | - | |
| 29 | - var $iId; | |
| 30 | - var $iUserID; | |
| 31 | - var $iFolderID; | |
| 32 | - var $iRoleTypeID; | |
| 33 | - var $dDateTime; | |
| 34 | - var $bDone; | |
| 35 | - var $bActive; | |
| 36 | - | |
| 37 | - /** | |
| 38 | - * Default constructor | |
| 39 | - * | |
| 40 | - * @param int Primary key of user to which role is linked | |
| 41 | - * @param int Primary key of folder to which role is linked | |
| 42 | - * @param int Primary key of role type | |
| 43 | - * | |
| 44 | - */ | |
| 45 | - function RoleFolderLink($iNewUserID, $iNewFolderID, $iNewRoleTypeID) { | |
| 46 | - //object not created in database yet | |
| 47 | - $this->iId = -1; | |
| 48 | - $this->iUserID = $iNewUserID; | |
| 49 | - $this->iFolderID = $iNewFolderID; | |
| 50 | - $this->iRoleTypeID = $iNewRoleTypeID; | |
| 51 | - //the date time is the time at which the task is finished, not the time | |
| 52 | - //at which the object is created | |
| 53 | - $this->dDateTime = null; | |
| 54 | - //task cannot be done yet | |
| 55 | - $this->bDone = false; | |
| 56 | - $this->bActive = false; | |
| 57 | - } | |
| 58 | - | |
| 59 | - /** | |
| 60 | - * Get the object's primary key | |
| 61 | - * | |
| 62 | - * @return int object's primary key | |
| 63 | - * | |
| 64 | - */ | |
| 65 | - function getID() { | |
| 66 | - return $this->iId; | |
| 67 | - } | |
| 68 | - | |
| 69 | - /** | |
| 70 | - * Get the primary key of the user to which the role is linked | |
| 71 | - * | |
| 72 | - * @return int primary key of user to which role is linked | |
| 73 | - * | |
| 74 | - */ | |
| 75 | - function getUserID() { | |
| 76 | - return $this->iUserID;; | |
| 77 | - } | |
| 78 | - | |
| 79 | - /** | |
| 80 | - * Set the primary key of the user to which the role is linked | |
| 81 | - * | |
| 82 | - * @param int Primary key of user to which role will be linked | |
| 83 | - * | |
| 84 | - */ | |
| 85 | - function setUserID($iNewValue) { | |
| 86 | - $this->iUserID = $iNewValue; | |
| 87 | - } | |
| 88 | - | |
| 89 | - /** | |
| 90 | - * Get the primary key of the folder to which the role is linked | |
| 91 | - * | |
| 92 | - * @return int primary key of folder to which role is linked | |
| 93 | - * | |
| 94 | - */ | |
| 95 | - function getFolderID() { | |
| 96 | - return $this->iFolderID; | |
| 97 | - } | |
| 98 | - | |
| 99 | - /** | |
| 100 | - * Set the primary key of the folder to which the role is linked | |
| 101 | - * | |
| 102 | - * @param int Primary key of folder to which role is linked | |
| 103 | - * | |
| 104 | - */ | |
| 105 | - function setFolderID($iNewValue) { | |
| 106 | - $this->iFolderID = $iNewValue; | |
| 107 | - } | |
| 108 | - | |
| 109 | - /** | |
| 110 | - * Get the primary key of the role type | |
| 111 | - * | |
| 112 | - * @return int primary key of role type | |
| 113 | - * | |
| 114 | - */ | |
| 115 | - function getRoleTypeID() { | |
| 116 | - return $this->iRoleTypeID; | |
| 117 | - } | |
| 118 | - | |
| 119 | - /** | |
| 120 | - * Set the primary key of the role type | |
| 121 | - * | |
| 122 | - * @param int Primary key of role type | |
| 123 | - * | |
| 124 | - */ | |
| 125 | - function setRoleTypeID($iNewValue) { | |
| 126 | - $this->iRoleTypeID = $iNewValue; | |
| 127 | - } | |
| 128 | - | |
| 129 | - /** | |
| 130 | - * Get the date at which the function for this role was performed | |
| 131 | - * | |
| 132 | - * @return date date at which the function for this role was performed | |
| 133 | - * | |
| 134 | - */ | |
| 135 | - function getDateTime() { | |
| 136 | - return $this->dDateTime; | |
| 137 | - } | |
| 138 | - | |
| 139 | - /** | |
| 140 | - * Set the date/time at which the function for this role was performed | |
| 141 | - * | |
| 142 | - * @param date/time Date/time at which the function for this role was performed | |
| 143 | - * | |
| 144 | - */ | |
| 145 | - function setDateTime($dNewValue) { | |
| 146 | - $this->dDateTine = $dNewValue; | |
| 147 | - } | |
| 148 | - | |
| 149 | - /** | |
| 150 | - * Get the done status of the role/folder/user link | |
| 151 | - * | |
| 152 | - * @return boolean done status of this role/folder/user link | |
| 153 | - * | |
| 154 | - */ | |
| 155 | - function getDone() { | |
| 156 | - return $this->bDone; | |
| 157 | - } | |
| 158 | - | |
| 159 | - /** | |
| 160 | - * Set the done status of this role/folder/user link | |
| 161 | - * | |
| 162 | - * @param boolean Done status of this role/folder/user link | |
| 163 | - * | |
| 164 | - */ | |
| 165 | - function setDone($bNewValue) { | |
| 166 | - $this->bDone = $bNewValue; | |
| 167 | - } | |
| 168 | - | |
| 169 | - function _fieldValues () { | |
| 170 | - return array( | |
| 171 | - 'user_id' => $this->iUserID, | |
| 172 | - 'folder_id' => $this->iFolderID, | |
| 173 | - 'role_type_id' => $this->iRoleTypeID, | |
| 174 | - 'datetime' => $this->dDateTime, | |
| 175 | - 'done' => $this->bDone, | |
| 176 | - 'active' => $this->bActive, | |
| 177 | - ); | |
| 178 | - } | |
| 179 | - | |
| 180 | - function _table () { | |
| 181 | - global $default; | |
| 182 | - return $default->folders_user_roles_table; | |
| 183 | - } | |
| 184 | - | |
| 185 | - /** | |
| 186 | - * Static function. | |
| 187 | - * Given a folders_users_roles_link primary key it will create a | |
| 188 | - * RolesFoldersLink object and populate it with the | |
| 189 | - * corresponding database values | |
| 190 | - * | |
| 191 | - * @return RolesFoldersLink populated RolesFoldersLink object on successful query, false otherwise and set $_SESSION["errorMessage"] | |
| 192 | - */ | |
| 193 | - function & get($iRolesFoldersID) { | |
| 194 | - global $default; | |
| 195 | - $sql = $default->db; | |
| 196 | - $result = $sql->query(array("SELECT * FROM $default->folders_user_roles_table WHERE id = ?", $iRolesFoldersID));/*ok*/ | |
| 197 | - if ($result) { | |
| 198 | - if ($sql->next_record()) { | |
| 199 | - $oRolesFoldersLink = & new RoleFolderLink($sql->f("user_id"), $sql->f("folder_id"), $sql->f("role_type_id"), $sql->f("datetime")); | |
| 200 | - $oRolesFoldersLink->bDone = $sql->f("done"); | |
| 201 | - $oRolesFoldersLink->bActive = $sql->f("active"); | |
| 202 | - $oRolesFoldersLink->iId = $iRolesFoldersID; | |
| 203 | - return $oRolesFoldersLink; | |
| 204 | - } | |
| 205 | - $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iRolesFoldersID . " table = $default->folders_user_roles_table"; | |
| 206 | - return false; | |
| 207 | - } | |
| 208 | - $_SESSION["errorMessage"] = $lang_err_database; | |
| 209 | - return false; | |
| 210 | - } | |
| 211 | - | |
| 212 | -/** | |
| 213 | - * Static function | |
| 214 | - * Get a list of web documents | |
| 215 | - * | |
| 216 | - * @param String Where clause (not required) | |
| 217 | - * | |
| 218 | - * @return Array array of RolesFoldersLink objects, false otherwise and set $_SESSION["errorMessage"] | |
| 219 | - */ | |
| 220 | - function getList($sWhereClause = null) { | |
| 221 | - return KTEntityUtil::getList(RoleFolderLink::_table(), 'RoleFolderLink', $sWhereClause); | |
| 222 | - } | |
| 223 | - | |
| 224 | -} | |
| 225 | -?> |
plugins/ktcore/admin/orgManagement.php deleted
| 1 | -<?php | |
| 2 | - | |
| 3 | -require_once(KT_LIB_DIR . '/orgmanagement/Organisation.inc'); | |
| 4 | - | |
| 5 | -require_once(KT_LIB_DIR . "/templating/templating.inc.php"); | |
| 6 | -require_once(KT_LIB_DIR . "/dispatcher.inc.php"); | |
| 7 | -require_once(KT_LIB_DIR . "/templating/kt3template.inc.php"); | |
| 8 | -require_once(KT_LIB_DIR . "/widgets/fieldWidgets.php"); | |
| 9 | - | |
| 10 | -class KTOrgAdminDispatcher extends KTAdminDispatcher { | |
| 11 | - function do_main() { | |
| 12 | - $this->aBreadcrumbs[] = array('url' => $_SERVER['PHP_SELF'], 'name' => _('Organisation Management')); | |
| 13 | - $this->oPage->setBreadcrumbDetails(_('select a organisation')); | |
| 14 | - $this->oPage->setTitle(_("Organisation Management")); | |
| 15 | - | |
| 16 | - $org_id= KTUtil::arrayGet($_REQUEST, 'org_id', null); | |
| 17 | - if ($org_id === null) { $for_edit = false; } | |
| 18 | - else { $for_edit = true; } | |
| 19 | - | |
| 20 | - $org_list =& Organisation::getList(); | |
| 21 | - | |
| 22 | - $edit_fields = array(); | |
| 23 | - $edit_org = null; | |
| 24 | - if ($for_edit === true) { | |
| 25 | - $oOrg = Organisation::get($org_id); | |
| 26 | - if (PEAR::isError($oOrg) || ($oOrg == false)) { $this->errorRedirectToMain(_('Invalid Organisation')); } | |
| 27 | - $edit_fields[] = new KTStringWidget(_('Organisation Name'),_("The organisation's visible name. e.g. <strong>Tech Support</strong>"), 'name', $oOrg->getName(), $this->oPage, true); | |
| 28 | - } | |
| 29 | - | |
| 30 | - $oTemplating = new KTTemplating; | |
| 31 | - $oTemplate = $oTemplating->loadTemplate("ktcore/principals/orgadmin"); | |
| 32 | - $aTemplateData = array( | |
| 33 | - "context" => $this, | |
| 34 | - "for_edit" => $for_edit, | |
| 35 | - "edit_fields" => $edit_fields, | |
| 36 | - "edit_org" => $oOrg, | |
| 37 | - "org_list" => $org_list, | |
| 38 | - ); | |
| 39 | - return $oTemplate->render($aTemplateData); | |
| 40 | - } | |
| 41 | - | |
| 42 | - function do_updateOrg() { | |
| 43 | - $org_id = KTUtil::arrayGet($_REQUEST, 'org_id'); | |
| 44 | - $oOrg = Organisation::get($org_id); | |
| 45 | - if (PEAR::isError($oOrg) || ($oOrg == false)) { | |
| 46 | - $this->errorRedirectToMain(_('Please specify an organisation.')); | |
| 47 | - exit(0); | |
| 48 | - } | |
| 49 | - | |
| 50 | - $org_name = KTUtil::arrayGet($_REQUEST, 'name', null); | |
| 51 | - if (empty($org_name)) { | |
| 52 | - $this->errorRedirectToMain(_('Please specify an org name.')); | |
| 53 | - exit(0); | |
| 54 | - } | |
| 55 | - | |
| 56 | - $this->startTransaction(); | |
| 57 | - $oOrg->setName($org_name); | |
| 58 | - $res = $oOrg->update(); | |
| 59 | - if (PEAR::isError($res)) { | |
| 60 | - $this->errorRedirectToMain(_('Failed to update org name.')); | |
| 61 | - exit(0); | |
| 62 | - } | |
| 63 | - | |
| 64 | - $this->commitTransaction(); | |
| 65 | - $this->successRedirectToMain(_('Org name changed to') . ': "' . $org_name . '"'); | |
| 66 | - } | |
| 67 | - | |
| 68 | -} | |
| 69 | - | |
| 70 | -?> |