Commit 4280090e4377fb3aa867bf233acba1c6b1973322
1 parent
e721ec14
Remove unused GroupUnitLink class.
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@5083 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
0 additions
and
210 deletions
lib/groups/GroupUnitLink.inc deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Represents a group, unit link as per the database table groups_units_link. | |
| 6 | - * | |
| 7 | - * Copyright (c) 2006 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; using version 2 of the License. | |
| 12 | - * | |
| 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 | - */ | |
| 27 | -class GroupUnitLink extends KTEntity { | |
| 28 | - | |
| 29 | - /** primary key of object */ | |
| 30 | - var $iId; | |
| 31 | - /** primary key of group to which unit is linked */ | |
| 32 | - var $iGroupID; | |
| 33 | - /** primary key of unit to which group is linked */ | |
| 34 | - var $iUnitID; | |
| 35 | - | |
| 36 | - function GroupUnitLink($iNewGroupID, $iNewUnitID) { | |
| 37 | - //object not created in database yet | |
| 38 | - $this->iId = -1; | |
| 39 | - $this->iGroupID = $iNewGroupID; | |
| 40 | - $this->iUnitID = $iNewUnitID; | |
| 41 | - } | |
| 42 | - | |
| 43 | - /** | |
| 44 | - * Get the object's primary key | |
| 45 | - * | |
| 46 | - * @return int object's primary key | |
| 47 | - * | |
| 48 | - */ | |
| 49 | - function getID() { | |
| 50 | - return $this->iId; | |
| 51 | - } | |
| 52 | - | |
| 53 | - /** | |
| 54 | - * Get the primary key of the group to which the unit is linked | |
| 55 | - * | |
| 56 | - * @return int primary key of group to which unit is linked | |
| 57 | - * | |
| 58 | - */ | |
| 59 | - function getGroupID() { | |
| 60 | - return $this->iGroupID; | |
| 61 | - } | |
| 62 | - | |
| 63 | - /** | |
| 64 | - * Set the primary key of the group to which the unit is linked | |
| 65 | - * | |
| 66 | - * @param int Primary key of group to which unit is ilinked | |
| 67 | - * | |
| 68 | - */ | |
| 69 | - function setGroupID($iNewValue) { | |
| 70 | - $this->iGroupID = $iNewValue; | |
| 71 | - } | |
| 72 | - | |
| 73 | - /** | |
| 74 | - * Get the prijmary key of the unit to which the group is linked | |
| 75 | - * | |
| 76 | - * @return int primary key of unit to which the group is linked | |
| 77 | - * | |
| 78 | - */ | |
| 79 | - function getUnitID() { | |
| 80 | - return $this->iUnitID; | |
| 81 | - } | |
| 82 | - | |
| 83 | - /** | |
| 84 | - * Set the primary key of the unit to which the group is linked | |
| 85 | - * | |
| 86 | - * @param int Primary key of unit to which the group is linked | |
| 87 | - * | |
| 88 | - */ | |
| 89 | - function setUnitID($iNewValue) { | |
| 90 | - $this->iUnitID = $iNewValue; | |
| 91 | - } | |
| 92 | - | |
| 93 | - function _fieldValues () { | |
| 94 | - return array( | |
| 95 | - 'group_id' => $this->iGroupID, | |
| 96 | - 'unit_id' => $this->iUnitID, | |
| 97 | - ); | |
| 98 | - } | |
| 99 | - | |
| 100 | - function _table () { | |
| 101 | - global $default; | |
| 102 | - return $default->groups_units_table; | |
| 103 | - } | |
| 104 | - | |
| 105 | - /** | |
| 106 | - * Create the current object in the database | |
| 107 | - * | |
| 108 | - * @return boolean on successful store, false otherwise and set $_SESSION["errorMessage"] | |
| 109 | - * | |
| 110 | - */ | |
| 111 | - function create() { | |
| 112 | - global $default, $lang_err_database, $lang_err_object_exists; | |
| 113 | - //if the object hasn't been created | |
| 114 | - if ($this->iId < 0) | |
| 115 | - { | |
| 116 | - $sql = $default->db; | |
| 117 | - $query = "SELECT unit_id, group_id FROM ". $default->groups_units_table ." WHERE unit_id = ? and group_id = ?";/*ok*/ | |
| 118 | - $aParams = array($this->iUnitID, $this->iGroupID); | |
| 119 | - $sql->query(array($query, $aParams)); | |
| 120 | - $rows = $sql->num_rows($sql); | |
| 121 | - | |
| 122 | - if ($rows > 0) { | |
| 123 | - $_SESSION["errorMessage"] = "GroupUnitlink::The id " . $this->iUnitID . " already exists!"; | |
| 124 | - return false; | |
| 125 | - } | |
| 126 | - } | |
| 127 | - | |
| 128 | - return parent::create(); | |
| 129 | - } | |
| 130 | - | |
| 131 | - /** | |
| 132 | - * Static function. | |
| 133 | - * Given a groups_units_link primary key it will create a | |
| 134 | - * GroupUnitsLink object and populate it with the | |
| 135 | - * corresponding database values | |
| 136 | - * | |
| 137 | - * @return GroupUnitsLink populated GroupUnitsLink object on successful query, false otherwise and set $_SESSION["errorMessage"] | |
| 138 | - */ | |
| 139 | - function & get($iGroupUnitLinkID) { | |
| 140 | - global $default; | |
| 141 | - $sql = $default->db; | |
| 142 | - $result = $sql->query(array("SELECT * FROM $default->groups_units_table WHERE id = ?", $iGroupUnitLinkID));/*ok*/ | |
| 143 | - if ($result) { | |
| 144 | - if ($sql->next_record()) { | |
| 145 | - $oGroupUnitLink = & new GroupUnitLink($sql->f("group_id"), $sql->f("unit_id")); | |
| 146 | - $oGroupUnitLink->iId = $iGroupUnitLinkID; | |
| 147 | - return $oGroupUnitLink; | |
| 148 | - } | |
| 149 | - $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iGroupUnitLinkID . " table = $default->groups_units_table"; | |
| 150 | - return false; | |
| 151 | - } | |
| 152 | - $_SESSION["errorMessage"] = $lang_err_database; | |
| 153 | - return false; | |
| 154 | - } | |
| 155 | - | |
| 156 | -/** | |
| 157 | - * Static function | |
| 158 | - * Get a list of web documents | |
| 159 | - * | |
| 160 | - * @param String Where clause (not required) | |
| 161 | - * | |
| 162 | - * @return Array array of GroupUnitLink objects, false otherwise and set $_SESSION["errorMessage"] | |
| 163 | - */ | |
| 164 | - function getList($sWhereClause = null) { | |
| 165 | - return KTEntityUtil::getList(GroupUnitLink::_table(), 'GroupUnitLink', $sWhereClause); | |
| 166 | - } | |
| 167 | - | |
| 168 | - | |
| 169 | - | |
| 170 | - /* | |
| 171 | - * static function | |
| 172 | - * | |
| 173 | - * test to see if group exists already | |
| 174 | - * | |
| 175 | - * @param false or a value | |
| 176 | - * | |
| 177 | - */ | |
| 178 | - | |
| 179 | - function groupBelongsToUnit($groupId) | |
| 180 | - { | |
| 181 | - global $default; | |
| 182 | - | |
| 183 | - $value = lookupField("$default->groups_units_table", "unit_id", "group_id", $groupId ); | |
| 184 | - | |
| 185 | - return $value; | |
| 186 | - | |
| 187 | - } | |
| 188 | - | |
| 189 | - /* | |
| 190 | - * static function | |
| 191 | - * | |
| 192 | - * sets the id of the groupunit using their groupid | |
| 193 | - * | |
| 194 | - * @param String | |
| 195 | - * The unit_ID | |
| 196 | - * | |
| 197 | - */ | |
| 198 | - | |
| 199 | - function setGroupUnitID($groupId) | |
| 200 | - { | |
| 201 | - global $default; | |
| 202 | - | |
| 203 | - $id = lookupID($default->groups_units_table, "group_id", $groupId); | |
| 204 | - | |
| 205 | - $this->iId= $id; | |
| 206 | - } | |
| 207 | - | |
| 208 | - | |
| 209 | -} | |
| 210 | -?> |