]> git.mxchange.org Git - friendica.git/commitdiff
friend/contact sidebar block
authorFriendika <info@friendika.com>
Fri, 5 Nov 2010 12:01:54 +0000 (05:01 -0700)
committerFriendika <info@friendika.com>
Fri, 5 Nov 2010 12:01:54 +0000 (05:01 -0700)
boot.php
mod/profile.php
view/profile.php
view/theme/default/style.css

index eb52fb2a25cacc208e6bc1ccb0938bf423c81805..5aeb9ea9497f4c2b5adffb801677cf2dfab2c22b 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -1369,7 +1369,7 @@ function like_puller($a,$item,&$arr,$mode) {
        return;
 }}
 
-
+if(! function_exists('get_mentions')) {
 function get_mentions($item) {
        $o = '';
        if(! strlen($item['tag']))
@@ -1382,4 +1382,48 @@ function get_mentions($item) {
                        $o .= "\t\t" . '<link rel="mentioned" href="' . $matches[1] . '" />' . "\r\n";
        }
        return $o;
-}
\ No newline at end of file
+}}
+
+if(! function_exists('contact_block')) {
+function contact_block() {
+       $o = '';
+       $a = get_app();
+       if((! is_array($a->profile)) || ($a->profile['hide-friends']))
+               return $o;
+       $r = q("SELECT COUNT(*) AS `total` FROM `contact` WHERE `uid` = %d AND `self` = 0 ",
+                       intval($a->profile['uid'])
+       );
+       if(count($r)) {
+               $total = intval($r[0]['total']);
+       }
+       if(! $total) {
+               $o .= '<h4 class="contact-h4">' . t('No contacts') . '</h4>';
+               return $o;
+       }
+       $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 0 ORDER BY RAND() LIMIT 12",
+                       intval($a->profile['uid'])
+       );
+       if(count($r)) {
+               $o .= '<h4 class="contact-h4">' . $total . ' ' . t('Contacts') . '</h4><div id="contact-block">';
+               foreach($r as $rr) {
+                       $redirect_url = $a->get_baseurl() . '/redir/' . $rr['id'];
+                       if(local_user() && ($rr['uid'] == local_user())
+                               && ($rr['network'] === 'dfrn')) {
+                               $url = $redirect_url;
+                               $sparkle = ' sparkle';
+                       }
+                       else {
+                               $url = $rr['url'];
+                               $sparkle = '';
+                       }
+
+                       $o .= '<div class="contact-block-div"><a class="contact-block-link' . $sparkle . '" href="' . $url . '" ><img class="contact-block-img' . $sparkle . '" src="' . $rr['micro'] . '" title="' . $rr['name'] . ' [' . $rr['url'] . ']" alt="' . $rr['name'] . '" /></a></div>' . "\r\n";
+               }
+               $o .= '<div id="contact-block-end"></div>';
+               $o .=  '<div id="viewcontacts"><a id="viewcontacts-link" href="viewcontacts/' . $profile['nickname'] . '">' . t('View Contacts') . '</a></div>';
+               
+       }
+       return $o;
+
+}}
+
index a3148eea3de8a5e2efe0f3fe8312e9ebc3b8b128..99c775c4eedb38fb5d122e1844dcc7657dd102db 100644 (file)
@@ -41,6 +41,10 @@ function profile_load(&$a, $username, $profile = 0) {
        $a->page['title'] = $a->profile['name'];
        $_SESSION['theme'] = $a->profile['theme'];
 
+       if(! (x($a->page,'aside')))
+               $a->page['aside'] = '';
+       $a->page['aside'] .= contact_block();
+
        return;
 }}
 
index 1d036dc5cd383de9c1fcd599e0459f021be1ec95..b59a12b715d4281af9901aa887f222af221448ac 100644 (file)
@@ -23,8 +23,6 @@
        <?php if($profile['uid'] != $_SESSION['uid']) { ?>\r
        <li><a id="dfrn-request-link" href="dfrn_request/<?php echo $profile['nickname']; ?>">Connect</a></li>\r
        <?php } ?>\r
-       <?php if(! $profile['hide-friends']) echo '<li><a id="viewcontacts-link" href="viewcontacts/' . $profile['nickname'] . '">View Contacts</a></li>'; ?>\r
-\r
        </ul>\r
 \r
        </div>\r
index fd51e1d53c3dec744e1274c269823bfd9d907215..42da72d6a61dcaf6d9eb4ec5d29ea766500f22f3 100644 (file)
@@ -616,6 +616,9 @@ input#dfrn-url {
 #view-contact-end {
        clear: both;
 }
+#viewcontacts {
+       margin-top: 15px;
+}
 #profile-edit-default-desc {
        color: #FF0000;
        border: 1px solid #FF8888;
@@ -1780,3 +1783,15 @@ a.mail-list-link:hover {
        cursor: url('lock.cur'), pointer;
 /*     cursor: pointer !important; */
 }
+
+.contact-block-div {
+       float: left;
+       width: 52px;
+       height: 52px;
+}
+#contact-block-end {
+       clear: both;
+}
+.contact-block-link {
+       float: left;
+}
\ No newline at end of file