diff options
| author | lsces <lester@lsces.co.uk> | 2013-08-22 15:42:41 +0100 |
|---|---|---|
| committer | lsces <lester@lsces.co.uk> | 2013-08-22 15:42:41 +0100 |
| commit | b32cd9d6457137cc0d4cecd4f384d624eeee88fe (patch) | |
| tree | 5d77590b4688ed1f3b1a1342b78a47264fd38033 /ContactXrefType.php | |
| parent | 1923e813045c00cab7b0c7a5798aacd1360e9d09 (diff) | |
| download | contact-b32cd9d6457137cc0d4cecd4f384d624eeee88fe.tar.gz contact-b32cd9d6457137cc0d4cecd4f384d624eeee88fe.tar.bz2 contact-b32cd9d6457137cc0d4cecd4f384d624eeee88fe.zip | |
XRef type list
Diffstat (limited to 'ContactXrefType.php')
| -rw-r--r-- | ContactXrefType.php | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/ContactXrefType.php b/ContactXrefType.php index 3ca2fde..434185a 100644 --- a/ContactXrefType.php +++ b/ContactXrefType.php @@ -2,7 +2,7 @@ /** * @version $Header$ * @package articles - * + * * @copyright Copyright (c) 2004-2006, bitweaver.org * All Rights Reserved. See below for details and a complete list of authors. * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details. @@ -24,5 +24,36 @@ class ContactXrefType extends BitBase { } + public static function getContactXrefTypeList( $pOptionHash=NULL ) { + global $gBitSystem; + + $where = ''; + $bindVars = array(); + if( !empty( $pOptionHash['active_role'] ) ) { + $where = " WHERE cxs.`role_id` = ? "; + $bindVars[] = $pOptionHash['active_role']; + } + if ( !empty( $pOptionHash['source'] ) ) { + $where = " WHERE cxs.`source` = ? "; + $bindVars[] = $pOptionHash['source']; + } + + $query = "SELECT cxs.* + FROM `".BIT_DB_PREFIX."contact_xref_source` cxs + $where ORDER BY cxs.`xref_type`, cxs.source`"; + + $result = $gBitSystem->mDb->query( $query, $bindVars ); + + $ret = array(); + + while( $res = $result->fetchRow() ) { + $res["num_entries"] = $gBitSystem->mDb->getOne( "SELECT COUNT(*) FROM `".BIT_DB_PREFIX."contact_xref` WHERE `source`= ?", array( $res["source"] ) ); + + $ret[] = $res; + } + + return $ret; + } + } ?> |
