summaryrefslogtreecommitdiff
path: root/templates/sidebar.block.watchlist.php
blob: 5b476ea1502d2d7d6290e22cb454d043fb51b06a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
/* Service creation: only useful services are created */
//No specific services

$watching = $userservice->getWatchNames($userid);
$watchedBy = $userservice->getWatchNames($userid, true);

$closeContacts = array(); // people in my contacts list and whose I am also in the contacts list
foreach($watching as $watchuser) {
	if(in_array($watchuser, $watchedBy)) {
		$closeContacts[] = $watchuser;
	}
}

?>

<?php if(count($closeContacts)>0):?>
<h2 title="<?php echo T_('Close contacts are mutual contacts');?>"><?php echo ' &harr '. T_('Close contacts'); ?></h2>
<div id="watching">
    <ul>
    <?php foreach($watching as $watchuser): ?>
        <li><a href="<?php echo createURL('bookmarks', $watchuser); ?>"><?php echo $watchuser; ?></a> </li>
    <?php endforeach; ?>
    </ul>
</div>
<?php endif; ?>


<h2><?php echo ' &rarr '. T_('Watching'); ?></h2>
<div id="watching">
    <ul>
        <?php if($userservice->isLoggedOn() && $currentUser->getUsername() == $user): ?>            
        <li>
          <form action="<?php echo createURL('watch', '');?>" method="post">
            <input type="text" name="contact" value="<?php echo T_('Add a contact...');?>" onfocus="if (this.value == '<?php echo T_('Add a contact...');?>') this.value = '';" onblur="if (this.value == '') this.value = '<?php echo T_('Add a contact...');?>';" title="<?php echo T_('Type a username to add it to your contacts.') ?>" />
          </form>
        </li>
        <?php endif; ?>
            
    <?php if(count($watching) == 0):?>
        <li><?php echo T_("Nobody");?></li>    
    <?php endif; ?>
    
    <?php foreach($watching as $watchuser): ?>
        <li><a href="<?php echo createURL('bookmarks', $watchuser); ?>"><?php echo $watchuser; ?></a>
        <?php if($userservice->isLoggedOn() && $currentUser->getUsername() == $user): ?>
         - <a href="<?php echo createUrl('watch','?contact='.$watchuser); ?>" title="<?php echo T_('Remove this contact'); ?>">x<a/>
        </li>
        <?php endif; ?>  
    <?php endforeach; ?>
        
    </ul>
</div>

<h2><?php echo ' &larr '. T_('Watched by'); ?></h2>
<div id="watching">
    <ul>
    <?php foreach($watchedBy as $watchuser): ?>
        <li><a href="<?php echo createURL('bookmarks', $watchuser); ?>"><?php echo $watchuser; ?></a> </li>
    <?php endforeach; ?>
    </ul>

</div>