fae614b36170b0cf45bd97980d6c0705774a3f51
[atutor.git] / mods / social / html / index_public.tmpl.php
1 <script src="<?php echo AT_SOCIAL_BASENAME; ?>lib/js/livesearch.js" type="text/javascript"></script>
2 <?php 
3         //Add Friends Template
4         //Generate a random number for the search input name fields, so that the browser will not remember any previous entries.
5         $rand = md5(rand(0, time())); 
6         if ($this->rand_key != ''){
7                 $last_search = $_POST['search_friends_'.$this->rand_key];
8         } else {
9                 $last_search = $_POST['search_friends_'.$rand]; 
10         }
11 ?>
12 <?php print_paginator($this->page, $this->num_pages, 'search_friends='.$this->search_field, 1);  ?>
13 <div class="input-form" style="float:right; width:34%;padding:1em;min-height:4.5em;">
14         <div class="contentrow">
15                 <h3><?php echo _AT('search_for_friends'); ?></h3>
16                 <form action="<?php echo url_rewrite(AT_SOCIAL_BASENAME.'index_public.php');?>" method="POST" id="search_friends_form">
17                         <label for="searchFriends" style="display:none;"><?php echo _AT('search'); ?></label>
18                         <input type="text" size="60" name="search_friends_<?php echo $rand;?>" id="search_friends" value="<?php echo $last_search; ?>" onkeyup="showResults(this.value, 'livesearch', '<?php echo AT_SOCIAL_BASENAME; ?>index_public.php')"/>
19                         <input type="submit" name="search" value="<?php echo _AT('search'); ?>">
20                         <input type="hidden" name="rand_key" value="<?php echo $rand; ?>" />
21                         
22                         <div id="livesearch"></div>
23                 </form>
24         </div>
25 </div>
26 <div class="" style="float:left; width:59%">
27         <div class="headingbox"><h3><?php echo _AT('search_results'); ?></h3></div>
28         <div class="contentbox">
29         <?php 
30         if (!empty($this->friends)):
31                 $privacy_controller = new PrivacyController();
32                 echo "<h4>"._AT('there_are_entries', sizeof($this->friends))."</h4>";
33                 foreach ($this->friends as $id=>$person): 
34                         $privacy_obj = $privacy_controller->getPrivacyObject($id);
35 //                      debug($privacy_obj->getSearch(), 'search'.$id);
36                         $relationship = $privacy_controller->getRelationship($id);
37
38                         if ((!isset($person['added']) || $person['added']!=1) && !PrivacyController::validatePrivacy(AT_SOCIAL_SEARCH_VISIBILITY, $relationship, $privacy_obj->getSearch())){
39                                 //if this user doesn't want to be searched.
40                                 continue;
41                         }
42         ?>
43         <div class="contact_mini" >
44                 <div>
45                         <div style="float:left;"><?php echo printSocialProfileImg($id); ?></div>
46                         <div style="padding-left:0.5em; float:left;">
47                                 <?php 
48                                         $member_obj = new Member($id);
49                                         $profile = $member_obj->getAddress();
50                                         echo printSocialName($id) . '<br/>';
51                                         echo $profile['country'] . ' ' . $profile['province'] . '<br/>';
52                                 ?>
53                         </div>
54                         <div style="clear:both;"></div><br/>
55                 </div>  
56         </div>
57         <?php 
58                 endforeach; 
59                 else: 
60                         echo _AT('none_found');
61         endif;
62         ?>
63         </div>
64         <!--
65         <div style="float:right;">
66                 [-- TODO: Paginator --]
67         </div>
68         -->
69 </div>
70 <div style="clear:both;"></div>
71 <?php print_paginator($this->page, $this->num_pages, 'search_friends='.$this->search_field, 1);  ?>