Changeset 7

Show
Ignore:
Timestamp:
10/01/06 21:04:17 (2 years ago)
Author:
misja
Message:

Forgot two files ...

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • friendicon/mod/friendicon/lib.php

    r5 r7  
    11<?php 
    22 
    3     function friendicon_pagesetup() 
    4     { 
     3    function friendicon_init() { 
    54        global $CFG, $function; 
    65 
    7         // Replace the displaying of the friends and add the image element  
     6        $function['userdetails:init'][] = $CFG->dirroot . 'mod/friendicon/friendicon_userdetails_actions.php'; 
     7        $function['userdetails:edit:details'][] = $CFG->dirroot . 'mod/friendicon/friendicon_userdetails_edit_details.php'; 
     8    } 
     9 
     10    function friendicon_pagesetup() { 
     11        global $CFG, $function; 
     12 
     13        // Replace the displaying of the friends and add the image element 
    814        $i = 0; 
    915        foreach ($function['users:infobox'] as $element) { 
     
    1521        } 
    1622    } 
     23     
     24    function friendicon_userdetails_edit_details($userid) { 
     25        $title = gettext("Sidebar friend icon:"); 
     26        $blurb = gettext("Choose if you would like your friends user icons displayed in your sidebar friends list."); 
    1727 
     28        $body = <<< END 
     29            <h2>$title</h2> 
     30            <p>$blurb</p> 
     31END; 
     32 
     33        $true = gettext('Yes'); 
     34        $false = gettext('No'); 
     35 
     36        $checked_true = ''; 
     37        $checked_false = ''; 
     38 
     39        $setting = user_flag_get('friendicon_sidebar', $userid); 
     40                 
     41        if (!empty($setting)) { 
     42            if ($setting == 'true') { 
     43                $checked_true = 'checked="checked"'; 
     44            } elseif ($setting == 'false') { 
     45                $checked_false = 'checked="checked"'; 
     46            } 
     47        } else { 
     48            // Default 
     49            $checked_false = 'checked="checked"'; 
     50        } 
     51 
     52        $chooser = <<< END 
     53            <input type="radio" name="friendicon_sidebar" value="true" {$checked_true}/>&nbsp;{$true}&nbsp; 
     54            <input type="radio" name="friendicon_sidebar" value="false" {$checked_false}/>&nbsp;{$false} 
     55END; 
     56 
     57        $body .= templates_draw( array( 
     58                    'context' => 'databox', 
     59                    'name' => gettext("Sidebar user icon: "), 
     60                    'column1' => $chooser 
     61        ) 
     62        ); 
     63         
     64        return $body; 
     65    } 
     66 
     67    function friendicon_userdetails_actions() { 
     68         
     69        global $messages; 
     70 
     71        $action = optional_param('action'); 
     72        $id = optional_param('id',0,PARAM_INT); 
     73        $friendicon_sidebar = optional_param('friendicon_sidebar','false',TEXT); 
     74        $friendicon_sidebar_db = user_flag_get('friendicon_sidebar', $id); 
     75 
     76        if (logged_on && !empty($action) && run("permissions:check", array("userdetails:change",$id)) && $action == "userdetails:update") { 
     77            if (!empty($friendicon_sidebar)) { 
     78                if ($friendicon_sidebar != $friendicon_sidebar_db) { 
     79                    if(user_flag_set('friendicon_sidebar', $friendicon_sidebar, $id)) { 
     80                        $messages[] .= gettext("Display of user icons") . " " . gettext("saved") ."."; 
     81                    } else { 
     82                        $messages[] .= gettext("Display of user icons") . " " . gettext("not saved") ."."; 
     83                    } 
     84                } 
     85            } 
     86        } 
     87    } 
    1888?> 
  • friendicon/mod/friendicon/user_info.php

    r5 r7  
    22 
    33global $profile_id; 
    4 global $CFG
     4global $CFG, $USER
    55 
    66// Given a title and series of user IDs as a parameter, will display a box containing the icons and names of each specified user 
     
    4949            $usermenu = ''; 
    5050 
     51            $body .= '<li>'; 
     52 
     53            if ($icon = user_flag_get('friendicon_sidebar', $USER->ident)) { 
    5154            $body .= <<< END 
    52         <li> 
    53             <img src="{$CFG->wwwroot}{$info->username}/icons/{$info->icon}/h/47/w/47"/ alt="{$username}"><br/> 
     55            <a href="{$CFG->wwwroot}{$info->username}/"> 
     56                <img src="{$CFG->wwwroot}{$info->username}/icons/{$info->icon}/h/47/w/47"/ alt="{$username}"> 
     57            </a> 
     58            <br/> 
     59END; 
     60            } 
     61 
     62            $body .= <<< END 
    5463            <a href="{$CFG->wwwroot}{$info->username}/">{$username}</a> 
    5564        </li>