本文整理汇总了PHP中Request::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::get方法的具体用法?PHP Request::get怎么用?PHP Request::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Request
的用法示例。
在下文中一共展示了Request::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCalleIdAsociado
/**
* Update or creates a 'Calle' as from the resquest data, and return the id.
*
* @param Request $request
* @return int
*/
protected function getCalleIdAsociado($request)
{
$nombre_calle = strtolower($request->get('nombre_calle'));
// Intento buscar la calle, si no existe entonces la creo.
$calle = Calle::firstOrCreate(['nombre' => $nombre_calle, 'localidad_id' => $request->get('localidad_id')]);
return $calle->id;
}
示例2: testTranslate
/**
* @covers Request::translate
* @todo Implement testTranslate().
*/
public function testTranslate()
{
// Remove the following lines when you implement this test.
$test_t = $this->object->add("test_add2", " <p>タグ</p> ");
$test_t = $this->object->get("test_add2");
$this->assertEquals($test_t, "タグ");
}
示例3: testReturnsResultOfPassingWpDataToFactoryCreate
public function testReturnsResultOfPassingWpDataToFactoryCreate()
{
$wpData = ['response' => ['code' => 201]];
$this->wpHttp->get('uri', [])->willReturn($wpData);
$this->factory->create($wpData)->shouldBeCalled();
$this->request->get('uri');
}
示例4: alipayreturn
/**
* @Route("/alipayreturn", name="alipayreturn")
*/
public function alipayreturn(Request $request)
{
$payment = $this->get('payment')->get('alipay');
$verify_result = $payment->verifyReturn();
if ($verify_result) {
//验证成功
//请在这里加上商户的业务逻辑程序代码
//——请根据您的业务逻辑来编写程序(以下代码仅作参考)——
//获取支付宝的通知返回参数,可参考技术文档中页面跳转同步通知参数列表
//商户订单号
$out_trade_no = $request->get('out_trade_no');
//支付宝交易号
$trade_no = $request->get('trade_no');
//交易状态
$trade_status = $request->get('trade_status');
if ($trade_status == 'TRADE_FINISHED' || $trade_status == 'TRADE_SUCCESS') {
//判断该笔订单是否在商户网站中已经做过处理
//如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序
//如果有做过处理,不执行商户的业务程序
} else {
echo "trade_status=" . $trade_status;
}
echo "验证成功<br />";
//——请根据您的业务逻辑来编写程序(以上代码仅作参考)——
} else {
//验证失败
//如要调试,请看alipay_notify.php页面的verifyReturn函数
echo "验证失败";
}
return $this->render('default/index.html.twig', ['base_dir' => realpath($this->getParameter('kernel.root_dir') . '/..')]);
}
示例5: ajaxSetDate
/**
* AJAX call for set payment and cancel dates on Dossier details page (Financial > Price)
*
* @Route("/ajax/set/date", name="payment_ajax_set_date")
*/
public function ajaxSetDate(Request $request)
{
$type = $request->get('type');
$dateType = $request->get('dateType');
$dossierId = $request->get('dossierId');
$paymentId = $request->get('paymentId');
$value = $request->get('value');
$em = $this->getDoctrine()->getManager();
$dossier = $em->getRepository('BraemBackofficeBundle:Dossier')->find($dossierId);
if (!$dossier) {
throw $this->createNotFoundException('Unable to find Dossier entity.');
}
$payment = $this->getCurrentPayment($paymentId, $type, $dossierId);
$hasPayment = $payment->getId() ? true : false;
if (!$hasPayment) {
$payment->setDossier($dossier);
$user = $this->container->get('security.context')->getToken()->getUser();
$payment->setUser($user);
}
$payment->setType($type);
$dateSetter = 'set' . ucfirst($dateType);
$date = \DateTime::createFromFormat('d/m/Y', $value);
$payment->{$dateSetter}($date);
$em->persist($payment);
$em->flush();
$dateTitle = $this->getTitleForDate($dateType);
$dateTitleReturn = $this->get('translator')->trans($dateTitle);
$valueArr = explode('/', $value);
$valueReturn = $valueArr[2] . '-' . $valueArr[1] . '-' . $valueArr[0];
$dateTypeReturn = str_replace('Date', '', $dateType);
$response = array('type' => $type, 'dateType' => $dateTypeReturn, 'dossierId' => $dossierId, 'paymentId' => $payment->getId(), 'value' => $valueReturn, 'title' => $dateTitleReturn);
$return = new Response();
$return->setContent(json_encode($response));
return $return;
}
示例6: splitDossierProcessAction
/**
* Split dossier with few units into dossiers with one unit for selected.
*
* @Route("/{id}/split/process", name="dossier_split_process")
* @Secure(roles="ROLE_ADVANCED_USER")
* @Template("IMSCCSBundle:BaseDossier:show.html.twig")
*/
public function splitDossierProcessAction(Request $request, $id)
{
$newDossierIds = "";
$em = $this->getDoctrine()->getManager();
$baseDossier = $em->getRepository('IMSCCSBundle:BaseDossier')->find($id);
if (!$baseDossier) {
throw $this->createNotFoundException('Unable to find Dossier entity.');
}
if ($baseDossier->isLockedManifest()) {
throw new AccessDeniedException('The manifest is locked this action is not possible anymore');
}
if ($request->get('units') == 0) {
$this->get('logger')->info('request: ' . var_export($this->getRequest()->request, TRUE));
throw $this->createNotFoundException('No selected units for split.');
}
$detailedDossiers = $baseDossier->getDossiers();
$detailedDossier = $detailedDossiers[0];
$carsIds = array();
foreach ($request->get('units') as $key => $value) {
array_push($carsIds, $key);
}
$cars = $em->createQuery('SELECT c FROM IMSCCSBundle:Car c WHERE c.id IN(?1)')->setParameter(1, $carsIds)->getResult();
$totalCars = $em->createQuery('SELECT c FROM IMSCCSBundle:Car c WHERE c.detailedDossier = ?1')->setParameter(1, $detailedDossier->getId())->getResult();
$amountCars = count($cars);
$amountTotalCars = count($totalCars);
foreach ($cars as $key => $car) {
if ($amountCars == $amountTotalCars && $key != 0 || $amountCars != $amountTotalCars) {
$newBaseDossier = clone $baseDossier;
$newBaseDossier->setDonorDossier($baseDossier->getUniqueId());
$bl = clone $detailedDossier->getBl();
$newDetailedDossier = clone $detailedDossier;
// It's important that the creation date of the new dossier is the current date
// otherwise it can mess up the BL numbering for the departure
$newBaseDossier->setDate(new \DateTime());
// Prevent integrity constraint violation
$newBaseDossier->setInvoice($baseDossier->getInvoice());
$car->setDetailedDossier($newDetailedDossier);
$car->setBaseDossierForExternalApps($newBaseDossier);
$bl->setDossier($newDetailedDossier);
$newDetailedDossier->setBaseDossier($newBaseDossier);
$newBaseDossier->setReference($em->getRepository('IMSCCSBundle:BaseDossier')->generateDossierReference($baseDossier->getCustomer()));
$em->persist($baseDossier);
$em->persist($newBaseDossier);
$em->persist($newDetailedDossier);
$em->persist($car);
$em->persist($bl);
$em->flush();
$isMaster = $this->container->getParameter('master_app');
if ($isMaster) {
$newBaseDossier->setSourceDossierId($newBaseDossier->getId());
$em->flush();
}
$newDossierIds .= " <a href=" . $this->generateUrl('dossier_show', array('id' => $newBaseDossier->getId())) . ">#" . $newBaseDossier->getId() . "</a>,";
}
}
$em->clear();
$this->get('session')->getFlashBag()->add('success', 'Current dossier was successfully split on current and ' . rtrim($newDossierIds, ",") . ' dossier(s)');
return $this->redirect($this->generateUrl('dossier_show', array('id' => $id)));
}
示例7: getInput
protected function getInput($value, $label = '', $transformers = null, $validators = null)
{
$value = $this->request->get($value);
if (!empty($transformers) && !empty($validators)) {
$value = \eBuildy\DataBinder\DataBinderHelper::get($value, $label, $transformers, $validators);
}
return $value;
}
示例8: searchAction
public function searchAction()
{
$phrase = $this->request->get('search_type[phrase]', false, true);
if (empty($phrase)) {
return $this->render('ValantirForumBundle:Search:search-result.html.twig', array('phrase' => $phrase));
}
$searchQuery = $this->getTopicManager()->findWith($phrase);
$pagination = $this->paginator->paginate($searchQuery, $this->request->get('page', 1), 10, array('wrap-queries' => true));
return $this->render('ValantirForumBundle:Search:search-result.html.twig', array('topics' => $pagination, 'phrase' => $phrase));
}
示例9: convert
public function convert(Request $request)
{
$messageData = [];
$messageData['to'] = "admin@example.com";
$messageData['from'] = [$request->get('name') => $request->get('email')];
$messageData['subject'] = 'Contact form submission';
$messageData['alt'] = true;
$body = "{$request->get}('name') \n {$request->get}('company') \n {$request->get}('phone') \n {$request->get}('comment')";
$messageData['body'] = $body;
return $messageData;
}
示例10: getPagination
public function getPagination()
{
$request = new Request();
$bookModel = new BookModel();
$itemsCount = $bookModel->getBooksCount();
$itemsPerPage = BOOKS_PER_PAGE;
$currentPage = $request->get('page') ? (int) $request->get('page') : 1;
if ($currentPage < 0) {
throw new Exception('Bad request', 400);
}
$pagination = new Pagination($currentPage, $itemsCount, $itemsPerPage);
$args['pagination'] = $pagination->buttons;
return $this->render('pagination', $args);
//Debugger::PrintR($args);
}
示例11: execute
function execute()
{
$app = strtolower(Request::get('app_local'));
$locale = new Locales($app);
$locale->deleteTranslate(Request::get('local_iso'), Request::post('var'));
return false;
}
示例12: __construct
public function __construct($table, $id = null, $fields = array())
{
$this->table = $table;
$this->content = $this->view();
$this->id = $id;
$this->fields = $fields;
switch (Request::get('action')) {
case 'index':
$this->content = $this->index();
break;
case 'add':
$this->content = $this->create();
break;
case 'view':
$this->content = $this->view();
break;
case 'edit':
$this->content = $this->create($this->id);
break;
case 'delete':
$this->delete($this->id);
$this->content = $this->index();
break;
case 'update':
$this->update();
$this->content = $this->index();
break;
default:
$this->content = $this->index();
break;
}
}
示例13: unpaidPayeePayments
public function unpaidPayeePayments()
{
$query = PayeePayment::unpaid();
$query->with(["payee", "client"]);
$query->join(User::table() . " as user", 'user.code', '=', PayeePayment::table() . '.payee_code');
$filters = Request::get('_filter');
if (count($filters)) {
foreach ($filters as $key => $filter) {
list($field, $value) = explode(':', $filter);
if (strpos($filter, 'search') !== false) {
$query->where(function ($query) use($value) {
$query->orWhere("user.name", "like", '%' . $value . '%');
});
} else {
$this->attachWhere($query, $value, $field);
}
}
}
$this->attachSort(new PayeePayment(), $query);
$count = $this->getQueryCount($query);
$offset = $this->attachOffset($query);
$limit = $this->attachLimit($query);
$items = $query->get([PayeePayment::table() . '.*']);
return Response::json(array('model' => "PayeePayment", 'items' => $items->toApiArray(), 'offset' => $offset, 'limit' => $limit, 'count' => $count), 200, [], JSON_NUMERIC_CHECK);
}
示例14: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
$route = Route::getCurrentRoute()->getPath();
if ('/admin/disciplinas' == $route) {
$conteudoDisciplinas = new Disciplinas();
/*$id = Input::get('id');
if($id>0){
$conteudoDisciplinas = Disciplinas::find($id);
}*/
$conteudoDisciplinas->nome_dis = Request::get('nomeDisciplina');
$conteudoDisciplinas->codigo_dis = Request::get('codigoDisciplina');
$conteudoDisciplinas->periodo_dis = Request::get('periodoDisciplina');
$conteudoDisciplinas->save();
$value = array('success' => true);
// return json_encode($value);
return Redirect::to('/admin/disciplinas');
}
if ('/admin/professores' == $route) {
return 'oi';
}
/*switch($route){
case '/admin/disciplinas/add':
$queryBuilder = 'Disciplinas';
break;
default:
break;
}
$updater = new $queryBuilder();*/
}
示例15: before_filter
public function before_filter(&$action, &$args)
{
parent::before_filter($action, $args);
$course_id = Request::option('sem_id', $args[0]);
if (empty($course_id)) {
checkObject();
//wirft Exception, wenn $SessionSeminar leer ist
$course_id = $GLOBALS['SessionSeminar'];
}
$this->course = Course::find($course_id);
if (!$this->course) {
throw new Trails_Exception(400);
}
$this->send_from_search_page = Request::get('send_from_search_page');
if ($GLOBALS['SessionSeminar'] != $this->course->id && !(int) $this->course->visible && !($GLOBALS['perm']->have_perm(Config::get()->SEM_VISIBILITY_PERM) || $GLOBALS['perm']->have_studip_perm('user', $this->course->id))) {
throw new AccessDeniedException(_('Diese Veranstaltung ist versteckt. Hier gibt es nichts zu sehen.'));
}
if (!preg_match('/^(' . preg_quote($GLOBALS['CANONICAL_RELATIVE_PATH_STUDIP'], '/') . ')?([a-zA-Z0-9_-]+\\.php)([a-zA-Z0-9_?&=-]*)$/', $this->send_from_search_page)) {
$this->send_from_search_page = '';
}
if ($this->course->getSemClass()->offsetGet('studygroup_mode')) {
if ($GLOBALS['perm']->have_studip_perm('autor', $this->course->id)) {
// participants may see seminar_main
$link = URLHelper::getUrl('seminar_main.php', array('auswahl' => $this->course->id));
} else {
$link = URLHelper::getUrl('dispatch.php/course/studygroup/details/' . $this->course->id, array('send_from_search_page' => $this->send_from_search_page));
}
$this->redirect($link);
return;
}
}