- // Form stuff (settings etc.)
-
- public function onEndEmailFormData(Action $action, Profile $scoped)
- {
- $emailfave = $scoped->getConfigPref('email', 'notify_fave') ? 1 : 0;
-
- $action->elementStart('li');
- $action->checkbox('email-notify_fave',
- // TRANS: Checkbox label in e-mail preferences form.
- _('Send me email when someone adds my notice as a favorite.'),
- $emailfave);
- $action->elementEnd('li');
-
- return true;
- }
-
- public function onStartEmailSaveForm(Action $action, Profile $scoped)
- {
- $emailfave = $action->booleanintstring('email-notify_fave');
- try {
- if ($emailfave == $scoped->getPref('email', 'notify_fave')) {
- // No need to update setting
- return true;
- }
- } catch (NoResultException $e) {
- // Apparently there's no previously stored setting, then continue to save it as it is now.
- }
-
- $scoped->setPref('email', 'notify_fave', $emailfave);
-
- return true;
- }
-
- // Layout stuff
-
- public function onEndPersonalGroupNav(Menu $menu, Profile $target, Profile $scoped=null)
- {
- $menu->out->menuItem(common_local_url('showfavorites', array('nickname' => $target->getNickname())),
- // TRANS: Menu item in personal group navigation menu.
- _m('MENU','Favorites'),
- // @todo i18n FIXME: Need to make this two messages.
- // TRANS: Menu item title in personal group navigation menu.
- // TRANS: %s is a username.
- sprintf(_('%s\'s favorite notices'), $target->getBestName()),
- $scoped instanceof Profile && $target->id === $scoped->id && $menu->actionName =='showfavorites',
- 'nav_timeline_favorites');
- }
-
- public function onEndPublicGroupNav(Menu $menu)
- {
- if (!common_config('singleuser', 'enabled')) {
- // TRANS: Menu item in search group navigation panel.
- $menu->out->menuItem(common_local_url('favorited'), _m('MENU','Popular'),
- // TRANS: Menu item title in search group navigation panel.
- _('Popular notices'), $menu->actionName == 'favorited', 'nav_timeline_favorited');
- }
- }
-
- public function onEndShowSections(Action $action)
- {
- if (!$action->isAction(array('all', 'public'))) {
- return true;
- }
-
- if (!common_config('performance', 'high')) {
- $section = new PopularNoticeSection($action, $action->getScoped());
- $section->show();
- }
- }
-