From: <gem...@li...> - 2012-05-30 14:09:22
|
Revision: 708 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=708&view=rev Author: mennodekker Date: 2012-05-30 14:09:16 +0000 (Wed, 30 May 2012) Log Message: ----------- Add helper to find all organizations with the same gor_code Modified Paths: -------------- trunk/library/classes/Gems/Util/DbLookup.php Modified: trunk/library/classes/Gems/Util/DbLookup.php =================================================================== --- trunk/library/classes/Gems/Util/DbLookup.php 2012-05-30 14:06:59 UTC (rev 707) +++ trunk/library/classes/Gems/Util/DbLookup.php 2012-05-30 14:09:16 UTC (rev 708) @@ -236,6 +236,30 @@ } /** + * Get all organizations that share a given code + * + * On empty this will return all organizations + * + * @staticvar array $organizations + * @param string $code + * @return array key = gor_id_organization, value = gor_name + */ + public function getOrganizationsByCode($code = null) + { + static $organizations = array(); + + if (is_null($code)) { + return $this->getOrganizations(); + } + + if (!isset($organizations[$code])) { + $organizations[$code] = $this->db->fetchPairs('SELECT gor_id_organization, gor_name FROM gems__organizations WHERE gor_active=1 and gor_code=? ORDER BY gor_name', array($code)); + } + + return $organizations[$code]; + } + + /** * Returns a list of the organizations where users can login. * * @staticvar array $organizations This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |