Changeset 2229:d5e819e27bea for admin/index.php
- Timestamp:
- 10/03/13 15:17:58 (12 years ago)
- Branch:
- default
- File:
-
- 1 edited
-
admin/index.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
admin/index.php
r2225 r2229 74 74 $__dashboard_icons = new ArrayObject(); 75 75 76 # Dashboard favorites 77 $post_count = $core->blog->getPosts(array(),true)->f(0); 78 $str_entries = ($post_count > 1) ? __('%d entries') : __('%d entry'); 79 80 $comment_count = $core->blog->getComments(array(),true)->f(0); 81 $str_comments = ($comment_count > 1) ? __('%d comments') : __('%d comment'); 82 83 $ws = $core->auth->user_prefs->addWorkspace('favorites'); 84 $count = 0; 85 foreach ($ws->dumpPrefs() as $k => $v) { 86 // User favorites only 87 if (!$v['global']) { 88 $fav = unserialize($v['value']); 89 if (($fav['permissions'] == '*') || $core->auth->check($fav['permissions'],$core->blog->id)) { 90 if (dc_valid_fav($fav['url'])) { 91 $count++; 92 $title = ($fav['name'] == 'posts' ? sprintf($str_entries,$post_count) : 93 ($fav['name'] == 'comments' ? sprintf($str_comments,$comment_count) : $fav['title'])); 94 $__dashboard_icons[$fav['name']] = new ArrayObject(array(__($title),$fav['url'],$fav['large-icon'])); 95 96 # Let plugins set their own title for favorite on dashboard 97 $core->callBehavior('adminDashboardFavsIcon',$core,$fav['name'],$__dashboard_icons[$fav['name']]); 98 } 99 } 100 } 101 } 102 if (!$count) { 103 // Global favorites if any 104 foreach ($ws->dumpPrefs() as $k => $v) { 105 $fav = unserialize($v['value']); 106 if (($fav['permissions'] == '*') || $core->auth->check($fav['permissions'],$core->blog->id)) { 107 if (dc_valid_fav($fav['url'])) { 108 $count++; 109 $title = ($fav['name'] == 'posts' ? sprintf($str_entries,$post_count) : 110 ($fav['name'] == 'comments' ? sprintf($str_comments,$comment_count) : $fav['title'])); 111 $__dashboard_icons[$fav['name']] = new ArrayObject(array(__($title),$fav['url'],$fav['large-icon'])); 112 113 # Let plugins set their own title for favorite on dashboard 114 $core->callBehavior('adminDashboardFavsIcon',$core,$fav['name'],$__dashboard_icons[$fav['name']]); 115 } 116 } 117 } 118 } 119 if (!$count) { 120 // No user or global favorites, add "user pref" and "new entry" fav 121 if ($core->auth->check('usage,contentadmin',$core->blog->id)) { 122 $__dashboard_icons['new_post'] = new ArrayObject(array(__('New entry'),'post.php','images/menu/edit-b.png')); 123 } 124 $__dashboard_icons['prefs'] = new ArrayObject(array(__('My preferences'),'preferences.php','images/menu/user-pref-b.png')); 125 } 76 $favs = $core->favs->getUserFavorites(); 77 $core->favs->appendDashboardIcons($__dashboard_icons); 126 78 127 79 # Latest news for dashboard 128 $__dashboard_items = new ArrayObject(array(new ArrayObject ,new ArrayObject));80 $__dashboard_items = new ArrayObject(array(new ArrayObject(),new ArrayObject())); 129 81 130 82 $dashboardItem = 0;
Note: See TracChangeset
for help on using the changeset viewer.
