protected function execute(ConduitAPIRequest $request)
 {
     $query = new PhabricatorFlagQuery();
     $owner_phids = $request->getValue('ownerPHIDs', array());
     if ($owner_phids) {
         $query->withOwnerPHIDs($owner_phids);
     }
     $object_phids = $request->getValue('objectPHIDs', array());
     if ($object_phids) {
         $query->withObjectPHIDs($object_phids);
     }
     $types = $request->getValue('types', array());
     if ($types) {
         $query->withTypes($types);
     }
     $query->needHandles(true);
     $query->setOffset($request->getValue('offset', 0));
     $query->setLimit($request->getValue('limit', 100));
     $flags = $query->execute();
     $results = array();
     foreach ($flags as $flag) {
         $color = $flag->getColor();
         $uri = PhabricatorEnv::getProductionURI($flag->getHandle()->getURI());
         $results[] = array('id' => $flag->getID(), 'ownerPHID' => $flag->getOwnerPHID(), 'type' => $flag->getType(), 'objectPHID' => $flag->getObjectPHID(), 'reasonPHID' => $flag->getReasonPHID(), 'color' => $color, 'colorName' => PhabricatorFlagColor::getColorName($color), 'note' => $flag->getNote(), 'handle' => array('uri' => $uri, 'name' => $flag->getHandle()->getName()), 'dateCreated' => $flag->getDateCreated(), 'dateModified' => $flag->getDateModified());
     }
     return $results;
 }
 protected function execute(ConduitAPIRequest $request)
 {
     $query = new PhabricatorFlagQuery();
     $query->setViewer($request->getUser());
     $owner_phids = $request->getValue('ownerPHIDs', array());
     if ($owner_phids) {
         $query->withOwnerPHIDs($owner_phids);
     }
     $object_phids = $request->getValue('objectPHIDs', array());
     if ($object_phids) {
         $query->withObjectPHIDs($object_phids);
     }
     $types = $request->getValue('types', array());
     if ($types) {
         $query->withTypes($types);
     }
     $query->needHandles(true);
     $query->setOffset($request->getValue('offset', 0));
     $query->setLimit($request->getValue('limit', 100));
     $flags = $query->execute();
     $results = array();
     foreach ($flags as $flag) {
         $results[] = $this->buildFlagInfoDictionary($flag);
     }
     return $results;
 }
 public function processRequest()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI(new PhutilURI('/flag/view/'));
     $nav->addFilter('all', 'Flags');
     $nav->selectFilter('all', 'all');
     $query = new PhabricatorFlagQuery();
     $query->withOwnerPHIDs(array($user->getPHID()));
     $query->needHandles(true);
     $flags = $query->execute();
     $view = new PhabricatorFlagListView();
     $view->setFlags($flags);
     $view->setUser($user);
     $panel = new AphrontPanelView();
     $panel->setHeader('Flags');
     $panel->appendChild($view);
     $nav->appendChild($panel);
     return $this->buildStandardPageResponse($nav, array('title' => 'Flags'));
 }