diff options
| author | Jams H Thompson <jht001@users.sourceforge.net> | 2008-01-02 09:28:55 +0000 |
|---|---|---|
| committer | Jams H Thompson <jht001@users.sourceforge.net> | 2008-01-02 09:28:55 +0000 |
| commit | 2dffacd289bfb3770f22591e19466ee78e98dd6f (patch) | |
| tree | 8433905a9cfdea3dca039b8c687f8d1678cbe287 | |
| parent | 8035aad679a17299bbdc1aeb7217d21c05d68afb (diff) | |
| download | liberty-2dffacd289bfb3770f22591e19466ee78e98dd6f.tar.gz liberty-2dffacd289bfb3770f22591e19466ee78e98dd6f.tar.bz2 liberty-2dffacd289bfb3770f22591e19466ee78e98dd6f.zip | |
add missing function
| -rw-r--r-- | LibertyAttachable.php | 37 | ||||
| -rw-r--r-- | templates/attachments.tpl | 2 |
2 files changed, 37 insertions, 2 deletions
diff --git a/LibertyAttachable.php b/LibertyAttachable.php index bd1b988..d5efa18 100644 --- a/LibertyAttachable.php +++ b/LibertyAttachable.php @@ -3,7 +3,7 @@ * Management of Liberty Content * * @package liberty - * @version $Header: /cvsroot/bitweaver/_bit_liberty/LibertyAttachable.php,v 1.138 2007/11/30 09:56:35 nickpalmer Exp $ + * @version $Header: /cvsroot/bitweaver/_bit_liberty/LibertyAttachable.php,v 1.139 2008/01/02 09:28:54 jht001 Exp $ * @author spider <spider@steelsun.com> */ // +----------------------------------------------------------------------+ @@ -650,5 +650,40 @@ class LibertyAttachable extends LibertyContent { return $ret; } + + /** + * scanForAttchmentUse generates a list of all content associated with a given attachment + * + * @param numeric $pAttachmentId attachment id of the item to check + * @access public + * @return FALSE on failure, or an array on success + */ + function scanForAttchmentUse( $pAttachmentId = NULL ) { + $ret = FALSE; + if( !@BitBase::verifyId( $pAttachmentId )) { + return $ret; + } + + $bindVars[] = $pAttachmentId; + + $query = " + SELECT * + FROM `".BIT_DB_PREFIX."liberty_content` lc + INNER JOIN `".BIT_DB_PREFIX."liberty_attachments` la ON( lc.`content_id` = la.`content_id` ) + WHERE la.`attachment_id` = ?"; + + $result = $this->mDb->query( $query, $bindVars); + while( $res = $result->fetchRow() ) { + $content_id = $res['content_id']; + $liberty_content = new LibertyContent(); + $res['display_link'] = $liberty_content->getDisplayLink(NULL,$res); + $attached_to[] = $res; + } + + return $attached_to; + + + } + } ?> diff --git a/templates/attachments.tpl b/templates/attachments.tpl index 60ff9ad..59f512b 100644 --- a/templates/attachments.tpl +++ b/templates/attachments.tpl @@ -27,7 +27,7 @@ {if $smarty.request.attachment_id} <ul class="data" id="usage"> - <li>{tr}This attachment is used in the following content{/tr}: + <li>{tr}Attachment ID:{/tr} {$smarty.request.attachment_id} {tr}is used in the following content{/tr}: <ul> {foreach from=$attachmentUsage item=content} <li class="{cycle values="odd,even"} item"> |
