diff options
| author | Tyler Bello <tylerbello@users.sourceforge.net> | 2009-09-24 19:21:39 +0000 |
|---|---|---|
| committer | Tyler Bello <tylerbello@users.sourceforge.net> | 2009-09-24 19:21:39 +0000 |
| commit | aba8836cd19cb30065b81c1464f79ff3ac226d79 (patch) | |
| tree | b637e8a39231592eaefe70cbfc83cf3156dc00bc | |
| parent | 1877271b76d6496ad6e0ab4e53f0dc0f4653d32e (diff) | |
| download | feed-aba8836cd19cb30065b81c1464f79ff3ac226d79.tar.gz feed-aba8836cd19cb30065b81c1464f79ff3ac226d79.tar.bz2 feed-aba8836cd19cb30065b81c1464f79ff3ac226d79.zip | |
center modules that pull recent comments including status changes and comments on statuses
| -rwxr-xr-x | templates/center_recent_comments.php | 44 | ||||
| -rwxr-xr-x | templates/center_recent_comments.tpl | 19 |
2 files changed, 63 insertions, 0 deletions
diff --git a/templates/center_recent_comments.php b/templates/center_recent_comments.php new file mode 100755 index 0000000..4cc25c1 --- /dev/null +++ b/templates/center_recent_comments.php @@ -0,0 +1,44 @@ +<?php + +require_once( LIBERTY_PKG_PATH.'LibertyComment.php' ); +global $gQueryUser, $gBitUser, $gLibertySystem, $moduleParams; +$params = $moduleParams['module_params']; +$moduleTitle = !empty($moduleParams['title'])? $moduleParams['title'] : 'Recent Activity'; + +$userId = NULL; + +if( !empty( $gQueryUser->mUserId ) ) { + $userId = $gQueryUser->mUserId; +} + +$listHash = array( + 'user_id' => $userId, + 'max_records' => $moduleParams['module_rows'], +); + +if (!empty($params['full'])) { + $listHash['parse'] = TRUE; +} + +$listHash['full'] = TRUE; +$listHash['thumb_size'] = 'avatar'; +$listHash['show_date'] = TRUE; +$listHash['root_content_type_guid'] = array('fisheyeimage','fisheyegallery','bituser','fisheyeflickrimage','fisheyeflickrset','feedstatus'); + +$gBitSmarty->assign( 'moduleTitle', $moduleTitle ); +$lcom = new LibertyComment(); +$modLastComments = $lcom->getList( $listHash ); +$keys = array_keys( $modLastComments ); +foreach( $keys as $k ) { + if($modLastComments[$k]['parent_content_type_guid'] == 'feedstatus'){ //if comment is a reply to a status, use the poster as the object, otherwise our thumbnail will be of the content we commented on (the other user,status) + $user = new BitUser( $modLastComments[$k]['user_id'] ); + $user->load(); + $modLastComments[$k]['object'] = $user; + }else{ //If a comment on a piece of content, use piece of content as object in question + $modLastComments[$k]['object'] = LibertyBase::getLibertyObject( $modLastComments[$k]['root_id'], $modLastComments[$k]['root_content_type_guid'] ); + } +} + +$gBitSmarty->assign( 'modLastComments', $modLastComments ); + +?> diff --git a/templates/center_recent_comments.tpl b/templates/center_recent_comments.tpl new file mode 100755 index 0000000..3c078a3 --- /dev/null +++ b/templates/center_recent_comments.tpl @@ -0,0 +1,19 @@ +{strip} +{if $modLastComments} +<div class="listing fisheye"> + <div class="header"> + <h1>{tr}{$moduleTitle}{/tr}</h1> + </div> + <div class="body"> + {section name=ix loop=$modLastComments} + <div style="clear:both;"> + <a href="{$modLastComments[ix].object->getDisplayUrl()}"><img style="width:50px;height:50px;float:left;" src="{if $modLastComments[ix].object->getThumbnailUrl($moduleParams.module_params.thumb_size)}{$modLastComments[ix].object->getThumbnailUrl($moduleParams.module_params.thumb_size)}{else}{$smarty.const.USERS_PKG_URL}icons/silhouette.png{/if}" alt="{$modLastComments[ix].object->getTitle()|escape}" title="{$modLastComments[ix].object->getTitle()|escape}" /></a> + <div style="width:550px;float:left;margin-left:10px;vertical-align:top;min-height:40px;margin-bottom:10px;background-color:#eee;padding:5px;"> + {displayname hash=$modLastComments[ix]} {$modLastComments[ix].parsed_data} + <small>{$modLastComments[ix].last_modified|bit_short_datetime}</small> + </div> + </div> + {/section} + </div> <!-- end .body --> +{/if} +{/strip} |
