本文整理汇总了PHP中sfWebRequest::setParameter方法的典型用法代码示例。如果您正苦于以下问题:PHP sfWebRequest::setParameter方法的具体用法?PHP sfWebRequest::setParameter怎么用?PHP sfWebRequest::setParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfWebRequest
的用法示例。
在下文中一共展示了sfWebRequest::setParameter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeIndex
public function executeIndex(sfWebRequest $request)
{
// sorting
if (!$request->getParameter('sort') && !$this->isValidSortColumn($request->getParameter('sort'))) {
$request->setParameter('sort', 'date');
$request->setParameter('sort_type', 'desc');
}
parent::executeIndex($request);
}
示例2: executeIndex
/**
* Executes index action
*
* @param sfRequest $request A request object
*/
public function executeIndex(sfWebRequest $request)
{
opApplicationConfiguration::registerJanRainOpenID();
require_once 'Auth/OpenID/Server.php';
require_once 'Auth/OpenID/FileStore.php';
$url = $this->getController()->genUrl('OpenID/index', true);
$server = new Auth_OpenID_Server(new Auth_OpenID_FileStore(sfConfig::get('sf_cache_dir')), $url);
$this->getResponse()->setHttpHeader('X-XRDS-Location', $this->getController()->genUrl('OpenID/signonXrds', true));
$openIDRequest = $server->decodeRequest();
if (!$openIDRequest) {
$_SESSION['request'] = null;
return sfView::SUCCESS;
}
$sregRequest = Auth_OpenID_SRegRequest::fromOpenIDRequest($openIDRequest);
$axRequest = Auth_OpenID_AX_FetchRequest::fromOpenIDRequest($openIDRequest);
$this->requestedProfiles = $this->createListOfRequestedProfiles($sregRequest, $axRequest);
$_SESSION['request'] = serialize($openIDRequest);
if (!empty($openIDRequest->mode) && in_array($openIDRequest->mode, array('checkid_immediate', 'checkid_setup'))) {
if ($openIDRequest->idSelect()) {
if ($openIDRequest->mode === 'checkid_immediate') {
$response = $openIDRequest->answer(false);
} else {
$this->getRequest()->setMethod(sfWebRequest::GET);
$_SERVER['QUERY_STRING'] = http_build_query($openIDRequest->message->toPostArgs());
$this->forwardUnless($this->getUser()->isAuthenticated() && $this->getUser()->getMember(), 'member', 'login');
$log = Doctrine::getTable('OpenIDTrustLog')->findByOpenID($openIDRequest->trust_root, $this->getUser()->getMemberId());
if ($log && $log->is_permanent) {
$request->setParameter('trust', '1');
$this->forward('OpenID', 'trust');
}
$this->info = $openIDRequest;
return 'Trust';
}
} elseif (!$openIDRequest->identity && !$openIDRequest->idSelect()) {
$this->forward('@error');
} elseif ($openIDRequest->immediate) {
$response = $openIDRequest->answer(false, $url);
} else {
$this->forwardUnless($this->getUser()->isAuthenticated() && $this->getUser()->getMember(), 'member', 'login');
$log = Doctrine::getTable('OpenIDTrustLog')->findByOpenID($openIDRequest->trust_root, $this->getUser()->getMemberId());
if ($log && $log->is_permanent) {
$request->setParameter('trust', '1');
$this->forward('OpenID', 'trust');
}
$this->info = $openIDRequest;
return 'Trust';
}
} else {
$response = $server->handleRequest($openIDRequest);
}
$response = $server->encodeResponse($response);
return $this->writeResponse($response);
}
示例3: execute
/**
* Action permettant de créer un data set.
*
* @param sfWebRequest $request
*/
public function execute($request)
{
$this->setLayout(false);
// On détermine le type de contenu retourné.
$this->getResponse()->setContentType('application/xml');
$this->getUser()->signIn($this->user, true);
/* @var EiTestSet $test_set */
$test_set = $this->getRoute()->getObject();
$request->setParameter("ei_test_set_id", $test_set->getId());
$request->setParameter("project_ref", $test_set->getEiScenario()->getProjectRef());
$request->setParameter("project_id", $test_set->getEiScenario()->getProjectId());
$request->setParameter("ei_scenario_id", $test_set->getEiScenario()->getId());
$content = $this->getController()->getPresentationFor("eitestset", "downloadOracle");
return $this->renderText($content);
}
示例4: executeIndex
/**
* executes an action defined by an ecrypted url parameter bypassing authentication
* This action must be called with the request parameter 'encrypted_uri'
* containing the target module/action and optional parameters encrypted
* using the class 'Encryption'.
*
* Example:
* Encryption::encode('module=myModule&action=myAction¶m1=value1, ...');
*
* @param sfWebRequest $request
* @return
*/
public function executeIndex(sfWebRequest $request)
{
//--------------------------------------------------------------------------
// make sure required parameter 'encrypted_uri' is provided
//--------------------------------------------------------------------------
$this->forward404If(!($encrypted_uri = $request->getParameter('encrypted_uri')));
//--------------------------------------------------------------------------
// decrypt parameters
// v1: 'action', 'module', 'parameters' & 'sfGuardUserId'
// v2: 'uri' & 'sfGuardUserId'
//--------------------------------------------------------------------------
$data = Encryption::decryptUri($encrypted_uri);
//--------------------------------------------------------------------------
// make sure required 'uri' is provided
//--------------------------------------------------------------------------
$this->forward404If(!isset($data['module']) or !isset($data['action']));
$request->setParameter('module', $data['module']);
$request->setParameter('action', $data['action']);
if (is_array($data['parameters'])) {
foreach ($data['parameters'] as $key => $value) {
$request->setParameter($key, $value);
}
}
//--------------------------------------------------------------------------
// handle automatic authentication if turned on, otherwise skip it
//--------------------------------------------------------------------------
if ($data['sfGuardUserId'] > 0 and sfConfig::get('app_esUriEncryptionPlugin_authenticate')) {
//------------------------------------------------------------------------
// make sure sfGuardPlugin is installed and enabled
//------------------------------------------------------------------------
if (!class_exists('sfGuardUser')) {
throw new sfException('esUriEncryptionPlugin: sfGuardPlugin not found - cannot authenticate.');
}
//------------------------------------------------------------------------
// determine user identified by sfGuardUserId
//------------------------------------------------------------------------
if ($user = Doctrine::getTable('sfGuardUser')->find($data['sfGuardUserId'])) {
$this->getUser()->signin($user);
}
if (sfConfig::get('app_esUriEncryptionPlugin_debug')) {
sfContext::getInstance()->getLogger()->debug('esUriEncryptionPlugin: user logged in, id=' . $data['sfGuardUserId']);
}
}
//--------------------------------------------------------------------------
// forward to destination action
//--------------------------------------------------------------------------
$this->forward($data['module'], $data['action']);
}
示例5: executeSave
/**
* Executes save action
*
* @param sfWebRequest $request A request object
*/
public function executeSave(sfWebRequest $request)
{
$member = $this->getUser()->getMember();
$isValid = $member->getConfig('paint_is_valid');
$this->forward404Unless($isValid);
$member->setConfig('paint_is_valid', false);
$id = $request->getParameter('id', 0);
$ccccImage = Doctrine::getTable('CcccImage')->find($id);
if (!$ccccImage) {
$ccccImage = new CcccImage();
}
$ccccComaId = $ccccImage->getCcccComaId();
if ($ccccComaId && $ccccImage->getCcccComa()->getCcccImageId() == $ccccImage->getId()) {
$ccccImage->getPchFile()->delete();
$newCcccImage = new CcccImage();
$newCcccImage->setBaseCcccImage($ccccImage);
$ccccImage =& $newCcccImage;
}
$raw = new RawSpainter(base64_decode($member->getConfig('paint_rawdata')));
$member->setConfig('paint_rawdata', '');
$ccccImage->saveImageFileFromRawData($raw->getImage());
$ccccImage->savePchFileFromRawData($raw->getPch());
$ccccImage->setMember($member);
$ccccImage->setCcccComaId($ccccComaId);
$ccccImage->save();
if ($ccccComaId) {
$ccccComa = $ccccImage->getCcccComa();
$ccccComa->setCcccImage($ccccImage);
$ccccComa->save();
$request->setParameter('id', $ccccComa->getCcccMangaId());
$this->forward('ccccManga', 'index');
}
$this->forward('ccccImage', 'index');
}
示例6: checkEiScenario
public function checkEiScenario(sfWebRequest $request, EiProjet $ei_project)
{
if (($this->ei_scenario_id = $request->getParameter('ei_scenario_id')) != null) {
//Recherche du scénario en base
$this->ei_scenario = Doctrine_Core::getTable('EiScenario')->findOneByIdAndProjectIdAndProjectRef($this->ei_scenario_id, $ei_project->getProjectId(), $ei_project->getRefId());
//Si le scénario n'existe pas , alors on retourne un erreur 404
if ($this->ei_scenario == null) {
$message = 'Scénario introuvable!! l identificateur n\'est pas spécifié';
$request->setParameter('msg', $message);
$request->setParameter('back_link', $request->getReferer());
$this->forward('erreur', 'error404');
}
} else {
$this->forward404('Missing scenario parameters ...');
}
}
示例7: execute
/**
* Add Holiday
* @param sfWebRequest $request
*/
public function execute($request)
{
//Keep Menu in Leave/Config
$request->setParameter('initialActionName', 'viewHolidayList');
$this->form = new HolidayForm();
$editId = $request->getParameter('hdnEditId');
$this->editMode = false;
// Pass edit mode for teh view
$this->form->editMode = false;
// Pass edit mode for form
if ($editId && $editId != '') {
$this->form->setDefaultValues($editId);
}
if ($editId && $editId != '' || $request->getParameter('hdnEditMode') == 'yes') {
$this->editMode = true;
$this->form->editMode = true;
}
if ($request->isMethod('post')) {
$this->form->bind($request->getParameter($this->form->getName()));
if ($this->form->isValid()) {
$post = $this->form->getValues();
/* Save holiday */
if ($post['id'] != '') {
$this->getUser()->setFlash('success', __(TopLevelMessages::UPDATE_SUCCESS));
} else {
$this->getUser()->setFlash('success', __(TopLevelMessages::SAVE_SUCCESS));
}
$date = $post['date'];
$holidayId = $post['id'];
/* Read the holiday by date */
$holidayObjectDate = $this->getHolidayService()->readHolidayByDate($date);
$allowToAdd = true;
if ($this->editMode) {
$holidayObject = $this->getHolidayService()->readHoliday($holidayId);
if ($date != $holidayObjectDate->getDate() && $holidayObjectDate->getRecurring()) {
$allowToAdd = false;
}
} else {
/* Days already added can not be selected to add */
if ($date == $holidayObjectDate->getDate() || $holidayObjectDate->getRecurring() == 1) {
$allowToAdd = false;
}
}
/* Error will not return if the date if not in the correct format */
if (!$allowToAdd && !is_null($date)) {
$this->templateMessage = array('WARNING', __('Failed to Save: Date Already Assigned'));
} else {
$holidayObject = $this->getHolidayService()->readHoliday($post['id']);
$holidayObject->setDescription($post['description']);
$holidayObject->setDate($post['date']);
$recurringValue = $post['recurring'] == 'on' ? 1 : 0;
$holidayObject->setRecurring($recurringValue);
$holidayObject->setLength($post['length']);
$this->getHolidayService()->saveHoliday($holidayObject);
$this->redirect('leave/viewHolidayList');
}
}
}
}
示例8: executeList
public function executeList(sfWebRequest $request)
{
if (!$request->hasParameter('model')) {
throw new sfException('sfDoctrineFBAutocompleteJson : Model is not defined');
}
$this->items = Doctrine_Core::getTable($request->getParameter('model'))->findAll();
$this->setLayout(false);
$request->setParameter('sf_format', 'json');
}
示例9: execute
/**
* Action permettant de générer un nouveau token pour l'utilisateur courant.
*
* @param sfWebRequest $request
*/
public function execute($request)
{
$this->setLayout(false);
$this->getResponse()->setContentType('application/json');
$request->setParameter("ei_user", $this->user);
/** @var EiUser $user */
$user = $this->getUser()->getGuardUser()->getEiUser();
$token = $user->getTokenApi();
return $this->renderText(json_encode(array("token" => $token)));
}
示例10: execute
/**
* Action permettant de générer un nouveau token pour l'utilisateur courant.
*
* @param sfWebRequest $request
*/
public function execute($request)
{
$this->setLayout(false);
$this->getResponse()->setContentType('application/json');
$request->setParameter("ei_user", $this->user);
/** @var EiUserTable $table */
$table = Doctrine_Core::getTable('EiUser');
$token = $table::getInstance()->generateToken($this->getUser()->getGuardUser()->getEiUser());
return $this->renderText(json_encode(array("token" => $token)));
}
示例11: execute
/**
* Action permettant de créer un data set.
*
* @param sfWebRequest $request
*/
public function execute($request)
{
$this->setLayout(false);
$this->logger = sfContext::getInstance()->getLogger();
// On détermine le type de contenu retourné.
$this->getResponse()->setContentType('application/xml');
$this->getUser()->signIn($this->user, true);
/** @var EiProfilTable $tableProfil */
$tableProfil = Doctrine_Core::getTable("EiProfil");
/* @var EiDataSet $data_set */
$data_set = $this->getRoute()->getObject();
/** @var EiScenario $scenario */
$scenario = Doctrine_Core::getTable("EiDataSet")->getDataSetScenario($data_set);
/** @var EiProfil $profil */
$profil = $tableProfil->findOneByProfileRefAndProfileId($request->getParameter("profil_ref"), $request->getParameter("profil_id"));
$request->setParameter("ei_test_set_id", $data_set->getId());
$request->setParameter("project_ref", $scenario->getProjectRef());
$request->setParameter("project_id", $scenario->getProjectId());
$request->setParameter("profile_ref", $profil->getProfileRef());
$request->setParameter("profile_id", $profil->getProfileId());
$request->setParameter("profile_name", $profil->getName());
$this->logger->info("----------------------------------------------------------");
$chronometre = new Chronometre();
$chronometre->lancerChrono("PERFORMANCE RECUPERATION JDD");
$content = $this->getController()->getPresentationFor("eidataset", "download");
// Fin mesure
$chronometre->arreterEtAfficherChrono();
$this->logger->info("----------------------------------------------------------");
return $this->renderText($content);
}
示例12: executeUpdate
public function executeUpdate(sfWebRequest $request)
{
$this->forward404Unless($request->isMethod('post'));
$invoice_params = $request->getParameter('invoice');
$request->setParameter('id', $invoice_params['id']);
$invoice = $this->getRecurringInvoice($request);
$this->invoiceForm = new RecurringInvoiceForm($invoice, array('culture' => $this->culture));
$this->processForm($request, $this->invoiceForm);
$i18n = $this->getContext()->getI18N();
$this->title = $i18n->__('Edit Invoice');
$this->action = 'update';
$this->setTemplate('edit');
}
示例13: executeUpdate
public function executeUpdate(sfWebRequest $request)
{
$product_params = $request->getParameter('product');
$request->setParameter('id', $product_params['id']);
$this->forward404Unless($request->isMethod('post'));
$product = $this->getProduct($request);
$this->productForm = new ProductForm($product, array('culture' => $this->culture));
$this->processForm($request, $this->productForm);
$i18n = $this->getContext()->getI18N();
$this->title = $i18n->__('Edit Product');
$this->action = 'update';
$this->setTemplate('edit');
}
示例14: executePost
public function executePost(sfWebRequest $request)
{
$form = new opTweetForm();
$form->bind($request->getParameter('tweet'));
if ($form->isValid()) {
$activity = $form->save();
if ($form->getValue('twitter')) {
$request->setParameter('id', $activity->id);
$this->forward('twitter', 'login');
}
}
$this->redirect('@homepage');
}
示例15: executeUpdate
public function executeUpdate(sfWebRequest $request)
{
$estimate_params = $request->getParameter('invoice');
$request->setParameter('id', $estimate_params['id']);
$this->forward404Unless($request->isMethod('post'));
$estimate = $this->getEstimate($request);
$this->db_draft = $estimate->getDraft();
$this->estimateForm = new EstimateForm($estimate, array('culture' => $this->culture));
$this->processForm($request, $this->estimateForm);
$i18n = $this->getContext()->getI18N();
$this->title = $i18n->__('Edit Estimate');
$this->action = 'update';
$this->setTemplate('edit');
}