summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kremmel <xing@synapse.plus.com>2006-11-26 12:51:58 +0000
committerMax Kremmel <xing@synapse.plus.com>2006-11-26 12:51:58 +0000
commitfb3e9b22fdbf672623f82a5499a3f9771d590fcd (patch)
tree34d9b99e0b126220ea7f04d9c310b253301eaa64
parentd1dc5cd0e22c4c546669424e6e4e77162c47c03d (diff)
downloadusers-fb3e9b22fdbf672623f82a5499a3f9771d590fcd.tar.gz
users-fb3e9b22fdbf672623f82a5499a3f9771d590fcd.tar.bz2
users-fb3e9b22fdbf672623f82a5499a3f9771d590fcd.zip
move getAttachmentList function to LibertyAttachable, where it belongs and add a basic page to list all available attachments - only admin may view attachments from other users as well. - functionally still somewhat lacking...
-rw-r--r--BitUser.php40
-rw-r--r--templates/menu_users.tpl5
2 files changed, 11 insertions, 34 deletions
diff --git a/BitUser.php b/BitUser.php
index 1771e53..090b59f 100644
--- a/BitUser.php
+++ b/BitUser.php
@@ -1,6 +1,6 @@
<?php
/**
- * $Header: /cvsroot/bitweaver/_bit_users/BitUser.php,v 1.115 2006/11/17 17:16:45 spiderr Exp $
+ * $Header: /cvsroot/bitweaver/_bit_users/BitUser.php,v 1.116 2006/11/26 12:51:58 squareing Exp $
*
* Lib for user administration, groups and permissions
* This lib uses pear so the constructor requieres
@@ -12,7 +12,7 @@
* All Rights Reserved. See copyright.txt for details and a complete list of authors.
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details
*
- * $Id: BitUser.php,v 1.115 2006/11/17 17:16:45 spiderr Exp $
+ * $Id: BitUser.php,v 1.116 2006/11/26 12:51:58 squareing Exp $
* @package users
*/
@@ -40,7 +40,7 @@ define("ACCOUNT_DISABLED", -6);
* Class that holds all information for a given user
*
* @author spider <spider@steelsun.com>
- * @version $Revision: 1.115 $
+ * @version $Revision: 1.116 $
* @package users
* @subpackage BitUser
*/
@@ -1265,37 +1265,9 @@ return false;
}
function getUserAttachments( &$pListHash ) {
- global $gLibertySystem;
- LibertyContent::prepGetList( $pListHash );
-
- $ret = NULL;
- $bindVars[] = $this->mUserId;
- $mid = '';
-
- if( $this->mUserId ) {
- // TODO: this query should check for unique combinations of foreign_id *and* attachment_plugin_guid
- // doing that causes mysql to choke
- $query = "SELECT DISTINCT( a.`foreign_id` ) AS `hash_key`, a.*
- FROM `".BIT_DB_PREFIX."liberty_attachments` a
- WHERE a.`user_id` = ? $mid";
- $result = $this->mDb->query( $query, $bindVars, $pListHash['max_records'], $pListHash['offset'] );
- while( $res = $result->fetchRow() ) {
- $attachments[] = $res;
- }
- $data = array();
- foreach( $attachments as $attachment ) {
- $loadFunc = $gLibertySystem->getPluginFunction( $attachment['attachment_plugin_guid'], 'load_function' );
- $data[] = $loadFunc( $attachment );
- }
- $ret['data'] = $data;
-
- // count all entries
- $queryc = "SELECT COUNT( DISTINCT( a.`foreign_id` ) ) AS `attachment_count`
- FROM `".BIT_DB_PREFIX."liberty_attachments` a
- WHERE a.`user_id` = ? $mid";
- $ret['cant'] = $this->mDb->getOne( $queryc, $bindVars );
- }
- return $ret;
+ $pListHash['user_id'] = $this->mUserId;
+ $libertyAttachable = new LibertyAttachable();
+ return $libertyAttachable->getAttachmentList( $pListHash );
}
function storeFavorite( $pContentId ) {
diff --git a/templates/menu_users.tpl b/templates/menu_users.tpl
index 301f690..76565a9 100644
--- a/templates/menu_users.tpl
+++ b/templates/menu_users.tpl
@@ -128,6 +128,11 @@
</a>
</li>
{/if}
+ <li>
+ <a class="item" href="{$smarty.const.LIBERTY_PKG_URL}attachments.php">
+ {biticon ipackage="icons" iname="mail-attachment" iexplain="Attachments" iforce=icon}{if !$icons_only} {tr}Attachments{/tr}{/if}
+ </a>
+ </li>
{else}
<li>
<a class="item" href="{$smarty.const.USERS_PKG_URL}login.php">