本文整理汇总了PHP中sfRequest类的典型用法代码示例。如果您正苦于以下问题:PHP sfRequest类的具体用法?PHP sfRequest怎么用?PHP sfRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了sfRequest类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: decomposeURL
public static function decomposeURL(sfContext $context, sfRequest $request)
{
$module = $context->getModuleName();
$action = $context->getActionName();
$parameters = $request->getParameterHolder()->getAll();
return array("module" => $module, "action" => $action, "parameters" => $parameters);
}
开发者ID:rafd,项目名称:SkuleCourses,代码行数:7,代码来源:skuleadminConst.class.php
示例2: 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;
}
开发者ID:Kazuhiro-Murota,项目名称:OpenPNE3,代码行数:32,代码来源:sfOpenPNEFriendAction.class.php
示例3: 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;
}
开发者ID:Kazuhiro-Murota,项目名称:OpenPNE3,代码行数:35,代码来源:actions.class.php
示例4: execute
/**
* Executes index action
*
* @param sfRequest $request A request object
*/
public function execute($request)
{
sfContext::getInstance()->getConfiguration()->loadHelpers('Url');
$this->editForm = new dayForm();
$this->day = DaysOrderTable::getInstance()->findOneById($this->getRequest()->getParameter('id'));
if ($this->day) {
$this->editForm->setDefaults($this->day->toArray());
}
if ($this->getRequest()->hasParameter('editDay')) {
$this->editForm->bind($this->getRequest()->getParameter('editDay'), $this->getRequest()->getFiles('editDay'));
if ($this->editForm->isValid()) {
$files = $request->getFiles('editDay');
$i = '';
foreach ($files as $key => $file) {
if ($file['name']) {
$image = new UploadService();
$image->setPath('./uploads/');
$image->setFile($file);
$image->setFileName(md5($file['name'] . date('YmdGis')) . '.' . UploadService::findexts($file['name']));
$image->save();
$this->day['image_name' . $i] = $image->getFileName();
}
$i = 2;
}
$this->day->fromArray(array('day_number' => $this->editForm->getValue('day_number'), 'day_tip' => $this->editForm->getValue('day_tip'), 'day_letter' => $this->editForm->getValue('day_letter')));
$this->day->save();
$this->getUser()->setFlash('editSuccess', true);
$this->redirect(url_for2('default', array('module' => 'days', 'action' => 'index')));
}
}
}
开发者ID:radzikowski,项目名称:ankieta,代码行数:36,代码来源:editAction.class.php
示例5: execute
/**
* Executes this action
*
* @param sfRequest $request A request object
*/
public function execute($request)
{
if ($request->isSmartphone()) {
$this->setLayout('smtLayoutSns');
$this->setTemplate('smtUserAgreement');
}
}
开发者ID:te-koyama,项目名称:openpne,代码行数:12,代码来源:userAgreementAction.class.php
示例6: executeEdit
public function executeEdit(sfRequest $request)
{
$this->logMessage("====== in aInsetAreaSlotActions::executeEdit", "info");
$this->editSetup();
// Work around FCK's incompatibility with AJAX and bracketed field names
// (it insists on making the ID bracketed too which won't work for AJAX)
// Don't forget, there's a CSRF field out there too. We need to grep through
// the submitted fields and get all of the relevant ones, reinventing what
// PHP's bracket syntax would do for us if FCK were compatible with it
$values = $request->getParameterHolder()->getAll();
$value = array();
foreach ($values as $k => $v) {
if (preg_match('/^slot-form-' . $this->id . '-(.*)$/', $k, $matches)) {
$value[$matches[1]] = $v;
}
}
$this->form = new aInsetAreaSlotForm($this->id, $this->options);
$this->form->bind($value);
if ($this->form->isValid()) {
$value = $this->form->getValue('value');
$this->slot->value = $value;
$result = $this->editSave();
return $result;
} else {
// Makes $this->form available to the next iteration of the
// edit view so that validation errors can be seen
return $this->editRetry();
}
}
开发者ID:hashir,项目名称:UoA,代码行数:29,代码来源:BaseaInsetAreaSlotActions.class.php
示例7: 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']);
}
}
}
开发者ID:hashir,项目名称:UoA,代码行数:37,代码来源:BaseaFeedbackActions.class.php
示例8: executeEdit
/**
* DOCUMENT ME
* @param sfRequest $request
* @return mixed
*/
public function executeEdit(sfRequest $request)
{
$this->editSetup();
// Work around FCK's incompatibility with AJAX and bracketed field names
// (it insists on making the ID bracketed too which won't work for AJAX)
// Don't forget, there's a CSRF field out there too. We need to grep through
// the submitted fields and get all of the relevant ones, reinventing what
// PHP's bracket syntax would do for us if FCK were compatible with it
$values = $request->getParameterHolder()->getAll();
$value = array();
foreach ($values as $k => $v) {
if (preg_match('/^slot-form-' . $this->id . '-(.*)$/', $k, $matches)) {
$value[$matches[1]] = $v;
}
}
// HTML is carefully filtered to allow only elements, attributes and styles that
// make sense in the context of a rich text slot, and you can adjust that.
// See aHtml::simplify(). You can do slot-specific overrides by setting the
// allowed-tags, allowed-attributes and allowed-styles options
$this->form = new aRichTextForm($this->id, $this->options);
$this->form->bind($value);
if ($this->form->isValid()) {
// The form validator took care of validating well-formed HTML
// and removing elements, attributes and styles we don't permit
$this->slot->value = $this->form->getValue('value');
return $this->editSave();
} else {
// Makes $this->form available to the next iteration of the
// edit view so that validation errors can be seen (although there
// aren't any in this case)
return $this->editRetry();
}
}
开发者ID:hashir,项目名称:UoA,代码行数:38,代码来源:BaseaRichTextSlotActions.class.php
示例9: 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
示例10: 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');
}
开发者ID:psskhal,项目名称:symfony-sample,代码行数:13,代码来源:actions.class.php
示例11: executeDelete
/**
* Executes delete action
*
* @param sfRequest $request A redirect object
*/
public function executeDelete($request)
{
$request->checkCSRFProtection();
$this->forward404Unless($this->communityEventComment->isDeletable($this->getUser()->getMemberId()));
$this->communityEventComment->delete();
$this->getUser()->setFlash('notice', 'The comment was deleted successfully.');
$this->redirect('@communityEvent_show?id=' . $this->communityEvent->getId());
}
开发者ID:kiwpon,项目名称:opCommunityTopicPlugin,代码行数:13,代码来源:opCommunityTopicPluginEventCommentActions.class.php
示例12: 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;
}
开发者ID:Kazuhiro-Murota,项目名称:OpenPNE3,代码行数:15,代码来源:actions.class.php
示例13: executeLogin
/**
* Executes login action
*
*
* @param sfRequest $request A request object
*/
public function executeLogin($request)
{
$this->form = new LoginForm();
if ($request->isMethod('post')) {
$this->form->bind($request->getParameter('login'));
if ($this->form->isValid()) {
$this->redirect('@homepage');
}
}
}
开发者ID:psskhal,项目名称:symfony-sample,代码行数:16,代码来源:actions.class.php
示例14: getJenkinsGroupRun
/**
* @param sfRequest $request
* @param jenkinsKhanUser $user
*
* @return JenkinsGroupRun
* @throws RuntimeException
*/
public function getJenkinsGroupRun(sfRequest $request, jenkinsKhanUser $user)
{
$branchName = $request->getParameter('git_branch_slug');
$userId = $user->getUserId();
$groupRun = JenkinsGroupRunPeer::retrieveBySfGuardUserIdAndGitBranchSlug($userId, $branchName);
if (null === $groupRun) {
throw new RuntimeException(sprintf('Can\'t retrieve JenkinsGroupRun with branch name %s for user %s.', $branchName, $user->getUsername()));
}
return $groupRun;
}
开发者ID:xfifix,项目名称:Jenkins-Khan,代码行数:17,代码来源:modelFactory.class.php
示例15: 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
示例16: execute
/**
*
* @param sfRequest $request
*/
public function execute($request)
{
$this->setForm(new BeaconRegistrationForm());
if ($request->isMethod('post')) {
$this->form->bind($request->getParameter($this->form->getName()));
if ($this->form->isValid()) {
$result = $this->form->save();
$this->getUser()->setFlash($result['messageType'], $result['message']);
}
}
}
开发者ID:lahirwisada,项目名称:orangehrm,代码行数:15,代码来源:beaconRegistrationAction.class.php
示例17: executeEdit
public function executeEdit(sfRequest $request)
{
$this->editSetup();
$item = Doctrine::getTable('aMediaItem')->find($request->getParameter('aMediaId'));
if (!$item || $item->type !== 'video') {
return $this->redirectToPage();
}
$this->slot->unlink('MediaItems');
$this->slot->link('MediaItems', array($item->id));
$this->editSave();
}
开发者ID:verenate,项目名称:gri,代码行数:11,代码来源:actions.class.php
示例18: executeIndex
/**
* Executes index action
*
* @param sfRequest $request A request object
*/
public function executeIndex($request)
{
$this->form = new reCaptchaForm();
if ($request->isMethod('post')) {
$requestData = array('challenge' => $this->getRequestParameter('recaptcha_challenge_field'), 'response' => $this->getRequestParameter('recaptcha_response_field'));
$this->form->bind($requestData);
if ($this->form->isValid()) {
// captcha is valid
}
}
}
开发者ID:broschb,项目名称:cyclebrain,代码行数:16,代码来源:actions.class.php
示例19: executeInsertEntry
/**
* Executes insertEntry action
*
* @param sfRequest $request A request object
*/
public function executeInsertEntry($request)
{
$this->result = $this->api->insert($this->api->getEntryXMLFromRequestBody());
$this->forward404Unless($this->result);
$params = array('model' => $request->getParameter('model'), 'id' => $this->result->getId());
$url = $this->generateUrl('feeds_community_retrieve_resource_normal', $params, true);
$this->getResponse()->setStatusCode(201);
$this->getResponse()->setHttpHeader('Location', $url);
$entry = $this->api->createEntryByInstance($this->result);
return $this->renderText($this->api->convertEmojiForAPI($entry->publish()));
}
开发者ID:kiwpon,项目名称:opWebAPIPlugin,代码行数:16,代码来源:actions.class.php
示例20: execute
/**
* Execute
*
* @param sfRequest $request A request object
*/
public function execute($request)
{
$user = $this->getUser()->getUserRecord();
$start = $this->getVar('start') ? $this->getVar('start') : $request->getParameter('start', date('Y-m-01'));
$start = preg_replace("/(\\d{2})\\.(\\d{2})\\.(\\d{4})/", "\$3-\$2-\$1", $start);
$returnJSON = $this->getVar('returnJSON') ? true : false;
$budget = new BudgetManager();
$rate = $this->getContext()->getMyCurrencyExchange()->getRate($user->getCurrencyId());
$budgetCategories = $budget->load($user, new DateTime($start));
$this->setVar('budgetCategories', $budgetCategories, $noEscape = true);
$this->setVar('returnJSON', $returnJSON);
}
开发者ID:ru-easyfinance,项目名称:EasyFinance,代码行数:17,代码来源:budgetComponent.class.php
注:本文中的sfRequest类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论