]> git.mxchange.org Git - friendica.git/blobdiff - mod/contacts.php
.
[friendica.git] / mod / contacts.php
index fb4595739b5e1f3047ddf67d1b4bb0b6075e2fb8..6e62ec8ef5538595ba8e9dccbfdde48a883d7940 100644 (file)
@@ -2,6 +2,7 @@
 
 require_once('include/Contact.php');
 require_once('include/socgraph.php');
+require_once('include/contact_selectors.php');
 
 function contacts_init(&$a) {
        if(! local_user())
@@ -28,39 +29,40 @@ function contacts_init(&$a) {
 
        if($contact_id) {
                        $a->data['contact'] = $r[0];
-                       $o .= '<div class="vcard">';
-                       $o .= '<div class="fn">' . $a->data['contact']['name'] . '</div>';
-                       $o .= '<div id="profile-photo-wrapper"><img class="photo" style="width: 175px; height: 175px;" src="' . $a->data['contact']['photo'] . '" alt="' . $a->data['contact']['name'] . '" /></div>';
-                       $o .= '</div>';
-                       $a->page['aside'] .= $o;
-
+                       $vcard_widget = replace_macros(get_markup_template("vcard-widget.tpl"),array(
+                               '$name' => $a->data['contact']['name'],
+                               '$photo' => $a->data['contact']['photo']
+                       ));
+                       $follow_widget = '';
        }       
-       else
-               $a->page['aside'] .= follow_widget();
-
-       $a->page['aside'] .= group_side('contacts','group',false,0,$contact_id);
+       else {
+               $vcard_widget = '';
+               $follow_widget = follow_widget();
+       }
 
-       $a->page['aside'] .= findpeople_widget();
+       $groups_widget .= group_side('contacts','group',false,0,$contact_id);
+       $findpeople_widget .= findpeople_widget();
+       $networks_widget .= networks_widget('contacts',$_GET['nets']);
+       $a->page['aside'] .= replace_macros(get_markup_template("contacts-widget-sidebar.tpl"),array(
+               '$vcard_widget' => $vcard_widget,
+               '$follow_widget' => $follow_widget,
+               '$groups_widget' => $groups_widget,
+               '$findpeople_widget' => $findpeople_widget,
+               '$networks_widget' => $networks_widget
+       ));
 
-       $a->page['aside'] .= networks_widget('contacts',$_GET['nets']);
        $base = $a->get_baseurl();
+       $tpl = get_markup_template("contacts-head.tpl");
+       $a->page['htmlhead'] .= replace_macros($tpl,array(
+               '$baseurl' => $a->get_baseurl(true),
+               '$base' => $base
+       ));
 
-       $a->page['htmlhead'] .= '<script src="' . $a->get_baseurl(true) . '/library/jquery_ac/friendica.complete.js" ></script>';
-       $a->page['htmlhead'] .= <<< EOT
-
-<script>$(document).ready(function() { 
-       var a; 
-       a = $("#contacts-search").autocomplete({ 
-               serviceUrl: '$base/acl',
-               minChars: 2,
-               width: 350,
-       });
-       a.setOptions({ params: { type: 'a' }});
-
-}); 
-
-</script>
-EOT;
+       $tpl = get_markup_template("contacts-end.tpl");
+       $a->page['end'] .= replace_macros($tpl,array(
+               '$baseurl' => $a->get_baseurl(true),
+               '$base' => $base
+       ));
 
 
 }
@@ -210,6 +212,9 @@ function contacts_content(&$a) {
                                intval($contact_id),
                                intval(local_user())
                        );
+                       if ($archived) {
+                               q("UPDATE `item` SET `private` = 2 WHERE `contact-id` = %d AND `uid` = %d", intval($contact_id), intval(local_user()));
+                       }
                        if($r) {
                                //notice( t('Contact has been ') . (($archived) ? t('archived') : t('unarchived')) . EOL );
                                info( (($archived) ? t('Contact has been archived') : t('Contact has been unarchived')) . EOL );
@@ -247,6 +252,10 @@ function contacts_content(&$a) {
                        '$baseurl' => $a->get_baseurl(true),
                        '$editselect' => $editselect,
                ));
+               $a->page['end'] .= replace_macros(get_markup_template('contact_end.tpl'), array(
+                       '$baseurl' => $a->get_baseurl(true),
+                       '$editselect' => $editselect,
+               ));
 
                require_once('include/contact_selectors.php');
 
@@ -337,7 +346,7 @@ function contacts_content(&$a) {
 
                $lost_contact = (($contact['archive'] && $contact['term-date'] != '0000-00-00 00:00:00' && $contact['term-date'] < datetime_convert('','','now')) ? t('Communications lost with this contact!') : '');
 
-               $o .= replace_macros($tpl,array(
+               $o .= replace_macros($tpl, array(
                        '$header' => t('Contact Editor'),
                        '$tab_str' => $tab_str,
                        '$submit' => t('Submit'),
@@ -379,7 +388,7 @@ function contacts_content(&$a) {
                        '$dir_icon' => $dir_icon,
                        '$alt_text' => $alt_text,
                        '$sparkle' => $sparkle,
-                       '$url' => $url
+                       '$url' => $url,
 
                ));
 
@@ -562,7 +571,7 @@ function contacts_content(&$a) {
        }
        
        $tpl = get_markup_template("contacts-template.tpl");
-       $o .= replace_macros($tpl,array(
+       $o .= replace_macros($tpl, array(
                '$header' => t('Contacts') . (($nets) ? ' - ' . network_to_name($nets) : ''),
                '$tabs' => $t,
                '$total' => $total,