From 65aa6cf708a34e20ebad3c6b6dfc4088e927cce1 Mon Sep 17 00:00:00 2001 From: marijus Date: Tue, 27 Jan 2015 19:00:16 +0100 Subject: move userReadableSize() and getIconFromType() from /include/RedDAV/RedBrowser.php to include/text.php and add template for mod/sharedwithme --- mod/sharedwithme.php | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) (limited to 'mod') diff --git a/mod/sharedwithme.php b/mod/sharedwithme.php index 8b7d2661c..56cbc35ec 100644 --- a/mod/sharedwithme.php +++ b/mod/sharedwithme.php @@ -73,27 +73,37 @@ function sharedwithme_content(&$a) { dbesc($channel['channel_hash']) ); - $o = profile_tabs($a, $is_owner, $channel['channel_address']); - - $o .= '
'; - - $o .= ' ' . t('Remove all entries') . ''; - - $o .= '

' . t('Files shared with me') . '

'; - - $o .= '
'; - - $o .= '
'; + $items =array(); if($r) { foreach($r as $rr) { $object = json_decode($rr['object'],true); - $url = rawurldecode(get_rel_link($object['link'],'alternate')); - $o .= '' . $url . ' 

'; + + $item = array(); + $item['id'] = $rr['id']; + $item['objfiletype'] = $object['filetype']; + $item['objfiletypeclass'] = getIconFromType($object['filetype']); + $item['objurl'] = rawurldecode(get_rel_link($object['link'],'alternate')) . '?f=&zid=' . $channel['xchan_addr']; + $item['objfilename'] = $object['filename']; + $item['objfilesize'] = userReadableSize($object['filesize']); + $item['objedited'] = $object['edited']; + + $items[] = $item; + } } - $o .= '
'; + $o = profile_tabs($a, $is_owner, $channel['channel_address']); + + $o .= replace_macros(get_markup_template('sharedwithme.tpl'), array( + '$header' => t('Files: shared with me'), + '$name' => t('Name'), + '$size' => t('Size'), + '$lastmod' => t('Last Modified'), + '$dropall' => t('Remove all files'), + '$drop' => t('Remove this file'), + '$items' => $items + )); return $o; -- cgit v1.2.3