Module: appdb Branch: master Commit: 4c13d6c1fd0d98bd9d3f48f4623364ea60ded072 URL: http://source.winehq.org/git/appdb.git/?a=commit;h=4c13d6c1fd0d98bd9d3f48f46...
Author: Alexander Nicolaysen Sørnes alexsornes@gmail.com Date: Sun Apr 24 22:50:28 2011 +0200
TagNoteVersion: Add class for handling associations between notes and versions
---
include/tag_Note.php | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 78 insertions(+), 0 deletions(-)
diff --git a/include/tag_Note.php b/include/tag_Note.php new file mode 100644 index 0000000..2644317 --- /dev/null +++ b/include/tag_Note.php @@ -0,0 +1,78 @@ +<?php + +require_once(BASE.'include/tag.php'); + +class TagNoteVersion extends Tag +{ + private $iAppId; + + function TagNoteVersion($iVersionId = null, $oRow = null, $sTextId = '') + { + if(!is_numeric($iVersionId) && !$oRow) + return; + + if(!$oRow) + { + $hResult = query_parameters("SELECT * FROM appVersion WHERE versionId = '?'", $iVersionId); + + if($hResult) + $oRow = mysql_fetch_object($hResult); + } + + if($oRow) + { + $this->bMultipleAssignments = true; + $this->iId = $oRow->versionId; + $this->sName = $oRow->versionName; + $this->sDescription = $oRow->description; + $this->iAppId = $oRow->appId; + $this->sTextId = $oRow->versionId; + $this->sState = $oRow->state; + } + } + + public function setAppId($iAppId) + { + if(is_numeric($iAppId) && $iAppId > 0) + $this->iAppId = $iAppId; + } + + protected function objectGetSQLTable() + { + return 'appVersion'; + } + + protected function getSQLTableForAssignments() + { + return 'tags_NoteVersion_assignments'; + } + + public function objectGetEntriesCount() + { + $hResult = query_parameters("SELECT COUNT(*) as count FROM ? WHERE appId = '?' AND state = 'accepted'", $this->objectGetSQLTable(), $this->iAppId); + + if(!$hResult) + return false; + + $oRow = mysql_fetch_object($hResult); + + return $oRow->count; + } + + public function objectGetEntries() + { + $hResult = query_parameters("SELECT * FROM ? WHERE appId = '?' AND state = 'accepted'", $this->objectGetSQLTable(), $this->iAppId); + + if(!$hResult) + return false; + + return $hResult; + } + + protected function getTagClass() + { + return 'Note'; + } +} + +?> \ No newline at end of file