Changeset 2566:9bf417837888 for inc/admin/class.dc.favorites.php
- Timestamp:
- 11/17/13 20:25:53 (12 years ago)
- Branch:
- 2.6
- Children:
- 2567:6c11245cbf04, 2568:61c67a7d17fa
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/admin/class.dc.favorites.php
r2376 r2566 20 20 /** @var dcCore dotclear core instance */ 21 21 protected $core; 22 22 23 23 /** @var array list of favorite definitions */ 24 24 protected $fav_defs; 25 25 26 26 /** @var dcWorkspace current favorite landing workspace */ 27 27 protected $ws; 28 28 29 29 /** @var array list of user-defined favorite ids */ 30 30 protected $local_prefs; … … 32 32 /** @var array list of globally-defined favorite ids */ 33 33 protected $global_prefs; 34 35 /** @var array list of user preferences (either one of the 2 above, or not!) */ 34 35 /** @var array list of user preferences (either one of the 2 above, or not!) */ 36 36 protected $user_prefs; 37 37 38 38 /** 39 39 * Class constructor 40 * 40 * 41 41 * @param mixed $core dotclear core 42 42 * … … 50 50 $this->ws = $core->auth->user_prefs->addWorkspace('dashboard'); 51 51 $this->user_prefs = array(); 52 52 53 53 if ($this->ws->prefExists('favorites')) { 54 54 $this->local_prefs = @unserialize($this->ws->getLocal('favorites')); … … 64 64 // No favorite defined ? Huhu, let's go for a migration 65 65 $this->migrateFavorites(); 66 } 66 } 67 67 defaultFavorites::initDefaultFavorites($this); 68 68 } 69 70 69 70 71 71 /** 72 72 * setup - sets up favorites, fetch user favorites (against his permissions) … … 84 84 /** 85 85 * getFavorite - retrieves a favorite (complete description) from its id. 86 * 86 * 87 87 * @param string $id the favorite id, or an array having 1 key 'name' set to id, ther keys are merged to favorite. 88 88 * … … 117 117 return $fattr; 118 118 } 119 119 120 120 /** 121 121 * getFavorites - retrieves a list of favorites. 122 * 122 * 123 123 * @param string $ids an array of ids, as defined in getFavorite. 124 124 * … … 137 137 return $prefs; 138 138 } 139 139 140 140 /** 141 141 * setUserPrefs - get user favorites from settings. These are complete favorites, not ids only … … 180 180 } 181 181 } 182 183 } 184 182 183 } 184 185 185 /** 186 186 * migrateFavorites - migrate dc < 2.6 favorites to new format … … 208 208 } 209 209 210 211 210 211 212 212 /** 213 213 * legacyFavorites - handle legacy favorites using adminDashboardFavs behavior … … 231 231 $this->register ($v[0], $fav); 232 232 } 233 234 } 235 233 234 } 235 236 236 /** 237 237 * getUserFavorites - returns favorites that correspond to current user … … 245 245 return $this->user_prefs; 246 246 } 247 247 248 248 249 249 /** … … 273 273 $this->ws->put('favorites',serialize($ids),null,null,true,$global); 274 274 } 275 275 276 276 /** 277 277 * getAvailableFavoritesIDs - returns all available fav ids … … 319 319 } 320 320 } 321 321 322 322 /** 323 323 * appendDashboardIcons - adds favorites icons to index page … … 336 336 $icons[$k]=new ArrayObject(array($v['title'],$v['url'],$v['large-icon'])); 337 337 $this->core->callBehavior('adminDashboardFavsIcon',$this->core,$k,$icons[$k]); 338 } 339 } 340 338 } 339 } 340 341 341 /** 342 342 * register - registers a new favorite definition … … 358 358 return $this; 359 359 } 360 360 361 361 /** 362 362 * registerMultiple - registers a list of favorites definition 363 363 * 364 * @param array an array defining all favorites key is the id, value is the data. 364 * @param array an array defining all favorites key is the id, value is the data. 365 365 * see register method for data format 366 366 * @access public 367 */ 367 */ 368 368 public function registerMultiple($data) { 369 369 foreach ($data as $k=>$v) { … … 372 372 return $this; 373 373 } 374 374 375 375 /** 376 376 * exists - tells whether a fav definition exists or not … … 381 381 * 382 382 * @return true if the fav definition exists, false otherwise 383 */ 383 */ 384 384 public function exists($id) { 385 385 return isset($this->fav_defs[$id]); 386 386 } 387 387 388 388 } 389 389
Note: See TracChangeset
for help on using the changeset viewer.