public static function getAppAlbums($force_app_ids = array()) { $photo_model = new photosPhotoModel(); $apps = wa()->getApps(); $result = array(); $counts = $photo_model->countAllByApp(); $counts += array_fill_keys((array) $force_app_ids, 0); $force_app_ids = array_fill_keys((array) $force_app_ids, true); foreach ($counts as $app_id => $count) { // Check that app exists and check access rights, unless app is forced to be present in the result if (empty($force_app_ids[$app_id])) { if ($count <= 0 || empty($apps[$app_id]) || !wa()->getUser()->getRights($app_id, 'backend')) { continue; } } if (!empty($apps[$app_id])) { $name = $apps[$app_id]['name']; if (!empty($apps[$app_id]['icon'][16])) { $icon = $apps[$app_id]['icon'][16]; } else { $icon = reset($apps[$app_id]['icon']); } } else { $name = $app_id; $icon = $apps['photos']['icon'][16]; } if ($icon) { $icon = wa()->getConfig()->getRootUrl() . $icon; } $result[$app_id] = array('id' => $app_id, 'name' => $name, 'count' => $count, 'icon' => $icon); } return $result; }