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


PHP sfRequest::hasParameter方法代码示例

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


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

示例1: execute

 /**
  * Execute any application/business logic for this component.
  *
  * @param sfRequest $request The current sfRequest object
  *
  * @return mixed     A string containing the view name associated with this action
  */
 function execute($request)
 {
     //pas de jenkins => pas de form
     if (!$this->getJenkins()->isAvailable()) {
         $this->redirect('jenkins/index');
     }
     if (is_array($buildRequest = $request->getParameter('build'))) {
         $groupRunId = isset($buildRequest['group_run_id']) ? $buildRequest['group_run_id'] : null;
     } else {
         $groupRunId = $request->getParameter('group_run_id');
     }
     $this->forward404If($groupRunId === null, 'group_run_id parameter is required');
     $jenkinsGroupRun = JenkinsGroupRunPeer::retrieveByPK($groupRunId);
     $this->forward404Unless($jenkinsGroupRun instanceof JenkinsGroupRun, sprintf('Can\'t create JenkinsGroupRun with id %s', $groupRunId));
     $defaults = array();
     if ($request->hasParameter('auto_launch')) {
         $autoLaunch = $request->getParameter('auto_launch');
         if ('on' === $autoLaunch) {
             $defaults = array('auto_launch' => true);
         }
     } else {
         $defaults = array('auto_launch' => true);
     }
     $form = new BuildForm($defaults, array('jenkins' => $this->getJenkins(), 'group_run' => $jenkinsGroupRun));
     if (sfRequest::POST === $request->getMethod()) {
         $form->bind($buildRequest);
         if ($form->isValid()) {
             $jobName = $form->getValue('job');
             $autoLaunch = 'on' === $form->getValue('auto_launch');
             $extraParameters = $form->getValue('parameters');
             $jobParameters = array();
             if (isset($extraParameters[$jobName])) {
                 $jobParameters = $extraParameters[$jobName];
             }
             //créer les builds
             $run = new JenkinsRun();
             $run->setJenkinsGroupRun($jenkinsGroupRun);
             $run->setJobName($jobName);
             $run->encodeParameters($jobParameters);
             $run->setLaunched($autoLaunch);
             $run->save();
             //launcher les builds
             if ($autoLaunch) {
                 $run->launch($this->getJenkins(), $jobParameters);
                 $run->computeJobBuildNumber($this->getJenkins(), $this->getUser());
             }
             $this->getUser()->setFlash('info', sprintf('Build [%s] has been added to build branch [%s]', $run->getJobName(), $jenkinsGroupRun->getLabel()));
             if ($request->hasParameter('add_and_continue')) {
                 $urlRedirect = sprintf('jenkins/addBuild?auto_launch=%s&group_run_id=%s', $autoLaunch ? 'on' : 'off', $jenkinsGroupRun->getId());
             } else {
                 $urlRedirect = $this->generateUrl('branch_view', $jenkinsGroupRun);
             }
             $this->redirect($urlRedirect);
         }
     }
     $this->setVar('form', $form);
     $this->setVar('group_run', array('label' => $jenkinsGroupRun->getLabel(), 'git_branch' => $jenkinsGroupRun->getGitBranch(), 'git_branch_slug' => $jenkinsGroupRun->getGitBranchSlug(), 'result' => $jenkinsGroupRun->getResult($this->getJenkins()), 'url' => $this->generateUrl('branch_view', $jenkinsGroupRun)));
 }
开发者ID:xfifix,项目名称:Jenkins-Khan,代码行数:65,代码来源:addBuildAction.class.php

示例2: executeCallback

 /**
  * Processes the callback from OAuth provider
  * 
  * @param sfRequest $request 
  */
 public function executeCallback(sfRequest $request)
 {
     $this->forward404Unless($request->getParameter('provider'));
     // user has denied auth'ing the app, don't continue
     if ($request->hasParameter('error')) {
         $this->redirect('@homepage');
     }
     $config = sfConfig::get('app_cacophony');
     $provider = $request->getParameter('provider');
     $this->forward404Unless(in_array($provider, array_keys($config['providers'])));
     // if OAuth 2.0
     if (is_null($config['providers'][$provider]['request_token_url'])) {
         $this->forward($request->getParameter('module'), 'callback2');
     }
     if (!$this->getUser()->isAuthenticated() || $config['plugin']['allow_multiple_tokens']) {
         $requestToken = $this->getUser()->getAttribute('requestToken', null, sprintf('sfCacophonyPlugin/%s', $provider));
         if ($requestToken) {
             try {
                 $this->getUser()->setAttribute('accessToken', sfCacophonyOAuth::getAccessToken($provider, $request->getParameter('oauth_token'), $requestToken['oauth_token_secret'], $request->getParameter('oauth_verifier')), sprintf('sfCacophonyPlugin/%s', $provider));
                 $this->getUser()->getAttributeHolder()->remove('requestToken', null, sprintf('sfCacophonyPlugin/%s', $provider));
                 // add me to session
                 $me = sfCacophonyOAuth::getMe($provider, $this->getUser()->getAttribute('accessToken', null, sprintf('sfCacophonyPlugin/%s', $provider)));
                 $this->getUser()->setAttribute('me', $me['normalized'], sprintf('sfCacophonyPlugin/%s', $provider));
             } catch (Exception $e) {
                 $this->getUser()->setFlash('error', sprintf('Failed to retrieve access token: %s', $e->getMessage()));
                 $this->redirect('@homepage');
             }
         }
     } else {
         $this->redirect('@homepage');
     }
     return sfView::NONE;
 }
开发者ID:nixilla,项目名称:sfCacophonyPlugin,代码行数:38,代码来源:BasesfCacophonyConsumerActions.class.php

示例3: executeJoinlist

 /**
  * Executes joinlist action
  *
  * @param sfRequest $request A request object
  */
 public function executeJoinlist($request)
 {
     sfConfig::set('sf_nav_type', 'default');
     if ($request->hasParameter('id') && $request->getParameter('id') != $this->getUser()->getMemberId()) {
         sfConfig::set('sf_nav_type', 'friend');
     }
     return parent::executeJoinlist($request);
 }
开发者ID:kawahara,项目名称:OpenPNE3,代码行数:13,代码来源:actions.class.php

示例4: execute

 /**
  *
  * @param sfRequest $request The current sfRequest object
  *
  * @return mixed     A string containing the view name associated with this action
  */
 function execute($request)
 {
     $this->forward404Unless($request->hasParameter('id'), 'id parameter is required');
     $jenkinsGroupRun = JenkinsGroupRunPeer::retrieveByPK($request->getParameter('id'));
     $this->forward404Unless($jenkinsGroupRun instanceof JenkinsGroupRun, sprintf('Can\'t create JenkinsGroupRun with id %s', $request->getParameter('id')));
     //suppression du group run (et, en cascade, des runs)
     $jenkinsGroupRun->delete(null);
     $this->getUser()->setFlash('info', sprintf('Build branch [%s] has been deleted', $jenkinsGroupRun->getLabel()));
     $this->redirect('jenkins/index');
 }
开发者ID:xfifix,项目名称:Jenkins-Khan,代码行数:16,代码来源:deleteGroupRunAction.class.php

示例5: getSelectedItems

 public static function getSelectedItems(sfRequest $request, $singular = false, $type = false)
 {
     if ($singular) {
         if (!$request->hasParameter('aMediaId')) {
             return false;
         }
         $id = $request->getParameter('aMediaId');
         if (!preg_match("/^\\d+\$/", $id)) {
             return false;
         }
         $ids = $id;
     } else {
         if (!$request->hasParameter('aMediaIds')) {
             // User cancelled the operation in the media plugin
             return false;
         }
         $ids = $request->getParameter('aMediaIds');
         if (!preg_match("/^(\\d+\\,?)*\$/", $ids)) {
             // Bad input, possibly a hack attempt
             return false;
         }
     }
     $ids = explode(",", $ids);
     if ($ids === false) {
         // Empty list, nothing to ask for
         return array();
     }
     $api = new aMediaAPI();
     $results = $api->getItems($ids);
     if ($type !== false) {
         // This is intended to filter out user attempts to jam video into the list
         // of ids before we ever got to the API stage
         $nresults = array();
         foreach ($results as $result) {
             if ($result->type === $type) {
                 $nresults[] = $result;
             }
         }
         $results = $nresults;
     }
     return $results;
 }
开发者ID:verenate,项目名称:gri,代码行数:42,代码来源:aMediaAPI.php

示例6: execute

 /**
  * @param sfRequest $request The current sfRequest object
  *
  * @return mixed|void A string containing the view name associated with this action|void
  * @throws Exception
  */
 function execute($request)
 {
     $jenkins = $this->getJenkins();
     if ($request->hasParameter('group_run_id')) {
         $jenkinsGroupRun = JenkinsGroupRunPeer::retrieveByPK($request->getParameter('group_run_id'));
         $this->forward404Unless($jenkinsGroupRun instanceof JenkinsGroupRun, sprintf('can\'t create JenkinsGroupRun with id %s', $request->getParameter('group_run_id')));
         $jenkinsRuns = $jenkinsGroupRun->getJenkinsRuns();
         foreach ($jenkinsRuns as $jenkinsRun) {
             $this->cancelJenkinsRun($jenkinsRun, $jenkins);
         }
         $this->getUser()->setFlash('info', sprintf('All builds of group [%s] have been canceled', $jenkinsGroupRun->getLabel()));
         $this->redirect($this->generateUrl('branch_view', $jenkinsGroupRun));
     } elseif ($request->hasParameter('run_id')) {
         $jenkinsRun = JenkinsRunPeer::retrieveByPK($request->getParameter('run_id'));
         $this->forward404Unless($jenkinsRun instanceof JenkinsRun, sprintf('can\'t create JenkinsRun with id %s', $request->getParameter('run_id')));
         $this->cancelJenkinsRun($jenkinsRun, $jenkins);
         $this->redirect($this->generateUrl('branch_view', $jenkinsRun->getJenkinsGroupRun()));
     } else {
         throw new Exception('run_id or group_run_id parameter is required');
     }
 }
开发者ID:xfifix,项目名称:Jenkins-Khan,代码行数:27,代码来源:cancelRunAction.class.php

示例7: process

 /**
  * Processes the current request.
  *
  * @param  sfRequest A sfRequest instance
  *
  * @return Boolean   true if the form is valid, false otherwise
  */
 public function process(sfRequest $request)
 {
     $data = array('max_per_page' => $request->getParameter('max_per_page', $this->user->getAttribute(self::getMaxPerPageName(), $this->getDefault('max_per_page'))));
     if ($request->hasParameter(self::$CSRFFieldName)) {
         $data[self::$CSRFFieldName] = $request->getParameter(self::$CSRFFieldName);
     }
     $this->bind($data);
     if ($isValid = $this->isValid()) {
         $this->save();
     }
     return $isValid;
 }
开发者ID:rbolliger,项目名称:otokou,代码行数:19,代码来源:PaginationMaxPerPageForm.class.php

示例8: executeIndex

 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex($request)
 {
     if ($request->hasParameter('show')) {
         $this->getUser()->setAttribute('show', $request->getParameter('show'));
     }
     $this->show = $this->getUser()->getAttribute('show', 'people');
     $table = $this->getShowTable($this->show);
     $this->pager = new sfDoctrinePager($table, sfConfig::get('app_max_entities_on_contacts'));
     $this->pager->setQuery(Doctrine::getTable($table)->getListQuery());
     $this->pager->setPage($request->getParameter('page', 1));
     $this->pager->init();
 }
开发者ID:nurihan007,项目名称:amaranto,代码行数:17,代码来源:actions.class.php

示例9: process

 /**
  * Processes the current request.
  *
  * @param  sfRequest A sfRequest instance
  *
  * @return Boolean   true if the form is valid, false otherwise
  */
 public function process(sfRequest $request)
 {
     $data = array('language' => $request->getParameter('language'));
     if ($request->hasParameter(self::$CSRFFieldName)) {
         $data[self::$CSRFFieldName] = $request->getParameter(self::$CSRFFieldName);
     }
     $this->bind($data);
     if ($isValid = $this->isValid()) {
         $this->save();
     }
     return $isValid;
 }
开发者ID:quafzi,项目名称:timpany-prototype,代码行数:19,代码来源:BaseaLanguageForm.class.php

示例10: executeUser

 /**
  * Executes user action
  *
  * @param sfRequest $request A request object
  */
 public function executeUser($request)
 {
     if (!$request->hasParameter('id')) {
         $this->member = $this->getUser()->getMember();
     } else {
         $this->member = $this->getRoute()->getObject();
         $relation = Doctrine::getTable('MemberRelationship')->retrieveByFromAndTo($this->getUser()->getMemberId(), $this->member->getId());
         $this->forward404If($relation && $relation->isAccessBlocked());
     }
     $this->blogRssCacheList = Doctrine::getTable('BlogRssCache')->findByMemberId($this->member->getId(), sfConfig::get('app_blog_action_size'));
     if (!count($this->blogRssCacheList)) {
         return sfView::ALERT;
     }
 }
开发者ID:kawahara,项目名称:opBlogPlugin,代码行数:19,代码来源:actions.class.php

示例11: executeLogin

 /**
  * Executes login action
  *
  * @param sfRequest $request A request object
  */
 public function executeLogin($request)
 {
     $this->getUser()->logout();
     $this->forms = $this->getUser()->getAuthForms();
     if ($request->hasParameter('authMode')) {
         if ($uri = $this->getUser()->login()) {
             $this->redirectIf($this->getUser()->hasCredential('SNSRegisterBegin'), 'member/registerInput');
             $this->redirectIf($this->getUser()->hasCredential('SNSRegisterFinish'), $this->getUser()->getRegisterEndAction());
             $this->redirectIf($this->getUser()->hasCredential('SNSMember'), $uri);
         }
         return sfView::ERROR;
     }
     $routing = sfContext::getInstance()->getRouting();
     if ('homepage' !== $routing->getCurrentRouteName() && 'login' !== $routing->getCurrentRouteName()) {
         $this->getUser()->setFlash('notice', 'Please login');
     }
     return sfView::SUCCESS;
 }
开发者ID:Kazuhiro-Murota,项目名称:OpenPNE3,代码行数:23,代码来源:sfOpenPNEMemberAction.class.php

示例12: executeIndex

 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  **/
 public function executeIndex($request)
 {
     $user = $this->sf_user;
     $this->user_id = $this->sf_user_id;
     $branch_id = $this->sf_branch_id;
     $this->is_branch_owner = $this->sf_is_branch_owner;
     $this->owner_branch_ids = $this->sf_owner_branch_ids;
     $user->setAttribute('type', '');
     $user->setAttribute('keyword', '');
     $option = '';
     $this->keepstay = '';
     $user->setAttribute('user_client_status_closed', false);
     if ($request->hasParameter('search')) {
         $search_criteria = $request->getParameter('search', array());
         $this->keepstay = $search_criteria['type'];
         if (array_key_exists($search_criteria['type'], $search_criteria)) {
             $option = $search_criteria[$search_criteria['type']];
         } else {
             $option = $search_criteria['keyword'];
         }
         $user->setAttribute('type', $this->keepstay);
         $user->setAttribute('keyword', $option);
     }
     $this->search_value = $option;
     $staff_users = array();
     $staff_users[0] = 'Select a Staff';
     $sales_lists = array();
     $sales_lists[0] = 'Select a Sales';
     $this->client_ranks = clientRankPeer::getClientOpportunityListForSearch($branch_id);
     $admin_users = $this->getUser()->getBranchAdminUsers();
     foreach ($admin_users as $admin_user) {
         $staff_users[$admin_user->getId()] = $admin_user->getProfile()->getFullname();
     }
     $sales_users = $this->getUser()->getBranchOfficeStaffUsers();
     foreach ($sales_users as $sales_user) {
         $sales_lists[$sales_user->getId()] = $sales_user->getProfile()->getFullname();
     }
     $this->created_by = $staff_users;
     $this->sales = $sales_lists;
 }
开发者ID:uniraymond,项目名称:ravebuild_symfony,代码行数:45,代码来源:actions.class.php

示例13: executeEdit

 /**
  * DOCUMENT ME
  * @param sfRequest $request
  * @return mixed
  */
 public function executeEdit(sfRequest $request)
 {
     $this->logMessage("====== in aSlideshowSlotActions::executeEdit", "info");
     if ($request->getParameter('aMediaCancel')) {
         return $this->redirectToPage();
     }
     $this->editSetup();
     if ($request->hasParameter('aMediaIds')) {
         $ids = preg_split('/,/', $request->getParameter('aMediaIds'));
         $q = Doctrine::getTable('aMediaItem')->createQuery('m')->select('m.*')->whereIn('m.id', $ids)->andWhere('m.type = "image"');
         // Let the query preserve order for us
         $items = aDoctrine::orderByList($q, $ids)->execute();
         $this->slot->unlink('MediaItems');
         $links = aArray::getIds($items);
         $this->slot->link('MediaItems', $links);
         // This isn't a normal form submission, but the act of selecting items for a
         // slideshow implies we picked the 'selected' radio button, so just save 'form' as if
         // that choice had been saved normally
         $this->slot->value = serialize(array('form' => array('type' => 'selected'), 'order' => $links));
         return $this->editSave();
     }
 }
开发者ID:hashir,项目名称:UoA,代码行数:27,代码来源:BaseaSlideshowSlotActions.class.php

示例14: executeSearch

 /**
  * Executes search action
  *
  * @param sfRequest $request A request object
  */
 public function executeSearch($request)
 {
     $params = array('keyword' => $request->getParameter('keyword'), 'target' => $request->getParameter('target', 'in_community'), 'type' => $request->getParameter('type', 'topic'));
     $this->form = new PluginCommunityTopicSearchForm();
     $this->form->bind($params);
     if ('event' === $request->getParameter('type')) {
         $table = Doctrine::getTable('CommunityEvent');
         $this->link_to_detail = 'communityEvent/show?id=%d';
         $this->type = 'event';
     } else {
         $table = Doctrine::getTable('CommunityTopic');
         $this->link_to_detail = 'communityTopic/show?id=%d';
         $this->type = 'topic';
     }
     $this->communityId = $request->getParameter('id');
     $this->pageUrl = '@communityTopic_search';
     if (!$request->hasParameter('id')) {
         unset($this->form['target']);
         $this->pageUrl .= '_all';
     } else {
         $this->pageUrl .= '?id=' . $this->communityId;
     }
     $q = $table->getSearchQuery($request->getParameter('id'), $request->getParameter('target'), $request->getParameter('keyword'));
     $this->pager = $table->getResultListPager($q, $request->getParameter('page'));
     $this->isResult = false;
     if (null !== $request->getParameter('keyword') || null !== $request->getParameter('target') || null !== $request->getParameter('type')) {
         $this->isResult = true;
     }
     return sfView::SUCCESS;
 }
开发者ID:te-koyama,项目名称:openpne,代码行数:35,代码来源:opCommunityTopicPluginTopicActions.class.php

示例15: doConnect

 /**
  * Connection test logic.
  * 
  * Overload this method to customize how a connection is determined.
  * 
  * @todo    Add support for configuring a request parameter that should
  *          _not_ be present.
  * 
  * @param   sfRequest $request
  * @param   string $page
  * @param   array $param
  * 
  * @return  bool
  */
 protected function doConnect(sfRequest $request, $page, $param)
 {
     if (sfConfig::get('sf_logging_enabled')) {
         sfContext::getInstance()->getLogger()->info(sprintf('{%s} connect %s:%s', __CLASS__, $this->name, $page));
     }
     $match = true;
     foreach ($param as $key => $value) {
         // if value is null (~ in yml), this parameter must be absent,
         // otherwise the value must match the request parameter
         if (is_null($value) && $request->hasParameter($key) || $request->getParameter($key) !== $value) {
             $match = false;
             break;
         }
     }
     return $match;
 }
开发者ID:JoshuaEstes,项目名称:sfGoogleWebsiteOptimizerPlugin,代码行数:30,代码来源:sfGWOExperiment.class.php


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