Changeset 7
- Timestamp:
- 10/01/06 21:04:17 (2 years ago)
- Files:
-
- friendicon/mod/friendicon/lib.php (modified) (2 diffs)
- friendicon/mod/friendicon/user_info.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
friendicon/mod/friendicon/lib.php
r5 r7 1 1 <?php 2 2 3 function friendicon_pagesetup() 4 { 3 function friendicon_init() { 5 4 global $CFG, $function; 6 5 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 8 14 $i = 0; 9 15 foreach ($function['users:infobox'] as $element) { … … 15 21 } 16 22 } 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."); 17 27 28 $body = <<< END 29 <h2>$title</h2> 30 <p>$blurb</p> 31 END; 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}/> {$true} 54 <input type="radio" name="friendicon_sidebar" value="false" {$checked_false}/> {$false} 55 END; 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 } 18 88 ?> friendicon/mod/friendicon/user_info.php
r5 r7 2 2 3 3 global $profile_id; 4 global $CFG ;4 global $CFG, $USER; 5 5 6 6 // Given a title and series of user IDs as a parameter, will display a box containing the icons and names of each specified user … … 49 49 $usermenu = ''; 50 50 51 $body .= '<li>'; 52 53 if ($icon = user_flag_get('friendicon_sidebar', $USER->ident)) { 51 54 $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/> 59 END; 60 } 61 62 $body .= <<< END 54 63 <a href="{$CFG->wwwroot}{$info->username}/">{$username}</a> 55 64 </li>
