da3172de24f35712b8f6b38dd1b70f2e7858b5e8
[atutor.git] / docs / themes / simplified-desktop / social / 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
14 <div class="input-form">
15         <div class="contentrow">
16                 <h3><?php echo _AT('search_for_friends'); ?></h3>
17                 <form action="<?php echo url_rewrite(AT_SOCIAL_BASENAME.'index_public.php');?>" method="POST" id="search_friends_form">
18                         <label for="searchFriends" style="display:none;"><?php echo _AT('search'); ?></label>
19                         <input type="text" size="40" 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')"/>
20                         <input type="submit" name="search" value="<?php echo _AT('search'); ?>">
21                         <input type="hidden" name="rand_key" value="<?php echo $rand; ?>" />
22                         
23                         <div id="livesearch"></div>
24                 </form>
25         </div>
26 </div>
27 <div>
28         <div class="headingbox"><h3><?php echo _AT('search_results'); ?></h3></div>
29         <div class="contentbox">
30         <?php 
31         if (!empty($this->friends)):
32                 $privacy_controller = new PrivacyController();
33                 echo "<h4>"._AT('there_are_entries', sizeof($this->friends))."</h4>";
34                 foreach ($this->friends as $id=>$person): 
35                         $privacy_obj = $privacy_controller->getPrivacyObject($id);
36 //                      debug($privacy_obj->getSearch(), 'search'.$id);
37                         $relationship = $privacy_controller->getRelationship($id);
38
39                         if ((!isset($person['added']) || $person['added']!=1) && !PrivacyController::validatePrivacy(AT_SOCIAL_SEARCH_VISIBILITY, $relationship, $privacy_obj->getSearch())){
40                                 //if this user doesn't want to be searched.
41                                 continue;
42                         }
43         ?>
44         <div class="contact_mini" >
45                 <div>
46                         <div ><?php echo printSocialProfileImg($id); ?></div>
47                         <div>
48                                 <?php 
49                                         $member_obj = new Member($id);
50                                         $profile = $member_obj->getAddress();
51                                         echo printSocialName($id) . '<br/>';
52                                         echo $profile['country'] . ' ' . $profile['province'] . '<br/>';
53                                 ?>
54                         </div>
55                         <div style="clear:both;"></div><br/>
56                 </div>  
57         </div>
58         <?php 
59                 endforeach; 
60                 else: 
61                         echo _AT('none_found');
62         endif;
63         ?>
64         </div>
65         <!--
66         <div style="float:right;">
67                 [-- TODO: Paginator --]
68         </div>
69         -->
70 </div>
71 </div>
72 <div style="clear:both;"></div>
73 <?php print_paginator($this->page, $this->num_pages, 'search_friends='.$this->search_field, 1);  ?>