Commit 205023878b399b1578d967d4e8a0737aec9f5de3
1 parent
ed435914
changed param order, reformatted, bug fixes
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@881 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
50 additions
and
39 deletions
lib/subscriptions/Subscription.inc
| ... | ... | @@ -67,37 +67,6 @@ class Subscription { |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | /** |
| 70 | - * Returns the correct table name for the subscription type | |
| 71 | - * | |
| 72 | - * @param integer the subscription type | |
| 73 | - * @return string the subscription table name to use | |
| 74 | - */ | |
| 75 | - function getTableName($iSubscriptionType) { | |
| 76 | - global $default; | |
| 77 | - | |
| 78 | - if ($iSubscriptionType == SubscriptionConstants::subscriptionType("DocumentSubscription")) { | |
| 79 | - return $default->owl_document_subscriptions_table; | |
| 80 | - } else if($iSubscriptionType == SubscriptionConstants::subscriptionType("FolderSubscription")) { | |
| 81 | - return $default->owl_folder_subscriptions_table; | |
| 82 | - } | |
| 83 | - | |
| 84 | - } | |
| 85 | - /** | |
| 86 | - * Returns the correct id field name for the subscription type | |
| 87 | - * | |
| 88 | - * @param integer the subscription type | |
| 89 | - * @return string the subscription id field name to use | |
| 90 | - */ | |
| 91 | - function getIdFieldName($iSubscriptionType) { | |
| 92 | - if ($iSubscriptionType == SubscriptionConstants::subscriptionType("DocumentSubscription")) { | |
| 93 | - return "document_id"; | |
| 94 | - } else if($iSubscriptionType == SubscriptionConstants::subscriptionType("FolderSubscription")) { | |
| 95 | - return "folder_id"; | |
| 96 | - } | |
| 97 | - | |
| 98 | - } | |
| 99 | - | |
| 100 | - /** | |
| 101 | 70 | * Get the primary key of the current subscription object |
| 102 | 71 | * |
| 103 | 72 | * @return integer primary key of subscription |
| ... | ... | @@ -161,13 +130,24 @@ class Subscription { |
| 161 | 130 | } |
| 162 | 131 | |
| 163 | 132 | /** |
| 164 | - * Returns the artefact link html | |
| 133 | + * Returns the link to view the subscription content | |
| 165 | 134 | */ |
| 166 | - function getLink() { | |
| 135 | + function getContentLink() { | |
| 167 | 136 | if ($iSubscriptionType == SubscriptionConstants::subscriptionType("DocumentSubscription")) { |
| 168 | - return Document::getDocumentDisplayPath($iDocumentID); | |
| 137 | + return generateControllerLink("viewDocument", Document::getDocumentDisplayPath($this->iExternalID), "fDocumentID=$iExternalID"); | |
| 169 | 138 | } else if ($iSubscriptionType == SubscriptionConstants::subscriptionType("FolderSubscription")) { |
| 170 | - return Folder::getFolderDisplayPath($iFolderID); | |
| 139 | + return generateControllerLink("browse", Folder::getFolderDisplayPath($this->iExternalID), "fBrowseType=folder&fFolderID=$iExternalID"); | |
| 140 | + } | |
| 141 | + } | |
| 142 | + | |
| 143 | + /** | |
| 144 | + * Returns the url to the subscription content | |
| 145 | + */ | |
| 146 | + function getContentUrl() { | |
| 147 | + if ($iSubscriptionType == SubscriptionConstants::subscriptionType("DocumentSubscription")) { | |
| 148 | + return generateControllerUrl("viewDocument", "fDocumentID=$iExternalID"); | |
| 149 | + } else if ($iSubscriptionType == SubscriptionConstants::subscriptionType("FolderSubscription")) { | |
| 150 | + return generateControllerUrl("browse", "fBrowseType=folder&fFolderID=$iExternalID"); | |
| 171 | 151 | } |
| 172 | 152 | } |
| 173 | 153 | |
| ... | ... | @@ -281,12 +261,12 @@ class Subscription { |
| 281 | 261 | * Given a subscription's values will create a subscription object and populate it with the corresponding |
| 282 | 262 | * primary key |
| 283 | 263 | * |
| 264 | + * @param integer the user ID | |
| 284 | 265 | * @param integer the external ID |
| 285 | - * @param integer the user ID | |
| 286 | 266 | * @param integer the type of subscription |
| 287 | 267 | * @return object subscription object on successful retrieval, false otherwise and set $_SESSION["errorMessage"] |
| 288 | 268 | */ |
| 289 | - function getByIDs($iExternalID, $iUserID, $iSubscriptionType) { | |
| 269 | + function getByIDs($iUserID, $iExternalID, $iSubscriptionType) { | |
| 290 | 270 | global $default, $lang_err_database, $lang_err_object_not_exist; |
| 291 | 271 | $sql = $default->db; |
| 292 | 272 | if ($sql->query("SELECT * FROM " . Subscription::getTableName($iSubscriptionType) . " " . |
| ... | ... | @@ -310,12 +290,12 @@ class Subscription { |
| 310 | 290 | /** |
| 311 | 291 | * Checks if a given subscription already exists using the external and user ids |
| 312 | 292 | * |
| 293 | + * @param integer the user ID | |
| 313 | 294 | * @param integer the external ID |
| 314 | - * @param integer the user ID | |
| 315 | 295 | * @param integer the subscription type |
| 316 | 296 | * @return true if the document subscription exists, false otherwise |
| 317 | 297 | */ |
| 318 | - function exists($iExternalID, $iUserID, $iSubscriptionType) { | |
| 298 | + function exists($iUserID, $iExternalID, $iSubscriptionType) { | |
| 319 | 299 | global $default, $lang_err_database; |
| 320 | 300 | $sql = $default->db; |
| 321 | 301 | if ($sql->query("SELECT id FROM " . Subscription::getTableName($iSubscriptionType) . " " . |
| ... | ... | @@ -328,5 +308,36 @@ class Subscription { |
| 328 | 308 | } |
| 329 | 309 | return false; |
| 330 | 310 | } |
| 311 | + | |
| 312 | + /** | |
| 313 | + * Returns the correct table name for the subscription type | |
| 314 | + * | |
| 315 | + * @param integer the subscription type | |
| 316 | + * @return string the subscription table name to use | |
| 317 | + */ | |
| 318 | + function getTableName($iSubscriptionType) { | |
| 319 | + global $default; | |
| 320 | + | |
| 321 | + if ($iSubscriptionType == SubscriptionConstants::subscriptionType("DocumentSubscription")) { | |
| 322 | + return $default->owl_document_subscriptions_table; | |
| 323 | + } else if($iSubscriptionType == SubscriptionConstants::subscriptionType("FolderSubscription")) { | |
| 324 | + return $default->owl_folder_subscriptions_table; | |
| 325 | + } | |
| 326 | + | |
| 327 | + } | |
| 328 | + /** | |
| 329 | + * Returns the correct id field name for the subscription type | |
| 330 | + * | |
| 331 | + * @param integer the subscription type | |
| 332 | + * @return string the subscription id field name to use | |
| 333 | + */ | |
| 334 | + function getIdFieldName($iSubscriptionType) { | |
| 335 | + if ($iSubscriptionType == SubscriptionConstants::subscriptionType("DocumentSubscription")) { | |
| 336 | + return "document_id"; | |
| 337 | + } else if($iSubscriptionType == SubscriptionConstants::subscriptionType("FolderSubscription")) { | |
| 338 | + return "folder_id"; | |
| 339 | + } | |
| 340 | + | |
| 341 | + } | |
| 331 | 342 | } |
| 332 | 343 | ?> | ... | ... |