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


PHP sfWebRequest::getRequestParameters方法代码示例

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


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

示例1: executeRating

 public function executeRating(sfWebRequest $request)
 {
     if ($request->isXmlHttpRequest()) {
         $postParam = $request->getRequestParameters();
         $postParam2 = $request->getPostParameters();
         if ((array_key_exists('rating', $postParam) || array_key_exists('rating', $postParam2)) && array_key_exists('querytrackid', $postParam) && array_key_exists('resulttrackid', $postParam) && array_key_exists('resultposition', $postParam) && array_key_exists('featurevectortypeid', $postParam) && array_key_exists('distancetypeid', $postParam)) {
             $rating = array_key_exists('rating', $postParam) ? $postParam['rating'] : $postParam2['rating'];
             QueryCommentTrackPeer::updateRating($rating, $postParam['querytrackid'], $postParam['resulttrackid'], $postParam['resultposition'], $postParam['featurevectortypeid'], $postParam['distancetypeid']);
             return $this->renderText($postParam['rating']);
         }
     }
     $this->getResponse()->setStatusCode(500);
     return $this->renderText("Comment was not saved! Please contact us about the problem." . print_r($postParam, true) . print_r($postParam2, true));
 }
开发者ID:EQ4,项目名称:smint,代码行数:14,代码来源:actions.class.php

示例2: extractParameters

 /**
  *
  * @param sfWebRequest $request 
  * @return WSRequestParameters
  */
 public function extractParameters(sfWebRequest $request)
 {
     $webRequestParameters = new WSRequestParameters();
     $logger = Logger::getLogger('core.webservices');
     $requestMethod = $request->getMethod();
     $contentType = $request->getContentType();
     $logger->debug("HTTP Method: {$requestMethod}, Content-Type: {$contentType}");
     $requestParameters = $request->getRequestParameters();
     $logger->debug("Request Parameters: " . print_r($requestParameters, true));
     if (!isset($requestParameters['ws_method'])) {
         throw new WebServiceException('Web service method is not specified', 400);
     }
     $webServiceMethod = $requestParameters['ws_method'];
     $methodParameters = array();
     // Checking for deprecated method of sending parameters using an http header
     $header = $request->getHttpHeader('ohrm_ws_method_parameters');
     if (!empty($header)) {
         $methodParameters = json_decode($header, true);
         if (!is_array($methodParameters)) {
             throw new WebServiceException("header ohrm_ws_method_parameters should be json encoded", 400);
         }
     } else {
         // get request parameters in URL (eg: /empNumber/11) after removing the default parameters
         $methodParameters = array_diff_key($requestParameters, array_flip(array('action', 'module', 'ws_method', '_sf_route')));
         // Merge with GET parameters
         $methodParameters = array_merge($methodParameters, $request->getGetParameters());
         // Check for JSON encoded body
         if ($contentType === 'application/json') {
             $postParams = json_decode(file_get_contents('php://input'), true);
             $methodParameters = array_merge($methodParameters, $postParams);
         } else {
             if ($requestMethod === 'POST') {
                 $methodParameters = array_merge($methodParameters, $request->getPostParameters());
             }
         }
     }
     //        $arrayName = $this->getArrayNameForFunction($function);
     //        if(!array_key_exists($arrayName, $methodParameters)) {
     //            throw new WebServiceException('Required array name not provided', 404);
     //        }
     $webRequestParameters->setRequestMethod($requestMethod);
     $webRequestParameters->setMethod($webServiceMethod);
     $webRequestParameters->setParameters($methodParameters);
     //        $webRequestParameters->setAppId($authenticationParamerters['app_id']);
     //        $webRequestParameters->setAppToken($authenticationParamerters['app_token']);
     //        $webRequestParameters->setSessionToken($authenticationParamerters['session_token']);
     return $webRequestParameters;
 }
开发者ID:lahirwisada,项目名称:orangehrm,代码行数:53,代码来源:WSHelper.php

示例3: extractParamerts

 /**
  *
  * @param sfWebRequest $request 
  * @return WSRequestParameters
  */
 public function extractParamerts(sfWebRequest $request)
 {
     $webRequestParameters = new WSRequestParameters();
     $requestMethod = $request->getMethod();
     $parameters = array_keys($request->getRequestParameters());
     if (count($parameters) < 4) {
         throw new WebServiceException('Web service method is not specified', 1001);
     }
     //$authenticationParamerters = json_decode($request->getHttpHeader('ohrm_ws_auth_parameters'), true);
     $methodParameters = json_decode($request->getHttpHeader('ohrm_ws_method_parameters'), true);
     //        if (!is_array($authenticationParamerters)) {
     //            throw new WebServiceException('Authentication parameters are sent in a wrong format', 1002);
     //        }
     if (!is_array($methodParameters)) {
         throw new WebServiceException('Method parameters are sent in a wrong format', 1003);
     }
     $webRequestParameters->setRequestMethod($requestMethod);
     $webRequestParameters->setMethod($parameters[2]);
     $webRequestParameters->setParameters($methodParameters);
     //        $webRequestParameters->setAppId($authenticationParamerters['app_id']);
     //        $webRequestParameters->setAppToken($authenticationParamerters['app_token']);
     //        $webRequestParameters->setSessionToken($authenticationParamerters['session_token']);
     return $webRequestParameters;
 }
开发者ID:EFForg,项目名称:lemonhrm,代码行数:29,代码来源:WSHelper.php

示例4: executeAdd

 public function executeAdd(sfWebRequest $request)
 {
     if ($request->isMethod('post')) {
         $name = $request->getParameter('reports')['name'];
         if (!$name) {
             $this->forwardToSecureAction();
         }
         if (!in_array($name, array_keys(Reports::getGlobalReports($this->getUser())))) {
             $this->info_message = $this->getI18N()->__("You are not allowed to print this kind of report.");
             return $this->renderPartial("info_msg", array("info_message" => $this->info_message));
         }
         $default_vals = array();
         foreach ($request->getRequestParameters() as $rp_key => $rp_value) {
             if (strpos($rp_key, 'default_vals[') !== false && strpos($rp_key, ']') !== false && strpos($rp_key, ']') - strpos($rp_key, '[') > 1) {
                 $default_vals[substr($rp_key, strpos($rp_key, '[') + 1, strpos($rp_key, ']') - strpos($rp_key, '[') - 1)] = $rp_value;
             }
         }
         $this->setWidgetsOptions($name);
         $this->form = new ReportsForm(null, array('fields' => $this->widgets, 'name' => $name, 'model_name' => $request->getParameter('catalogue', 'taxonomy'), 'with_js' => $request->getParameter('with_js', false), 'default_vals' => $default_vals, 'current_user' => $this->getUser()));
         $this->form->bind($request->getParameter($this->form->getName()));
         if ($this->form->isValid()) {
             if (isset($request->getParameter('reports')['loan_id']) && count(Doctrine::getTable('Loans')->getPrintableLoans(array($request->getParameter('reports')['loan_id']), $this->getUser())) == 0) {
                 $this->info_message = $this->getI18n()->__("You don't have the necessary credentials to print this loan");
             } else {
                 $this->info_message = $this->getI18n()->__("Your report has been saved. It will be availlable tomorrow");
                 $report = new Reports();
                 $report->fromArray(array('name' => $name, 'user_ref' => $this->getUser()->getId(), 'lang' => $this->getUser()->getCulture(), 'format' => $request->getParameter('reports')['format'], 'comment' => $request->getParameter('reports')['comment']));
                 $report->setParameters($request->getParameter('reports'));
                 // Save the report whatever it's a fast or a non fast one
                 $report->save();
                 //if it's a fast report, it can be downloaded directly
                 if (Reports::getIsFast($name)) {
                     $response = $this->processDownload($report);
                     if ($response != 0) {
                         $message = json_encode($this->getPartial("info_msg", array("info_message" => $this->info_message)));
                         return $this->renderText('{ "report_url" : "' . $this->generateUrl("default", array("module" => "report", "action" => "downloadFile", "id" => $response), TRUE) . '", "message": ' . $message . ' }');
                     }
                 }
             }
             return $this->renderPartial("info_msg", array("info_message" => $this->info_message));
         }
         $val = $this->renderPartial("report_form", array('form' => $this->form, 'fields' => $this->widgets, 'fields_options' => $this->widgets_options, 'fields_at_second_line' => $this->widgets_second_line_count, 'model_name' => $request->getParameter('catalogue', 'taxonomy'), 'fast' => Reports::getIsFast($name), 'with_js' => $request->getParameter('with_js', false), 'default_vals' => $default_vals));
         return $val;
     }
 }
开发者ID:naturalsciences,项目名称:Darwin,代码行数:45,代码来源:actions.class.php

示例5: executeAjaxAddPersonAndPassenger


//.........这里部分代码省略.........
             $this->person->setDeceased($this->person_form->getValue('deceased'));
             $this->person->setDeceasedComment($this->person_form->getValue('deceased_comment'));
             $this->person->setSecondaryEmail($this->person_form->getValue('secondary_email'));
             $this->person->setDeceasedDate($this->person_form->getValue('deceased_date'));
             $this->person->setMiddleName($this->person_form->getValue('middle_name'));
             $this->person->setSuffix($this->person_form->getValue('suffix'));
             $this->person->setNickname($this->person_form->getValue('nickname'));
             $this->person->setVeteran($this->person_form->getValue('veteran'));
             if ($this->person->isNew()) {
                 $content = $this->getUser()->getName() . ' added new Person: ' . $this->person->getFirstName();
                 ActivityPeer::log($content);
             }
             $this->person->save();
             //////////////////////////////////////#bglobal omar
             if ($this->person->getId()) {
                 $passenger = new Passenger($this->person->getId());
                 $passenger->setPersonId($this->person->getId());
                 $passenger->save();
                 $c = new Criteria();
                 $c->add(RoleNotificationPeer::MID, 5);
                 $c->add(RoleNotificationPeer::NOTIFICATION, 1);
                 $c->addOr(RoleNotificationPeer::NOTIFICATION, 3);
                 $c->addJoin(RoleNotificationPeer::ROLE_ID, PersonRolePeer::ROLE_ID);
                 $c->addJoin(PersonRolePeer::PERSON_ID, PersonPeer::ID);
                 $personemail = PersonPeer::doSelect($c);
                 $allemail = array();
                 $pindex = 0;
                 foreach ($personemail as $getEmail) {
                     if (strlen($getEmail->getEmail()) > 0) {
                         $allemail[$pindex++] = $getEmail->getEmail();
                     } else {
                         if (strlen($getEmail->getSecondaryEmail()) > 0) {
                             $allemail[$pindex++] = $getEmail->getSecondaryEmail();
                         }
                     }
                 }
                 //$allemail[$pindex]="engfaruque@gmail.com";
                 /*
                                         $email['subject']="New Person added";
                                         $link=$request->getHost()."/person/view/".$this->person->getId();
                                         $body="A new person added in ".$request->getHost()."\r\n"
                                               .$this->person->getFirstName()." ".$this->person->getLastName()."\r\n Profile Link: ".$link;
                                         $email['body']=$body;
                                         $email['sender_email']="admin@afw.com";                        
                 
                                         $this->getComponent('mail', 'sendBulk', array(
                                         'subject' => $email['subject'],
                                         'recievers' => $allemail,
                                         'sender' => $email['sender_email'],
                                         'body' => $email['body'],
                                         ));*/
             }
             /////////////////////////////////////
             if ($request->hasParameter('has')) {
                 $data = '';
                 if ($request->getParameter('camp_id')) {
                     $data = '&camp_id=' . $request->getParameter('camp_id');
                 }
                 $this->getUser()->setFlash('success', 'Step 1 : New Person information has been successfully created! Now you can add passenger!');
                 $this->redirect('@passenger_create?add_pass=' . $request->getParameter('has') . '&p_id=' . $this->person->getId() . $data);
             }
             if ($request->hasParameter('iti')) {
                 $this->getUser()->setFlash('success', 'Step 1 : New Person information has been successfully created! Now you can add passenger!');
                 $this->redirect('@passenger_create?add_pass_iti=' . $request->getParameter('iti') . '&p_id=' . $this->person->getId());
             }
             if ($request->hasParameter('contact')) {
                 $this->getUser()->setFlash('success', 'Step 1 : New Person information has been successfully created! Now you can add contact!');
                 $this->redirect('@contact_create?person_id=' . $this->person->getId());
             }
             $this->getUser()->setFlash('success', 'Person information has been successfully saved!');
             $last = $request->getParameter('back');
             $referer_session = $this->getUser()->getAttribute('ref');
             //$back_url = '@person_view?id='.$this->person->getId();
             //$this->redirect($back_url);
             //$this->person_a = $this->person_form->getValue('first_name').' '. $this->person_form->getValue('last_name');
             //return $this->renderText('Person information has been successfully saved!');
             //return $this->renderText($this->person_form->getValue('first_name').' '. $this->person_form->getValue('last_name'));
             $this->personpass_id = $this->person->getId();
             $this->_passenger = PassengerPeer::getByPersonId($this->personpass_id);
             $this->personpass_last_name = $this->person->getLastName();
             //echo $this->person->getId();
             //$this->person_a = $this->person_form->getValue('first_name').' '. $this->person_form->getValue('last_name');
         } else {
             if ($request->getParameter("per[title]") == "") {
                 $this->titleError = "true";
             }
             if ($request->getParameter("per[first_name]") == "") {
                 $this->first_name_error = "true";
             }
             if ($request->getParameter("per[last_name]") == "") {
                 $this->last_name_error = "true";
             }
         }
         $this->person_form__ = $request->getRequestParameters();
         $this->setTemplate("ajaxAddPersonAndPassenger");
     } else {
         # Set referer URL
         $this->person_referer = $request->getReferer() ? $request->getReferer() : '@person';
     }
 }
开发者ID:yasirgit,项目名称:afids,代码行数:101,代码来源:actions.class.php


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