Changeset 19976
- Timestamp:
- 09/26/08 21:33:26 (5 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
events/phpframework/codeigniter/trunk/system/application/helpers/MY_url_helper.php
r19450 r19976 6 6 } 7 7 8 function picture($ size)8 function picture($username, $image, $size, $class) 9 9 { 10 $CI =& get_instance(); 11 $username = $CI->session->userdata('username'); 12 $image = $CI->session->userdata('image'); 10 $str = ''; 11 $attr = ''; 12 13 if ($username) 14 { 15 $attr = 'alt="' . $username . '" '; 16 } 17 18 if ($class) 19 { 20 $attr .= 'class="' . $class . '" '; 21 } 22 13 23 if ($image) 14 24 { … … 16 26 $ext = '.' . end($x); 17 27 $raw_name = str_replace($ext, '', $image); 28 18 29 if ($size == 31) 19 30 { … … 32 43 switch ($size) { 33 44 case 24: 34 $str = '<img src="' . base_url() . $filename . '" height="24" width="24">';45 $str = '<img src="' . base_url() . $filename . '" ' . $attr . 'height="24" width="24" />'; 35 46 break; 36 47 case 31: 37 $str = '<img src="' . base_url() . $filename . '" height="31" width="31">';48 $str = '<img src="' . base_url() . $filename . '" ' . $attr . 'height="31" width="31" />'; 38 49 break; 39 50 case 48: 40 $str = '<img src="' . base_url() . $filename . '" height="48" width="48">';51 $str = '<img src="' . base_url() . $filename . '" ' . $attr . 'height="48" width="48" />'; 41 52 break; 42 53 case 73: 43 $str = '<img src="' . base_url() . $filename . '" height="73" width="73">';54 $str = '<img src="' . base_url() . $filename . '" ' . $attr . 'height="73" width="73" />'; 44 55 break; 45 56 } … … 47 58 return $str; 48 59 } 60 61 function my_pict($size) 62 { 63 $CI =& get_instance(); 64 $image = $CI->session->userdata('image'); 65 66 return picture('', $image, $size, ''); 67 } 68 69 70 /* 本来は date helper かな */ 71 function posted_time($time) 72 { 73 $elapsed = time() - $time; 74 75 if ($elapsed < 60) 76 { 77 $str = (intval($elapsed / 5) + 1) * 5 . '秒以内'; 78 } 79 else if ($elapsed < 60 * 60) 80 { 81 $str = '約' . round($elapsed / 60) . '分前'; 82 } 83 else if ($elapsed < 60 * 60 * 24) 84 { 85 $str = '約' . round($elapsed / (60 * 60)) . '時間前'; 86 } 87 else 88 { 89 $str = date('h:i A F d, Y', $time); 90 } 91 92 return $str; 93 }
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)