本文整理汇总了PHP中sfRequest::getParameter方法的典型用法代码示例。如果您正苦于以下问题:PHP sfRequest::getParameter方法的具体用法?PHP sfRequest::getParameter怎么用?PHP sfRequest::getParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfRequest
的用法示例。
在下文中一共展示了sfRequest::getParameter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeFeedback
/**
* Executes feedback action
*
*/
public function executeFeedback(sfRequest $request)
{
$section = $request->getParameter('section', false);
$this->form = new aFeedbackForm($section);
$this->feedbackSubmittedBy = false;
$this->failed = false;
sfContext::getInstance()->getConfiguration()->loadHelpers(array('Tag', 'Url'));
if ($request->isMethod('post')) {
$this->form->bind($request->getParameter('feedback'), $request->getFiles('feedback'));
// $this->form->bind(array_merge($request->getParameter('feedback'), array('captcha' => $request->getParameter('captcha'))), $request->getFiles('feedback'));
if ($this->form->isValid()) {
$feedback = $this->form->getValues();
$feedback['browser'] = $_SERVER['HTTP_USER_AGENT'];
try {
aZendSearch::registerZend();
$mail = new Zend_Mail();
$mail->setBodyText($this->getPartial('feedbackEmailText', array('feedback' => $feedback)))->setFrom($feedback['email'], $feedback['name'])->addTo(sfConfig::get('app_aFeedback_email_auto'))->setSubject($this->form->getValue('subject', 'New aBugReport submission'));
if ($screenshot = $this->form->getValue('screenshot')) {
$mail->createAttachment(file_get_contents($screenshot->getTempName()), $screenshot->getType());
}
$mail->send();
// A new form for a new submission
$this->form = new aFeedbackForm();
} catch (Exception $e) {
$this->logMessage('Request email failed: ' . $e->getMessage(), 'err');
$this->failed = true;
return 'Success';
}
$this->getUser()->setFlash('reportSubmittedBy', $feedback['name']);
$this->redirect($feedback['section']);
}
}
}
示例2: 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)));
}
示例3: executeIndex
/**
* Executes index action
*
* @param sfRequest $request A request object
*/
public function executeIndex(sfRequest $request)
{
$params = array('filename' => $request->getParameter('filename', null), 'format' => $request->getParameter('format', null), 'width' => str_replace('w', '', $request->getParameter('width', null)), 'height' => str_replace('h', '', $request->getParameter('height', null)));
$image = new sfImageHandler($params);
$this->forward404Unless($image->isValidSource(), 'Invalid URL.');
$binary = $image->createImage();
header('Content-Type:' . $image->getContentType());
echo $binary;
exit;
}
示例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');
}
示例5: 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;
}
示例6: 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;
}
示例7: 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();
}
示例8: execute
/**
* Executes deleteLeaveType action
*
* @param sfRequest $request A request object
*/
public function execute($request)
{
if ($request->isMethod('post')) {
if (count($request->getParameter('chkSelectRow')) == 0) {
$this->getUser()->setFlash('notice', __(TopLevelMessages::SELECT_RECORDS));
} else {
$leaveTypeService = $this->getLeaveTypeService();
$leaveTypeIds = $request->getParameter('chkSelectRow');
$leaveTypeService->deleteLeaveType($leaveTypeIds);
$this->getUser()->setFlash('success', __(TopLevelMessages::DELETE_SUCCESS));
}
$this->redirect('leave/leaveTypeList');
}
}
示例9: executeEdit
public function executeEdit(sfRequest $request)
{
if ($request->getParameter('aMediaCancel')) {
$this->redirectToPage();
}
$this->logMessage("====== in aPDFSlotActions::executeEdit", "info");
$this->editSetup();
$item = Doctrine::getTable('aMediaItem')->find($request->getParameter('aMediaId'));
if (!$item || $item->type !== 'pdf') {
return $this->redirectToPage();
}
$this->slot->unlink('MediaItems');
$this->slot->link('MediaItems', array($item->id));
$this->editSave();
}
示例10: executeConfigUID
/**
* Executes configUID action
*
* @param sfRequest $request A request object
*/
public function executeConfigUID($request)
{
$option = array('member' => $this->getUser()->getMember());
$this->passwordForm = new sfOpenPNEPasswordForm(array(), $option);
$mobileUid = Doctrine::getTable('MemberConfig')->retrieveByNameAndMemberId('mobile_uid', $this->getUser()->getMemberId());
$this->isSetMobileUid = !is_null($mobileUid);
$this->isDeletableUid = (int) opConfig::get('retrieve_uid') < 2 && $this->isSetMobileUid;
if ($request->isMethod('post')) {
$this->passwordForm->bind($request->getParameter('password'));
if ($this->passwordForm->isValid()) {
if ($request->hasParameter('update')) {
$memberConfig = Doctrine::getTable('MemberConfig')->retrieveByNameAndMemberId('mobile_uid', $this->getUser()->getMemberId());
if (!$memberConfig) {
$memberConfig = new MemberConfig();
$memberConfig->setMember($this->getUser()->getMember());
$memberConfig->setName('mobile_uid');
}
$memberConfig->setValue($request->getMobileUID());
$memberConfig->save();
$this->getUser()->setFlash('notice', 'Your mobile UID was set successfully.');
$this->redirect('member/configUID');
} elseif ($request->hasParameter('delete') && $this->isDeletableUid) {
$mobileUid->delete();
$this->getUser()->setFlash('notice', 'Your mobile UID was deleted successfully.');
$this->redirect('member/configUID');
}
}
}
return sfView::SUCCESS;
}
示例11: executeLink
/**
* Executes link action
*
* @param sfRequest $request A request object
*/
public function executeLink($request)
{
$this->redirectUnless(opConfig::get('enable_friend_link'), '@error');
$this->redirectIf($this->relation->isAccessBlocked(), '@error');
$this->forward404If($this->relation->getMemberIdFrom() == $this->relation->getMemberIdTo());
$this->member = Doctrine::getTable('Member')->find($this->id);
$this->forward404Unless($this->member);
if ($this->relation->isFriend()) {
$this->getUser()->setFlash('error', 'This member already belongs to %my_friend%.');
$this->getUser()->setFlash('error_params', array('%my_friend%' => Doctrine::getTable('SnsTerm')->get('my_friend')->pluralize()));
$this->redirect('@member_profile?id=' . $this->id);
}
if ($this->relation->isFriendPreFrom()) {
$this->getUser()->setFlash('error', '%Friend% request is already sent.');
$this->redirect('@member_profile?id=' . $this->id);
}
$this->form = new FriendLinkForm();
if ($request->isMethod(sfWebRequest::POST)) {
$this->form->bind($request->getParameter('friend_link'));
if ($this->form->isValid()) {
$this->getUser()->setFlash('notice', 'You have requested %friend% link.');
$this->redirectToHomeIfIdIsNotValid();
$this->relation->setFriendPre();
$this->redirect('@member_profile?id=' . $this->id);
}
}
return sfView::INPUT;
}
示例12: executeLink
/**
* Executes link action
*
* @param sfRequest $request A request object
*/
public function executeLink($request)
{
$this->redirectUnless(opConfig::get('enable_friend_link'), '@error');
$this->redirectIf($this->relation->isAccessBlocked(), '@error');
if ($this->relation->isFriend()) {
$this->getUser()->setFlash('error', 'This member already belongs to %my_friend%.');
$this->getUser()->setFlash('error_params', array('%my_friend%' => Doctrine::getTable('SnsTerm')->get('my_friend')->pluralize()));
$this->redirect('member/profile?id=' . $this->id);
}
if ($this->relation->isFriendPreFrom()) {
$this->getUser()->setFlash('error', '%Friend% request is already sent.');
$this->redirect('member/profile?id=' . $this->id);
}
$this->form = new FriendLinkForm();
if ($request->isMethod(sfWebRequest::POST)) {
$this->form->bind($request->getParameter('friend_link'));
if ($this->form->isValid()) {
$this->getUser()->setFlash('notice', 'You have requested %friend% link.');
$this->redirectToHomeIfIdIsNotValid();
$this->relation->setFriendPre();
$this->dispatcher->notify(new sfEvent($this, 'op_action.post_execute_' . $this->moduleName . '_' . $this->actionName, array('moduleName' => $this->moduleName, 'actionName' => $this->actionName, 'actionInstance' => $this, 'result' => sfView::SUCCESS)));
$this->redirect('member/profile?id=' . $this->id);
}
}
$this->member = Doctrine::getTable('Member')->find($this->id);
return sfView::INPUT;
}
示例13: 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);
}
示例14: executeSetDefault
/**
* Handles setDefault action
*
* @param sfRequest $request A request object
*/
public function executeSetDefault($request)
{
$c = BadgePeer::retrieveByPK($request->getParameter('id'));
if ($c) {
$c->setAsDefault();
}
$this->redirect('badge/list');
}
示例15: executeIndex
/**
* Executes index action
*
* @param sfRequest $request A request object
*/
public function executeIndex(sfRequest $request)
{
$params = array('filename' => $request->getParameter('filename', null), 'format' => $request->getParameter('format', null), 'width' => str_replace('w', '', $request->getParameter('width', null)), 'height' => str_replace('h', '', $request->getParameter('height', null)));
try {
$image = new sfImageHandler($params);
} catch (RuntimeException $e) {
if (sfImageGenerator::ERROR_NOT_ALLOWED_SIZE !== $e->getCode()) {
throw $e;
}
$this->forward404($e->getMessage());
}
$this->forward404Unless($image->isValidSource(), 'Invalid URL.');
$binary = $image->createImage();
header('Content-Type:' . $image->getContentType());
echo $binary;
exit;
}