当前位置: 首页>>代码示例>>PHP>>正文


PHP AphrontRequest::isPreviewRequest方法代码示例

本文整理汇总了PHP中AphrontRequest::isPreviewRequest方法的典型用法代码示例。如果您正苦于以下问题:PHP AphrontRequest::isPreviewRequest方法的具体用法?PHP AphrontRequest::isPreviewRequest怎么用?PHP AphrontRequest::isPreviewRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AphrontRequest的用法示例。


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

示例1: handleRequest

 public function handleRequest(AphrontRequest $request)
 {
     $viewer = $request->getViewer();
     $id = $request->getURIData('id');
     if (!$request->isFormPost()) {
         return new Aphront400Response();
     }
     $question = id(new PonderQuestionQuery())->setViewer($viewer)->withIDs(array($id))->executeOne();
     if (!$question) {
         return new Aphront404Response();
     }
     $is_preview = $request->isPreviewRequest();
     //    $draft = PhabricatorDraft::buildFromRequest($request);
     $qid = $question->getID();
     $view_uri = "/Q{$qid}";
     $xactions = array();
     $xactions[] = id(new PonderQuestionTransaction())->setTransactionType(PhabricatorTransactions::TYPE_COMMENT)->attachComment(id(new PonderQuestionTransactionComment())->setContent($request->getStr('comment')));
     $editor = id(new PonderQuestionEditor())->setActor($viewer)->setContinueOnNoEffect($request->isContinueRequest())->setContentSourceFromRequest($request)->setIsPreview($is_preview);
     try {
         $xactions = $editor->applyTransactions($question, $xactions);
     } catch (PhabricatorApplicationTransactionNoEffectException $ex) {
         return id(new PhabricatorApplicationTransactionNoEffectResponse())->setCancelURI($view_uri)->setException($ex);
     }
     //    if ($draft) {
     //      $draft->replaceOrDelete();
     //    }
     if ($request->isAjax() && $is_preview) {
         return id(new PhabricatorApplicationTransactionResponse())->setViewer($viewer)->setTransactions($xactions)->setIsPreview($is_preview);
     } else {
         return id(new AphrontRedirectResponse())->setURI($view_uri);
     }
 }
开发者ID:pugong,项目名称:phabricator,代码行数:32,代码来源:PonderQuestionCommentController.php

示例2: handleRequest

 public function handleRequest(AphrontRequest $request)
 {
     $user = $request->getUser();
     if (!$request->isFormPost()) {
         return new Aphront400Response();
     }
     $event = id(new PhabricatorCalendarEventQuery())->setViewer($user)->withIDs(array($this->id))->executeOne();
     if (!$event) {
         return new Aphront404Response();
     }
     $is_preview = $request->isPreviewRequest();
     $draft = PhabricatorDraft::buildFromRequest($request);
     $view_uri = '/' . $event->getMonogram();
     $xactions = array();
     $xactions[] = id(new PhabricatorCalendarEventTransaction())->setTransactionType(PhabricatorTransactions::TYPE_COMMENT)->attachComment(id(new PhabricatorCalendarEventTransactionComment())->setContent($request->getStr('comment')));
     $editor = id(new PhabricatorCalendarEventEditor())->setActor($user)->setContinueOnNoEffect($request->isContinueRequest())->setContentSourceFromRequest($request)->setIsPreview($is_preview);
     try {
         $xactions = $editor->applyTransactions($event, $xactions);
     } catch (PhabricatorApplicationTransactionNoEffectException $ex) {
         return id(new PhabricatorApplicationTransactionNoEffectResponse())->setCancelURI($view_uri)->setException($ex);
     }
     if ($draft) {
         $draft->replaceOrDelete();
     }
     if ($request->isAjax() && $is_preview) {
         return id(new PhabricatorApplicationTransactionResponse())->setViewer($user)->setTransactions($xactions)->setIsPreview($is_preview);
     } else {
         return id(new AphrontRedirectResponse())->setURI($view_uri);
     }
 }
开发者ID:hrb518,项目名称:phabricator,代码行数:30,代码来源:PhabricatorCalendarEventCommentController.php

示例3: handleRequest

 public function handleRequest(AphrontRequest $request)
 {
     $viewer = $request->getViewer();
     $id = $request->getURIData('id');
     if (!$request->isFormPost()) {
         return new Aphront400Response();
     }
     $document = id(new LegalpadDocumentQuery())->setViewer($viewer)->withIDs(array($id))->needDocumentBodies(true)->executeOne();
     if (!$document) {
         return new Aphront404Response();
     }
     $is_preview = $request->isPreviewRequest();
     $draft = PhabricatorDraft::buildFromRequest($request);
     $document_uri = $this->getApplicationURI('view/' . $document->getID());
     $comment = $request->getStr('comment');
     $xactions = array();
     if (strlen($comment)) {
         $xactions[] = id(new LegalpadTransaction())->setTransactionType(PhabricatorTransactions::TYPE_COMMENT)->attachComment(id(new LegalpadTransactionComment())->setDocumentID($document->getID())->setLineNumber(0)->setLineLength(0)->setContent($comment));
     }
     $editor = id(new LegalpadDocumentEditor())->setActor($viewer)->setContentSourceFromRequest($request)->setContinueOnNoEffect($request->isContinueRequest())->setIsPreview($is_preview);
     try {
         $xactions = $editor->applyTransactions($document, $xactions);
     } catch (PhabricatorApplicationTransactionNoEffectException $ex) {
         return id(new PhabricatorApplicationTransactionNoEffectResponse())->setCancelURI($document_uri)->setException($ex);
     }
     if ($draft) {
         $draft->replaceOrDelete();
     }
     if ($request->isAjax() && $is_preview) {
         return id(new PhabricatorApplicationTransactionResponse())->setViewer($viewer)->setTransactions($xactions)->setIsPreview($is_preview);
     } else {
         return id(new AphrontRedirectResponse())->setURI($document_uri);
     }
 }
开发者ID:pugong,项目名称:phabricator,代码行数:34,代码来源:LegalpadDocumentCommentController.php

示例4: handleRequest

 public function handleRequest(AphrontRequest $request)
 {
     $viewer = $request->getViewer();
     $id = $request->getURIData('id');
     if (!$request->isFormPost()) {
         return new Aphront400Response();
     }
     $answer = id(new PonderAnswerQuery())->setViewer($viewer)->withIDs(array($id))->executeOne();
     if (!$answer) {
         return new Aphront404Response();
     }
     $is_preview = $request->isPreviewRequest();
     $qid = $answer->getQuestion()->getID();
     $aid = $answer->getID();
     // TODO, this behaves badly when redirecting to the answer
     $view_uri = "/Q{$qid}";
     $xactions = array();
     $xactions[] = id(new PonderAnswerTransaction())->setTransactionType(PhabricatorTransactions::TYPE_COMMENT)->attachComment(id(new PonderAnswerTransactionComment())->setContent($request->getStr('comment')));
     $editor = id(new PonderAnswerEditor())->setActor($viewer)->setContinueOnNoEffect($request->isContinueRequest())->setContentSourceFromRequest($request)->setIsPreview($is_preview);
     try {
         $xactions = $editor->applyTransactions($answer, $xactions);
     } catch (PhabricatorApplicationTransactionNoEffectException $ex) {
         return id(new PhabricatorApplicationTransactionNoEffectResponse())->setCancelURI($view_uri)->setException($ex);
     }
     if ($request->isAjax() && $is_preview) {
         return id(new PhabricatorApplicationTransactionResponse())->setViewer($viewer)->setTransactions($xactions)->setIsPreview($is_preview);
     } else {
         return id(new AphrontRedirectResponse())->setURI($view_uri);
     }
 }
开发者ID:pugong,项目名称:phabricator,代码行数:30,代码来源:PonderAnswerCommentController.php

示例5: buildFromRequest

 public static function buildFromRequest(AphrontRequest $request)
 {
     $user = $request->getUser();
     if (!$user->getPHID()) {
         return null;
     }
     if (!$request->getStr('__draft__')) {
         return null;
     }
     $draft = id(new PhabricatorDraft())->setAuthorPHID($user->getPHID())->setDraftKey($request->getStr('__draft__'));
     // If this is a preview, add other data. If not, leave the draft empty so
     // that replaceOrDelete() will delete it.
     if ($request->isPreviewRequest()) {
         $other_data = $request->getPassthroughRequestData();
         unset($other_data['comment']);
         $draft->setDraft($request->getStr('comment'))->setMetadata($other_data);
     }
     return $draft;
 }
开发者ID:pugong,项目名称:phabricator,代码行数:19,代码来源:PhabricatorDraft.php

示例6: handleRequest

 public function handleRequest(AphrontRequest $request)
 {
     $viewer = $request->getViewer();
     $id = $request->getURIData('id');
     if (!$request->isFormPost()) {
         return new Aphront400Response();
     }
     $mock = id(new PholioMockQuery())->setViewer($viewer)->withIDs(array($id))->needImages(true)->executeOne();
     if (!$mock) {
         return new Aphront404Response();
     }
     $is_preview = $request->isPreviewRequest();
     $draft = PhabricatorDraft::buildFromRequest($request);
     $mock_uri = '/M' . $mock->getID();
     $comment = $request->getStr('comment');
     $xactions = array();
     $inline_comments = id(new PholioTransactionComment())->loadAllWhere('authorphid = %s AND transactionphid IS NULL AND imageid IN (%Ld)', $viewer->getPHID(), mpull($mock->getImages(), 'getID'));
     if (!$inline_comments || strlen($comment)) {
         $xactions[] = id(new PholioTransaction())->setTransactionType(PhabricatorTransactions::TYPE_COMMENT)->attachComment(id(new PholioTransactionComment())->setContent($comment));
     }
     foreach ($inline_comments as $inline_comment) {
         $xactions[] = id(new PholioTransaction())->setTransactionType(PholioTransaction::TYPE_INLINE)->attachComment($inline_comment);
     }
     $editor = id(new PholioMockEditor())->setActor($viewer)->setContentSourceFromRequest($request)->setContinueOnNoEffect($request->isContinueRequest())->setIsPreview($is_preview);
     try {
         $xactions = $editor->applyTransactions($mock, $xactions);
     } catch (PhabricatorApplicationTransactionNoEffectException $ex) {
         return id(new PhabricatorApplicationTransactionNoEffectResponse())->setCancelURI($mock_uri)->setException($ex);
     }
     if ($draft) {
         $draft->replaceOrDelete();
     }
     if ($request->isAjax() && $is_preview) {
         $xaction_view = id(new PholioTransactionView())->setMock($mock);
         return id(new PhabricatorApplicationTransactionResponse())->setViewer($viewer)->setTransactions($xactions)->setTransactionView($xaction_view)->setIsPreview($is_preview);
     } else {
         return id(new AphrontRedirectResponse())->setURI($mock_uri);
     }
 }
开发者ID:truSense,项目名称:phabricator,代码行数:39,代码来源:PholioMockCommentController.php


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