[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/settings/panel/ -> PhabricatorSettingsPanelConpherencePreferences.php (source)

   1  <?php
   2  
   3  final class PhabricatorSettingsPanelConpherencePreferences
   4    extends PhabricatorSettingsPanel {
   5  
   6    public function isEnabled() {
   7      return PhabricatorApplication::isClassInstalled(
   8        'PhabricatorConpherenceApplication');
   9    }
  10  
  11    public function getPanelKey() {
  12      return 'conpherence';
  13    }
  14  
  15    public function getPanelName() {
  16      return pht('Conpherence Preferences');
  17    }
  18  
  19    public function getPanelGroup() {
  20      return pht('Application Settings');
  21    }
  22  
  23    public function processRequest(AphrontRequest $request) {
  24      $user = $request->getUser();
  25      $preferences = $user->loadPreferences();
  26  
  27      $pref = PhabricatorUserPreferences::PREFERENCE_CONPH_NOTIFICATIONS;
  28  
  29      if ($request->isFormPost()) {
  30        $notifications = $request->getInt($pref);
  31        $preferences->setPreference($pref, $notifications);
  32        $preferences->save();
  33        return id(new AphrontRedirectResponse())
  34          ->setURI($this->getPanelURI('?saved=true'));
  35      }
  36  
  37      $form = id(new AphrontFormView())
  38        ->setUser($user)
  39        ->appendChild(
  40          id(new AphrontFormSelectControl())
  41            ->setLabel(pht('Conpherence Notifications'))
  42            ->setName($pref)
  43            ->setValue($preferences->getPreference($pref))
  44            ->setOptions(
  45              array(
  46                ConpherenceSettings::EMAIL_ALWAYS
  47                  => pht('Email Always'),
  48                ConpherenceSettings::NOTIFICATIONS_ONLY
  49                  => pht('Notifications Only'),
  50              ))
  51            ->setCaption(
  52              pht('Should Conpherence send emails for updates or '.
  53                  'notifications only? This global setting can be overridden '.
  54                  'on a per-thread basis within Conpherence.')))
  55        ->appendChild(
  56          id(new AphrontFormSubmitControl())
  57            ->setValue(pht('Save Preferences')));
  58  
  59      $form_box = id(new PHUIObjectBoxView())
  60        ->setHeaderText(pht('Conpherence Preferences'))
  61        ->setForm($form)
  62        ->setFormSaved($request->getBool('saved'));
  63  
  64      return array(
  65        $form_box,
  66      );
  67    }
  68  
  69  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1