Show
Ignore:
Timestamp:
10/10/08 21:03:41 (8 weeks ago)
Author:
aarkerio
Message:

Little changes

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/app/views/entries/search.ctp

    r541 r806  
    11<?php 
     2//die(debug($data)); 
     3echo $html->div('title_portal', __('Search Results', true)); 
    24 
    3 echo $html->div('title_section','Results'); 
     5if ( count($data) < 1 ): 
     6  echo $html->div(null, 'Sorry, no search results'); 
     7else: 
     8  $num = (count($data['News']) + count($data['Entry'])); 
     9  echo $html->div(null, $num.' results found'); 
     10endif; 
    411 
    5 echo '<div style="padding:4px;margin:4px;">'; 
     12if (count($data['Entry']) > 0 ): 
     13 echo $html->div(null, 'Edublogs', array('style'=>'margin-top:10px;padding:4px;background-color:#ecebeb;font-size:13pt;')); 
     14 foreach($data['Entry'] as $e): 
     15      $tmp  = $html->link($e[0]['title'], '/entries/view/'.$e[0]['id']).'<br />';  
     16      $tmp .= 'Rank:'.$e[0]['rank'] .'<br /> '. $e[0]['ts_headline']; 
     17       echo $html->div(null, $tmp, array('style'=>'padding:4px;font-size:10pt;')); 
     18 endforeach; 
     19endif; 
    620 
    7 //die(print_r($data)); 
     21if (count($data['News']) > 0 ): 
     22 echo $html->div(null, __('News', true), array('style'=>'margin-top:10px;padding:4px;background-color:#ecebeb;font-size:13pt;')); 
     23 foreach($data['News'] as $n): 
     24      $tmp  = $html->link($n[0]['title'], '/news/view/'.$n[0]['id']).'<br />';  
     25      $tmp .= 'Rank:'.$n[0]['rank'] .'<br /> '. $n[0]['ts_headline']; 
     26       echo $html->div(null, $tmp, array('style'=>'padding:4px;font-size:10pt;')); 
     27 endforeach; 
     28endif; 
    829 
    9 $Models = array('Entry'=>'entries', 'News'=>'news', 'Podcast'=>'podcasts', 'Faq'=>'faqs', 'Glossary'=>'glossaries', 'Lesson'=>'lessons'); 
    10  
    11 $i = 0; 
    12  
    13 foreach( $Models as $model => $controller) 
    14  
    15    if (count($data[$model]) > 1 )  
    16    {  
    17      $i++; 
    18      echo '<div style="padding:4px;background-color:#ecebeb;font-size:14pt;">' . $model . '</div>'; 
    19      echo "<p>" .count($data[$model]) . " results found</p>"; 
    20        
    21      foreach ($data[$model] as $val)  
    22      {   
    23         switch($model) 
    24         { 
    25           case 'Entry': 
    26           echo '<p>'; 
    27            echo $html->link($val[$model]['title'], '/users/entry/' .$val[$model]['id'].'/'.$val[$model]['id']); 
    28               echo '</p>'; 
    29               break; 
    30                
    31           case 'News': 
    32               echo '<p><a href="/users/entry/' .$val[$model]['id'].'/'.$val[$model]['id'].'">' . $val[$model]['title'] . '</a></p>'; 
    33               break; 
    34                
    35           case 'Podcast': 
    36               echo '<p><a href="/users/entry/' .$val[$model]['id'].'/'.$val[$model]['id'].'">' . $val[$model]['title'] . '</a></p>'; 
    37               break; 
    38                
    39           case 'Faq': 
    40               echo '<p><a href="/users/entry/' .$val[$model]['id'].'/'.$val[$model]['id'].'">' . $val[$model]['question'] . '</a></p>'; 
    41               break; 
    42                
    43           case 'Glossary': 
    44               echo '<p><a href="/users/entry/' .$val[$model]['id'].'/'.$val[$model]['id'].'">' . $val[$model]['item'] . '</a></p>'; 
    45               break; 
    46                
    47           case 'Lesson': 
    48               echo '<p><a href="/users/entry/' .$val[$model]['id'].'/'.$val[$model]['id'].'">' . $val[$model]['title'] . '</a></p>'; 
    49               break; 
    50         } 
    51      } 
    52    } 
    53 } 
    54  
    55 if ( $i == 0): 
    56    echo "<h3>Sorry, no results found.</h3>"; 
    57 endif; 
    5830?> 
    59 </div>