Changeset 1603

Show
Ignore:
Timestamp:
06/09/08 08:02:17 (6 months ago)
Author:
misja
Message:

#357, Search of usernames - thanks justinr

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • devel/mod/search/lib/search_suggest_users.php

    r1602 r1603  
    22global $CFG, $db, $PAGE; 
    33 
    4 if (isset($parameter)) { 
     4if (isset($parameter) && $parameter) { 
    55     
    66    if (!empty($PAGE->search_type_unformatted)) { 
     
    2828            $run_result .= "<h2>" . __gettext("Matching users and communities:") . "</h2><p>"; 
    2929        } 
     30        /* 
    3031        foreach($results as $returned_name) { 
    3132            $run_result .= "<a href=\"" . url . $returned_name->username . '/">' . htmlspecialchars($returned_name->name) . "</a> <br />"; 
    3233        } 
     34        */ 
     35 
     36        $body .= <<< END 
     37    <table class="userlist"> 
     38        <tr> 
     39END; 
     40        $i = 1; 
     41        $w = 100; 
     42        if (sizeof($result) > 4) { 
     43          $w = 50; 
     44        } 
     45 
     46        foreach($results as $key => $info) { 
     47          $friends_username = $info->username; 
     48          $friends_name = run("profile:display:name",$info->ident); 
     49          $info->icon = run("icons:get",$info->ident); 
     50          $friends_icon = user_icon_html($info->ident,$w); 
     51          $body .= <<< END 
     52        <td align="center"> 
     53            <p> 
     54            <a href="{$CFG->wwwroot}{$friends_username}/"> 
     55            {$friends_icon}</a><br /> 
     56            <span class="userdetails"> 
     57                <a href="{$CFG->wwwroot}{$friends_username}/">{$friends_name}</a> 
     58            </span> 
     59            </p> 
     60        </td> 
     61END; 
     62          if ($i % 5 == 0) { 
     63            $body .= "</tr><tr>"; 
     64          } 
     65          $i++; 
     66        } 
     67        $body .= <<< END 
     68    </tr> 
     69    </table> 
     70END; 
     71        $run_result .= $body; 
     72 
     73 
    3374        $run_result .= "</p>"; 
    3475