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 <?php 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 require_once("$default->fileSystemRoot/lib/foldermanagement/PhysicalFolderManagement.inc"); 27 require_once("$default->fileSystemRoot/lib/foldermanagement/PhysicalFolderManagement.inc");
15 28
16 class Folder { 29 class Folder {
@@ -203,7 +216,7 @@ class Folder { @@ -203,7 +216,7 @@ class Folder {
203 //if the folder is not the root folder 216 //if the folder is not the root folder
204 if ($iFolderID != 0) { 217 if ($iFolderID != 0) {
205 $sql = $default->db; 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 $sql->next_record(); 220 $sql->next_record();
208 return $this->generateParentFolderIDS($sql->f("parent_id")) . ",$iFolderID"; 221 return $this->generateParentFolderIDS($sql->f("parent_id")) . ",$iFolderID";
209 } 222 }
@@ -221,7 +234,7 @@ class Folder { @@ -221,7 +234,7 @@ class Folder {
221 //if the folder is not the root folder 234 //if the folder is not the root folder
222 if ($iFolderID != 0) { 235 if ($iFolderID != 0) {
223 $sql = $default->db; 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 $sql->next_record(); 238 $sql->next_record();
226 return $this->generateFullFolderPath($sql->f("parent_id")) . "/" . stripslashes($sql->f("name")); 239 return $this->generateFullFolderPath($sql->f("parent_id")) . "/" . stripslashes($sql->f("name"));
227 } 240 }
@@ -242,7 +255,7 @@ class Folder { @@ -242,7 +255,7 @@ class Folder {
242 $this->sParentFolderIDs = $this->generateParentFolderIDS($this->iParentID); 255 $this->sParentFolderIDs = $this->generateParentFolderIDS($this->iParentID);
243 $this->sParentFolderIDs = substr($this->sParentFolderIDs, 1, strlen($this->sParentFolderIDs)); 256 $this->sParentFolderIDs = substr($this->sParentFolderIDs, 1, strlen($this->sParentFolderIDs));
244 $sql = $default->db; 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 "VALUES ('" . addslashes($this->sName) . "', '" . addslashes($this->sDescription) . "', $this->iParentID, $this->iCreatorID, $this->iUnitID, " . ($this->bIsPublic ? 1 : 0) . ",'" . addslashes($this->sFullPath) . "','" . addslashes($this->sParentFolderIDs) . "')"); 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 if ($result) { 260 if ($result) {
248 $this->iId = $sql->insert_id(); 261 $this->iId = $sql->insert_id();
@@ -266,7 +279,7 @@ class Folder { @@ -266,7 +279,7 @@ class Folder {
266 $sOldPath; 279 $sOldPath;
267 if ($this->iId >= 0) { 280 if ($this->iId >= 0) {
268 $sql = $default->db; 281 $sql = $default->db;
269 - $sQuery = "UPDATE " . $default->owl_folders_table . " SET " . 282 + $sQuery = "UPDATE " . $default->folders_table . " SET " .
270 "name = '" . addslashes($this->sName) . "', " . 283 "name = '" . addslashes($this->sName) . "', " .
271 "description = '" . addslashes($this->sDescription) . "', " . 284 "description = '" . addslashes($this->sDescription) . "', " .
272 "parent_id = $this->iParentID, " . 285 "parent_id = $this->iParentID, " .
@@ -308,7 +321,7 @@ class Folder { @@ -308,7 +321,7 @@ class Folder {
308 function updateChildPaths($iID, $sql) { 321 function updateChildPaths($iID, $sql) {
309 global $default; 322 global $default;
310 //get the direct children 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 while ($sql->next_record()) { 325 while ($sql->next_record()) {
313 //force an update, this will cause this child's children to be updated 326 //force an update, this will cause this child's children to be updated
314 $oFolder = Folder::get($sql->f("id")); 327 $oFolder = Folder::get($sql->f("id"));
@@ -328,7 +341,7 @@ class Folder { @@ -328,7 +341,7 @@ class Folder {
328 function getChildren($iFolderID, $aChildren = array()) { 341 function getChildren($iFolderID, $aChildren = array()) {
329 global $default; 342 global $default;
330 $sql = $default->db; 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 while ($sql->next_record()) { 345 while ($sql->next_record()) {
333 $aChildren[count($aChildren)] = $sql->f("id"); 346 $aChildren[count($aChildren)] = $sql->f("id");
334 Folder::getChildren($sql->f("id"), & $aChildren); 347 Folder::getChildren($sql->f("id"), & $aChildren);
@@ -344,7 +357,7 @@ class Folder { @@ -344,7 +357,7 @@ class Folder {
344 function getDocumentIDs($iFolderID) { 357 function getDocumentIDs($iFolderID) {
345 global $default; 358 global $default;
346 $sql = $default->db; 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 while ($sql->next_record()) { 361 while ($sql->next_record()) {
349 $sChildString .= $sql->f("id") . ","; 362 $sChildString .= $sql->f("id") . ",";
350 } 363 }
@@ -360,7 +373,7 @@ class Folder { @@ -360,7 +373,7 @@ class Folder {
360 global $default, $lang_err_database, $lang_err_object_key; 373 global $default, $lang_err_database, $lang_err_object_key;
361 if ($this->iId >= 0) { 374 if ($this->iId >= 0) {
362 $sql = $default->db; 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 if ($result) { 377 if ($result) {
365 $this->iId = -1; 378 $this->iId = -1;
366 return true; 379 return true;
@@ -386,7 +399,7 @@ class Folder { @@ -386,7 +399,7 @@ class Folder {
386 function get($iFolderID) { 399 function get($iFolderID) {
387 global $default, $lang_err_object_not_exist; 400 global $default, $lang_err_object_not_exist;
388 $sql = $default->db; 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 if ($sql->next_record()) { 403 if ($sql->next_record()) {
391 $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")); 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 $oFolder->iId = $iFolderID; 405 $oFolder->iId = $iFolderID;
@@ -404,7 +417,7 @@ class Folder { @@ -404,7 +417,7 @@ class Folder {
404 function exists() { 417 function exists() {
405 global $default; 418 global $default;
406 $sql = $default->db; 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 "AND description = '" . $this->sDescription . "' AND parent_id=$this->iParentID"); 421 "AND description = '" . $this->sDescription . "' AND parent_id=$this->iParentID");
409 if ($sql->next_record()) { 422 if ($sql->next_record()) {
410 return true; 423 return true;
@@ -427,7 +440,7 @@ class Folder { @@ -427,7 +440,7 @@ class Folder {
427 settype($aFolderArray, "array"); 440 settype($aFolderArray, "array");
428 $sql = $default->db; 441 $sql = $default->db;
429 // TODO: join on sys_deleted 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 if ($result) { 444 if ($result) {
432 $iCount = 0; 445 $iCount = 0;
433 while ($sql->next_record()) { 446 while ($sql->next_record()) {
@@ -537,7 +550,7 @@ class Folder { @@ -537,7 +550,7 @@ class Folder {
537 if ($iFolderID != 0) { 550 if ($iFolderID != 0) {
538 global $default; 551 global $default;
539 $sql = $default->db; 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 $sql->next_record(); 554 $sql->next_record();
542 return $sql->f("parent_id"); 555 return $sql->f("parent_id");
543 } 556 }
@@ -556,7 +569,7 @@ class Folder { @@ -556,7 +569,7 @@ class Folder {
556 global $default, $lang_err_database; 569 global $default, $lang_err_database;
557 if (Folder::folderExistsID($iFolderID)) { 570 if (Folder::folderExistsID($iFolderID)) {
558 $sql = $default->db; 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 if ($sql->next_record()) { 573 if ($sql->next_record()) {
561 return $sql->f("document_type_id"); 574 return $sql->f("document_type_id");
562 } 575 }
@@ -580,7 +593,7 @@ class Folder { @@ -580,7 +593,7 @@ class Folder {
580 $sName = addslashes($sName); 593 $sName = addslashes($sName);
581 global $default, $lang_err_folder_exist; 594 global $default, $lang_err_folder_exist;
582 $sql = $default->db; 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 if ($sql->next_record()) { 597 if ($sql->next_record()) {
585 return true; 598 return true;
586 } 599 }
@@ -598,7 +611,7 @@ class Folder { @@ -598,7 +611,7 @@ class Folder {
598 function folderExistsID($iFolderID) { 611 function folderExistsID($iFolderID) {
599 global $default, $lang_err_folder_exist; 612 global $default, $lang_err_folder_exist;
600 $sql = $default->db; 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 if ($sql->next_record()) { 615 if ($sql->next_record()) {
603 return true; 616 return true;
604 } 617 }
@@ -616,7 +629,7 @@ class Folder { @@ -616,7 +629,7 @@ class Folder {
616 function getFolderName($iFolderID) { 629 function getFolderName($iFolderID) {
617 global $default, $lang_err_database; 630 global $default, $lang_err_database;
618 $sql = $default->db; 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 if ($sql->next_record()) { 633 if ($sql->next_record()) {
621 return stripslashes($sql->f("name")); 634 return stripslashes($sql->f("name"));
622 } 635 }
@@ -634,7 +647,7 @@ class Folder { @@ -634,7 +647,7 @@ class Folder {
634 function getFolderID($sFolderName) { 647 function getFolderID($sFolderName) {
635 global $default, $lang_err_database; 648 global $default, $lang_err_database;
636 $sql = $default->db; 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 if ($sql->next_record()) { 651 if ($sql->next_record()) {
639 return $sql->f("id"); 652 return $sql->f("id");
640 } 653 }
@@ -650,7 +663,7 @@ class Folder { @@ -650,7 +663,7 @@ class Folder {
650 function folderIsLinkedToDocType($iFolderID, $iDocTypeID) { 663 function folderIsLinkedToDocType($iFolderID, $iDocTypeID) {
651 global $default; 664 global $default;
652 $sql = $default->db; 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 if ($sql->next_record()) { 667 if ($sql->next_record()) {
655 return true; 668 return true;
656 } 669 }
@@ -666,7 +679,7 @@ class Folder { @@ -666,7 +679,7 @@ class Folder {
666 */ 679 */
667 function folderIsUnitRootFolder($iFolderID) { 680 function folderIsUnitRootFolder($iFolderID) {
668 global $default; 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 $sql = $default->db; 684 $sql = $default->db;
672 $sql->query($sQuery); 685 $sql->query($sQuery);
lib/foldermanagement/FolderCollaboration.inc
1 <?php 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 class FolderCollaboration { 28 class FolderCollaboration {
15 29
16 /** primary key of current object */ 30 /** primary key of current object */
@@ -91,7 +105,7 @@ class FolderCollaboration { @@ -91,7 +105,7 @@ class FolderCollaboration {
91 //if the object hasn't been created 105 //if the object hasn't been created
92 if ($this->iId < 0) { 106 if ($this->iId < 0) {
93 $sql = $default->db; 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 if ($result) { 109 if ($result) {
96 $this->iId = $sql->insert_id(); 110 $this->iId = $sql->insert_id();
97 return true; 111 return true;
@@ -99,7 +113,7 @@ class FolderCollaboration { @@ -99,7 +113,7 @@ class FolderCollaboration {
99 $_SESSION["errorMessage"] = $lang_err_database; 113 $_SESSION["errorMessage"] = $lang_err_database;
100 return false; 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 return false; 117 return false;
104 } 118 }
105 119
@@ -114,7 +128,7 @@ class FolderCollaboration { @@ -114,7 +128,7 @@ class FolderCollaboration {
114 //only update if the object has been stored 128 //only update if the object has been stored
115 if ($this->iId > 0) { 129 if ($this->iId > 0) {
116 $sql = $default->db; 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 if ($result) { 132 if ($result) {
119 return true; 133 return true;
120 } 134 }
@@ -136,7 +150,7 @@ class FolderCollaboration { @@ -136,7 +150,7 @@ class FolderCollaboration {
136 //only delete the object if it exists in the database 150 //only delete the object if it exists in the database
137 if ($this->iId >= 0) { 151 if ($this->iId >= 0) {
138 $sql = $default->db; 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 if ($result) { 154 if ($result) {
141 return true; 155 return true;
142 } 156 }
@@ -156,8 +170,8 @@ class FolderCollaboration { @@ -156,8 +170,8 @@ class FolderCollaboration {
156 function hasDocumentInProcess() { 170 function hasDocumentInProcess() {
157 global $default; 171 global $default;
158 $sQuery = "SELECT FURL.id " . 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 "WHERE GFAL.id = " . $this->iId . " " . 175 "WHERE GFAL.id = " . $this->iId . " " .
162 "AND FURL.active != 0"; 176 "AND FURL.active != 0";
163 $sql = $default->db; 177 $sql = $default->db;
@@ -177,14 +191,14 @@ class FolderCollaboration { @@ -177,14 +191,14 @@ class FolderCollaboration {
177 function & get($iFolderCollaborationID) { 191 function & get($iFolderCollaborationID) {
178 global $default; 192 global $default;
179 $sql = $default->db; 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 if ($result) { 195 if ($result) {
182 if ($sql->next_record()) { 196 if ($sql->next_record()) {
183 $oFolderCollaboration = & new FolderCollaboration($sql->f("folder_id"), $sql->f("group_id"), $sql->f("precedence"), $sql->f("role_id"), $sql->f("user_id")); 197 $oFolderCollaboration = & new FolderCollaboration($sql->f("folder_id"), $sql->f("group_id"), $sql->f("precedence"), $sql->f("role_id"), $sql->f("user_id"));
184 $oFolderCollaboration->iId = $iFolderCollaborationID; 198 $oFolderCollaboration->iId = $iFolderCollaborationID;
185 return $oFolderCollaboration; 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 return false; 202 return false;
189 } 203 }
190 $_SESSION["errorMessage"] = $lang_err_database; 204 $_SESSION["errorMessage"] = $lang_err_database;
@@ -204,7 +218,7 @@ class FolderCollaboration { @@ -204,7 +218,7 @@ class FolderCollaboration {
204 $aFolderCollaborationArray; 218 $aFolderCollaborationArray;
205 settype($aFolderCollaborationArray, "array"); 219 settype($aFolderCollaborationArray, "array");
206 $sql = $default->db; 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 if ($result) { 222 if ($result) {
209 $iCount = 0; 223 $iCount = 0;
210 while ($sql->next_record()) { 224 while ($sql->next_record()) {
lib/foldermanagement/FolderDocTypeLink.inc
1 <?php 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 class FolderDocTypeLink { 27 class FolderDocTypeLink {
11 28
12 /** primary key of object */ 29 /** primary key of object */
@@ -32,7 +49,7 @@ class FolderDocTypeLink { @@ -32,7 +49,7 @@ class FolderDocTypeLink {
32 //if the object has not already been stored 49 //if the object has not already been stored
33 if ($this->iId < 0) { 50 if ($this->iId < 0) {
34 $sql = $default->db; 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 "VALUES ($this->iFolderID, $this->iDocumentTypeID)"); 53 "VALUES ($this->iFolderID, $this->iDocumentTypeID)");
37 if ($result) { 54 if ($result) {
38 $this->iId = $sql->insert_id(); 55 $this->iId = $sql->insert_id();
@@ -59,7 +76,7 @@ class FolderDocTypeLink { @@ -59,7 +76,7 @@ class FolderDocTypeLink {
59 $sOldPath = $default->documentRoot . "/" . $this->sFullPath . "/" . $this->sName; 76 $sOldPath = $default->documentRoot . "/" . $this->sFullPath . "/" . $this->sName;
60 } 77 }
61 $sql = $default->db; 78 $sql = $default->db;
62 - $sQuery = "UPDATE " . $default->owl_folder_doctypes_table . " SET " . 79 + $sQuery = "UPDATE " . $default->folder_doctypes_table . " SET " .
63 "folder_id = $this->iFolderID, " . 80 "folder_id = $this->iFolderID, " .
64 "document_type_id = $this->iDocumentTypeID " . 81 "document_type_id = $this->iDocumentTypeID " .
65 "WHERE id = " . $this->iId; 82 "WHERE id = " . $this->iId;
@@ -82,7 +99,7 @@ class FolderDocTypeLink { @@ -82,7 +99,7 @@ class FolderDocTypeLink {
82 global $default, $lang_err_database, $lang_err_object_key; 99 global $default, $lang_err_database, $lang_err_object_key;
83 if ($this->iId >= 0) { 100 if ($this->iId >= 0) {
84 $sql = $default->db; 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 if ($result) { 103 if ($result) {
87 $this->iId = -1; 104 $this->iId = -1;
88 return true; 105 return true;
@@ -108,7 +125,7 @@ class FolderDocTypeLink { @@ -108,7 +125,7 @@ class FolderDocTypeLink {
108 function get($iFolderDocTypeLinkID) { 125 function get($iFolderDocTypeLinkID) {
109 global $default, $lang_err_object_not_exist; 126 global $default, $lang_err_object_not_exist;
110 $sql = $default->db; 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 if ($sql->next_record()) { 129 if ($sql->next_record()) {
113 $oFolderDocTypeLink = & new FolderDocTypeLink($sql->f("folder_id"), $sql->f("document_type_id")); 130 $oFolderDocTypeLink = & new FolderDocTypeLink($sql->f("folder_id"), $sql->f("document_type_id"));
114 $oFolderDocTypeLink->iId = $iFolderDocTypeLinkID; 131 $oFolderDocTypeLink->iId = $iFolderDocTypeLinkID;
@@ -132,7 +149,7 @@ class FolderDocTypeLink { @@ -132,7 +149,7 @@ class FolderDocTypeLink {
132 settype($aFolderDocTypeLinkArray, "array"); 149 settype($aFolderDocTypeLinkArray, "array");
133 $sql = $default->db; 150 $sql = $default->db;
134 // TODO: join on sys_deleted 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 if ($result) { 153 if ($result) {
137 $iCount = 0; 154 $iCount = 0;
138 while ($sql->next_record()) { 155 while ($sql->next_record()) {
lib/foldermanagement/FolderUserRole.inc
1 <?php 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 class FolderUserRole { 28 class FolderUserRole {
13 29
14 var $iId; 30 var $iId;
@@ -103,7 +119,7 @@ class FolderUserRole { @@ -103,7 +119,7 @@ class FolderUserRole {
103 //if the object hasn't been created 119 //if the object hasn't been created
104 if ($this->iId < 0) { 120 if ($this->iId < 0) {
105 $sql = $default->db; 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 if ($result) { 123 if ($result) {
108 $this->iId = $sql->insert_id(); 124 $this->iId = $sql->insert_id();
109 return true; 125 return true;
@@ -126,8 +142,8 @@ class FolderUserRole { @@ -126,8 +142,8 @@ class FolderUserRole {
126 //only update if the object has been stored 142 //only update if the object has been stored
127 if ($this->iId > 0) { 143 if ($this->iId > 0) {
128 $sql = $default->db; 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 if ($result) { 147 if ($result) {
132 return true; 148 return true;
133 } 149 }
@@ -149,7 +165,7 @@ class FolderUserRole { @@ -149,7 +165,7 @@ class FolderUserRole {
149 //only delete the object if it exists in the database 165 //only delete the object if it exists in the database
150 if ($this->iId >= 0) { 166 if ($this->iId >= 0) {
151 $sql = $default->db; 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 if ($result) { 169 if ($result) {
154 return true; 170 return true;
155 } 171 }
@@ -171,7 +187,7 @@ class FolderUserRole { @@ -171,7 +187,7 @@ class FolderUserRole {
171 function & get($iFolderUserRoleID) { 187 function & get($iFolderUserRoleID) {
172 global $default; 188 global $default;
173 $sql = $default->db; 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 if ($result) { 191 if ($result) {
176 if ($sql->next_record()) { 192 if ($sql->next_record()) {
177 $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")); 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,7 +196,7 @@ class FolderUserRole {
180 196
181 return $oFolderUserRole; 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 return false; 200 return false;
185 } 201 }
186 $_SESSION["errorMessage"] = $lang_err_database; 202 $_SESSION["errorMessage"] = $lang_err_database;
@@ -200,7 +216,7 @@ class FolderUserRole { @@ -200,7 +216,7 @@ class FolderUserRole {
200 $aFolderUserRoleArray; 216 $aFolderUserRoleArray;
201 settype($aFolderUserRoleArray, "array"); 217 settype($aFolderUserRoleArray, "array");
202 $sql = $default->db; 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 if ($result) { 220 if ($result) {
205 $iCount = 0; 221 $iCount = 0;
206 while ($sql->next_record()) { 222 while ($sql->next_record()) {
@@ -217,7 +233,7 @@ class FolderUserRole { @@ -217,7 +233,7 @@ class FolderUserRole {
217 function & getFromFolderCollaboration($iFolderCollaborationID, $iDocumentID) { 233 function & getFromFolderCollaboration($iFolderCollaborationID, $iDocumentID) {
218 global $default, $lang_err_database; 234 global $default, $lang_err_database;
219 $sql = $default->db; 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 if ($sql->next_record()) { 237 if ($sql->next_record()) {
222 return FolderUserRole::get($sql->f("id")); 238 return FolderUserRole::get($sql->f("id"));
223 } 239 }
lib/foldermanagement/PhysicalFolderManagement.inc
1 <?php 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 class PhysicalFolderManagement { 28 class PhysicalFolderManagement {
16 29
17 /** 30 /**
lib/groups/Group.inc
1 <?php 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 class Group { 27 class Group {
12 28
13 /** primary key of current object */ 29 /** primary key of current object */
@@ -66,7 +82,7 @@ class Group { @@ -66,7 +82,7 @@ class Group {
66 function hasUsers() { 82 function hasUsers() {
67 global $default; 83 global $default;
68 $sql = $default->db; 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 $rows = $sql->num_rows(); 86 $rows = $sql->num_rows();
71 if ($rows > 0) { 87 if ($rows > 0) {
72 return true; 88 return true;
@@ -82,7 +98,7 @@ class Group { @@ -82,7 +98,7 @@ class Group {
82 global $default; 98 global $default;
83 99
84 $sql = $default->db; 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 $sql->query($query); 102 $sql->query($query);
87 $rows = $sql->num_rows(); 103 $rows = $sql->num_rows();
88 if ($rows > 0){ 104 if ($rows > 0){
@@ -104,7 +120,7 @@ class Group { @@ -104,7 +120,7 @@ class Group {
104 if ($this->iId < 0) { 120 if ($this->iId < 0) {
105 //check to see if name exsits 121 //check to see if name exsits
106 $sql = $default->db; 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 $sql->query($query); 124 $sql->query($query);
109 $rows = $sql->num_rows(); 125 $rows = $sql->num_rows();
110 if ($rows > 0) { 126 if ($rows > 0) {
@@ -113,7 +129,7 @@ class Group { @@ -113,7 +129,7 @@ class Group {
113 return false; 129 return false;
114 } else { 130 } else {
115 $sql = $default->db; 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 if ($result) { 133 if ($result) {
118 $this->iId = $sql->insert_id(); 134 $this->iId = $sql->insert_id();
119 return true; 135 return true;
@@ -137,7 +153,7 @@ class Group { @@ -137,7 +153,7 @@ class Group {
137 //only update if the object has been stored 153 //only update if the object has been stored
138 if ($this->iId > 0) { 154 if ($this->iId > 0) {
139 $sql = $default->db; 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 if ($result) { 157 if ($result) {
142 return true; 158 return true;
143 } 159 }
@@ -159,7 +175,7 @@ class Group { @@ -159,7 +175,7 @@ class Group {
159 //only delete the object if it exists in the database 175 //only delete the object if it exists in the database
160 if ($this->iId >= 0) { 176 if ($this->iId >= 0) {
161 $sql = $default->db; 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 return $result; 179 return $result;
164 } 180 }
165 $_SESSION["errorMessage"] = $lang_err_object_key; 181 $_SESSION["errorMessage"] = $lang_err_object_key;
@@ -177,14 +193,14 @@ class Group { @@ -177,14 +193,14 @@ class Group {
177 function & get($iGroupID) { 193 function & get($iGroupID) {
178 global $default; 194 global $default;
179 $sql = $default->db; 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 if ($result) { 197 if ($result) {
182 if ($sql->next_record()) { 198 if ($sql->next_record()) {
183 $oGroup = & new Group(stripslashes($sql->f("name")), $sql->f("is_unit_admin"), $sql->f("is_sys_admin")); 199 $oGroup = & new Group(stripslashes($sql->f("name")), $sql->f("is_unit_admin"), $sql->f("is_sys_admin"));
184 $oGroup->iId = $iGroupID; 200 $oGroup->iId = $iGroupID;
185 return $oGroup; 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 return false; 204 return false;
189 } 205 }
190 $_SESSION["errorMessage"] = $lang_err_database; 206 $_SESSION["errorMessage"] = $lang_err_database;
@@ -204,7 +220,7 @@ class Group { @@ -204,7 +220,7 @@ class Group {
204 $aGroupArray; 220 $aGroupArray;
205 settype($aGroupArray, "array"); 221 settype($aGroupArray, "array");
206 $sql = $default->db; 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 if ($result) { 224 if ($result) {
209 $iCount = 0; 225 $iCount = 0;
210 while ($sql->next_record()) { 226 while ($sql->next_record()) {
@@ -229,7 +245,7 @@ class Group { @@ -229,7 +245,7 @@ class Group {
229 */ 245 */
230 function getGroupName($id) { 246 function getGroupName($id) {
231 global $default; 247 global $default;
232 - $sName = lookupField("$default->owl_groups_table", "name", "id", $id ); 248 + $sName = lookupField("$default->groups_table", "name", "id", $id );
233 return $sName; 249 return $sName;
234 } 250 }
235 } 251 }
@@ -247,7 +263,7 @@ class Group { @@ -247,7 +263,7 @@ class Group {
247 { 263 {
248 global $default; 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 $this->sName= $name; 268 $this->sName= $name;
253 } 269 }
lib/groups/GroupFolderApprovalLink.inc
1 <?php 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 class GroupFolderApprovalLink { 29 class GroupFolderApprovalLink {
15 30
16 /** primary key of object */ 31 /** primary key of object */
@@ -134,7 +149,7 @@ class GroupFolderApprovalLink { @@ -134,7 +149,7 @@ class GroupFolderApprovalLink {
134 //if the object hasn't been created 149 //if the object hasn't been created
135 if ($this->iId < 0) { 150 if ($this->iId < 0) {
136 $sql = $default->db; 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 if ($result) { 153 if ($result) {
139 $this->iId = $sql->insert_id(); 154 $this->iId = $sql->insert_id();
140 return true; 155 return true;
@@ -157,7 +172,7 @@ class GroupFolderApprovalLink { @@ -157,7 +172,7 @@ class GroupFolderApprovalLink {
157 //only update if the object has been stored 172 //only update if the object has been stored
158 if ($this->iId > 0) { 173 if ($this->iId > 0) {
159 $sql = $default->db; 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 if ($result) { 176 if ($result) {
162 return true; 177 return true;
163 } 178 }
@@ -179,7 +194,7 @@ class GroupFolderApprovalLink { @@ -179,7 +194,7 @@ class GroupFolderApprovalLink {
179 //only delete the object if it exists in the database 194 //only delete the object if it exists in the database
180 if ($this->iId >= 0) { 195 if ($this->iId >= 0) {
181 $sql = $default->db; 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 if ($result) { 198 if ($result) {
184 return true; 199 return true;
185 } 200 }
@@ -201,7 +216,7 @@ class GroupFolderApprovalLink { @@ -201,7 +216,7 @@ class GroupFolderApprovalLink {
201 function & get($iGroupFolderLinkID) { 216 function & get($iGroupFolderLinkID) {
202 global $default; 217 global $default;
203 $sql = $default->db; 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 if ($result) { 220 if ($result) {
206 if ($sql->next_record()) { 221 if ($sql->next_record()) {
207 $oGroupFolderApprovalLink = & new GroupFolderApprovalLink($sql->f("folder_id"), $sql->f("group_id"), $sql->f("precedence"), $sql->f("role_id"), $sql->f("datetime")); 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,7 +243,7 @@ class GroupFolderApprovalLink {
228 $aGroupFolderApprovalLinkArray; 243 $aGroupFolderApprovalLinkArray;
229 settype($aGroupFolderApprovalLinkArray, "array"); 244 settype($aGroupFolderApprovalLinkArray, "array");
230 $sql = $default->db; 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 if ($result) { 247 if ($result) {
233 $iCount = 0; 248 $iCount = 0;
234 while ($sql->next_record()) { 249 while ($sql->next_record()) {
lib/groups/GroupFolderLink.inc
@@ -3,14 +3,28 @@ @@ -3,14 +3,28 @@
3 * $Id$ 3 * $Id$
4 * 4 *
5 * Represents the group_folders_link table in the db used to represent 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 * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa 25 * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa
12 - * @package lib.foldermanagement  
13 - */ 26 + * @package lib.groups
  27 + */
14 class GroupFolderLink { 28 class GroupFolderLink {
15 29
16 /** primary key of current object */ 30 /** primary key of current object */
@@ -80,7 +94,7 @@ class GroupFolderLink { @@ -80,7 +94,7 @@ class GroupFolderLink {
80 //if the object hasn't been created 94 //if the object hasn't been created
81 if ($this->iId < 0) { 95 if ($this->iId < 0) {
82 $sql = $default->db; 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 if ($result) { 98 if ($result) {
85 $this->iId = $sql->insert_id(); 99 $this->iId = $sql->insert_id();
86 return true; 100 return true;
@@ -88,7 +102,7 @@ class GroupFolderLink { @@ -88,7 +102,7 @@ class GroupFolderLink {
88 $_SESSION["errorMessage"] = $lang_err_database; 102 $_SESSION["errorMessage"] = $lang_err_database;
89 return false; 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 return false; 106 return false;
93 } 107 }
94 108
@@ -103,7 +117,7 @@ class GroupFolderLink { @@ -103,7 +117,7 @@ class GroupFolderLink {
103 //only update if the object has been stored 117 //only update if the object has been stored
104 if ($this->iId > 0) { 118 if ($this->iId > 0) {
105 $sql = $default->db; 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 if ($result) { 121 if ($result) {
108 return true; 122 return true;
109 } 123 }
@@ -125,7 +139,7 @@ class GroupFolderLink { @@ -125,7 +139,7 @@ class GroupFolderLink {
125 //only delete the object if it exists in the database 139 //only delete the object if it exists in the database
126 if ($this->iId >= 0) { 140 if ($this->iId >= 0) {
127 $sql = $default->db; 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 if ($result) { 143 if ($result) {
130 return true; 144 return true;
131 } 145 }
@@ -141,7 +155,7 @@ class GroupFolderLink { @@ -141,7 +155,7 @@ class GroupFolderLink {
141 function exists() { 155 function exists() {
142 global $default; 156 global $default;
143 $sql = $default->db; 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 $sql->next_record(); 159 $sql->next_record();
146 return ($sql->f("count") > 0) ? true : false; 160 return ($sql->f("count") > 0) ? true : false;
147 } else { 161 } else {
@@ -160,14 +174,14 @@ class GroupFolderLink { @@ -160,14 +174,14 @@ class GroupFolderLink {
160 function & get($iGroupFolderID) { 174 function & get($iGroupFolderID) {
161 global $default; 175 global $default;
162 $sql = $default->db; 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 if ($result) { 178 if ($result) {
165 if ($sql->next_record()) { 179 if ($sql->next_record()) {
166 $oGroupFolderLink = & new GroupFolderLink($sql->f("folder_id"), $sql->f("group_id"), $sql->f("can_read"), $sql->f("can_write")); 180 $oGroupFolderLink = & new GroupFolderLink($sql->f("folder_id"), $sql->f("group_id"), $sql->f("can_read"), $sql->f("can_write"));
167 $oGroupFolderLink->iId = $iGroupFolderID; 181 $oGroupFolderLink->iId = $iGroupFolderID;
168 return $oGroupFolderLink; 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 return false; 185 return false;
172 } 186 }
173 $_SESSION["errorMessage"] = $lang_err_database; 187 $_SESSION["errorMessage"] = $lang_err_database;
@@ -186,7 +200,7 @@ class GroupFolderLink { @@ -186,7 +200,7 @@ class GroupFolderLink {
186 global $default, $lang_err_database; 200 global $default, $lang_err_database;
187 $oGroupFolderLinkArray = array(); 201 $oGroupFolderLinkArray = array();
188 $sql = $default->db; 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 if ($result) { 204 if ($result) {
191 while ($sql->next_record()) { 205 while ($sql->next_record()) {
192 $oGroupFolderLinkArray[] = & GroupFolderLink::get($sql->f("id")); 206 $oGroupFolderLinkArray[] = & GroupFolderLink::get($sql->f("id"));
lib/groups/GroupUnitLink.inc
1 <?php 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 class GroupUnitLink { 27 class GroupUnitLink {
13 28
14 /** primary key of object */ 29 /** primary key of object */
@@ -87,7 +102,7 @@ class GroupUnitLink { @@ -87,7 +102,7 @@ class GroupUnitLink {
87 if ($this->iId < 0) 102 if ($this->iId < 0)
88 { 103 {
89 $sql = $default->db; 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 $sql->query($query); 106 $sql->query($query);
92 $rows = $sql->num_rows($sql); 107 $rows = $sql->num_rows($sql);
93 108
@@ -100,7 +115,7 @@ class GroupUnitLink { @@ -100,7 +115,7 @@ class GroupUnitLink {
100 else 115 else
101 { 116 {
102 $sql = $default->db; 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 if ($result) 119 if ($result)
105 { 120 {
106 $this->iId = $sql->insert_id(); 121 $this->iId = $sql->insert_id();
@@ -110,7 +125,7 @@ class GroupUnitLink { @@ -110,7 +125,7 @@ class GroupUnitLink {
110 return false; 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 return false; 129 return false;
115 } 130 }
116 131
@@ -125,7 +140,7 @@ class GroupUnitLink { @@ -125,7 +140,7 @@ class GroupUnitLink {
125 //only update if the object has been stored 140 //only update if the object has been stored
126 if ($this->iId > 0) { 141 if ($this->iId > 0) {
127 $sql = $default->db; 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 if ($result) { 144 if ($result) {
130 return true; 145 return true;
131 } 146 }
@@ -147,7 +162,7 @@ class GroupUnitLink { @@ -147,7 +162,7 @@ class GroupUnitLink {
147 //only delete the object if it exists in the database 162 //only delete the object if it exists in the database
148 if ($this->iId >= 0) { 163 if ($this->iId >= 0) {
149 $sql = $default->db; 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 if ($result) { 166 if ($result) {
152 return true; 167 return true;
153 } 168 }
@@ -169,14 +184,14 @@ class GroupUnitLink { @@ -169,14 +184,14 @@ class GroupUnitLink {
169 function & get($iGroupUnitLinkID) { 184 function & get($iGroupUnitLinkID) {
170 global $default; 185 global $default;
171 $sql = $default->db; 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 if ($result) { 188 if ($result) {
174 if ($sql->next_record()) { 189 if ($sql->next_record()) {
175 $oGroupUnitLink = & new GroupUnitLink($sql->f("group_id"), $sql->f("unit_id")); 190 $oGroupUnitLink = & new GroupUnitLink($sql->f("group_id"), $sql->f("unit_id"));
176 $oGroupUnitLink->iId = $iGroupUnitLinkID; 191 $oGroupUnitLink->iId = $iGroupUnitLinkID;
177 return $oGroupUnitLink; 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 return false; 195 return false;
181 } 196 }
182 $_SESSION["errorMessage"] = $lang_err_database; 197 $_SESSION["errorMessage"] = $lang_err_database;
@@ -196,7 +211,7 @@ class GroupUnitLink { @@ -196,7 +211,7 @@ class GroupUnitLink {
196 $aGroupUnitLink; 211 $aGroupUnitLink;
197 settype($aGroupUnitLink, "array"); 212 settype($aGroupUnitLink, "array");
198 $sql = $default->db; 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 if ($result) { 215 if ($result) {
201 $iCount = 0; 216 $iCount = 0;
202 while ($sql->next_record()) { 217 while ($sql->next_record()) {
@@ -225,7 +240,7 @@ class GroupUnitLink { @@ -225,7 +240,7 @@ class GroupUnitLink {
225 { 240 {
226 global $default; 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 return $value; 245 return $value;
231 246
@@ -245,7 +260,7 @@ class GroupUnitLink { @@ -245,7 +260,7 @@ class GroupUnitLink {
245 { 260 {
246 global $default; 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 $this->iId= $id; 265 $this->iId= $id;
251 } 266 }
lib/groups/GroupUserLink.inc
1 <?php 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 class GroupUserLink { 27 class GroupUserLink {
13 28
14 /** primary key of object */ 29 /** primary key of object */
@@ -87,7 +102,7 @@ class GroupUserLink { @@ -87,7 +102,7 @@ class GroupUserLink {
87 if ($this->iId < 0) 102 if ($this->iId < 0)
88 { 103 {
89 $sql = $default->db; 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 $sql->query($query); 106 $sql->query($query);
92 $rows = $sql->num_rows($sql); 107 $rows = $sql->num_rows($sql);
93 108
@@ -100,7 +115,7 @@ class GroupUserLink { @@ -100,7 +115,7 @@ class GroupUserLink {
100 else 115 else
101 { 116 {
102 $sql = $default->db; 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 if ($result) { 119 if ($result) {
105 $this->iId = $sql->insert_id(); 120 $this->iId = $sql->insert_id();
106 return true; 121 return true;
@@ -109,7 +124,7 @@ class GroupUserLink { @@ -109,7 +124,7 @@ class GroupUserLink {
109 return false; 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 return false; 128 return false;
114 } 129 }
115 130
@@ -124,7 +139,7 @@ class GroupUserLink { @@ -124,7 +139,7 @@ class GroupUserLink {
124 //only update if the object has been stored 139 //only update if the object has been stored
125 if ($this->iId > 0) { 140 if ($this->iId > 0) {
126 $sql = $default->db; 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 if ($result) { 143 if ($result) {
129 return true; 144 return true;
130 } 145 }
@@ -146,7 +161,7 @@ class GroupUserLink { @@ -146,7 +161,7 @@ class GroupUserLink {
146 //only delete the object if it exists in the database 161 //only delete the object if it exists in the database
147 if ($this->iId >= 0) { 162 if ($this->iId >= 0) {
148 $sql = $default->db; 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 if ($result) { 165 if ($result) {
151 return true; 166 return true;
152 } 167 }
@@ -168,14 +183,14 @@ class GroupUserLink { @@ -168,14 +183,14 @@ class GroupUserLink {
168 function & get($iGroupUserLinkID) { 183 function & get($iGroupUserLinkID) {
169 global $default; 184 global $default;
170 $sql = $default->db; 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 if ($result) { 187 if ($result) {
173 if ($sql->next_record()) { 188 if ($sql->next_record()) {
174 $oGroupUserLink = & new GroupUserLink($sql->f("group_id"), $sql->f("user_id")); 189 $oGroupUserLink = & new GroupUserLink($sql->f("group_id"), $sql->f("user_id"));
175 $oGroupUserLink->iId = $iGroupUserLinkID; 190 $oGroupUserLink->iId = $iGroupUserLinkID;
176 return $oGroupUserLink; 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 return false; 194 return false;
180 } 195 }
181 $_SESSION["errorMessage"] = $lang_err_database; 196 $_SESSION["errorMessage"] = $lang_err_database;
@@ -195,7 +210,7 @@ class GroupUserLink { @@ -195,7 +210,7 @@ class GroupUserLink {
195 $aGroupUserLink; 210 $aGroupUserLink;
196 settype($aGroupUserLink, "array"); 211 settype($aGroupUserLink, "array");
197 $sql = $default->db; 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 if ($result) { 214 if ($result) {
200 $iCount = 0; 215 $iCount = 0;
201 while ($sql->next_record()) { 216 while ($sql->next_record()) {
@@ -214,7 +229,7 @@ class GroupUserLink { @@ -214,7 +229,7 @@ class GroupUserLink {
214 $aGroupUserLink; 229 $aGroupUserLink;
215 settype($aGroupUserLink, "array"); 230 settype($aGroupUserLink, "array");
216 $sql = $default->db; 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 if ($result) { 233 if ($result) {
219 $iCount = 0; 234 $iCount = 0;
220 while ($sql->next_record()) { 235 while ($sql->next_record()) {
@@ -240,7 +255,7 @@ class GroupUserLink { @@ -240,7 +255,7 @@ class GroupUserLink {
240 { 255 {
241 global $default; 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 return $value; 260 return $value;
246 261
@@ -260,7 +275,7 @@ class GroupUserLink { @@ -260,7 +275,7 @@ class GroupUserLink {
260 { 275 {
261 global $default; 276 global $default;
262 $sql = $default->db; 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 if ($result) { 279 if ($result) {
265 if ($sql->next_record()) { 280 if ($sql->next_record()) {
266 $id = $sql->f("id"); 281 $id = $sql->f("id");