• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP mpull函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中mpull函数的典型用法代码示例。如果您正苦于以下问题:PHP mpull函数的具体用法?PHP mpull怎么用?PHP mpull使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了mpull函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: buildQueryFromSavedQuery

 public function buildQueryFromSavedQuery(PhabricatorSavedQuery $saved)
 {
     $query = id(new PhortuneSubscriptionQuery());
     $viewer = $this->requireViewer();
     $merchant = $this->getMerchant();
     $account = $this->getAccount();
     if ($merchant) {
         $can_edit = PhabricatorPolicyFilter::hasCapability($viewer, $merchant, PhabricatorPolicyCapability::CAN_EDIT);
         if (!$can_edit) {
             throw new Exception(pht('You can not query subscriptions for a merchant you do not ' . 'control.'));
         }
         $query->withMerchantPHIDs(array($merchant->getPHID()));
     } else {
         if ($account) {
             $can_edit = PhabricatorPolicyFilter::hasCapability($viewer, $account, PhabricatorPolicyCapability::CAN_EDIT);
             if (!$can_edit) {
                 throw new Exception(pht('You can not query subscriptions for an account you are not ' . 'a member of.'));
             }
             $query->withAccountPHIDs(array($account->getPHID()));
         } else {
             $accounts = id(new PhortuneAccountQuery())->withMemberPHIDs(array($viewer->getPHID()))->execute();
             if ($accounts) {
                 $query->withAccountPHIDs(mpull($accounts, 'getPHID'));
             } else {
                 throw new Exception(pht('You have no accounts!'));
             }
         }
     }
     return $query;
 }
开发者ID:hrb518,项目名称:phabricator,代码行数:30,代码来源:PhortuneSubscriptionSearchEngine.php


示例2: willFilterPage

 protected function willFilterPage(array $comments)
 {
     if ($this->needReplyToComments) {
         $reply_phids = array();
         foreach ($comments as $comment) {
             $reply_phid = $comment->getReplyToCommentPHID();
             if ($reply_phid) {
                 $reply_phids[] = $reply_phid;
             }
         }
         if ($reply_phids) {
             $reply_comments = newv(get_class($this), array())->setViewer($this->getViewer())->setParentQuery($this)->withPHIDs($reply_phids)->execute();
             $reply_comments = mpull($reply_comments, null, 'getPHID');
         } else {
             $reply_comments = array();
         }
         foreach ($comments as $key => $comment) {
             $reply_phid = $comment->getReplyToCommentPHID();
             if (!$reply_phid) {
                 $comment->attachReplyToComment(null);
                 continue;
             }
             $reply = idx($reply_comments, $reply_phid);
             if (!$reply) {
                 $this->didRejectResult($comment);
                 unset($comments[$key]);
                 continue;
             }
             $comment->attachReplyToComment($reply);
         }
     }
     return $comments;
 }
开发者ID:pugong,项目名称:phabricator,代码行数:33,代码来源:PhabricatorDiffInlineCommentQuery.php


示例3: execute

 public function execute(PhutilArgumentParser $args)
 {
     $can_recover = id(new PhabricatorPeopleQuery())->setViewer($this->getViewer())->withIsAdmin(true)->execute();
     if (!$can_recover) {
         throw new PhutilArgumentUsageException(pht('This Phabricator installation has no recoverable administrator ' . 'accounts. You can use `bin/accountadmin` to create a new ' . 'administrator account or make an existing user an administrator.'));
     }
     $can_recover = mpull($can_recover, 'getUsername');
     sort($can_recover);
     $can_recover = implode(', ', $can_recover);
     $usernames = $args->getArg('username');
     if (!$usernames) {
         throw new PhutilArgumentUsageException(pht('You must specify the username of the account to recover.'));
     } else {
         if (count($usernames) > 1) {
             throw new PhutilArgumentUsageException(pht('You can only recover the username for one account.'));
         }
     }
     $username = head($usernames);
     $user = id(new PhabricatorPeopleQuery())->setViewer($this->getViewer())->withUsernames(array($username))->executeOne();
     if (!$user) {
         throw new PhutilArgumentUsageException(pht('No such user "%s". Recoverable administrator accounts are: %s.', $username, $can_recover));
     }
     if (!$user->getIsAdmin()) {
         throw new PhutilArgumentUsageException(pht('You can only recover administrator accounts, but %s is not an ' . 'administrator. Recoverable administrator accounts are: %s.', $username, $can_recover));
     }
     $engine = new PhabricatorAuthSessionEngine();
     $onetime_uri = $engine->getOneTimeLoginURI($user, null, PhabricatorAuthSessionEngine::ONETIME_RECOVER);
     $console = PhutilConsole::getConsole();
     $console->writeOut(pht('Use this link to recover access to the "%s" account from the web ' . 'interface:', $username));
     $console->writeOut("\n\n");
     $console->writeOut('    %s', $onetime_uri);
     $console->writeOut("\n\n");
     $console->writeOut(pht('After logging in, you can use the "Auth" application to add or ' . 'restore authentication providers and allow normal logins to ' . 'succeed.') . "\n");
     return 0;
 }
开发者ID:denghp,项目名称:phabricator,代码行数:35,代码来源:PhabricatorAuthManagementRecoverWorkflow.php


示例4: getGitResult

 protected function getGitResult(ConduitAPIRequest $request)
 {
     $drequest = $this->getDiffusionRequest();
     $repository = $drequest->getRepository();
     $commit = $drequest->getSymbolicCommit();
     $commit_filter = null;
     if ($commit) {
         $commit_filter = $this->loadTagNamesForCommit($commit);
     }
     $name_filter = $request->getValue('names', null);
     $all_tags = $this->loadGitTagList();
     $all_tags = mpull($all_tags, null, 'getName');
     if ($name_filter !== null) {
         $all_tags = array_intersect_key($all_tags, array_fuse($name_filter));
     }
     if ($commit_filter !== null) {
         $all_tags = array_intersect_key($all_tags, $commit_filter);
     }
     $tags = array_values($all_tags);
     $offset = $request->getValue('offset');
     $limit = $request->getValue('limit');
     if ($offset) {
         $tags = array_slice($tags, $offset);
     }
     if ($limit) {
         $tags = array_slice($tags, 0, $limit);
     }
     if ($request->getValue('needMessages')) {
         $this->loadMessagesForTags($all_tags);
     }
     return mpull($tags, 'toDictionary');
 }
开发者ID:denghp,项目名称:phabricator,代码行数:32,代码来源:DiffusionTagsQueryConduitAPIMethod.php


示例5: willFilterPage

 protected function willFilterPage(array $page)
 {
     if ($this->needSecrets) {
         $secret_ids = mpull($page, 'getSecretID');
         $secret_ids = array_filter($secret_ids);
         $secrets = array();
         if ($secret_ids) {
             $secret_objects = id(new PassphraseSecret())->loadAllWhere('id IN (%Ld)', $secret_ids);
             foreach ($secret_objects as $secret) {
                 $secret_data = $secret->getSecretData();
                 $secrets[$secret->getID()] = new PhutilOpaqueEnvelope($secret_data);
             }
         }
         foreach ($page as $key => $credential) {
             $secret_id = $credential->getSecretID();
             if (!$secret_id) {
                 $credential->attachSecret(null);
             } else {
                 if (isset($secrets[$secret_id])) {
                     $credential->attachSecret($secrets[$secret_id]);
                 } else {
                     unset($page[$key]);
                 }
             }
         }
     }
     return $page;
 }
开发者ID:barcelonascience,项目名称:phabricator,代码行数:28,代码来源:PassphraseCredentialQuery.php


示例6: renderEditControl

 public function renderEditControl(array $handles)
 {
     $engines = id(new PhutilSymbolLoader())->setAncestorClass('PhabricatorApplicationSearchEngine')->loadObjects();
     $value = $this->getFieldValue();
     $queries = array();
     $seen = false;
     foreach ($engines as $engine_class => $engine) {
         $engine->setViewer($this->getViewer());
         $engine_queries = $engine->loadEnabledNamedQueries();
         $query_map = mpull($engine_queries, 'getQueryName', 'getQueryKey');
         asort($query_map);
         foreach ($query_map as $key => $name) {
             $queries[$engine_class][] = array('key' => $key, 'name' => $name);
             if ($key == $value) {
                 $seen = true;
             }
         }
     }
     if (strlen($value) && !$seen) {
         $name = pht('Custom Query ("%s")', $value);
     } else {
         $name = pht('(None)');
     }
     $options = array($value => $name);
     $app_control_key = $this->getFieldConfigValue('control.application');
     Javelin::initBehavior('dashboard-query-panel-select', array('applicationID' => $this->getFieldControlID($app_control_key), 'queryID' => $this->getFieldControlID(), 'options' => $queries, 'value' => array('key' => strlen($value) ? $value : null, 'name' => $name)));
     return id(new AphrontFormSelectControl())->setID($this->getFieldControlID())->setLabel($this->getFieldName())->setCaption($this->getCaption())->setName($this->getFieldKey())->setValue($this->getFieldValue())->setOptions($options);
 }
开发者ID:denghp,项目名称:phabricator,代码行数:28,代码来源:PhabricatorDashboardPanelSearchQueryCustomField.php


示例7: handleRequest

 public function handleRequest(AphrontRequest $request)
 {
     $viewer = $request->getViewer();
     $pager = new PHUIPagerView();
     $pager->setURI($request->getRequestURI(), 'page');
     $pager->setOffset($request->getInt('page'));
     $query = id(new PhabricatorTokenReceiverQuery());
     $objects = $query->setViewer($viewer)->executeWithOffsetPager($pager);
     $counts = $query->getTokenCounts();
     $handles = array();
     $phids = array();
     if ($counts) {
         $phids = mpull($objects, 'getPHID');
         $handles = id(new PhabricatorHandleQuery())->setViewer($viewer)->withPHIDs($phids)->execute();
     }
     $list = new PHUIObjectItemListView();
     foreach ($phids as $object) {
         $count = idx($counts, $object, 0);
         $item = id(new PHUIObjectItemView());
         $handle = $handles[$object];
         $item->setHeader($handle->getFullName());
         $item->setHref($handle->getURI());
         $item->addAttribute(pht('Tokens: %s', $count));
         $list->addItem($item);
     }
     $title = pht('Token Leader Board');
     $box = id(new PHUIObjectBoxView())->setHeaderText($title)->setObjectList($list);
     $nav = $this->buildSideNav();
     $nav->setCrumbs($this->buildApplicationCrumbs()->addTextCrumb($title));
     $nav->selectFilter('leaders/');
     $nav->appendChild($box);
     $nav->appendChild($pager);
     return $this->newPage()->setTitle($title)->appendChild($nav);
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:34,代码来源:PhabricatorTokenLeaderController.php


示例8: renderResultList

 protected function renderResultList(array $polls, PhabricatorSavedQuery $query, array $handles)
 {
     assert_instances_of($polls, 'PhabricatorSlowvotePoll');
     $viewer = $this->requireViewer();
     $list = id(new PHUIObjectItemListView())->setUser($viewer);
     $phids = mpull($polls, 'getAuthorPHID');
     foreach ($polls as $poll) {
         $date_created = phabricator_datetime($poll->getDateCreated(), $viewer);
         if ($poll->getAuthorPHID()) {
             $author = $handles[$poll->getAuthorPHID()]->renderLink();
         } else {
             $author = null;
         }
         $item = id(new PHUIObjectItemView())->setUser($viewer)->setObject($poll)->setObjectName('V' . $poll->getID())->setHeader($poll->getQuestion())->setHref('/V' . $poll->getID())->addIcon('none', $date_created);
         if ($poll->getIsClosed()) {
             $item->setStatusIcon('fa-ban grey');
             $item->setDisabled(true);
         } else {
             $item->setStatusIcon('fa-bar-chart');
         }
         $description = $poll->getDescription();
         if (strlen($description)) {
             $item->addAttribute(id(new PhutilUTF8StringTruncator())->setMaximumGlyphs(120)->truncateString($poll->getDescription()));
         }
         if ($author) {
             $item->addByline(pht('Author: %s', $author));
         }
         $list->addItem($item);
     }
     $result = new PhabricatorApplicationSearchResultView();
     $result->setObjectList($list);
     $result->setNoDataString(pht('No polls found.'));
     return $result;
 }
开发者ID:patelhardik,项目名称:phabricator,代码行数:34,代码来源:PhabricatorSlowvoteSearchEngine.php


示例9: handleRequest

 public function handleRequest(AphrontRequest $request)
 {
     $viewer = $request->getViewer();
     $id = $request->getURIData('id');
     $post = id(new PhamePostQuery())->setViewer($viewer)->withIDs(array($id))->requireCapabilities(array(PhabricatorPolicyCapability::CAN_EDIT, PhabricatorPolicyCapability::CAN_VIEW))->executeOne();
     if (!$post) {
         return new Aphront404Response();
     }
     $view_uri = '/post/view/' . $post->getID() . '/';
     $view_uri = $this->getApplicationURI($view_uri);
     if ($request->isFormPost()) {
         $blog = id(new PhameBlogQuery())->setViewer($viewer)->withIDs(array($request->getInt('blog')))->requireCapabilities(array(PhabricatorPolicyCapability::CAN_EDIT))->executeOne();
         if ($blog) {
             $post->setBlogPHID($blog->getPHID());
             $post->save();
             return id(new AphrontRedirectResponse())->setURI($view_uri . '?moved=1');
         }
     }
     $blogs = id(new PhameBlogQuery())->setViewer($viewer)->requireCapabilities(array(PhabricatorPolicyCapability::CAN_EDIT))->execute();
     $options = mpull($blogs, 'getName', 'getID');
     asort($options);
     $selected_value = null;
     if ($post && $post->getBlog()) {
         $selected_value = $post->getBlog()->getID();
     }
     $form = id(new PHUIFormLayoutView())->setUser($viewer)->appendChild(id(new AphrontFormSelectControl())->setLabel(pht('Blog'))->setName('blog')->setOptions($options)->setValue($selected_value));
     return $this->newDialog()->setTitle(pht('Move Post'))->appendChild($form)->addSubmitButton(pht('Move Post'))->addCancelButton($view_uri);
 }
开发者ID:fuding,项目名称:phabricator,代码行数:28,代码来源:PhamePostMoveController.php


示例10: buildPaymentMethodsSection

 private function buildPaymentMethodsSection(PhortuneAccount $account)
 {
     $request = $this->getRequest();
     $viewer = $request->getUser();
     $can_edit = PhabricatorPolicyFilter::hasCapability($viewer, $account, PhabricatorPolicyCapability::CAN_EDIT);
     $id = $account->getID();
     $header = id(new PHUIHeaderView())->setHeader(pht('Payment Methods'))->addActionLink(id(new PHUIButtonView())->setTag('a')->setHref($this->getApplicationURI($id . '/card/new/'))->setText(pht('Add Payment Method'))->setIcon(id(new PHUIIconView())->setIconFont('fa-plus')));
     $list = id(new PHUIObjectItemListView())->setUser($viewer)->setNoDataString(pht('No payment methods associated with this account.'));
     $methods = id(new PhortunePaymentMethodQuery())->setViewer($viewer)->withAccountPHIDs(array($account->getPHID()))->execute();
     if ($methods) {
         $this->loadHandles(mpull($methods, 'getAuthorPHID'));
     }
     foreach ($methods as $method) {
         $id = $method->getID();
         $item = new PHUIObjectItemView();
         $item->setHeader($method->getFullDisplayName());
         switch ($method->getStatus()) {
             case PhortunePaymentMethod::STATUS_ACTIVE:
                 $item->setBarColor('green');
                 $disable_uri = $this->getApplicationURI('card/' . $id . '/disable/');
                 $item->addAction(id(new PHUIListItemView())->setIcon('fa-times')->setHref($disable_uri)->setDisabled(!$can_edit)->setWorkflow(true));
                 break;
             case PhortunePaymentMethod::STATUS_DISABLED:
                 $item->setDisabled(true);
                 break;
         }
         $provider = $method->buildPaymentProvider();
         $item->addAttribute($provider->getPaymentMethodProviderDescription());
         $item->setImageURI($provider->getPaymentMethodIcon());
         $edit_uri = $this->getApplicationURI('card/' . $id . '/edit/');
         $item->addAction(id(new PHUIListItemView())->setIcon('fa-pencil')->setHref($edit_uri)->setDisabled(!$can_edit)->setWorkflow(!$can_edit));
         $list->addItem($item);
     }
     return id(new PHUIObjectBoxView())->setHeader($header)->appendChild($list);
 }
开发者ID:denghp,项目名称:phabricator,代码行数:35,代码来源:PhortuneAccountViewController.php


示例11: handleRequest

 public function handleRequest(AphrontRequest $request)
 {
     $viewer = $request->getViewer();
     $id = $request->getURIData('id');
     $authority = $this->loadMerchantAuthority();
     $cart_query = id(new PhortuneCartQuery())->setViewer($viewer)->withIDs(array($id))->needPurchases(true);
     if ($authority) {
         $cart_query->withMerchantPHIDs(array($authority->getPHID()));
     }
     $cart = $cart_query->executeOne();
     if (!$cart) {
         return new Aphront404Response();
     }
     $charges = id(new PhortuneChargeQuery())->setViewer($viewer)->withCartPHIDs(array($cart->getPHID()))->needCarts(true)->withStatuses(array(PhortuneCharge::STATUS_HOLD, PhortuneCharge::STATUS_CHARGED))->execute();
     if ($charges) {
         $providers = id(new PhortunePaymentProviderConfigQuery())->setViewer($viewer)->withPHIDs(mpull($charges, 'getProviderPHID'))->execute();
         $providers = mpull($providers, null, 'getPHID');
     } else {
         $providers = array();
     }
     foreach ($charges as $charge) {
         if ($charge->isRefund()) {
             // Don't update refunds.
             continue;
         }
         $provider_config = idx($providers, $charge->getProviderPHID());
         if (!$provider_config) {
             throw new Exception(pht('Unable to load provider for charge!'));
         }
         $provider = $provider_config->buildProvider();
         $provider->updateCharge($charge);
     }
     return id(new AphrontRedirectResponse())->setURI($cart->getDetailURI($authority));
 }
开发者ID:truSense,项目名称:phabricator,代码行数:34,代码来源:PhortuneCartUpdateController.php


示例12: willFilterPage

 protected function willFilterPage(array $accounts)
 {
     if ($this->needImages) {
         $file_phids = mpull($accounts, 'getProfileImagePHID');
         $file_phids = array_filter($file_phids);
         if ($file_phids) {
             // NOTE: We use the omnipotent viewer here because these files are
             // usually created during registration and can't be associated with
             // the correct policies, since the relevant user account does not exist
             // yet. In effect, if you can see an ExternalAccount, you can see its
             // profile image.
             $files = id(new PhabricatorFileQuery())->setViewer(PhabricatorUser::getOmnipotentUser())->withPHIDs($file_phids)->execute();
             $files = mpull($files, null, 'getPHID');
         } else {
             $files = array();
         }
         $default_file = null;
         foreach ($accounts as $account) {
             $image_phid = $account->getProfileImagePHID();
             if ($image_phid && isset($files[$image_phid])) {
                 $account->attachProfileImageFile($files[$image_phid]);
             } else {
                 if ($default_file === null) {
                     $default_file = PhabricatorFile::loadBuiltin($this->getViewer(), 'profile.png');
                 }
                 $account->attachProfileImageFile($default_file);
             }
         }
     }
     return $accounts;
 }
开发者ID:pugong,项目名称:phabricator,代码行数:31,代码来源:PhabricatorExternalAccountQuery.php


示例13: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     $views = array(self::VIEW_ALL => 'All Slowvotes', self::VIEW_CREATED => 'Created', self::VIEW_VOTED => 'Voted In');
     $view = isset($views[$this->view]) ? $this->view : self::VIEW_ALL;
     $side_nav = $this->renderSideNav($views, $view);
     $pager = new AphrontPagerView();
     $pager->setOffset($request->getInt('page'));
     $pager->setURI($request->getRequestURI(), 'page');
     $polls = $this->loadPolls($pager, $view);
     $phids = mpull($polls, 'getAuthorPHID');
     $handles = id(new PhabricatorObjectHandleData($phids))->loadHandles();
     $rows = array();
     foreach ($polls as $poll) {
         $rows[] = array('V' . $poll->getID(), phutil_render_tag('a', array('href' => '/V' . $poll->getID()), phutil_escape_html($poll->getQuestion())), $handles[$poll->getAuthorPHID()]->renderLink(), phabricator_date($poll->getDateCreated(), $user), phabricator_time($poll->getDateCreated(), $user));
     }
     $table = new AphrontTableView($rows);
     $table->setColumnClasses(array('', 'pri wide', '', '', 'right'));
     $table->setHeaders(array('ID', 'Poll', 'Author', 'Date', 'Time'));
     $panel = new AphrontPanelView();
     $panel->setHeader($this->getTableHeader($view));
     $panel->setCreateButton('Create Slowvote', '/vote/create/');
     $panel->appendChild($table);
     $panel->appendChild($pager);
     $side_nav->appendChild($panel);
     return $this->buildStandardPageResponse($side_nav, array('title' => 'Slowvotes'));
 }
开发者ID:netcomtec,项目名称:phabricator,代码行数:28,代码来源:PhabricatorSlowvoteListController.php


示例14: buildPackagePropertyView

 private function buildPackagePropertyView(PhabricatorOwnersPackage $package)
 {
     $viewer = $this->getViewer();
     $view = id(new PHUIPropertyListView())->setUser($viewer);
     $primary_phid = $package->getPrimaryOwnerPHID();
     if ($primary_phid) {
         $primary_owner = $viewer->renderHandle($primary_phid);
     } else {
         $primary_owner = phutil_tag('em', array(), pht('None'));
     }
     $view->addProperty(pht('Primary Owner'), $primary_owner);
     // TODO: needOwners() this on the Query.
     $owners = $package->loadOwners();
     if ($owners) {
         $owner_list = $viewer->renderHandleList(mpull($owners, 'getUserPHID'));
     } else {
         $owner_list = phutil_tag('em', array(), pht('None'));
     }
     $view->addProperty(pht('Owners'), $owner_list);
     if ($package->getAuditingEnabled()) {
         $auditing = pht('Enabled');
     } else {
         $auditing = pht('Disabled');
     }
     $view->addProperty(pht('Auditing'), $auditing);
     $description = $package->getDescription();
     if (strlen($description)) {
         $view->addSectionHeader(pht('Description'));
         $view->addTextContent($output = PhabricatorMarkupEngine::renderOneObject(id(new PhabricatorMarkupOneOff())->setContent($description), 'default', $viewer));
     }
     return $view;
 }
开发者ID:bohanlin,项目名称:phabricator,代码行数:32,代码来源:PhabricatorOwnersDetailController.php


示例15: willApplyRules

 public function willApplyRules(PhabricatorUser $viewer, array $values, array $objects)
 {
     $viewer_phid = $viewer->getPHID();
     if (!$viewer_phid) {
         return;
     }
     if (empty($this->memberships[$viewer_phid])) {
         $this->memberships[$viewer_phid] = array();
     }
     foreach ($objects as $key => $object) {
         $cache = $this->getTransactionHint($object);
         if ($cache === null) {
             continue;
         }
         unset($objects[$key]);
         if (isset($cache[$viewer_phid])) {
             $this->memberships[$viewer_phid][$object->getPHID()] = true;
         }
     }
     if (!$objects) {
         return;
     }
     $object_phids = mpull($objects, 'getPHID');
     $edge_query = id(new PhabricatorEdgeQuery())->withSourcePHIDs(array($viewer_phid))->withDestinationPHIDs($object_phids)->withEdgeTypes(array(PhabricatorProjectMemberOfProjectEdgeType::EDGECONST));
     $edge_query->execute();
     $memberships = $edge_query->getDestinationPHIDs();
     if (!$memberships) {
         return;
     }
     $this->memberships[$viewer_phid] += array_fill_keys($memberships, true);
 }
开发者ID:truSense,项目名称:phabricator,代码行数:31,代码来源:PhabricatorProjectMembersPolicyRule.php


示例16: renderBreadcrumbs

 public function renderBreadcrumbs($slug)
 {
     $ancestor_handles = array();
     $ancestral_slugs = PhabricatorSlug::getAncestry($slug);
     $ancestral_slugs[] = $slug;
     if ($ancestral_slugs) {
         $empty_slugs = array_fill_keys($ancestral_slugs, null);
         $ancestors = id(new PhrictionDocumentQuery())->setViewer($this->getRequest()->getUser())->withSlugs($ancestral_slugs)->execute();
         $ancestors = mpull($ancestors, null, 'getSlug');
         $ancestor_phids = mpull($ancestors, 'getPHID');
         $handles = array();
         if ($ancestor_phids) {
             $handles = $this->loadViewerHandles($ancestor_phids);
         }
         $ancestor_handles = array();
         foreach ($ancestral_slugs as $slug) {
             if (isset($ancestors[$slug])) {
                 $ancestor_handles[] = $handles[$ancestors[$slug]->getPHID()];
             } else {
                 $handle = new PhabricatorObjectHandle();
                 $handle->setName(PhabricatorSlug::getDefaultTitle($slug));
                 $handle->setURI(PhrictionDocument::getSlugURI($slug));
                 $ancestor_handles[] = $handle;
             }
         }
     }
     $breadcrumbs = array();
     foreach ($ancestor_handles as $ancestor_handle) {
         $breadcrumbs[] = id(new PHUICrumbView())->setName($ancestor_handle->getName())->setHref($ancestor_handle->getUri());
     }
     return $breadcrumbs;
 }
开发者ID:pugong,项目名称:phabricator,代码行数:32,代码来源:PhrictionController.php


示例17: handleRequest

 public function handleRequest(AphrontRequest $request)
 {
     $viewer = $request->getViewer();
     $id = $request->getURIData('id');
     $post = id(new PhamePostQuery())->setViewer($viewer)->withIDs(array($id))->requireCapabilities(array(PhabricatorPolicyCapability::CAN_EDIT, PhabricatorPolicyCapability::CAN_VIEW))->executeOne();
     if (!$post) {
         return new Aphront404Response();
     }
     $view_uri = $post->getViewURI();
     $v_blog = $post->getBlog()->getPHID();
     if ($request->isFormPost()) {
         $v_blog = $request->getStr('blogPHID');
         $xactions = array();
         $xactions[] = id(new PhamePostTransaction())->setTransactionType(PhamePostTransaction::TYPE_BLOG)->setNewValue($v_blog);
         $editor = id(new PhamePostEditor())->setActor($viewer)->setContentSourceFromRequest($request)->setContinueOnMissingFields(true)->setContinueOnNoEffect(true);
         $editor->applyTransactions($post, $xactions);
         $view_uri = $post->getViewURI();
         return id(new AphrontRedirectResponse())->setURI($view_uri . '?moved=1');
     }
     $blogs = id(new PhameBlogQuery())->setViewer($viewer)->requireCapabilities(array(PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT))->execute();
     $options = mpull($blogs, 'getName', 'getPHID');
     asort($options);
     $form = id(new PHUIFormLayoutView())->setUser($viewer)->appendChild(id(new AphrontFormSelectControl())->setLabel(pht('Blog'))->setName('blogPHID')->setOptions($options)->setValue($v_blog));
     return $this->newDialog()->setTitle(pht('Move Post'))->appendChild($form)->addSubmitButton(pht('Move Post'))->addCancelButton($view_uri);
 }
开发者ID:truSense,项目名称:phabricator,代码行数:25,代码来源:PhamePostMoveController.php


示例18: execute

 protected function execute(ConduitAPIRequest $request)
 {
     $results = array();
     $task_ids = $request->getValue('ids');
     if (!$task_ids) {
         return $results;
     }
     $tasks = id(new ManiphestTaskQuery())->setViewer($request->getUser())->withIDs($task_ids)->execute();
     $tasks = mpull($tasks, null, 'getPHID');
     $transactions = array();
     if ($tasks) {
         $transactions = id(new ManiphestTransactionQuery())->setViewer($request->getUser())->withObjectPHIDs(mpull($tasks, 'getPHID'))->needComments(true)->execute();
     }
     foreach ($transactions as $transaction) {
         $task_phid = $transaction->getObjectPHID();
         if (empty($tasks[$task_phid])) {
             continue;
         }
         $task_id = $tasks[$task_phid]->getID();
         $comments = null;
         if ($transaction->hasComment()) {
             $comments = $transaction->getComment()->getContent();
         }
         $results[$task_id][] = array('taskID' => $task_id, 'transactionPHID' => $transaction->getPHID(), 'transactionType' => $transaction->getTransactionType(), 'oldValue' => $transaction->getOldValue(), 'newValue' => $transaction->getNewValue(), 'comments' => $comments, 'authorPHID' => $transaction->getAuthorPHID(), 'dateCreated' => $transaction->getDateCreated());
     }
     return $results;
 }
开发者ID:pugong,项目名称:phabricator,代码行数:27,代码来源:ManiphestGetTaskTransactionsConduitAPIMethod.php


示例19: processRequest

 public function processRequest()
 {
     $drequest = $this->getDiffusionRequest();
     $request = $this->getRequest();
     $viewer = $request->getUser();
     $repository = $drequest->getRepository();
     $pager = new AphrontPagerView();
     $pager->setURI($request->getRequestURI(), 'offset');
     $pager->setOffset($request->getInt('offset'));
     // TODO: Add support for branches that contain commit
     $branches = $this->callConduitWithDiffusionRequest('diffusion.branchquery', array('offset' => $pager->getOffset(), 'limit' => $pager->getPageSize() + 1));
     $branches = $pager->sliceResults($branches);
     $branches = DiffusionRepositoryRef::loadAllFromDictionaries($branches);
     $content = null;
     if (!$branches) {
         $content = $this->renderStatusMessage(pht('No Branches'), pht('This repository has no branches.'));
     } else {
         $commits = id(new DiffusionCommitQuery())->setViewer($viewer)->withIdentifiers(mpull($branches, 'getCommitIdentifier'))->withRepository($repository)->execute();
         $view = id(new DiffusionBranchTableView())->setUser($viewer)->setBranches($branches)->setCommits($commits)->setDiffusionRequest($drequest);
         $panel = id(new AphrontPanelView())->setNoBackground(true)->appendChild($view)->appendChild($pager);
         $content = $panel;
     }
     $crumbs = $this->buildCrumbs(array('branches' => true));
     return $this->buildApplicationPage(array($crumbs, $content), array('title' => array(pht('Branches'), 'r' . $repository->getCallsign()), 'device' => false));
 }
开发者ID:denghp,项目名称:phabricator,代码行数:25,代码来源:DiffusionBranchTableController.php


示例20: render

 public function render()
 {
     $conpherence = $this->getConpherence();
     $widget_data = $conpherence->getWidgetData();
     $viewer = $this->getUser();
     $participants = $conpherence->getParticipants();
     $handles = $conpherence->getHandles();
     $head_handles = array_select_keys($handles, array($viewer->getPHID()));
     $handle_list = mpull($handles, 'getName');
     natcasesort($handle_list);
     $handles = mpull($handles, null, 'getName');
     $handles = array_select_keys($handles, $handle_list);
     $head_handles = mpull($head_handles, null, 'getName');
     $handles = $head_handles + $handles;
     $can_edit = PhabricatorPolicyFilter::hasCapability($viewer, $conpherence, PhabricatorPolicyCapability::CAN_EDIT);
     $body = array();
     foreach ($handles as $handle) {
         $user_phid = $handle->getPHID();
         if ($user_phid == $viewer->getPHID() || $can_edit) {
             $icon = id(new PHUIIconView())->setIcon('fa-times lightbluetext');
             $remove_html = javelin_tag('a', array('class' => 'remove', 'sigil' => 'remove-person', 'meta' => array('remove_person' => $user_phid, 'action' => 'remove_person')), $icon);
         } else {
             $remove_html = null;
         }
         $body[] = phutil_tag('div', array('class' => 'person-entry grouped'), array(phutil_tag('a', array('class' => 'pic', 'href' => $handle->getURI()), phutil_tag('img', array('src' => $handle->getImageURI()), '')), $handle->renderLink(), $remove_html));
     }
     return $body;
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:28,代码来源:ConpherencePeopleWidgetView.php



注:本文中的mpull函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP mq函数代码示例发布时间:2022-05-15
下一篇:
PHP mpp_reset_media_data函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap