Changeset 3:cf375f1e7b0f for admin/index.php
- Timestamp:
- 04/27/11 09:06:30 (14 years ago)
- Branch:
- userprefs
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/index.php
r0 r3 46 46 $__dashboard_icons = new ArrayObject(); 47 47 48 # Dashboard favorites 48 49 $post_count = $core->blog->getPosts(array(),true)->f(0); 49 50 $str_entries = ($post_count > 1) ? __('%d entries') : __('%d entry'); … … 52 53 $str_comments = ($comment_count > 1) ? __('%d comments') : __('%d comment'); 53 54 54 $__dashboard_icons['new_post'] = new ArrayObject(array(__('New entry'),'post.php','images/menu/edit-b.png')); 55 $__dashboard_icons['posts'] = new ArrayObject(array(sprintf($str_entries,$post_count),'posts.php','images/menu/entries-b.png')); 56 $__dashboard_icons['comments'] = new ArrayObject(array(sprintf($str_comments,$comment_count),'comments.php','images/menu/comments-b.png')); 57 $__dashboard_icons['prefs'] = new ArrayObject(array(__('User preferences'),'preferences.php','images/menu/user-pref-b.png')); 58 59 if ($core->auth->check('admin',$core->blog->id)) 60 { 61 $__dashboard_icons['blog_pref'] = new ArrayObject(array(__('Blog settings'),'blog_pref.php','images/menu/blog-pref-b.png')); 62 $__dashboard_icons['blog_theme'] = new ArrayObject(array(__('Blog appearance'),'blog_theme.php','images/menu/blog-theme-b.png')); 63 } 64 65 $core->callBehavior('adminDashboardIcons', $core, $__dashboard_icons); 66 55 $ws = $core->auth->user_prefs->addWorkspace('favorites'); 56 $count = 0; 57 foreach ($ws->dumpPrefs() as $k => $v) { 58 // User favorites only 59 if (!$v['global']) { 60 $fav = unserialize($v['value']); 61 if (($fav['permissions'] == '*') || $core->auth->check($fav['permissions'],$core->blog->id)) { 62 $count++; 63 $title = ($fav['name'] == 'posts' ? sprintf($str_entries,$post_count) : 64 ($fav['name'] == 'comments' ? sprintf($str_comments,$comment_count) : $fav['title'])); 65 $__dashboard_icons[$fav['name']] = new ArrayObject(array($title,$fav['url'],$fav['large-icon'])); 66 } 67 } 68 } 69 if (!$count) { 70 // Global favorites if any 71 foreach ($ws->dumpPrefs() as $k => $v) { 72 $fav = unserialize($v['value']); 73 if (($fav['permissions'] == '*') || $core->auth->check($fav['permissions'],$core->blog->id)) { 74 $count++; 75 $title = ($fav['name'] == 'posts' ? sprintf($str_entries,$post_count) : 76 ($fav['name'] == 'comments' ? sprintf($str_comments,$comment_count) : $fav['title'])); 77 $__dashboard_icons[$fav['name']] = new ArrayObject(array($title,$fav['url'],$fav['large-icon'])); 78 } 79 } 80 } 81 if (!$count) { 82 // No user or global favorites, add "user pref" and "new entry" fav 83 if ($core->auth->check('usage,contentadmin',$core->blog->id)) { 84 $__dashboard_icons['new_post'] = new ArrayObject(array(__('New entry'),'post.php','images/menu/edit-b.png')); 85 } 86 $__dashboard_icons['prefs'] = new ArrayObject(array(__('My preferences'),'preferences.php','images/menu/user-pref-b.png')); 87 } 67 88 68 89 # Latest news for dashboard … … 112 133 } 113 134 $i++; 114 if ($i > 7) { break; }135 if ($i > 3) { break; } 115 136 } 116 137 $latest_news .= '</dl>';
Note: See TracChangeset
for help on using the changeset viewer.