Commit 010092a1dffa22a131124ecc9261da40de30ca98

Authored by Michael Joseph
1 parent 7a84781a

added copyright and gpl notice

removed owl prefix from table aliases


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2558 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/foldermanagement/Folder.inc
1 1 <?php
2   -
3 2 /**
4   -*
5   -* Class Folder
6   -*
7   -* Represents as folder as the per the folders table in the database
8   -*
9   -* @author Rob Cherry, Jam Warehouse (Pty), Ltd, South Africa
10   -* @date 16 Janurary 2003
11   -* @package lib.foldermanagement
12   -*/
13   -
  3 + * $Id$
  4 + *
  5 + * Represents as folder as the per the folders table in the database.
  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 + */
14 27 require_once("$default->fileSystemRoot/lib/foldermanagement/PhysicalFolderManagement.inc");
15 28  
16 29 class Folder {
... ... @@ -203,7 +216,7 @@ class Folder {
203 216 //if the folder is not the root folder
204 217 if ($iFolderID != 0) {
205 218 $sql = $default->db;
206   - $sql->query("SELECT parent_id FROM $default->owl_folders_table WHERE ID = $iFolderID");
  219 + $sql->query("SELECT parent_id FROM $default->folders_table WHERE ID = $iFolderID");
207 220 $sql->next_record();
208 221 return $this->generateParentFolderIDS($sql->f("parent_id")) . ",$iFolderID";
209 222 }
... ... @@ -221,7 +234,7 @@ class Folder {
221 234 //if the folder is not the root folder
222 235 if ($iFolderID != 0) {
223 236 $sql = $default->db;
224   - $sql->query("SELECT name, parent_id FROM $default->owl_folders_table WHERE ID = $iFolderID");
  237 + $sql->query("SELECT name, parent_id FROM $default->folders_table WHERE ID = $iFolderID");
225 238 $sql->next_record();
226 239 return $this->generateFullFolderPath($sql->f("parent_id")) . "/" . stripslashes($sql->f("name"));
227 240 }
... ... @@ -242,7 +255,7 @@ class Folder {
242 255 $this->sParentFolderIDs = $this->generateParentFolderIDS($this->iParentID);
243 256 $this->sParentFolderIDs = substr($this->sParentFolderIDs, 1, strlen($this->sParentFolderIDs));
244 257 $sql = $default->db;
245   - $result = $sql->query("INSERT INTO " . $default->owl_folders_table . " (name, description, parent_id, creator_id, unit_id, is_public, full_path, parent_folder_ids) " .
  258 + $result = $sql->query("INSERT INTO " . $default->folders_table . " (name, description, parent_id, creator_id, unit_id, is_public, full_path, parent_folder_ids) " .
246 259 "VALUES ('" . addslashes($this->sName) . "', '" . addslashes($this->sDescription) . "', $this->iParentID, $this->iCreatorID, $this->iUnitID, " . ($this->bIsPublic ? 1 : 0) . ",'" . addslashes($this->sFullPath) . "','" . addslashes($this->sParentFolderIDs) . "')");
247 260 if ($result) {
248 261 $this->iId = $sql->insert_id();
... ... @@ -266,7 +279,7 @@ class Folder {
266 279 $sOldPath;
267 280 if ($this->iId >= 0) {
268 281 $sql = $default->db;
269   - $sQuery = "UPDATE " . $default->owl_folders_table . " SET " .
  282 + $sQuery = "UPDATE " . $default->folders_table . " SET " .
270 283 "name = '" . addslashes($this->sName) . "', " .
271 284 "description = '" . addslashes($this->sDescription) . "', " .
272 285 "parent_id = $this->iParentID, " .
... ... @@ -308,7 +321,7 @@ class Folder {
308 321 function updateChildPaths($iID, $sql) {
309 322 global $default;
310 323 //get the direct children
311   - $sql->query("SELECT id from $default->owl_folders_table WHERE parent_id = $iID");
  324 + $sql->query("SELECT id from $default->folders_table WHERE parent_id = $iID");
312 325 while ($sql->next_record()) {
313 326 //force an update, this will cause this child's children to be updated
314 327 $oFolder = Folder::get($sql->f("id"));
... ... @@ -328,7 +341,7 @@ class Folder {
328 341 function getChildren($iFolderID, $aChildren = array()) {
329 342 global $default;
330 343 $sql = $default->db;
331   - $sql->query("SELECT id from $default->owl_folders_table WHERE parent_id = $iFolderID");
  344 + $sql->query("SELECT id from $default->folders_table WHERE parent_id = $iFolderID");
332 345 while ($sql->next_record()) {
333 346 $aChildren[count($aChildren)] = $sql->f("id");
334 347 Folder::getChildren($sql->f("id"), & $aChildren);
... ... @@ -344,7 +357,7 @@ class Folder {
344 357 function getDocumentIDs($iFolderID) {
345 358 global $default;
346 359 $sql = $default->db;
347   - $sql->query("SELECT id from $default->owl_documents_table WHERE folder_id = $iFolderID");
  360 + $sql->query("SELECT id from $default->documents_table WHERE folder_id = $iFolderID");
348 361 while ($sql->next_record()) {
349 362 $sChildString .= $sql->f("id") . ",";
350 363 }
... ... @@ -360,7 +373,7 @@ class Folder {
360 373 global $default, $lang_err_database, $lang_err_object_key;
361 374 if ($this->iId >= 0) {
362 375 $sql = $default->db;
363   - $result = $sql->query("DELETE FROM " . $default->owl_folders_table . " WHERE id = " . $this->iId);
  376 + $result = $sql->query("DELETE FROM " . $default->folders_table . " WHERE id = " . $this->iId);
364 377 if ($result) {
365 378 $this->iId = -1;
366 379 return true;
... ... @@ -386,7 +399,7 @@ class Folder {
386 399 function get($iFolderID) {
387 400 global $default, $lang_err_object_not_exist;
388 401 $sql = $default->db;
389   - $sql->query("SELECT * FROM " . $default->owl_folders_table . " WHERE id = " . $iFolderID);
  402 + $sql->query("SELECT * FROM " . $default->folders_table . " WHERE id = " . $iFolderID);
390 403 if ($sql->next_record()) {
391 404 $oFolder = & new Folder(stripslashes($sql->f("name")), stripslashes($sql->f("description")), $sql->f("parent_id"), $sql->f("creator_id"), $sql->f("unit_id"), $sql->f("is_public"));
392 405 $oFolder->iId = $iFolderID;
... ... @@ -404,7 +417,7 @@ class Folder {
404 417 function exists() {
405 418 global $default;
406 419 $sql = $default->db;
407   - $sql->query("SELECT id FROM $default->owl_folders_table WHERE name='" . $this->sName . "' " .
  420 + $sql->query("SELECT id FROM $default->folders_table WHERE name='" . $this->sName . "' " .
408 421 "AND description = '" . $this->sDescription . "' AND parent_id=$this->iParentID");
409 422 if ($sql->next_record()) {
410 423 return true;
... ... @@ -427,7 +440,7 @@ class Folder {
427 440 settype($aFolderArray, "array");
428 441 $sql = $default->db;
429 442 // TODO: join on sys_deleted
430   - $result = $sql->query("SELECT * FROM " . $default->owl_folders_table . (isset($sWhereClause) ? " WHERE " . $sWhereClause : ""));
  443 + $result = $sql->query("SELECT * FROM " . $default->folders_table . (isset($sWhereClause) ? " WHERE " . $sWhereClause : ""));
431 444 if ($result) {
432 445 $iCount = 0;
433 446 while ($sql->next_record()) {
... ... @@ -537,7 +550,7 @@ class Folder {
537 550 if ($iFolderID != 0) {
538 551 global $default;
539 552 $sql = $default->db;
540   - $sql->query("SELECT parent_id FROM " . $default->owl_folders_table . " WHERE id = " . $iFolderID);
  553 + $sql->query("SELECT parent_id FROM " . $default->folders_table . " WHERE id = " . $iFolderID);
541 554 $sql->next_record();
542 555 return $sql->f("parent_id");
543 556 }
... ... @@ -556,7 +569,7 @@ class Folder {
556 569 global $default, $lang_err_database;
557 570 if (Folder::folderExistsID($iFolderID)) {
558 571 $sql = $default->db;
559   - $sql->query("SELECT document_type_id FROM " . $default->owl_folder_doctypes_table . " WHERE folder_id = " . $iFolderID);
  572 + $sql->query("SELECT document_type_id FROM " . $default->folder_doctypes_table . " WHERE folder_id = " . $iFolderID);
560 573 if ($sql->next_record()) {
561 574 return $sql->f("document_type_id");
562 575 }
... ... @@ -580,7 +593,7 @@ class Folder {
580 593 $sName = addslashes($sName);
581 594 global $default, $lang_err_folder_exist;
582 595 $sql = $default->db;
583   - $sql->query("SELECT * FROM " . $default->owl_folders_table . " WHERE name = '" . $sName . "' AND parent_id = " . $iParentID);
  596 + $sql->query("SELECT * FROM " . $default->folders_table . " WHERE name = '" . $sName . "' AND parent_id = " . $iParentID);
584 597 if ($sql->next_record()) {
585 598 return true;
586 599 }
... ... @@ -598,7 +611,7 @@ class Folder {
598 611 function folderExistsID($iFolderID) {
599 612 global $default, $lang_err_folder_exist;
600 613 $sql = $default->db;
601   - $sql->query("SELECT * FROM " . $default->owl_folders_table . " WHERE id = " . $iFolderID);
  614 + $sql->query("SELECT * FROM " . $default->folders_table . " WHERE id = " . $iFolderID);
602 615 if ($sql->next_record()) {
603 616 return true;
604 617 }
... ... @@ -616,7 +629,7 @@ class Folder {
616 629 function getFolderName($iFolderID) {
617 630 global $default, $lang_err_database;
618 631 $sql = $default->db;
619   - $sql->query("SELECT name FROM " . $default->owl_folders_table . " WHERE id = " . $iFolderID);
  632 + $sql->query("SELECT name FROM " . $default->folders_table . " WHERE id = " . $iFolderID);
620 633 if ($sql->next_record()) {
621 634 return stripslashes($sql->f("name"));
622 635 }
... ... @@ -634,7 +647,7 @@ class Folder {
634 647 function getFolderID($sFolderName) {
635 648 global $default, $lang_err_database;
636 649 $sql = $default->db;
637   - $sql->query("SELECT id FROM " . $default->owl_folders_table . " WHERE name = '" . addslashes($sFolderName) . "'");
  650 + $sql->query("SELECT id FROM " . $default->folders_table . " WHERE name = '" . addslashes($sFolderName) . "'");
638 651 if ($sql->next_record()) {
639 652 return $sql->f("id");
640 653 }
... ... @@ -650,7 +663,7 @@ class Folder {
650 663 function folderIsLinkedToDocType($iFolderID, $iDocTypeID) {
651 664 global $default;
652 665 $sql = $default->db;
653   - $sql->query("SELECT id FROM $default->owl_folder_doctypes_table WHERE document_type_id = $iDocTypeID and folder_id = $iFolderID");
  666 + $sql->query("SELECT id FROM $default->folder_doctypes_table WHERE document_type_id = $iDocTypeID and folder_id = $iFolderID");
654 667 if ($sql->next_record()) {
655 668 return true;
656 669 }
... ... @@ -666,7 +679,7 @@ class Folder {
666 679 */
667 680 function folderIsUnitRootFolder($iFolderID) {
668 681 global $default;
669   - $sQuery ="SELECT F.id FROM $default->owl_folders_table AS F INNER JOIN $default->owl_units_table AS U ON F.name LIKE U.name WHERE F.id = $iFolderID";
  682 + $sQuery ="SELECT F.id FROM $default->folders_table AS F INNER JOIN $default->units_table AS U ON F.name LIKE U.name WHERE F.id = $iFolderID";
670 683  
671 684 $sql = $default->db;
672 685 $sql->query($sQuery);
... ...
lib/foldermanagement/FolderCollaboration.inc
1 1 <?php
2 2 /**
3   -* Class FolderCollaboration.inc
4   -*
5   -* Represents the group_folders_approval_link table in the db used to map out a
6   -* document approval process
7   -*
8   -* @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
9   -* @date 29 January 2003
10   -* @package lib.foldermanagement
11   -*
12   -*/
13   -
  3 + * $Id$
  4 + *
  5 + * Represents the group_folders_approval_link table in the db used to map out a
  6 + * document approval process.
  7 + *
  8 + * Copyright (c) 2003 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; either version 2 of the License, or
  13 + * (at your option) any later version.
  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.foldermanagement
  27 + */
14 28 class FolderCollaboration {
15 29  
16 30 /** primary key of current object */
... ... @@ -91,7 +105,7 @@ class FolderCollaboration {
91 105 //if the object hasn't been created
92 106 if ($this->iId < 0) {
93 107 $sql = $default->db;
94   - $result = $sql->query("INSERT INTO " . $default->owl_groups_folders_approval_table . " (folder_id, group_id, precedence, role_id, user_id) VALUES ($this->iFolderID, $this->iGroupID, $this->iSequenceNumber, $this->iRoleID, $this->iUserID)");
  108 + $result = $sql->query("INSERT INTO " . $default->groups_folders_approval_table . " (folder_id, group_id, precedence, role_id, user_id) VALUES ($this->iFolderID, $this->iGroupID, $this->iSequenceNumber, $this->iRoleID, $this->iUserID)");
95 109 if ($result) {
96 110 $this->iId = $sql->insert_id();
97 111 return true;
... ... @@ -99,7 +113,7 @@ class FolderCollaboration {
99 113 $_SESSION["errorMessage"] = $lang_err_database;
100 114 return false;
101 115 }
102   - $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->owl_groups_folders_approval_table";
  116 + $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->groups_folders_approval_table";
103 117 return false;
104 118 }
105 119  
... ... @@ -114,7 +128,7 @@ class FolderCollaboration {
114 128 //only update if the object has been stored
115 129 if ($this->iId > 0) {
116 130 $sql = $default->db;
117   - $result = $sql->query("UPDATE " . $default->owl_groups_folders_approval_table . " SET group_id = $this->iGroupID, folder_id = $this->iFolderID, precedence = $this->iSequenceNumber, role_id = $this->iRoleID, user_id = $this->iUserID WHERE id = $this->iId");
  131 + $result = $sql->query("UPDATE " . $default->groups_folders_approval_table . " SET group_id = $this->iGroupID, folder_id = $this->iFolderID, precedence = $this->iSequenceNumber, role_id = $this->iRoleID, user_id = $this->iUserID WHERE id = $this->iId");
118 132 if ($result) {
119 133 return true;
120 134 }
... ... @@ -136,7 +150,7 @@ class FolderCollaboration {
136 150 //only delete the object if it exists in the database
137 151 if ($this->iId >= 0) {
138 152 $sql = $default->db;
139   - $result = $sql->query("DELETE FROM $default->owl_groups_folders_approval_table WHERE id = $this->iId");
  153 + $result = $sql->query("DELETE FROM $default->groups_folders_approval_table WHERE id = $this->iId");
140 154 if ($result) {
141 155 return true;
142 156 }
... ... @@ -156,8 +170,8 @@ class FolderCollaboration {
156 170 function hasDocumentInProcess() {
157 171 global $default;
158 172 $sQuery = "SELECT FURL.id " .
159   - "FROM $default->owl_groups_folders_approval_table AS GFAL INNER JOIN documents AS D ON GFAL.folder_id = D.folder_id " .
160   - "INNER JOIN $default->owl_folders_user_roles_table AS FURL ON FURL.document_id = D.id " .
  173 + "FROM $default->groups_folders_approval_table AS GFAL INNER JOIN documents AS D ON GFAL.folder_id = D.folder_id " .
  174 + "INNER JOIN $default->folders_user_roles_table AS FURL ON FURL.document_id = D.id " .
161 175 "WHERE GFAL.id = " . $this->iId . " " .
162 176 "AND FURL.active != 0";
163 177 $sql = $default->db;
... ... @@ -177,14 +191,14 @@ class FolderCollaboration {
177 191 function & get($iFolderCollaborationID) {
178 192 global $default;
179 193 $sql = $default->db;
180   - $result = $sql->query("SELECT * FROM $default->owl_groups_folders_approval_table WHERE id = $iFolderCollaborationID");
  194 + $result = $sql->query("SELECT * FROM $default->groups_folders_approval_table WHERE id = $iFolderCollaborationID");
181 195 if ($result) {
182 196 if ($sql->next_record()) {
183 197 $oFolderCollaboration = & new FolderCollaboration($sql->f("folder_id"), $sql->f("group_id"), $sql->f("precedence"), $sql->f("role_id"), $sql->f("user_id"));
184 198 $oFolderCollaboration->iId = $iFolderCollaborationID;
185 199 return $oFolderCollaboration;
186 200 }
187   - $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iFolderCollaborationID . " table = $default->owl_groups_folders_approval_table";
  201 + $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iFolderCollaborationID . " table = $default->groups_folders_approval_table";
188 202 return false;
189 203 }
190 204 $_SESSION["errorMessage"] = $lang_err_database;
... ... @@ -204,7 +218,7 @@ class FolderCollaboration {
204 218 $aFolderCollaborationArray;
205 219 settype($aFolderCollaborationArray, "array");
206 220 $sql = $default->db;
207   - $result = $sql->query("SELECT * FROM " . $default->owl_groups_folders_approval_table . (isset($sWhereClause) ? " " . $sWhereClause : ""));
  221 + $result = $sql->query("SELECT * FROM " . $default->groups_folders_approval_table . (isset($sWhereClause) ? " " . $sWhereClause : ""));
208 222 if ($result) {
209 223 $iCount = 0;
210 224 while ($sql->next_record()) {
... ...
lib/foldermanagement/FolderDocTypeLink.inc
1 1 <?php
2 2 /**
3   -* Represents an entry in the database as per the folder_doctype_link table
4   -*
5   -* @author Rob Cherry, Jam Warehouse South Africa (Pty) Ltd
6   -* @date 27 February 2003
7   -* @package
8   -*/
9   -
  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 + */
10 27 class FolderDocTypeLink {
11 28  
12 29 /** primary key of object */
... ... @@ -32,7 +49,7 @@ class FolderDocTypeLink {
32 49 //if the object has not already been stored
33 50 if ($this->iId < 0) {
34 51 $sql = $default->db;
35   - $result = $sql->query("INSERT INTO " . $default->owl_folder_doctypes_table . " (folder_id, document_type_id) " .
  52 + $result = $sql->query("INSERT INTO " . $default->folder_doctypes_table . " (folder_id, document_type_id) " .
36 53 "VALUES ($this->iFolderID, $this->iDocumentTypeID)");
37 54 if ($result) {
38 55 $this->iId = $sql->insert_id();
... ... @@ -59,7 +76,7 @@ class FolderDocTypeLink {
59 76 $sOldPath = $default->documentRoot . "/" . $this->sFullPath . "/" . $this->sName;
60 77 }
61 78 $sql = $default->db;
62   - $sQuery = "UPDATE " . $default->owl_folder_doctypes_table . " SET " .
  79 + $sQuery = "UPDATE " . $default->folder_doctypes_table . " SET " .
63 80 "folder_id = $this->iFolderID, " .
64 81 "document_type_id = $this->iDocumentTypeID " .
65 82 "WHERE id = " . $this->iId;
... ... @@ -82,7 +99,7 @@ class FolderDocTypeLink {
82 99 global $default, $lang_err_database, $lang_err_object_key;
83 100 if ($this->iId >= 0) {
84 101 $sql = $default->db;
85   - $result = $sql->query("DELETE FROM " . $default->owl_folder_doctypes_table . " WHERE id = " . $this->iId);
  102 + $result = $sql->query("DELETE FROM " . $default->folder_doctypes_table . " WHERE id = " . $this->iId);
86 103 if ($result) {
87 104 $this->iId = -1;
88 105 return true;
... ... @@ -108,7 +125,7 @@ class FolderDocTypeLink {
108 125 function get($iFolderDocTypeLinkID) {
109 126 global $default, $lang_err_object_not_exist;
110 127 $sql = $default->db;
111   - $sql->query("SELECT * FROM " . $default->owl_folder_doctypes_table . " WHERE id = " . $iFolderDocTypeLinkID);
  128 + $sql->query("SELECT * FROM " . $default->folder_doctypes_table . " WHERE id = " . $iFolderDocTypeLinkID);
112 129 if ($sql->next_record()) {
113 130 $oFolderDocTypeLink = & new FolderDocTypeLink($sql->f("folder_id"), $sql->f("document_type_id"));
114 131 $oFolderDocTypeLink->iId = $iFolderDocTypeLinkID;
... ... @@ -132,7 +149,7 @@ class FolderDocTypeLink {
132 149 settype($aFolderDocTypeLinkArray, "array");
133 150 $sql = $default->db;
134 151 // TODO: join on sys_deleted
135   - $result = $sql->query("SELECT * FROM " . $default->owl_folder_doctypes_table . (isset($sWhereClause) ? " WHERE " . $sWhereClause : ""));
  152 + $result = $sql->query("SELECT * FROM " . $default->folder_doctypes_table . (isset($sWhereClause) ? " WHERE " . $sWhereClause : ""));
136 153 if ($result) {
137 154 $iCount = 0;
138 155 while ($sql->next_record()) {
... ...
lib/foldermanagement/FolderUserRole.inc
1 1 <?php
2 2 /**
3   -* Class that represents a link between users, folders and roles as per the
4   -* folders_users_roles_link
5   -*
6   -* @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
7   -* @date 29 January 2003
8   -* @package lib.foldermanagement
9   -*
10   -*/
11   -
  3 + * $Id$
  4 + *
  5 + * Class that represents a link between users, folders and roles as per the
  6 + * folders_users_roles_link table.
  7 + *
  8 + * Copyright (c) 2003 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; either version 2 of the License, or
  13 + * (at your option) any later version.
  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.foldermanagement
  27 + */
12 28 class FolderUserRole {
13 29  
14 30 var $iId;
... ... @@ -103,7 +119,7 @@ class FolderUserRole {
103 119 //if the object hasn't been created
104 120 if ($this->iId < 0) {
105 121 $sql = $default->db;
106   - $result = $sql->query("INSERT INTO " . $default->owl_folders_user_roles_table . " (user_id, document_id, group_folder_approval_id, datetime, done, active, dependant_documents_created) VALUES ($this->iUserID, $this->iDocumentID, $this->iGroupFolderApprovalID, '$this->dDateTime', " . ($this->bDone ? "1" : "0") . ", " . ($this->bActive ? "1" : "0") . ", " . (($this->bDependantDocumentsCreated) ? "1" : "0") . ")");
  122 + $result = $sql->query("INSERT INTO " . $default->folders_user_roles_table . " (user_id, document_id, group_folder_approval_id, datetime, done, active, dependant_documents_created) VALUES ($this->iUserID, $this->iDocumentID, $this->iGroupFolderApprovalID, '$this->dDateTime', " . ($this->bDone ? "1" : "0") . ", " . ($this->bActive ? "1" : "0") . ", " . (($this->bDependantDocumentsCreated) ? "1" : "0") . ")");
107 123 if ($result) {
108 124 $this->iId = $sql->insert_id();
109 125 return true;
... ... @@ -126,8 +142,8 @@ class FolderUserRole {
126 142 //only update if the object has been stored
127 143 if ($this->iId > 0) {
128 144 $sql = $default->db;
129   - //echo "UPDATE " . $default->owl_folders_user_roles_table . " SET user_id = $this->iUserID, document_id = $this->iDocumentID, group_folder_approval_id = $this->iGroupFolderApprovalID, datetime = '$this->dDateTime', done = " . ($this->bDone ? "1" : "0") . ", active = " . ($this->bActive ? "1" : "0") . ", dependant_documents_created = " . ($this->bDependantDocumentsCreated ? "1" : "0") . " WHERE id = $this->iId";
130   - $result = $sql->query("UPDATE " . $default->owl_folders_user_roles_table . " SET user_id = $this->iUserID, document_id = $this->iDocumentID, group_folder_approval_id = $this->iGroupFolderApprovalID, datetime = '$this->dDateTime', done = " . ($this->bDone ? "1" : "0") . ", active = " . ($this->bActive ? "1" : "0") . ", dependant_documents_created = " . ($this->bDependantDocumentsCreated ? "1" : "0") . " WHERE id = $this->iId");
  145 + //echo "UPDATE " . $default->folders_user_roles_table . " SET user_id = $this->iUserID, document_id = $this->iDocumentID, group_folder_approval_id = $this->iGroupFolderApprovalID, datetime = '$this->dDateTime', done = " . ($this->bDone ? "1" : "0") . ", active = " . ($this->bActive ? "1" : "0") . ", dependant_documents_created = " . ($this->bDependantDocumentsCreated ? "1" : "0") . " WHERE id = $this->iId";
  146 + $result = $sql->query("UPDATE " . $default->folders_user_roles_table . " SET user_id = $this->iUserID, document_id = $this->iDocumentID, group_folder_approval_id = $this->iGroupFolderApprovalID, datetime = '$this->dDateTime', done = " . ($this->bDone ? "1" : "0") . ", active = " . ($this->bActive ? "1" : "0") . ", dependant_documents_created = " . ($this->bDependantDocumentsCreated ? "1" : "0") . " WHERE id = $this->iId");
131 147 if ($result) {
132 148 return true;
133 149 }
... ... @@ -149,7 +165,7 @@ class FolderUserRole {
149 165 //only delete the object if it exists in the database
150 166 if ($this->iId >= 0) {
151 167 $sql = $default->db;
152   - $result = $sql->query("DELETE FROM $default->owl_folders_user_roles_table WHERE id = $this->iId");
  168 + $result = $sql->query("DELETE FROM $default->folders_user_roles_table WHERE id = $this->iId");
153 169 if ($result) {
154 170 return true;
155 171 }
... ... @@ -171,7 +187,7 @@ class FolderUserRole {
171 187 function & get($iFolderUserRoleID) {
172 188 global $default;
173 189 $sql = $default->db;
174   - $result = $sql->query("SELECT * FROM $default->owl_folders_user_roles_table WHERE id = $iFolderUserRoleID");
  190 + $result = $sql->query("SELECT * FROM $default->folders_user_roles_table WHERE id = $iFolderUserRoleID");
175 191 if ($result) {
176 192 if ($sql->next_record()) {
177 193 $oFolderUserRole = & new FolderUserRole($sql->f("user_id"), $sql->f("document_id"), $sql->f("group_folder_approval_id"), $sql->f("done"), $sql->f("active"), $sql->f("dependant_documents_created"));
... ... @@ -180,7 +196,7 @@ class FolderUserRole {
180 196  
181 197 return $oFolderUserRole;
182 198 }
183   - $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iFolderUserRoleID . " table = $default->owl_folders_user_roles_table";
  199 + $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iFolderUserRoleID . " table = $default->folders_user_roles_table";
184 200 return false;
185 201 }
186 202 $_SESSION["errorMessage"] = $lang_err_database;
... ... @@ -200,7 +216,7 @@ class FolderUserRole {
200 216 $aFolderUserRoleArray;
201 217 settype($aFolderUserRoleArray, "array");
202 218 $sql = $default->db;
203   - $result = $sql->query("SELECT * FROM " . $default->owl_folders_user_roles_table . (isset($sWhereClause) ? " WHERE " . $sWhereClause : ""));
  219 + $result = $sql->query("SELECT * FROM " . $default->folders_user_roles_table . (isset($sWhereClause) ? " WHERE " . $sWhereClause : ""));
204 220 if ($result) {
205 221 $iCount = 0;
206 222 while ($sql->next_record()) {
... ... @@ -217,7 +233,7 @@ class FolderUserRole {
217 233 function & getFromFolderCollaboration($iFolderCollaborationID, $iDocumentID) {
218 234 global $default, $lang_err_database;
219 235 $sql = $default->db;
220   - $sql->query("SELECT id FROM $default->owl_folders_user_roles_table WHERE group_folder_approval_id = $iFolderCollaborationID AND document_id = $iDocumentID");
  236 + $sql->query("SELECT id FROM $default->folders_user_roles_table WHERE group_folder_approval_id = $iFolderCollaborationID AND document_id = $iDocumentID");
221 237 if ($sql->next_record()) {
222 238 return FolderUserRole::get($sql->f("id"));
223 239 }
... ...
lib/foldermanagement/PhysicalFolderManagement.inc
1 1 <?php
2   -
3 2 /**
4   -*
5   -* Contains static functions for doing physical folder managements
6   -* such as creating/deleting folders
7   -*
8   -* @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
9   -* @date 19 January 2003
10   -*
11   -* @todo finished createFolder() function - find out correct mode
12   -* @package lib.foldermanagement
13   -*/
14   -
  3 + * $Id$
  4 + *
  5 + * Contains static functions for doing physical folder managements
  6 + * such as creating/deleting folders
  7 + *
  8 + * Copyright (c) 2003 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; either version 2 of the License, or
  13 + * (at your option) any later version.
  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.foldermanagement
  27 + */
15 28 class PhysicalFolderManagement {
16 29  
17 30 /**
... ...
lib/groups/Group.inc
1 1 <?php
2 2 /**
3   -* Represents a Group as per the database table groups
4   -*
5   -* @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
6   -* @date 23 January 2003
7   -* @package lib.groups
8   -*
9   -*/
10   -
  3 + * $Id$
  4 + *
  5 + * Represents a Group as per the database table groups.
  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.groups
  26 + */
11 27 class Group {
12 28  
13 29 /** primary key of current object */
... ... @@ -66,7 +82,7 @@ class Group {
66 82 function hasUsers() {
67 83 global $default;
68 84 $sql = $default->db;
69   - $sql->query("SELECT id FROM $default->owl_users_groups_table WHERE group_id = $this->iId");
  85 + $sql->query("SELECT id FROM $default->users_groups_table WHERE group_id = $this->iId");
70 86 $rows = $sql->num_rows();
71 87 if ($rows > 0) {
72 88 return true;
... ... @@ -82,7 +98,7 @@ class Group {
82 98 global $default;
83 99  
84 100 $sql = $default->db;
85   - $query = "SELECT id FROM $default->owl_groups_units_table WHERE group_id = $this->iId";
  101 + $query = "SELECT id FROM $default->groups_units_table WHERE group_id = $this->iId";
86 102 $sql->query($query);
87 103 $rows = $sql->num_rows();
88 104 if ($rows > 0){
... ... @@ -104,7 +120,7 @@ class Group {
104 120 if ($this->iId < 0) {
105 121 //check to see if name exsits
106 122 $sql = $default->db;
107   - $query = "SELECT name FROM ". $default->owl_groups_table ." WHERE name = '" . $this->sName . "'";
  123 + $query = "SELECT name FROM ". $default->groups_table ." WHERE name = '" . $this->sName . "'";
108 124 $sql->query($query);
109 125 $rows = $sql->num_rows();
110 126 if ($rows > 0) {
... ... @@ -113,7 +129,7 @@ class Group {
113 129 return false;
114 130 } else {
115 131 $sql = $default->db;
116   - $result = $sql->query("INSERT INTO " . $default->owl_groups_table . " (name, is_sys_admin, is_unit_admin) VALUES ('" . addslashes($this->sName) . "', " . ($this->bIsSysAdmin ? 1 : 0) . ", " . ($this->bIsUnitAdmin ? 1 : 0) . ")");
  132 + $result = $sql->query("INSERT INTO " . $default->groups_table . " (name, is_sys_admin, is_unit_admin) VALUES ('" . addslashes($this->sName) . "', " . ($this->bIsSysAdmin ? 1 : 0) . ", " . ($this->bIsUnitAdmin ? 1 : 0) . ")");
117 133 if ($result) {
118 134 $this->iId = $sql->insert_id();
119 135 return true;
... ... @@ -137,7 +153,7 @@ class Group {
137 153 //only update if the object has been stored
138 154 if ($this->iId > 0) {
139 155 $sql = $default->db;
140   - $result = $sql->query("UPDATE " . $default->owl_groups_table . " SET name = '" . addslashes($this->sName) . "', is_sys_admin = " . ($this->bIsSysAdmin ? 1 : 0) . ", is_unit_admin = " . ($this->bIsUnitAdmin ? 1 : 0) . " WHERE id = $this->iId");
  156 + $result = $sql->query("UPDATE " . $default->groups_table . " SET name = '" . addslashes($this->sName) . "', is_sys_admin = " . ($this->bIsSysAdmin ? 1 : 0) . ", is_unit_admin = " . ($this->bIsUnitAdmin ? 1 : 0) . " WHERE id = $this->iId");
141 157 if ($result) {
142 158 return true;
143 159 }
... ... @@ -159,7 +175,7 @@ class Group {
159 175 //only delete the object if it exists in the database
160 176 if ($this->iId >= 0) {
161 177 $sql = $default->db;
162   - $result = $sql->query("DELETE FROM $default->owl_groups_table WHERE id = $this->iId");
  178 + $result = $sql->query("DELETE FROM $default->groups_table WHERE id = $this->iId");
163 179 return $result;
164 180 }
165 181 $_SESSION["errorMessage"] = $lang_err_object_key;
... ... @@ -177,14 +193,14 @@ class Group {
177 193 function & get($iGroupID) {
178 194 global $default;
179 195 $sql = $default->db;
180   - $result = $sql->query("SELECT * FROM $default->owl_groups_table WHERE id = $iGroupID");
  196 + $result = $sql->query("SELECT * FROM $default->groups_table WHERE id = $iGroupID");
181 197 if ($result) {
182 198 if ($sql->next_record()) {
183 199 $oGroup = & new Group(stripslashes($sql->f("name")), $sql->f("is_unit_admin"), $sql->f("is_sys_admin"));
184 200 $oGroup->iId = $iGroupID;
185 201 return $oGroup;
186 202 }
187   - $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iGroupID . " table = $default->owl_groups_table";
  203 + $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iGroupID . " table = $default->groups_table";
188 204 return false;
189 205 }
190 206 $_SESSION["errorMessage"] = $lang_err_database;
... ... @@ -204,7 +220,7 @@ class Group {
204 220 $aGroupArray;
205 221 settype($aGroupArray, "array");
206 222 $sql = $default->db;
207   - $result = $sql->query("SELECT * FROM " . $default->owl_groups_table . (isset($sWhereClause) ? " " . $sWhereClause : ""));
  223 + $result = $sql->query("SELECT * FROM " . $default->groups_table . (isset($sWhereClause) ? " " . $sWhereClause : ""));
208 224 if ($result) {
209 225 $iCount = 0;
210 226 while ($sql->next_record()) {
... ... @@ -229,7 +245,7 @@ class Group {
229 245 */
230 246 function getGroupName($id) {
231 247 global $default;
232   - $sName = lookupField("$default->owl_groups_table", "name", "id", $id );
  248 + $sName = lookupField("$default->groups_table", "name", "id", $id );
233 249 return $sName;
234 250 }
235 251 }
... ... @@ -247,7 +263,7 @@ class Group {
247 263 {
248 264 global $default;
249 265  
250   - $name = lookupField("$default->owl_groups_table", "name", "id", $id );
  266 + $name = lookupField("$default->groups_table", "name", "id", $id );
251 267  
252 268 $this->sName= $name;
253 269 }
... ...
lib/groups/GroupFolderApprovalLink.inc
1 1 <?php
2 2 /**
3   -* Class GroupFolderApprovalLink
4   -* Represents a group/folder/approval link as per the groups_folders_approval_link
5   -*
6   -* groups_folders_approval_link are used to set the approval workflow for a document
7   -* The precedence_id determines the order of the workflow
8   -*
9   -* @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
10   -* @date 20 January 2003
11   -* @package lib.groups
12   -*/
13   -
  3 + * $Id$
  4 + *
  5 + * Represents a group/folder/approval link as per the groups_folders_approval_link.
  6 + * Used to set the approval workflow for a document
  7 + * The precedence_id determines the order of the workflow.
  8 + *
  9 + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com
  10 + *
  11 + * This program is free software; you can redistribute it and/or modify
  12 + * it under the terms of the GNU General Public License as published by
  13 + * the Free Software Foundation; either version 2 of the License, or
  14 + * (at your option) any later version.
  15 + *
  16 + * This program is distributed in the hope that it will be useful,
  17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19 + * GNU General Public License for more details.
  20 + *
  21 + * You should have received a copy of the GNU General Public License
  22 + * along with this program; if not, write to the Free Software
  23 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  24 + *
  25 + * @version $Revision$
  26 + * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
  27 + * @package lib.groups
  28 + */
14 29 class GroupFolderApprovalLink {
15 30  
16 31 /** primary key of object */
... ... @@ -134,7 +149,7 @@ class GroupFolderApprovalLink {
134 149 //if the object hasn't been created
135 150 if ($this->iId < 0) {
136 151 $sql = $default->db;
137   - $result = $sql->query("INSERT INTO " . $default->owl_groups_folders_approval_table . " (folder_id, group_id, precedence, role_id) VALUES ($this->iFolderID, $this->iGroupID, $this->iPrecedence, $this->iRoleID)");
  152 + $result = $sql->query("INSERT INTO " . $default->groups_folders_approval_table . " (folder_id, group_id, precedence, role_id) VALUES ($this->iFolderID, $this->iGroupID, $this->iPrecedence, $this->iRoleID)");
138 153 if ($result) {
139 154 $this->iId = $sql->insert_id();
140 155 return true;
... ... @@ -157,7 +172,7 @@ class GroupFolderApprovalLink {
157 172 //only update if the object has been stored
158 173 if ($this->iId > 0) {
159 174 $sql = $default->db;
160   - $result = $sql->query("UPDATE " . $default->owl_groups_folders_approval_table . " SET folder_id = $this->iFolderID, group_id = $this->iGroupID, precedence = $this->iPrecedence, role_id = $this->iRoleID WHERE id = $this->iId");
  175 + $result = $sql->query("UPDATE " . $default->groups_folders_approval_table . " SET folder_id = $this->iFolderID, group_id = $this->iGroupID, precedence = $this->iPrecedence, role_id = $this->iRoleID WHERE id = $this->iId");
161 176 if ($result) {
162 177 return true;
163 178 }
... ... @@ -179,7 +194,7 @@ class GroupFolderApprovalLink {
179 194 //only delete the object if it exists in the database
180 195 if ($this->iId >= 0) {
181 196 $sql = $default->db;
182   - $result = $sql->query("DELETE FROM $default->owl_groups_folders_approval_table WHERE id = $this->iId");
  197 + $result = $sql->query("DELETE FROM $default->groups_folders_approval_table WHERE id = $this->iId");
183 198 if ($result) {
184 199 return true;
185 200 }
... ... @@ -201,7 +216,7 @@ class GroupFolderApprovalLink {
201 216 function & get($iGroupFolderLinkID) {
202 217 global $default;
203 218 $sql = $default->db;
204   - $result = $sql->query("SELECT * FROM $default->owl_groups_folders_approval_table WHERE id = $iGroupFolderLinkID");
  219 + $result = $sql->query("SELECT * FROM $default->groups_folders_approval_table WHERE id = $iGroupFolderLinkID");
205 220 if ($result) {
206 221 if ($sql->next_record()) {
207 222 $oGroupFolderApprovalLink = & new GroupFolderApprovalLink($sql->f("folder_id"), $sql->f("group_id"), $sql->f("precedence"), $sql->f("role_id"), $sql->f("datetime"));
... ... @@ -228,7 +243,7 @@ class GroupFolderApprovalLink {
228 243 $aGroupFolderApprovalLinkArray;
229 244 settype($aGroupFolderApprovalLinkArray, "array");
230 245 $sql = $default->db;
231   - $result = $sql->query("SELECT * FROM " . $default->owl_groups_folders_approval_table . (isset($sWhereClause) ? " " . $sWhereClause : ""));
  246 + $result = $sql->query("SELECT * FROM " . $default->groups_folders_approval_table . (isset($sWhereClause) ? " " . $sWhereClause : ""));
232 247 if ($result) {
233 248 $iCount = 0;
234 249 while ($sql->next_record()) {
... ...
lib/groups/GroupFolderLink.inc
... ... @@ -3,14 +3,28 @@
3 3 * $Id$
4 4 *
5 5 * Represents the group_folders_link table in the db used to represent
6   - * folder access
  6 + * folder access.
7 7 *
8   - * Licensed under the GNU GPL. For full terms see the file COPYING.
  8 + * Copyright (c) 2003 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; either version 2 of the License, or
  13 + * (at your option) any later version.
  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.
9 19 *
10   - * @version $Revision$
  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$
11 25 * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa
12   - * @package lib.foldermanagement
13   - */
  26 + * @package lib.groups
  27 + */
14 28 class GroupFolderLink {
15 29  
16 30 /** primary key of current object */
... ... @@ -80,7 +94,7 @@ class GroupFolderLink {
80 94 //if the object hasn't been created
81 95 if ($this->iId < 0) {
82 96 $sql = $default->db;
83   - $result = $sql->query("INSERT INTO " . $default->owl_groups_folders_table . " (folder_id, group_id, can_read, can_write) VALUES ($this->iFolderID, $this->iGroupID, " . ($this->bCanRead ? 1 : 0) . ", " . ($this->bCanWrite ? 1 : 0) . ")");
  97 + $result = $sql->query("INSERT INTO " . $default->groups_folders_table . " (folder_id, group_id, can_read, can_write) VALUES ($this->iFolderID, $this->iGroupID, " . ($this->bCanRead ? 1 : 0) . ", " . ($this->bCanWrite ? 1 : 0) . ")");
84 98 if ($result) {
85 99 $this->iId = $sql->insert_id();
86 100 return true;
... ... @@ -88,7 +102,7 @@ class GroupFolderLink {
88 102 $_SESSION["errorMessage"] = $lang_err_database;
89 103 return false;
90 104 }
91   - $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->owl_groups_folders_table";
  105 + $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->groups_folders_table";
92 106 return false;
93 107 }
94 108  
... ... @@ -103,7 +117,7 @@ class GroupFolderLink {
103 117 //only update if the object has been stored
104 118 if ($this->iId > 0) {
105 119 $sql = $default->db;
106   - $result = $sql->query("UPDATE $default->owl_groups_folders_table SET group_id = $this->iGroupID, folder_id = $this->iFolderID, can_read = " . ($this->bCanRead ? 1 : 0) .", can_write = " . ($this->bCanWrite ? 1 : 0) . " WHERE id = $this->iId");
  120 + $result = $sql->query("UPDATE $default->groups_folders_table SET group_id = $this->iGroupID, folder_id = $this->iFolderID, can_read = " . ($this->bCanRead ? 1 : 0) .", can_write = " . ($this->bCanWrite ? 1 : 0) . " WHERE id = $this->iId");
107 121 if ($result) {
108 122 return true;
109 123 }
... ... @@ -125,7 +139,7 @@ class GroupFolderLink {
125 139 //only delete the object if it exists in the database
126 140 if ($this->iId >= 0) {
127 141 $sql = $default->db;
128   - $result = $sql->query("DELETE FROM $default->owl_groups_folders_table WHERE id = $this->iId");
  142 + $result = $sql->query("DELETE FROM $default->groups_folders_table WHERE id = $this->iId");
129 143 if ($result) {
130 144 return true;
131 145 }
... ... @@ -141,7 +155,7 @@ class GroupFolderLink {
141 155 function exists() {
142 156 global $default;
143 157 $sql = $default->db;
144   - if ($sql->query("SELECT count(*) AS count FROM $default->owl_groups_folders_table WHERE folder_id = $this->iFolderID AND group_id = $this->iGroupID")) {
  158 + if ($sql->query("SELECT count(*) AS count FROM $default->groups_folders_table WHERE folder_id = $this->iFolderID AND group_id = $this->iGroupID")) {
145 159 $sql->next_record();
146 160 return ($sql->f("count") > 0) ? true : false;
147 161 } else {
... ... @@ -160,14 +174,14 @@ class GroupFolderLink {
160 174 function & get($iGroupFolderID) {
161 175 global $default;
162 176 $sql = $default->db;
163   - $result = $sql->query("SELECT * FROM $default->owl_groups_folders_table WHERE id = $iGroupFolderID");
  177 + $result = $sql->query("SELECT * FROM $default->groups_folders_table WHERE id = $iGroupFolderID");
164 178 if ($result) {
165 179 if ($sql->next_record()) {
166 180 $oGroupFolderLink = & new GroupFolderLink($sql->f("folder_id"), $sql->f("group_id"), $sql->f("can_read"), $sql->f("can_write"));
167 181 $oGroupFolderLink->iId = $iGroupFolderID;
168 182 return $oGroupFolderLink;
169 183 }
170   - $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iFolderAccessID . " table = $default->owl_groups_folders_table";
  184 + $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iFolderAccessID . " table = $default->groups_folders_table";
171 185 return false;
172 186 }
173 187 $_SESSION["errorMessage"] = $lang_err_database;
... ... @@ -186,7 +200,7 @@ class GroupFolderLink {
186 200 global $default, $lang_err_database;
187 201 $oGroupFolderLinkArray = array();
188 202 $sql = $default->db;
189   - $result = $sql->query("SELECT * FROM " . $default->owl_groups_folders_table . (isset($sWhereClause) ? " " . $sWhereClause : ""));
  203 + $result = $sql->query("SELECT * FROM " . $default->groups_folders_table . (isset($sWhereClause) ? " " . $sWhereClause : ""));
190 204 if ($result) {
191 205 while ($sql->next_record()) {
192 206 $oGroupFolderLinkArray[] = & GroupFolderLink::get($sql->f("id"));
... ...
lib/groups/GroupUnitLink.inc
1 1 <?php
2 2 /**
3   -*
4   -* Class GroupUnitLink
5   -* Represents a group, unit link as per the database table groups_units_link
6   -*
7   -* @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
8   -* @date 20 January 2003
9   -* @package lib.groups
10   -*/
11   -
  3 + * $Id$
  4 + *
  5 + * Represents a group, unit link as per the database table groups_units_link.
  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.groups
  26 + */
12 27 class GroupUnitLink {
13 28  
14 29 /** primary key of object */
... ... @@ -87,7 +102,7 @@ class GroupUnitLink {
87 102 if ($this->iId < 0)
88 103 {
89 104 $sql = $default->db;
90   - $query = "SELECT unit_id, group_id FROM ". $default->owl_groups_units_table ." WHERE unit_id = '" . $this->iUnitID . "' and group_id = '". $this->iGroupID ."'";
  105 + $query = "SELECT unit_id, group_id FROM ". $default->groups_units_table ." WHERE unit_id = '" . $this->iUnitID . "' and group_id = '". $this->iGroupID ."'";
91 106 $sql->query($query);
92 107 $rows = $sql->num_rows($sql);
93 108  
... ... @@ -100,7 +115,7 @@ class GroupUnitLink {
100 115 else
101 116 {
102 117 $sql = $default->db;
103   - $result = $sql->query("INSERT INTO " . $default->owl_groups_units_table . " (group_id, unit_id) VALUES ($this->iGroupID, $this->iUnitID)");
  118 + $result = $sql->query("INSERT INTO " . $default->groups_units_table . " (group_id, unit_id) VALUES ($this->iGroupID, $this->iUnitID)");
104 119 if ($result)
105 120 {
106 121 $this->iId = $sql->insert_id();
... ... @@ -110,7 +125,7 @@ class GroupUnitLink {
110 125 return false;
111 126 }
112 127 }
113   - $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->owl_groups_units_table";
  128 + $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->groups_units_table";
114 129 return false;
115 130 }
116 131  
... ... @@ -125,7 +140,7 @@ class GroupUnitLink {
125 140 //only update if the object has been stored
126 141 if ($this->iId > 0) {
127 142 $sql = $default->db;
128   - $result = $sql->query("UPDATE " . $default->owl_groups_units_table . " SET group_id = $this->iGroupID, unit_id = $this->iUnitID WHERE id = $this->iId");
  143 + $result = $sql->query("UPDATE " . $default->groups_units_table . " SET group_id = $this->iGroupID, unit_id = $this->iUnitID WHERE id = $this->iId");
129 144 if ($result) {
130 145 return true;
131 146 }
... ... @@ -147,7 +162,7 @@ class GroupUnitLink {
147 162 //only delete the object if it exists in the database
148 163 if ($this->iId >= 0) {
149 164 $sql = $default->db;
150   - $result = $sql->query("DELETE FROM $default->owl_groups_units_table WHERE id = $this->iId");
  165 + $result = $sql->query("DELETE FROM $default->groups_units_table WHERE id = $this->iId");
151 166 if ($result) {
152 167 return true;
153 168 }
... ... @@ -169,14 +184,14 @@ class GroupUnitLink {
169 184 function & get($iGroupUnitLinkID) {
170 185 global $default;
171 186 $sql = $default->db;
172   - $result = $sql->query("SELECT * FROM $default->owl_groups_units_table WHERE id = $iGroupUnitLinkID");
  187 + $result = $sql->query("SELECT * FROM $default->groups_units_table WHERE id = $iGroupUnitLinkID");
173 188 if ($result) {
174 189 if ($sql->next_record()) {
175 190 $oGroupUnitLink = & new GroupUnitLink($sql->f("group_id"), $sql->f("unit_id"));
176 191 $oGroupUnitLink->iId = $iGroupUnitLinkID;
177 192 return $oGroupUnitLink;
178 193 }
179   - $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iGroupUnitLinkID . " table = $default->owl_groups_units_table";
  194 + $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iGroupUnitLinkID . " table = $default->groups_units_table";
180 195 return false;
181 196 }
182 197 $_SESSION["errorMessage"] = $lang_err_database;
... ... @@ -196,7 +211,7 @@ class GroupUnitLink {
196 211 $aGroupUnitLink;
197 212 settype($aGroupUnitLink, "array");
198 213 $sql = $default->db;
199   - $result = $sql->query("SELECT * FROM " . $default->owl_groups_units_table . (isset($sWhereClause) ? " " . $sWhereClause : ""));
  214 + $result = $sql->query("SELECT * FROM " . $default->groups_units_table . (isset($sWhereClause) ? " " . $sWhereClause : ""));
200 215 if ($result) {
201 216 $iCount = 0;
202 217 while ($sql->next_record()) {
... ... @@ -225,7 +240,7 @@ class GroupUnitLink {
225 240 {
226 241 global $default;
227 242  
228   - $value = lookupField("$default->owl_groups_units_table", "unit_id", "group_id", $groupId );
  243 + $value = lookupField("$default->groups_units_table", "unit_id", "group_id", $groupId );
229 244  
230 245 return $value;
231 246  
... ... @@ -245,7 +260,7 @@ class GroupUnitLink {
245 260 {
246 261 global $default;
247 262  
248   - $id = lookupID($default->owl_groups_units_table, "group_id", $groupId);
  263 + $id = lookupID($default->groups_units_table, "group_id", $groupId);
249 264  
250 265 $this->iId= $id;
251 266 }
... ...
lib/groups/GroupUserLink.inc
1 1 <?php
2 2 /**
3   -*
4   -* Class GroupUserLink
5   -* Represents a group, unit link as per the database table groups_units_link
6   -*
7   -* @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa
8   -* @date 20 January 2003
9   -* @package lib.groups
10   -*/
11   -
  3 + * $Id$
  4 + *
  5 + * Represents a group, unit link as per the database table groups_units_link.
  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.groups
  26 + */
12 27 class GroupUserLink {
13 28  
14 29 /** primary key of object */
... ... @@ -87,7 +102,7 @@ class GroupUserLink {
87 102 if ($this->iId < 0)
88 103 {
89 104 $sql = $default->db;
90   - $query = "SELECT user_id, group_id FROM ". $default->owl_users_groups_table ." WHERE user_id = '" . $this->iUserID . "' and group_id = '". $this->iGroupID ."'";
  105 + $query = "SELECT user_id, group_id FROM ". $default->users_groups_table ." WHERE user_id = '" . $this->iUserID . "' and group_id = '". $this->iGroupID ."'";
91 106 $sql->query($query);
92 107 $rows = $sql->num_rows($sql);
93 108  
... ... @@ -100,7 +115,7 @@ class GroupUserLink {
100 115 else
101 116 {
102 117 $sql = $default->db;
103   - $result = $sql->query("INSERT INTO " . $default->owl_users_groups_table . " (group_id, user_id) VALUES ($this->iGroupID, $this->iUserID)");
  118 + $result = $sql->query("INSERT INTO " . $default->users_groups_table . " (group_id, user_id) VALUES ($this->iGroupID, $this->iUserID)");
104 119 if ($result) {
105 120 $this->iId = $sql->insert_id();
106 121 return true;
... ... @@ -109,7 +124,7 @@ class GroupUserLink {
109 124 return false;
110 125 }
111 126 }
112   - $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->owl_users_groups_table";
  127 + $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->users_groups_table";
113 128 return false;
114 129 }
115 130  
... ... @@ -124,7 +139,7 @@ class GroupUserLink {
124 139 //only update if the object has been stored
125 140 if ($this->iId > 0) {
126 141 $sql = $default->db;
127   - $result = $sql->query("UPDATE " . $default->owl_users_groups_table . " SET group_id = $this->iGroupID, user_id = $this->iUserID WHERE id = $this->iId");
  142 + $result = $sql->query("UPDATE " . $default->users_groups_table . " SET group_id = $this->iGroupID, user_id = $this->iUserID WHERE id = $this->iId");
128 143 if ($result) {
129 144 return true;
130 145 }
... ... @@ -146,7 +161,7 @@ class GroupUserLink {
146 161 //only delete the object if it exists in the database
147 162 if ($this->iId >= 0) {
148 163 $sql = $default->db;
149   - $result = $sql->query("DELETE FROM $default->owl_users_groups_table WHERE id = $this->iId");
  164 + $result = $sql->query("DELETE FROM $default->users_groups_table WHERE id = $this->iId");
150 165 if ($result) {
151 166 return true;
152 167 }
... ... @@ -168,14 +183,14 @@ class GroupUserLink {
168 183 function & get($iGroupUserLinkID) {
169 184 global $default;
170 185 $sql = $default->db;
171   - $result = $sql->query("SELECT * FROM $default->owl_users_groups_table WHERE id = $iGroupUserLinkID");
  186 + $result = $sql->query("SELECT * FROM $default->users_groups_table WHERE id = $iGroupUserLinkID");
172 187 if ($result) {
173 188 if ($sql->next_record()) {
174 189 $oGroupUserLink = & new GroupUserLink($sql->f("group_id"), $sql->f("user_id"));
175 190 $oGroupUserLink->iId = $iGroupUserLinkID;
176 191 return $oGroupUserLink;
177 192 }
178   - $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iGroupUserLinkID . " table = $default->owl_users_groups_table";
  193 + $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iGroupUserLinkID . " table = $default->users_groups_table";
179 194 return false;
180 195 }
181 196 $_SESSION["errorMessage"] = $lang_err_database;
... ... @@ -195,7 +210,7 @@ class GroupUserLink {
195 210 $aGroupUserLink;
196 211 settype($aGroupUserLink, "array");
197 212 $sql = $default->db;
198   - $result = $sql->query("SELECT * FROM " . $default->owl_users_groups_table . (isset($sWhereClause) ? " " . $sWhereClause : ""));
  213 + $result = $sql->query("SELECT * FROM " . $default->users_groups_table . (isset($sWhereClause) ? " " . $sWhereClause : ""));
199 214 if ($result) {
200 215 $iCount = 0;
201 216 while ($sql->next_record()) {
... ... @@ -214,7 +229,7 @@ class GroupUserLink {
214 229 $aGroupUserLink;
215 230 settype($aGroupUserLink, "array");
216 231 $sql = $default->db;
217   - $result = $sql->query("SELECT group_id FROM " . $default->owl_users_groups_table . " Where user_id = ". $iUserID);
  232 + $result = $sql->query("SELECT group_id FROM " . $default->users_groups_table . " Where user_id = ". $iUserID);
218 233 if ($result) {
219 234 $iCount = 0;
220 235 while ($sql->next_record()) {
... ... @@ -240,7 +255,7 @@ class GroupUserLink {
240 255 {
241 256 global $default;
242 257  
243   - $value = lookupField("$default->owl_users_groups_table", "group_id", "user_id", $iUserID );
  258 + $value = lookupField("$default->users_groups_table", "group_id", "user_id", $iUserID );
244 259  
245 260 return $value;
246 261  
... ... @@ -260,7 +275,7 @@ class GroupUserLink {
260 275 {
261 276 global $default;
262 277 $sql = $default->db;
263   - $result = $sql->query("SELECT id FROM $default->owl_users_groups_table WHERE user_id = $iUserId and group_id = $iGroupId");
  278 + $result = $sql->query("SELECT id FROM $default->users_groups_table WHERE user_id = $iUserId and group_id = $iGroupId");
264 279 if ($result) {
265 280 if ($sql->next_record()) {
266 281 $id = $sql->f("id");
... ...