f8eb9a4c2e04f76c1c0fcf19bd42cf8c3f0ee746
[atutor.git] / mods / social / html / sgroup_search.tmpl.php
1 <script src="<?php echo AT_SOCIAL_BASENAME; ?>lib/js/livesearch.js" type="text/javascript"></script>
2 <?php 
3         //Generate a random number for the search input name fields, so that the browser will not remember any previous entries.
4         $rand = md5(rand(0, time())); 
5         if ($this->rand_key != ''){
6                 $last_search = $_POST['search_groups_'.$this->rand_key];
7         } else {
8                 $last_search = $_POST['search_groups_'.$rand];  
9         }
10         //take out double quotes until there is a way to escape XSS from the ajax script.
11         $last_search = preg_replace('/\"/', '', $last_search);
12 ?>
13 <div class="input-form" style="width:40%;padding:1em;min-height:4.5em;">
14 <h3><?php echo _AT('search_for_groups'); ?></h3>
15         <form action="<?php echo AT_SOCIAL_BASENAME.'groups/search.php'; ?>" method="POST" id="search_group_form">
16                 <div class="row">
17                         <label for="search_groups"><?php echo _AT('search'); ?></label>
18                                 <input type="text" size="60" name="search_groups_<?php echo $rand;?>" id="search_groups" value="<?php echo $last_search; ?>" onkeyup="showResults(this.value, 'livesearch', '<?php echo AT_SOCIAL_BASENAME; ?>groups/search.php')"/>
19                         <input type="hidden" name="rand_key" value="<?php echo $rand;?>"/>
20                         <input class="button" type="submit" name="search" value="<?php echo _AT('search'); ?>" />
21                         <span style="float:right"><a href="<?php echo AT_SOCIAL_BASENAME; ?>groups/create.php"><?php echo _AT('create_group'); ?></a></span><br />
22                         <div id="livesearch"></div>
23                 </div>
24         </form>
25 </div>
26
27         <div class="headingbox"><h3><?php echo _AT('search_results'); ?></h3></div>
28         <div class="contentbox">
29                 <?php if (!empty($this->search_result)):
30                 foreach($this->search_result as $group_id=>$group_array): 
31                 $grp_obj = $group_array['obj'];
32                 ?>
33                 <div class="box">
34                         <div style="float:left;">
35                         <?php echo $grp_obj->getLogo(); ?>
36                         
37                         </div>
38                         <div style="float:left; padding-left:0.5em;">
39                         <a href="<?php echo url_rewrite(AT_SOCIAL_BASENAME.'groups/view.php?id='.$grp_obj->getId());?>"><h4><?php echo $grp_obj->getName(); ?></h4></a><br/>
40                                 <?php echo _AT('type') .': '. $grp_obj->getGroupType();?><br/>
41                                 <?php echo _AT('description') .': <br/>'. $grp_obj->getDescription();?><br/>
42                         </div>
43                         <div style="clear:both;"></div>
44                 </div>
45                 <?php endforeach; 
46                 else: 
47                         echo _AT('none_found');
48                 endif;?>
49         </div>
50
51 </div>