本文整理汇总了PHP中SS_HTTPResponse::param方法的典型用法代码示例。如果您正苦于以下问题:PHP SS_HTTPResponse::param方法的具体用法?PHP SS_HTTPResponse::param怎么用?PHP SS_HTTPResponse::param使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SS_HTTPResponse
的用法示例。
在下文中一共展示了SS_HTTPResponse::param方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleResolveCategoryChange
/**
* @param SS_HTTPResponse $r
* @return SS_HTTPResponse|void
* @throws SS_HTTPResponse_Exception
* @throws ValidationException
* @throws null
*/
public function handleResolveCategoryChange(SS_HTTPResponse $r)
{
if (!Permission::check('ADMIN')) {
return $this->httpError(403);
}
if (!is_numeric($r->param('ID'))) {
return $this->httpError(500, "Invalid category change id");
}
$vars = Convert::json2array($r->getBody());
if (!isset($vars['approved'])) {
return $this->httpError(500, "Request body must contain 'approved' 1 or 0");
}
$approved = (bool) $vars['approved'];
$request = SummitCategoryChange::get()->byID($r->param('ID'));
if (!$request) {
return $this->httpError(500, "Request " . $r->param('ID') . " does not exist");
}
$status = $approved ? SummitCategoryChange::STATUS_APPROVED : SummitCategoryChange::STATUS_REJECTED;
if ($request->Presentation()->isSelectedByAnyone()) {
return new SS_HTTPResponse("The presentation has already been selected by chairs.", 500);
}
if ($request->Presentation()->CategoryID == $request->NewCategoryID) {
return new SS_HTTPResponse("The presentation is already in this category.", 200);
}
// Make the category change
$summit = Summit::get_active();
$category = $summit->Categories()->filter('ID', $request->NewCategoryID)->first();
if (!$category->exists()) {
return $this->httpError(500, "Category not found in current summit");
}
$oldCat = $request->Presentation()->Category();
if ($approved) {
$request->OldCategoryID = $request->Presentation()->CategoryID;
$request->Presentation()->CategoryID = $request->NewCategoryID;
$request->Presentation()->write();
$request->Presentation()->addNotification('{member} approved ' . $request->Reqester()->getName() . '\'s request to move this presentation from ' . $oldCat->Title . ' to ' . $category->Title);
} else {
$request->Presentation()->addNotification('{member} rejected ' . $request->Reqester()->getName() . '\'s request to move this presentation from ' . $oldCat->Title . ' to ' . $category->Title);
}
$request->AdminApproverID = Member::currentUserID();
$request->Status = $status;
$request->ApprovalDate = SS_Datetime::now();
$request->write();
$peers = SummitCategoryChange::get()->filter(['PresentationID' => $request->PresentationID, 'NewCategoryID' => $request->NewCategoryID])->exclude(['ID' => $request->ID]);
foreach ($peers as $p) {
$p->AdminApproverID = Member::currentUserID();
$p->Status = SummitCategoryChange::STATUS_APPROVED;
$p->ApprovalDate = SS_Datetime::now();
$p->write();
}
return $this->ok('change request accepted.');
}
示例2: handleAcceptCategoryChange
public function handleAcceptCategoryChange(SS_HTTPResponse $r)
{
if (!Permission::check('ADMIN')) {
return $this->httpError(403);
}
if (!is_numeric($r->param('ID'))) {
return $this->httpError(500, "Invalid category change id");
}
$request = SummitCategoryChange::get()->byID($r->param('ID'));
if ($request->exists()) {
if ($request->Presentation()->isSelectedByAnyone()) {
return new SS_HTTPResponse("The presentation has already been selected by chairs.", 500);
}
if ($request->Presentation()->CategoryID == $request->NewCategoryID) {
$request->Done = TRUE;
$request->write();
return new SS_HTTPResponse("The presentation is already in this category.", 200);
}
// Make the category change
$summit = Summit::get_active();
$category = $summit->Categories()->filter('ID', $request->NewCategoryID)->first();
if (!$category->exists()) {
return $this->httpError(500, "Category not found in current summit");
}
$request->OldCategoryID = $request->Presentation()->CategoryID;
$request->Presentation()->CategoryID = $request->NewCategoryID;
$request->Presentation()->write();
$comment = new SummitPresentationComment();
$comment->Body = 'This presentaiton was moved into the category ' . $category->Title . '.' . ' The chage was approved by ' . Member::currentUser()->FirstName . ' ' . Member::currentUser()->Surname . '.';
$comment->PresentationID = $request->Presentation()->ID;
$comment->write();
$request->AdminApproverID = Member::currentUserID();
$request->Approved = TRUE;
$request->Done = TRUE;
$request->ApprovalDate = SS_Datetime::now();
$request->write();
return new SS_HTTPResponse("change request accepted.", 200);
}
}
示例3: cancel
/**
* Process request from the external gateway, this action is usually triggered if the payment was cancelled
* and the user was redirected to the cancelURL.
*
* @param SS_HTTPResponse $request
*/
public function cancel($request)
{
// Reconstruct the payment object
$this->payment = Payment::get()->byID($request->param('OtherID'));
// Reconstruct the gateway object
$methodName = $request->param('ID');
$this->gateway = PaymentFactory::get_gateway($methodName);
// The payment result was a failure
$this->payment->updateStatus(new PaymentGateway_Failure());
// Do redirection
$this->doRedirect();
}