[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/notification/controller/ -> PhabricatorNotificationClearController.php (source)

   1  <?php
   2  
   3  final class PhabricatorNotificationClearController
   4    extends PhabricatorNotificationController {
   5  
   6    public function processRequest() {
   7      $request = $this->getRequest();
   8      $chrono_key = $request->getStr('chronoKey');
   9      $user = $request->getUser();
  10  
  11      if ($request->isDialogFormPost()) {
  12        $table = new PhabricatorFeedStoryNotification();
  13  
  14        queryfx(
  15          $table->establishConnection('w'),
  16          'UPDATE %T SET hasViewed = 1 '.
  17          'WHERE userPHID = %s AND hasViewed = 0 and chronologicalKey <= %s',
  18          $table->getTableName(),
  19          $user->getPHID(),
  20          $chrono_key);
  21  
  22        return id(new AphrontReloadResponse())
  23          ->setURI('/notification/');
  24      }
  25  
  26      $dialog = new AphrontDialogView();
  27      $dialog->setUser($user);
  28      $dialog->addCancelButton('/notification/');
  29      if ($chrono_key) {
  30        $dialog->setTitle('Really mark all notifications as read?');
  31        $dialog->addHiddenInput('chronoKey', $chrono_key);
  32  
  33        $is_serious =
  34          PhabricatorEnv::getEnvConfig('phabricator.serious-business');
  35        if ($is_serious) {
  36          $dialog->appendChild(
  37            pht(
  38              'All unread notifications will be marked as read. You can not '.
  39              'undo this action.'));
  40        } else {
  41          $dialog->appendChild(
  42            pht(
  43              "You can't ignore your problems forever, you know."));
  44        }
  45  
  46        $dialog->addSubmitButton(pht('Mark All Read'));
  47      } else {
  48        $dialog->setTitle('No notifications to mark as read.');
  49        $dialog->appendChild(pht(
  50          'You have no unread notifications.'));
  51      }
  52  
  53      return id(new AphrontDialogResponse())->setDialog($dialog);
  54    }
  55  }


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