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


PHP sfWebRequest::getRequestFormat方法代码示例

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


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

示例1: executeShow

 public function executeShow(sfWebRequest $request)
 {
     $q = Doctrine_Query::create()->select('d.concept_name, um.*')->from('DomainModel d')->leftJoin('d.Concept um')->where('d.concept_slug = ?', $request->getParameter('concept_slug'))->andWhere('User.id = um.user_id')->andWhere('User.username = ?', $request->getParameter('username'))->setHydrationMode(Doctrine::HYDRATE_ARRAY);
     $domain_model = $q->execute();
     $dumper = userModelDumperFactory::getDumperFor($request->getRequestFormat());
     $this->domain_dump = $dumper->dump($domain_model);
 }
开发者ID:googlecode-mirror,项目名称:orso,代码行数:7,代码来源:actions.class.php

示例2: executeShow

 public function executeShow(sfWebRequest $request)
 {
     $this->cluster = $this->getRoute()->getObject();
     $this->forward404Unless($this->cluster);
     switch ($request->getRequestFormat()) {
         case 'yaml':
             $this->setLayout(false);
             $this->getResponse()->setContentType('text/yaml');
             break;
     }
 }
开发者ID:Koushi009,项目名称:station-manager,代码行数:11,代码来源:actions.class.php

示例3: executeList

 public function executeList(sfWebRequest $request)
 {
     $this->jobs = array();
     foreach ($this->getRoute()->getObjects() as $job) {
         $this->jobs[$this->generateUrl('job_show_user', $job, true)] = $job->asArray($request->getHost());
     }
     switch ($request->getRequestFormat()) {
         case 'yaml':
             $this->setLayout(false);
             $this->getResponse()->setContentType('text/yaml');
             break;
     }
 }
开发者ID:kalimatas,项目名称:jobeet,代码行数:13,代码来源:actions.class.php

示例4: executeConvert

 public function executeConvert(sfWebRequest $request)
 {
     // Check for additional get parameters
     if (count(array_diff(array_keys($request->getGetParameters()), sfConfig::get('app_convert_' . $request->getRequestFormat() . '_params')))) {
         return $this->setError(1200);
     }
     // Check for missing parameters
     if (!$request->hasParameter('amnt') || !$request->hasParameter('from') || !$request->hasParameter('to')) {
         return $this->setError(1100);
     }
     $currency = Doctrine::getTable('Currency');
     /* @var $currency Doctrine_Table */
     $this->from = $currency->findOneByCode($request->getParameter('from'));
     $this->to = $currency->findOneByCode($request->getParameter('to'));
     $this->amount = $request->getParameter('amnt');
     // Check for recognised currencies
     if (!$this->from instanceof Currency || !$this->to instanceof Currency) {
         return $this->setError(2000);
     }
     // Check the currencies are not the same
     if ($this->from == $this->to) {
         return $this->setError(1300);
     }
     // Check if amount contains >2 decimal digits.
     if (!is_numeric($this->amount) || strlen(substr(strrchr($this->amount, '.'), 1)) > sfConfig::get('app_convert_decimal_amount')) {
         return $this->setError(2100);
     }
     // Find cached currency rate
     $currency_rate = Doctrine::getTable('CurrencyRate')->getCurrencyRate($this->from, $this->to);
     /* @var $currency_rate CurrencyRate */
     // Check if currency rate needs updating
     if ($currency_rate->isNew() || $currency_rate->isOutdated()) {
         $currency_rate->setRate($this->getMoneyConverterRate());
         if (!$currency_rate->getRate()) {
             // Fallback functionality for rates not surved by themoneyconverter
             $currency_rate->setRate($this->getBloombergRate());
         }
         if ($currency_rate->getRate() > 0) {
             $currency_rate->setUpdatedAt(date('Y-m-d H:i:s'));
             $currency_rate->save();
         } else {
             return $this->setError(3200);
         }
     }
     // We want to be precise for currencies like ZWD where rates are often miniscule, but for other currencies 5 dp is fine
     $this->rate = $currency_rate->getRate() < 1.0E-5 ? number_format($currency_rate->getRate(), sfConfig::get('app_convert_decimal_stored')) : round($currency_rate->getRate(), sfConfig::get('app_convert_decimal_result'));
     $this->result = sprintf('%0.' . sfConfig::get('app_convert_decimal_result') . 'f', $this->amount * $this->rate);
     $this->at = $currency_rate->getDateTimeObject('updated_at')->format('d F Y H:i');
 }
开发者ID:asaraf28,项目名称:CurrencyConverter,代码行数:49,代码来源:actions.class.php

示例5: executeGenerateAuthToken

 public function executeGenerateAuthToken(sfWebRequest $request)
 {
     $this->auth_token = new AuthToken();
     $this->auth_token->User = $this->getUser()->getGuardUser();
     $pathInfo = $request->getPathInfoArray();
     $this->auth_token->remote_address = $pathInfo['REMOTE_ADDR'];
     $this->auth_token->remote_port = $pathInfo['REMOTE_PORT'];
     $this->auth_token->save();
     $this->user_id = $this->getUser()->getGuardUser()->getId();
     $this->username = $this->getUser()->getGuardUser()->getUsername();
     switch ($request->getRequestFormat()) {
         case 'yaml':
             $this->setLayout(false);
             $this->getResponse()->setContentType('text/yaml');
             break;
     }
 }
开发者ID:Koushi009,项目名称:station-manager,代码行数:17,代码来源:actions.class.php

示例6: executeShow

 public function executeShow(sfWebRequest $request)
 {
     $tree = Doctrine::getTable('DomainModel')->findOneByConceptSlug($request->getParameter('concept_slug'));
     switch ($request->getRequestFormat()) {
         case 'xml':
             $dumper = new domainModelXMLDumper($tree);
             break;
         case 'html':
             $dumper = new domainModelHTMLDumper($tree);
             break;
         case 'json':
             $dumper = new domainModelJsonDumper($tree);
             break;
         case 'dot':
             $dumper = new domainModelGraphvizDumper($tree);
             break;
         default:
             return sfView::NONE;
     }
     $this->domain_dump = $dumper->dump();
     $this->setTemplate('index');
 }
开发者ID:googlecode-mirror,项目名称:orso,代码行数:22,代码来源:actions.class.php


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