Author: david
Date: 2008-09-10 14:53:25 -0700 (Wed, 10 Sep 2008)
New Revision: 1371
Modified:
trunk/lib/model/QubitRepository.php
Log:
Fix indenting and add DocBlocks to lib/model/QubitRepository.php
Modified: trunk/lib/model/QubitRepository.php
===================================================================
--- trunk/lib/model/QubitRepository.php 2008-09-10 18:47:26 UTC (rev 1370)
+++ trunk/lib/model/QubitRepository.php 2008-09-10 21:53:25 UTC (rev 1371)
@@ -19,33 +19,60 @@
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+/**
+ * @package qubit
+ * @subpackage repository
+ * @author Peter Van Garderen <[EMAIL PROTECTED]>
+ * @version svn:$Id$
+ */
class QubitRepository extends BaseRepository
{
-public function setTermRelation($termId, $relationNote = null)
+
+ /**
+ * Save new link to a term.
+ *
+ * @param integer $termId QubitTerm primary key
+ * @param string $relationNote DEPRECATED
+ */
+ public function setTermRelation($termId, $relationNote = null)
{
- $newTermRelation = new QubitObjectTermRelation;
- $newTermRelation->setTermId($termId);
-//TODO: move to QubitNote
-// $newTermRelation->setRelationNote($relationNote);
- $newTermRelation->setObjectId($this->getId());
- $newTermRelation->save();
+ $newTermRelation = new QubitObjectTermRelation;
+ $newTermRelation->setTermId($termId);
+
+ //TODO: move to QubitNote
+ // $newTermRelation->setRelationNote($relationNote);
+ $newTermRelation->setObjectId($this->getId());
+ $newTermRelation->save();
}
-
-public function getTermRelations($taxonomyId = 'all')
+
+ /**
+ * Get many-to-many links to QubitTerm objects
+ *
+ * @param mixed $taxonomyId Limit results by taxonomy type
+ * @return QubitQuery collection of QubitObjectTermRelation objects
+ */
+ public function getTermRelations($taxonomyId = 'all')
{
- $criteria = new Criteria;
- $criteria->add(QubitObjectTermRelation::OBJECT_ID, $this->getId());
-
- if ($taxonomyId != 'all')
+ $criteria = new Criteria;
+ $criteria->add(QubitObjectTermRelation::OBJECT_ID, $this->getId());
+
+ if ($taxonomyId != 'all')
{
- $criteria->addJoin(QubitObjectTermRelation::TERM_ID, QubitTERM::ID);
- $criteria->add(QubitTerm::TAXONOMY_ID, $taxonomyId);
+ $criteria->addJoin(QubitObjectTermRelation::TERM_ID, QubitTERM::ID);
+ $criteria->add(QubitTerm::TAXONOMY_ID, $taxonomyId);
}
-
- return QubitObjectTermRelation::get($criteria);
+
+ return QubitObjectTermRelation::get($criteria);
}
-
-public function setRepositoryNote($userId, $note, $noteTypeId)
+
+ /**
+ * Create new related QubitNote
+ *
+ * @param integer $userId QubitUser id
+ * @param string $note Note text
+ * @param integer $noteTypeId Type of note (QubitTerm pk)
+ */
+ public function setRepositoryNote($userId, $note, $noteTypeId)
{
$newNote = new QubitNote;
$newNote->setObjectId($this->getId());
@@ -55,8 +82,13 @@
$newNote->setTypeId($noteTypeId);
$newNote->save();
}
-
-public function getRepositoryNotes()
+
+ /**
+ * Get related notes
+ *
+ * @return QubitQuery list of QubitNote objects
+ */
+ public function getRepositoryNotes()
{
$criteria = new Criteria;
$criteria->addJoin(QubitNote::TYPE_ID, QubitTerm::ID);
@@ -66,21 +98,33 @@
return QubitNote::get($criteria);
}
-
-public function getCountry()
-{
- if ($this->getPrimaryContact())
+
+ /**
+ * Get country of primary contact for repository (If one exists)
+ *
+ * @return string primary contact's country
+ */
+ public function getCountry()
{
- return format_country($this->getPrimaryContact()->getCountryCode());
+ if ($this->getPrimaryContact())
+ {
+ return format_country($this->getPrimaryContact()->getCountryCode());
+ }
+ else
+ {
+ return null;
+ }
}
- else
+
+ /**
+ * Create a new QubitProperty related to this repository
+ *
+ * @param mixed $code value for property
+ * @param string $name name of property (optional)
+ * @param string $scope scope note (optional)
+ */
+ public function setProperty($code, $name = null, $scope = null)
{
- return null;
- }
-}
-
-public function setProperty($code, $name = null, $scope = null)
- {
$newCode = new QubitProperty;
$newCode->setObjectId($this->getId());
$newCode->setScope($scope);
@@ -89,23 +133,35 @@
$newCode->save();
}
-public function getProperties($name = null, $scope = null)
+ /**
+ * Return a list of related properties.
+ *
+ * @param string $name Filter by property name (optional)
+ * @param string $scope Filter by property scope (optional)
+ * @return QubitQuery collection of QubitProperty objects
+ */
+ public function getProperties($name = null, $scope = null)
{
$criteria = new Criteria;
$criteria->add(QubitProperty::OBJECT_ID, $this->getId());
if ($name)
- {
- $criteria->add(QubitProperty::NAME, $name);
- }
+ {
+ $criteria->add(QubitProperty::NAME, $name);
+ }
if ($scope)
- {
- $criteria->add(QubitProperty::SCOPE, $scope);
- }
+ {
+ $criteria->add(QubitProperty::SCOPE, $scope);
+ }
return QubitProperty::get($criteria);
}
-public function getRepositoryHoldings()
+ /**
+ * Get information objects in this repository.
+ *
+ * @return QubitQuery collection of QubitInformationObject objects
+ */
+ public function getRepositoryHoldings()
{
$criteria = new Criteria;
$criteria->add(QubitInformationObject::REPOSITORY_ID, $this->getId());
@@ -113,8 +169,15 @@
return $holdings;
}
-
-public static function getRepositories($sort=null, $countryId=null)
+
+ /**
+ * Get a list of repositories.
+ *
+ * @param string $sort sort order (optional)
+ * @param integer $countryId UNUSED (optional)
+ * @return QubitQuery collection of QubitRepository objects
+ */
+ public static function getRepositories($sort=null, $countryId=null)
{
$criteria = new Criteria;
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.ca/group/qubit-commits?hl=en
-~----------~----~----~----~------~----~------~--~---