diff --git a/lib/archiving/ArchiveRestorationRequest.inc b/lib/archiving/ArchiveRestorationRequest.inc deleted file mode 100644 index 49a2aa0..0000000 --- a/lib/archiving/ArchiveRestorationRequest.inc +++ /dev/null @@ -1,201 +0,0 @@ -, Jam Warehouse (Pty) Ltd, South Africa - * @package lib.archiving - */ -class ArchiveRestorationRequest extends KTEntity { - - /** - * The primary key - */ - var $iId; - /** - * The document to be restored - */ - var $iDocumentID; - /** - * The user requesting the restoration - */ - var $iRequestUserID; - /** - * The administrator to perform the restore - */ - var $iAdminUserID; - /** - * Timestamp - */ - var $dDateTime; - - /** - * Constructs an archive restoration request instance - * - * @param integer the document id - * @param integer the request user id - * @param integer the admin user id - */ - function ArchiveRestorationRequest($iNewDocumentID, $iNewRequestUserID, $iNewAdminUserID, $dNewDateTime = "") { - global $default; - - // primary key not set as this is not stored yet - $this->iId = -1; - $this->iDocumentID = $iNewDocumentID; - $this->iRequestUserID = $iNewRequestUserID; - $this->iAdminUserID = $iNewAdminUserID; - $this->dDateTime = strlen($dNewDateTime) == 0 ? getCurrentDateTime() : $dNewDateTime; - } - - /** - * Gets the primary key - */ - function getID(){ - return $this->iId; - } - - /** - * Gets the document id - */ - function getDocumentID(){ - return $this->iDocumentID; - } - - /** - * Sets the document id - * - * @param integer the new document id - */ - function setDocumentID($iNewDocumentID){ - $this->iDocumentID = $iNewDocumentID; - } - - /** - * Gets the request user - */ - function getRequestUserID(){ - return $this->iRequestUserID; - } - - /** - * Sets the request user - * - * @param integer the new user id - */ - function setRequestUserID($iNewRequestUserID){ - $this->iRequestUserID = $iNewRequestUserID; - } - - /** - * Gets the admin user - */ - function getAdminUserID(){ - return $this->iAdminUserID; - } - - /** - * Sets the admin user - * - * @param integer the new user id - */ - function setAdminUserID($iNewAdminUserID){ - $this->iAdminUserID = $iNewAdminUserID; - } - - /** - * Gets the datetime - */ - function getDateTime(){ - return $this->dDateTime; - } - - /** - * Sets the datetime - * - * @param datetime the new date time - */ - function setDateTime($dNewDateTime){ - $this->dDateTime = $dNewDateTime; - } - - function _fieldValues () { - return array( - 'document_id' => $this->iDocumentID, - 'request_user_id' => $this->iRequestUserID, - 'admin_user_id' => $this->iAdminUserID, - 'datetime' => $this->dDateTime, - ); - } - - function _table () { - global $default; - return $default->archive_restoration_table; - } - - /** - * Static function. Given a document primary key will create - * a ArchiveRestorationRequest object and populate it with the corresponding - * database values - * - * @return ArchiveRestorationRequest populated ArchiveRestorationRequest object on success, false otherwise - */ - function & getFromDocumentID($iDocumentID) { - global $default; - $sql = $default->db; - $sql->query(array("SELECT * FROM $default->archive_restoration_table WHERE document_id = ?", $iDocumentID));/*ok*/ - if ($sql->next_record()) { - $oArchiveRestorationRequest = & new ArchiveRestorationRequest($sql->f("document_id"), $sql->f("request_user_id"), $sql->f("admin_user_id"), $sql->f("datetime")); - $oArchiveRestorationRequest->iId = $sql->f("id"); - return $oArchiveRestorationRequest; - } - return false; - } - - /** - * Static function. Given a news item primary key will create - * a ArchiveRestorationRequest object and populate it with the corresponding - * database values - * - * @return ArchiveRestorationRequest populated ArchiveRestorationRequest object on success, false otherwise - */ - function & get($iArchiveRestorationRequestID) { - global $default; - $sql = $default->db; - $sql->query(array("SELECT * FROM $default->archive_restoration_table WHERE id = ?", $iArchiveRestorationRequestID));/*ok*/ - if ($sql->next_record()) { - $oArchiveRestorationRequest = & new ArchiveRestorationRequest($sql->f("document_id"), $sql->f("request_user_id"), $sql->f("admin_user_id"), $sql->f("datetime")); - $oArchiveRestorationRequest->iId = $iArchiveRestorationRequestID; - return $oArchiveRestorationRequest; - } - return false; - } - - /** - * Static function - * Get a list of ArchiveRestorationRequest objects - * - * @param String Where clause (optional) - * @return Array array of ArchiveRestorationRequest objects, false otherwise - */ - function getList($sWhereClause = null) { - return KTEntityUtil::getList(ArchiveRestorationRequest::_table(), 'ArchiveRestorationRequest', $sWhereClause); - } -} diff --git a/lib/archiving/ArchivingSettings.inc b/lib/archiving/ArchivingSettings.inc deleted file mode 100644 index dbb4cfd..0000000 --- a/lib/archiving/ArchivingSettings.inc +++ /dev/null @@ -1,194 +0,0 @@ -, Jam Warehouse (Pty) Ltd, South Africa - * @package lib.archiving - */ - -class ArchivingSettings extends KTEntity { - - /** - * The primary key - */ - var $iId; - /** - * The archiving method- date or utilisation - */ - var $iArchivingTypeID; - /** - * The expiration date - */ - var $dExpirationDate; - /** - * The document transaction id - */ - var $iDocumentTransactionID; - /** - * The expiration time period - */ - var $iTimePeriodID; - - /** - * Constructs an archive date settings instance - * - * @param date the expiration date - * @param integer the expiration time period id - */ - function ArchivingSettings($iNewArchivingTypeID, $dNewExpirationDate, $iNewDocumentTransactionID, $iNewTimePeriodID) { - global $default; - - // primary key not set as this is not stored yet - $this->iId = -1; - $this->iArchivingTypeID = $iNewArchivingTypeID; - $this->setExpirationDate($dNewExpirationDate); - $this->iDocumentTransactionID = $iNewDocumentTransactionID; - $this->iTimePeriodID = $iNewTimePeriodID; - } - - /** - * Gets the primary key - */ - function getID(){ - return $this->iId; - } - - /** - * Gets the archiving type - */ - function getArchivingTypeID(){ - return $this->iArchivingTypeID; - } - - /** - * Sets the archiving type - * - * @param integer the new archiving type - */ - function setArchivingTypeID($iNewArchivingTypeID){ - $this->iArchivingTypeID = $iNewArchivingTypeID; - } - - /** - * Gets the expiration date - */ - function getExpirationDate() { - return ($this->dExpirationDate == "NULL" ? "" : $this->dExpirationDate); - } - - /** - * Sets the expiration date - * - * @param date the new expiration date - */ - function setExpirationDate($dNewExpirationDate){ - $this->dExpirationDate = strlen($dNewExpirationDate) == 0 ? "NULL" : $dNewExpirationDate; - } - - /** - * Gets the document transaction id - */ - function getDocumentTransactionID() { - return $this->iDocumentTransactionID; - } - - /** - * Sets the document transaction id - * - * @param integer the new document transaction id - */ - function setDocumentTransactionID($iNewDocumentTransactionID){ - $this->iDocumentTransactionID = $iNewDocumentTransactionID; - } - - /** - * Gets the time period id - */ - function getTimePeriodID(){ - return $this->iTimePeriodID; - } - - /** - * Sets the time period id - * - * @param integer the new time period id - */ - function setTimePeriodID($iNewTimePeriodID){ - $this->iTimePeriodID = $iNewTimePeriodID; - } - - function _fieldValues () { - return array( - 'archiving_type_id' => $this->iArchivingTypeID, - 'expiration_date' => $this->dExpirationDate, - 'document_transaction_id' => $this->iDocumentTransactionID, - 'time_period_id' => $this->iTimePeriodID, - ); - } - - function _table () { - global $default; - return $default->archiving_settings_table; - } - - function addQuotes($sDate) { - if ($sDate == "NULL") { - return $sDate; - } else { - return "'$sDate'"; - } - } - - /** - * Static function. Given a primary key will create - * a ArchivingSettings object and populate it with the corresponding - * database values - * - * @return ArchivingSettings populated ArchivingSettings object on success, false otherwise - */ - function & get($iArchivingSettingsID) { - global $default; - $sql = $default->db; - $sql->query(array("SELECT * FROM $default->archiving_settings_table WHERE id = ?", $iArchivingSettingsID));/*ok*/ - if ($sql->next_record()) { - $oArchivingSettings = & new ArchivingSettings($sql->f("archiving_type_id"), - $sql->f("expiration_date"), - $sql->f("document_transaction_id"), - $sql->f("time_period_id")); - $oArchivingSettings->iId = $iArchivingSettingsID; - return $oArchivingSettings; - } - return false; - } - - /** - * Static function - * Get a list of ArchivingSettings objects - * - * @param String Where clause (optional) - * @return Array array of ArchivingSettings objects, false otherwise - */ - function getList($sWhereClause = null) { - return KTEntityUtil::getList(ArchivingSettings::_table(), 'ArchivingSettings', $sWhereClause); - } -} -?> diff --git a/lib/archiving/ArchivingType.inc b/lib/archiving/ArchivingType.inc deleted file mode 100644 index 85cf770..0000000 --- a/lib/archiving/ArchivingType.inc +++ /dev/null @@ -1,115 +0,0 @@ -, Jam Warehouse (Pty) Ltd, South Africa - * @package lib.archiving - */ -class ArchivingType extends KTEntity { - - /** - * The primary key - */ - var $iId; - /** - * The archiving type - */ - var $sName; - - /** - * Constructs an archiving type instance - * - * @param string the archiving type name - */ - function ArchivingType($sNewName) { - global $default; - - // primary key not set as this is not stored yet - $this->iId = -1; - $this->sName = $sNewName; - } - - /** - * Gets the primary key - */ - function getID(){ - return $this->iId; - } - - /** - * Gets the name - */ - function getName() { - return $this->sName; - } - - /** - * Sets the name - * - * @param string the new name - */ - function setName($sNewName){ - $this->sName = $sNewName; - } - - function _fieldValues () { - return array( - 'name' => $this->sName, - ); - - } - - function _table () { - global $default; - return $default->archiving_type_lookup_table; - } - - /** - * Static function. Given a news item primary key will create - * a ArchivingType object and populate it with the corresponding - * database values - * - * @return ArchivingType populated ArchivingType object on success, false otherwise - */ - function & get($iArchivingTypeID) { - global $default; - $sql = $default->db; - $sql->query(array("SELECT * FROM $default->archiving_type_lookup_table WHERE id = ?", $iArchivingTypeID));/*ok*/ - if ($sql->next_record()) { - $oArchivingType = & new ArchivingType($sql->f("name")); - $oArchivingType->iId = $iArchivingTypeID; - return $oArchivingType; - } - return false; - } - - /** - * Static function - * Get a list of ArchivingType objects - * - * @param String Where clause (optional) - * @return Array array of ArchivingType objects, false otherwise - */ - function getList($sWhereClause = null) { - return KTEntityUtil::getList(ArchivingType::_table(), 'ArchivingType', $sWhereClause); - } -} diff --git a/lib/archiving/DocumentArchiveSettingsFactory.inc b/lib/archiving/DocumentArchiveSettingsFactory.inc deleted file mode 100644 index b937df8..0000000 --- a/lib/archiving/DocumentArchiveSettingsFactory.inc +++ /dev/null @@ -1,142 +0,0 @@ -, Jam Warehouse (Pty) Ltd, South Africa - * @package lib.archiving - */ -class DocumentArchiveSettingsFactory { - - function handleTimePeriod($iTimeUnitID, $iUnits) { - if ($iTimeUnitID && $iUnits) { - // search for an existing time period id - $aWhereClause = array('time_unit_id = ? AND units = ?', array($iTimeUnitID, $iUnits)); - $aTimePeriod = TimePeriod::getList($aWhereClause);/*ok*/ - if (count($aTimePeriod) > 0) { - $iTimePeriodID = $aTimePeriod[0]->getID(); - } else { - // create it - $oTimePeriod = new TimePeriod($iTimeUnitID, $iUnits); - if ($oTimePeriod->create()) { - $iTimePeriodID = $oTimePeriod->getID(); - } else { - $default->log->error("couldn't create time period- " . arrayToString($oTimePeriod)); - return false; - } - } - } else { - $iTimePeriodID = -1; - } - return $iTimePeriodID; - } - - function validateDate($dExpirationDate) { - if ($dExpirationDate) { - $sTime = strtotime($dExpirationDate); - // check that its later than today - if ($sTime <= time()) { - return false; - } - } - return true; - } - - function create($iArchivingTypeID, $iDocumentID, $dExpirationDate, $iDocumentTransactionID, $iTimeUnitID, $iUnits) { - global $default; - - $sArchivingType = lookupName($default->archiving_type_lookup_table, $iArchivingTypeID); - - // process time period (if any) - $iTimePeriodID = $this->handleTimePeriod($iTimeUnitID, $iUnits); - - // construction strings - // XXX: eval?! - switch ($sArchivingType) { - case "Date" : $sSearchConstruction = "\$aArchiveSettings = ArchivingSettings::getList(\""; - $sSearchConstruction .= (isset($dExpirationDate) ? "expiration_date='$dExpirationDate'" : "time_period_id=$iTimePeriodID") . "\");"; - $sConstruction = "\$oArchiveSettings = new ArchivingSettings($iArchivingTypeID, \$dExpirationDate, -1, $iTimePeriodID);"; - break; - case "Utilisation" : $sSearchConstruction = "\$aArchiveSettings = ArchivingSettings::getList(\"document_transaction_id=$iDocumentTransactionID AND time_period_id=$iTimePeriodID\");"; - $sConstruction = "\$oArchiveSettings = new ArchivingSettings($iArchivingTypeID, \"NULL\", $iDocumentTransactionID, $iTimePeriodID);"; - break; - } - - // search for the settings first - eval($sSearchConstruction); - if (count($aArchiveSettings) > 0) { - $iArchiveSettingsID = $aArchiveSettings[0]->getID(); - $default->log->info("looked up archive settings id=$iArchiveSettingsID"); - } else { - // create them - eval($sConstruction); - if ($oArchiveSettings->create()) { - $iArchiveSettingsID = $oArchiveSettings->getID(); - } else { - $default->log->error("couldn't create archive settings- " . arrayToString($oArchiveSettings)); - return false; - } - } - - // now link to the documents - $oDocumentArchiving = new DocumentArchiving($iDocumentID, $iArchiveSettingsID); - if ($oDocumentArchiving->create()) { - return true; - } else { - $default->log->error("couldn't create document archiving - " . arrayToString($oDocumentArchiving)); - return false; - } - } - - function update($oDocumentArchiving, $dExpirationDate, $iDocumentTransactionID, $iTimeUnitID, $iUnits) { - global $default; - - // retrieve the settings - $oArchiveSettings = ArchivingSettings::get($oDocumentArchiving->getArchivingSettingsID()); - if ($oArchiveSettings) { - - // process time period (if any) - $iTimePeriodID = $this->handleTimePeriod($iTimeUnitID, $iUnits); - $oArchiveSettings->setTimePeriodID($iTimePeriodID); - - $sArchivingType = lookupName($default->archiving_type_lookup_table, $oArchiveSettings->getArchivingTypeID()); - // update it based on the type - switch ($sArchivingType) { - case "Date" : $oArchiveSettings->setExpirationDate($dExpirationDate); - break; - case "Utilisation" : $oArchiveSettings->setDocumentTransactionID($iDocumentTransactionID); - break; - } - if ($oArchiveSettings->update()) { - return true; - } else { - $default->log->error("error updating archive settings for documentID=" . $oArchiveSettings->getDocumentID()); - } - } else { - $default->log->error("couldn't retrieve archive settings"); - return false; - } - } -} -?> diff --git a/lib/archiving/DocumentArchiving.inc b/lib/archiving/DocumentArchiving.inc deleted file mode 100644 index 88ab4b2..0000000 --- a/lib/archiving/DocumentArchiving.inc +++ /dev/null @@ -1,158 +0,0 @@ -, Jam Warehouse (Pty) Ltd, South Africa - * @package lib.archiving - */ - -class DocumentArchiving extends KTEntity { - /** - * The primary key - */ - var $iId; - /** - * The document ID - */ - var $iDocumentID; - - /** - * The archiving settings - */ - var $iArchivingSettingsID; - - /** - * Constructs an archive settings instance - * - * @param integer the document id - * @param integer the archiving type id - * @param integer the archiving settings id - */ - function DocumentArchiving($iNewDocumentID, $iNewArchivingSettingsID) { - global $default; - - // primary key not set as this is not stored yet - $this->iId = -1; - $this->iDocumentID = $iNewDocumentID; - $this->iArchivingSettingsID = $iNewArchivingSettingsID; - } - - /** - * Gets the primary key - */ - function getID(){ - return $this->iId; - } - - /** - * Gets the document id - */ - function getDocumentID(){ - return $this->iDocumentID; - } - - /** - * Sets the document id - * - * @param integer the new document id - */ - function setDocumentID($iNewDocumentID){ - $this->iDocumentID = $iNewDocumentID; - } - - /** - * Gets the archiving settings - */ - function getArchivingSettingsID(){ - return $this->iArchivingSettingsID; - } - - /** - * Sets the archiving settings - * - * @param integer the new archiving settings - */ - function setArchivingSettingsID($iNewArchivingSettingsID){ - $this->iArchivingSettingsID = $iNewArchivingSettingsID; - } - - function _fieldValues () { - return array( - 'document_id' => $this->iDocumentID, - 'archiving_settings_id' => $this->iArchivingSettingsID, - ); - } - - function _table () { - global $default; - return $default->document_archiving_table; - } - - /** - * Static function. Given a document primary key will create - * a DocumentArchiving object and populate it with the corresponding - * database values - * - * @return DocumentArchiving populated DocumentArchiving object on success, false otherwise - */ - function & getFromDocumentID($iDocumentID) { - global $default; - $sql = $default->db; - $sql->query(array("SELECT * FROM $default->document_archiving_table WHERE document_id = ?", $iDocumentID));/*ok*/ - if ($sql->next_record()) { - $oDocumentArchiving = & new DocumentArchiving($sql->f("document_id"), $sql->f("archiving_settings_id")); - $oDocumentArchiving->iId = $sql->f("id"); - return $oDocumentArchiving; - } - return false; - } - - /** - * Static function. Given a news item primary key will create - * a DocumentArchiving object and populate it with the corresponding - * database values - * - * @return DocumentArchiving populated DocumentArchiving object on success, false otherwise - */ - function & get($iDocumentArchivingID) { - global $default; - $sql = $default->db; - $sql->query(array("SELECT * FROM $default->document_archiving_table WHERE id = ?", $iDocumentArchivingID));/*ok*/ - if ($sql->next_record()) { - $oDocumentArchiving = & new DocumentArchiving($sql->f("document_id"), $sql->f("archiving_settings_id")); - $oDocumentArchiving->iId = $iDocumentArchivingID; - return $oDocumentArchiving; - } - return false; - } - - /** - * Static function - * Get a list of DocumentArchiving objects - * - * @param String Where clause (optional) - * @return Array array of DocumentArchiving objects, false otherwise - */ - function getList($sWhereClause = null) { - return KTEntityUtil::getList(DocumentArchiving::_table(), 'DocumentArchiving', $sWhereClause); - } -} diff --git a/lib/dashboard/Dashboard.inc b/lib/dashboard/Dashboard.inc deleted file mode 100644 index 1ae7ed8..0000000 --- a/lib/dashboard/Dashboard.inc +++ /dev/null @@ -1,121 +0,0 @@ -, Jam Warehouse (Pty) Ltd, South Africa - * @package lib.dashboard - */ -class Dashboard { - - /** - * The user id of the user viewing the dashboard - */ - var $iUserID; - - /** - * Constructs a new instance of the Dashboard - * @param integer the user id of the current user - */ - function Dashboard($iUserID){ - $this->iUserID = $iUserID; - } - - /** - * Retrieves details of supporting documents that the current user must create - */ - function getArchiveRestorationRequestDocuments() { - return ArchiveRestorationRequest::getList(array("admin_user_id = ?", $this->iUserID));/*ok*/ - } - - /** - * Retrieve checked out documents for this user - * - * @return array of documents - */ - function getCheckedOutDocuments(){ - return Document::getList(array("checked_out_user_id = ?", $this->iUserID));/*ok*/ - } - - /** - * Retrieve subscription alerts for this user. - * - * @return array of subscription alerts - */ - function getSubscriptionAlerts(){ - return SubscriptionManager::listSubscriptionAlerts($this->iUserID); - } - - /** - * Retrieve quicklinks - * - * @return array of link objects - */ - function getQuickLinks(){ - return Link::getList("ORDER BY rank");/*ok*/ - } - - /** - * Retrieves Public Folders - */ - function getPublicFolders() { - global $default; - $sQuery = array("SELECT id FROM $default->folders_table WHERE is_public = ?", array(true)); - $aFolderList = array(); - $sql = $default->db; - $sql->query($sQuery); - while ($sql->next_record()) { - $aFolderList[] = & Folder::get($sql->f("id")); - } - return $aFolderList; - } - - /** - * Retrieves Browseable Folders for this user - */ - function getBrowseableFolders() { - return; - - /* - global $default; - $sQuery = array("SELECT DISTINCT F.id as folderid, F.parent_id as parentfolderid " . - "FROM $default->folders_table F, $default->groups_folders_table GFL, $default->users_groups_table UGL " . - "WHERE UGL.user_id=? AND UGL.group_id=GFL.group_id AND GFL.folder_id = F.id AND " . - "F.id=F.permission_folder_id AND F.id \!= 1 ORDER BY F.id", $this->iUserID); - $aBrowseableList = array(); - $aShowedFolderList = array(); - $sql = $default->db; - $sql->query($sQuery); - while ($sql->next_record()) { - - if (!$aShowedFolderList[$sql->f("parentfolderid")]) { - $aBrowseableList[] = & Folder::get($sql->f("folderid")); - } - $aShowedFolderList[$sql->f("folderid")] = 1; // check the showed folder - } - return $aBrowseableList; - */ - } - -} diff --git a/lib/foldermanagement/FolderDocTypeLink.inc b/lib/foldermanagement/FolderDocTypeLink.inc deleted file mode 100644 index 6efa968..0000000 --- a/lib/foldermanagement/FolderDocTypeLink.inc +++ /dev/null @@ -1,110 +0,0 @@ -iId = -1; - $this->iFolderID = $iNewFolderID; - $this->iDocumentTypeID = $iNewDocumentTypeID; - } - - function _table() { - global $default; - return $default->folder_doctypes_table; - } - - /** - * Create the current folder in the database - * - * @return boolean true and set $this->iId with new primary key, false otherwise and set $_SESSION["errorMessage"] - */ - function create() { - global $default, $lang_err_database; $lang_err_object_exists; - //if the object has not already been stored - if ($this->iId < 0) { - $sTable = $default->folder_doctypes_table; - $aFieldValues = array( - 'folder_id' => $this->iFolderID, - 'document_type_id' => $this->iDocumentTypeID, - ); - $id =& DBUtil::autoInsert($sTable, $aFieldValues); - - if (PEAR::isError($id)) { - $_SESSION["errorMessage"] = $id->toString(); - return false; - } - $this->iId = $id; - return true; - } - $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = folders"; - return false; - } - - /** - * Static function. - * Given a folder_doctype_link primary key will create - * a FolderDocTypeLink object and populate it with the corresponding - * database values - * - * @param $iFolderDocTypeID Primary key of folder to get - * - * @return Folder folder object on successful retrieval, false otherwise and set $_SESSION["errorMessage"] - */ - function get($iFolderDocTypeLinkID) { - global $default, $lang_err_object_not_exist; - $sql = $default->db; - $sql->query(array("SELECT * FROM " . $default->folder_doctypes_table . " WHERE id = ?", $iFolderDocTypeLinkID));/*ok*/ - if ($sql->next_record()) { - $oFolderDocTypeLink = & new FolderDocTypeLink($sql->f("folder_id"), $sql->f("document_type_id")); - $oFolderDocTypeLink->iId = $iFolderDocTypeLinkID; - return $oFolderDocTypeLink; - } - $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iFolderID . " table = folders"; - return false; - } - - /** - * Static function - * Get a list of Documents - * - * @param String Where clause (not required) - * - * @return Array array of Documents objects, false otherwise and set $_SESSION["errorMessage"] - */ - function getList($sWhereClause = null) { - return KTEntityUtil::getList(FolderDocTypeLink::_table(), 'FolderDocTypeLink', $sWhereClause); - } - -} -?> diff --git a/lib/orgmanagement/Organisation.inc b/lib/orgmanagement/Organisation.inc deleted file mode 100644 index 91b3908..0000000 --- a/lib/orgmanagement/Organisation.inc +++ /dev/null @@ -1,163 +0,0 @@ -iId = -1; - $this->sName = $sNewName; - } - /** - * Get the object's primary key - * - * @return int object's primary key - * - */ - function getID() { - return $this->iId; - } - /** - * Get the org's name - * - * @return String org's name - * - */ - function getName() { - return $this->sName; - } - /** - * Set the orgs name - * - * @param String Unit's name - * - */ - function setName($sNewValue) { - $this->sName = $sNewValue; - } - - function _fieldValues () { - return array( - 'name' => $this->sName, - ); - } - - function _table () { - global $default; - return $default->organisations_table; - } - - /** - * Delete the current object from the database - * - * @return boolean true on successful deletion, false otherwise and set $_SESSION["errorMessage"] - * - */ - function delete() { - global $default, $lang_err_database, $lang_err_object_key; - //only delete the object if it exists in the database - if ($this->iId >= 0) { - //check to see if group is linked to a unit - $sql = $default->db; - $query = "SELECT organisation_id FROM ". $default->units_organisations_table ." WHERE organisation_id = ?";/*ok*/ - $aParams = array($this->iId); - $sql->query(array($query, $aParams)); - $rows = $sql->num_rows($sql); - if ($rows > 0) { - // duplicate link exists - $_SESSION["errorMessage"] = "Group::The Group " . $this->sName . " exits!"; - return false; - } - } - return parent::delete(); - } - /** - * Static function. - * Given a web_documents primary key it will create a - * Unit object and populate it with the - * corresponding database values - * - * @return Unit populated Unit object on successful query, false otherwise and set $_SESSION["errorMessage"] - */ - function & get($iOrgID) { - global $default; - $sql = $default->db; - $result = $sql->query(array("SELECT * FROM $default->organisations_table WHERE id = ?", $iOrgID));/*ok*/ - if ($result) { - if ($sql->next_record()) { - $oOrg = & new Organisation($sql->f("name")); - $oOrg->iId = $iOrgID; - return $oOrg; - } - $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iOrgID . " table = $default->organisations_table"; - return false; - } - $_SESSION["errorMessage"] = $lang_err_database; - return false; - } - /* - * static function - * - * gets the id of a org using their name - * - * @param String - * The username for which we want its ID - * - */ - function getOrgID($name) { - global $default; - $id = lookupID($default->organisations_table, "name", $name); - $this->iId = $id; - } - /** - * Static function - * Get a list of web documents - * - * @param String Where clause (not required) - * - * @return Array array of org objects, false otherwise and set $_SESSION["errorMessage"] - */ - function getList($sWhereClause = null) { - return KTEntityUtil::getList(Organisation::_table(), 'Organisation', $sWhereClause); - } -} -/** -* Static function -* -* Creates a Org object from an array -* -* @param Array Array of parameters. Must match order of parameters in constructor -* -* @return User user object -*/ -function & organisationCreateFromArray($aParameters) { - $oOrg = & new Organisation($aParameters[0], $aParameters[1], $aParameters[2], $aParameters[3], $aParameters[4], $aParameters[5], $aParameters[6], $aParameters[7], $aParameters[8], $aParameters[9], $aParameters[10]); - return $oOrg; -} -?> diff --git a/lib/roles/RoleFolderLink.inc b/lib/roles/RoleFolderLink.inc deleted file mode 100644 index 2420e93..0000000 --- a/lib/roles/RoleFolderLink.inc +++ /dev/null @@ -1,225 +0,0 @@ -iId = -1; - $this->iUserID = $iNewUserID; - $this->iFolderID = $iNewFolderID; - $this->iRoleTypeID = $iNewRoleTypeID; - //the date time is the time at which the task is finished, not the time - //at which the object is created - $this->dDateTime = null; - //task cannot be done yet - $this->bDone = false; - $this->bActive = false; - } - - /** - * Get the object's primary key - * - * @return int object's primary key - * - */ - function getID() { - return $this->iId; - } - - /** - * Get the primary key of the user to which the role is linked - * - * @return int primary key of user to which role is linked - * - */ - function getUserID() { - return $this->iUserID;; - } - - /** - * Set the primary key of the user to which the role is linked - * - * @param int Primary key of user to which role will be linked - * - */ - function setUserID($iNewValue) { - $this->iUserID = $iNewValue; - } - - /** - * Get the primary key of the folder to which the role is linked - * - * @return int primary key of folder to which role is linked - * - */ - function getFolderID() { - return $this->iFolderID; - } - - /** - * Set the primary key of the folder to which the role is linked - * - * @param int Primary key of folder to which role is linked - * - */ - function setFolderID($iNewValue) { - $this->iFolderID = $iNewValue; - } - - /** - * Get the primary key of the role type - * - * @return int primary key of role type - * - */ - function getRoleTypeID() { - return $this->iRoleTypeID; - } - - /** - * Set the primary key of the role type - * - * @param int Primary key of role type - * - */ - function setRoleTypeID($iNewValue) { - $this->iRoleTypeID = $iNewValue; - } - - /** - * Get the date at which the function for this role was performed - * - * @return date date at which the function for this role was performed - * - */ - function getDateTime() { - return $this->dDateTime; - } - - /** - * Set the date/time at which the function for this role was performed - * - * @param date/time Date/time at which the function for this role was performed - * - */ - function setDateTime($dNewValue) { - $this->dDateTine = $dNewValue; - } - - /** - * Get the done status of the role/folder/user link - * - * @return boolean done status of this role/folder/user link - * - */ - function getDone() { - return $this->bDone; - } - - /** - * Set the done status of this role/folder/user link - * - * @param boolean Done status of this role/folder/user link - * - */ - function setDone($bNewValue) { - $this->bDone = $bNewValue; - } - - function _fieldValues () { - return array( - 'user_id' => $this->iUserID, - 'folder_id' => $this->iFolderID, - 'role_type_id' => $this->iRoleTypeID, - 'datetime' => $this->dDateTime, - 'done' => $this->bDone, - 'active' => $this->bActive, - ); - } - - function _table () { - global $default; - return $default->folders_user_roles_table; - } - - /** - * Static function. - * Given a folders_users_roles_link primary key it will create a - * RolesFoldersLink object and populate it with the - * corresponding database values - * - * @return RolesFoldersLink populated RolesFoldersLink object on successful query, false otherwise and set $_SESSION["errorMessage"] - */ - function & get($iRolesFoldersID) { - global $default; - $sql = $default->db; - $result = $sql->query(array("SELECT * FROM $default->folders_user_roles_table WHERE id = ?", $iRolesFoldersID));/*ok*/ - if ($result) { - if ($sql->next_record()) { - $oRolesFoldersLink = & new RoleFolderLink($sql->f("user_id"), $sql->f("folder_id"), $sql->f("role_type_id"), $sql->f("datetime")); - $oRolesFoldersLink->bDone = $sql->f("done"); - $oRolesFoldersLink->bActive = $sql->f("active"); - $oRolesFoldersLink->iId = $iRolesFoldersID; - return $oRolesFoldersLink; - } - $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iRolesFoldersID . " table = $default->folders_user_roles_table"; - return false; - } - $_SESSION["errorMessage"] = $lang_err_database; - return false; - } - -/** - * Static function - * Get a list of web documents - * - * @param String Where clause (not required) - * - * @return Array array of RolesFoldersLink objects, false otherwise and set $_SESSION["errorMessage"] - */ - function getList($sWhereClause = null) { - return KTEntityUtil::getList(RoleFolderLink::_table(), 'RoleFolderLink', $sWhereClause); - } - -} -?> diff --git a/plugins/ktcore/admin/orgManagement.php b/plugins/ktcore/admin/orgManagement.php deleted file mode 100755 index 555f76a..0000000 --- a/plugins/ktcore/admin/orgManagement.php +++ /dev/null @@ -1,70 +0,0 @@ -aBreadcrumbs[] = array('url' => $_SERVER['PHP_SELF'], 'name' => _('Organisation Management')); - $this->oPage->setBreadcrumbDetails(_('select a organisation')); - $this->oPage->setTitle(_("Organisation Management")); - - $org_id= KTUtil::arrayGet($_REQUEST, 'org_id', null); - if ($org_id === null) { $for_edit = false; } - else { $for_edit = true; } - - $org_list =& Organisation::getList(); - - $edit_fields = array(); - $edit_org = null; - if ($for_edit === true) { - $oOrg = Organisation::get($org_id); - if (PEAR::isError($oOrg) || ($oOrg == false)) { $this->errorRedirectToMain(_('Invalid Organisation')); } - $edit_fields[] = new KTStringWidget(_('Organisation Name'),_("The organisation's visible name. e.g. Tech Support"), 'name', $oOrg->getName(), $this->oPage, true); - } - - $oTemplating = new KTTemplating; - $oTemplate = $oTemplating->loadTemplate("ktcore/principals/orgadmin"); - $aTemplateData = array( - "context" => $this, - "for_edit" => $for_edit, - "edit_fields" => $edit_fields, - "edit_org" => $oOrg, - "org_list" => $org_list, - ); - return $oTemplate->render($aTemplateData); - } - - function do_updateOrg() { - $org_id = KTUtil::arrayGet($_REQUEST, 'org_id'); - $oOrg = Organisation::get($org_id); - if (PEAR::isError($oOrg) || ($oOrg == false)) { - $this->errorRedirectToMain(_('Please specify an organisation.')); - exit(0); - } - - $org_name = KTUtil::arrayGet($_REQUEST, 'name', null); - if (empty($org_name)) { - $this->errorRedirectToMain(_('Please specify an org name.')); - exit(0); - } - - $this->startTransaction(); - $oOrg->setName($org_name); - $res = $oOrg->update(); - if (PEAR::isError($res)) { - $this->errorRedirectToMain(_('Failed to update org name.')); - exit(0); - } - - $this->commitTransaction(); - $this->successRedirectToMain(_('Org name changed to') . ': "' . $org_name . '"'); - } - -} - -?>