本文整理汇总了PHP中sfRequest类的典型用法代码示例。如果您正苦于以下问题:PHP sfRequest类的具体用法?PHP sfRequest怎么用?PHP sfRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了sfRequest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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;
}
示例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;
}
示例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')));
}
}
}
示例5: execute
/**
* Executes this action
*
* @param sfRequest $request A request object
*/
public function execute($request)
{
if ($request->isSmartphone()) {
$this->setLayout('smtLayoutSns');
$this->setTemplate('smtUserAgreement');
}
}
示例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();
}
}
示例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']);
}
}
}
示例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();
}
}
示例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);
}
示例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');
}
示例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;
}
示例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');
}
}
}
示例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;
}
示例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');
}