本文整理汇总了PHP中sfWebRequest::getParameter方法的典型用法代码示例。如果您正苦于以下问题:PHP sfWebRequest::getParameter方法的具体用法?PHP sfWebRequest::getParameter怎么用?PHP sfWebRequest::getParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfWebRequest
的用法示例。
在下文中一共展示了sfWebRequest::getParameter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeIndex
/**
* Executes index action
*
* @param sfRequest $request A request object
*/
public function executeIndex(sfWebRequest $request)
{
$this->transaction_type = $request->getParameter("transaction_type");
$this->transaction_id = $request->getParameter("transaction_id");
$keywords = explode(" ", $request->getParameter("searchstring"));
//search in name
$query = Doctrine_Query::create()->from('Product p')->orderBy("p.name")->where('p.id != 0');
foreach ($keywords as $keyword) {
$query->andWhere("p.name LIKE '%" . $keyword . "%'");
}
//search in description
$query->orWhere('p.id != 0');
foreach ($keywords as $keyword) {
$query->andWhere("p.description LIKE '%" . $keyword . "%'");
}
$this->products = $query->execute();
$productids = array();
foreach ($this->products as $product) {
$productids[] = $product->getId();
}
$stocks = Doctrine_Query::create()->from('Stock s')->whereIn('s.product_id', $productids)->andWhere('s.warehouse_id = ' . SettingsTable::fetch('default_warehouse_id'))->execute();
$this->stockarray = array();
foreach ($stocks as $stock) {
$this->stockarray[$stock->getProductId()] = $stock;
}
}
示例2: executeUndo_tree_ajax
public function executeUndo_tree_ajax(sfWebRequest $request)
{
$request->setRequestFormat('json');
$id_tree = $request->getParameter('treeId');
$production = $request->getParameter('production');
$user = $this->getUser()->getAttribute(sfConfig::get('app_session_current_user'), null);
if ($user != null) {
$tree = TreeScPeer::retrieveByPK($id_tree);
if (is_object($tree)) {
//si es el dueño del arbol
if ($tree->getUserId() == $user->getId()) {
$tree->setFlag(1);
if ($production == 'production') {
$tree->setProduccion('production');
}
$tree->save();
return sfView::SUCCESS;
} else {
$this->message = 'owner not found';
return sfView::ERROR;
}
} else {
$this->message = 'objet not found';
return sfView::ERROR;
}
} else {
$this->message = 'session expird';
return sfView::ERROR;
}
}
示例3: executeIndex
public function executeIndex(sfWebRequest $request)
{
app::setPageTitle('Gantt Chart', $this->getResponse());
if ($request->hasParameter('projects_id')) {
$this->forward404Unless($this->projects = Doctrine_Core::getTable('Projects')->createQuery()->addWhere('id=?', $request->getParameter('projects_id'))->fetchOne(), sprintf('Object projects does not exist (%s).', $request->getParameter('projects_id')));
$this->checkProjectsAccess($this->projects);
$this->checkTasksAccess('view', false, $this->projects);
} else {
$this->checkTasksAccess('view');
}
if (!$this->getUser()->hasAttribute('gantt_filter' . $this->get_pid($request))) {
$this->getUser()->setAttribute('gantt_filter' . $this->get_pid($request), Tasks::getDefaultFilter($request, $this->getUser(), 'ganttChart'));
}
$this->filter_by = $this->getUser()->getAttribute('gantt_filter' . $this->get_pid($request));
if ($fb = $request->getParameter('filter_by')) {
$this->filter_by[key($fb)] = current($fb);
$this->getUser()->setAttribute('gantt_filter' . $this->get_pid($request), $this->filter_by);
$this->redirect('ganttChart/index' . $this->add_pid($request));
}
if ($request->hasParameter('remove_filter')) {
unset($this->filter_by[$request->getParameter('remove_filter')]);
$this->getUser()->setAttribute('gantt_filter' . $this->get_pid($request), $this->filter_by);
$this->redirect('ganttChart/index' . $this->add_pid($request));
}
$this->tasks_tree = array();
$this->tasks_list = $this->getTasks($request, $this->tasks_tree);
}
示例4: executeIndex
public function executeIndex(sfWebRequest $request)
{
if ($request->hasParameter('object_id') && $request->hasParameter('object_class')) {
$this->object = Doctrine::getTable($request->getParameter('object_class'))->find($request->getParameter('object_id'));
}
$this->setLayout(false);
}
示例5: executeIndex
/**
* Executes index action
*
* @param sfRequest $request A request object
*/
public function executeIndex(sfWebRequest $request)
{
// Download the image
$url = $request->getParameter("url");
$remote_file = $url;
//urldecode( $url );
//$remote_file = "/Users/robbymillsap/Sites/eventflo.dev/web/images/myface.jpg";
$remote_handle = fopen($remote_file, "r");
$temp = tempnam(sfConfig::get('sf_upload_dir'), 'Img') . '.jpg';
$temp_handle = fopen($temp, "w");
while ($cline = fgets($remote_handle)) {
fwrite($temp_handle, $cline);
}
fclose($temp_handle);
fclose($remote_handle);
//$url_to_tmp = realpath(dirname($temp));
// Process the image
/*
$path = sfConfig::get('sf_upload_dir') . '/';
$src = "myface.jpg";
$new = "myface.jpg";
*
*/
// Run image magick
$cmd = "convert {$temp} -resize " . $request->getParameter("size") . " " . $temp;
shell_exec($cmd);
// show image
$this->showImage($temp);
shell_exec("rm {$temp}");
return sfView::NONE;
}
示例6: executePaymentSuccess
public function executePaymentSuccess(sfWebRequest $request)
{
$payment_type = $request->getParameter('type');
/** @var sfGuardUser $user */
$user = $this->getUser()->getGuardUser();
/** @var PaymentTransaction $payment */
$payment = $user->getLastNotPayedTransaction($payment_type);
$gtw = new PaypalGateway(array('amount' => $payment->amount, 'success_url' => $this->generateUrl('payment\\success', array('type' => $payment_type)), 'cancel_url' => $this->generateUrl('payment\\cancel'), 'token' => $request->getParameter('token'), 'payer_id' => $request->getParameter('PayerID')));
$res = $gtw->doExpressCheckout();
if ($res) {
$payment->is_payed = true;
$payment->date_payed = date('Y-m-d H:i:s');
$payment->status_code = 'success';
$payment->stamp = $request->getParameter('PayerID');
$payment->save();
$user->account_type = $payment->type;
$user->credit = $payment->type == 'basic' ? 12 : -1;
$user->last_payment_date = date('Y-m-d H:i:s');
$user->save();
$this->getUser()->setFlash('notice', 'The payment is accepted, thank you!');
} else {
$this->getUser()->setFlash('error', 'PayPal connection error');
}
$this->redirect('/project/user/account');
}
示例7: processForm
protected function processForm(sfWebRequest $request, sfForm $form)
{
$requestparam = $request->getParameter('accountentry');
$account = AccountTable::fetchById($requestparam['account_id']);
$qty = $requestparam['qty'];
$date = $requestparam['date']['year'] . "-" . $requestparam['date']['month'] . "-" . $requestparam['date']['day'];
//$ref_class=$requestparam['ref_class'];
//$ref_id=$requestparam['ref_id'];
$type = $requestparam['type'] != "" ? $requestparam['type'] : 'Adjustment';
//$priority=0;
$description = $requestparam['description'];
if ($qty == 0) {
$this->redirect('home/error?msg="Invalid Qty"');
}
$accountentry = $account->addEntry($date, $qty, null, null, $type, $description);
$form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
if ($form->isValid()) {
$notice = $form->getObject()->isNew() ? 'The item was created successfully.' : 'The item was updated successfully.';
$this->dispatcher->notify(new sfEvent($this, 'admin.save_object', array('object' => $accountentry)));
$this->getUser()->setFlash('notice', $notice);
$this->redirect('account/view?id=' . $accountentry->getaccountId());
} else {
if ($form['qty']->getError()) {
$this->redirect('home/error?msg="Invalid Qty: ' . $qty . '"');
}
if ($form['date']->getError()) {
$this->redirect('home/error?msg="Invalid Date: ' . $date . '"');
}
//$this->getUser()->setFlash('error', 'The item has not been saved due to some errors.', false);
}
}
示例8: generateThumbnailPath
/**
* @param string $fileName
* @param string $directory
* @param sfWebRequest $request
* @return string
*/
protected function generateThumbnailPath($fileName, $directory, sfWebRequest $request)
{
$extension = $this->getFileExtension($fileName);
$baseName = $this->getFileBaseName($fileName);
$fileName = sprintf('%s_%s%s%s', $baseName, (int) $request->getParameter('scale', 1), (int) $request->getParameter('inflate', 1), $extension);
return $directory . $fileName;
}
示例9: executeFile
public function executeFile(sfWebRequest $request)
{
$file = $request->getParameter('filename');
$type = $request->getParameter('type');
switch ($type) {
case 'backup':
$apl = new Appliance();
$base_dir = $apl->get_archive_base_dir();
break;
default:
break;
}
if (!$base_dir) {
return sfView::NONE;
}
$path = realpath($base_dir . '/' . $file);
// if base_dir isn't at the front 0==strpos, most likely hacking attempt
if (strpos($path, $base_dir)) {
die('Invalid Path');
} elseif (file_exists($path)) {
$this->prepareDownload($file);
readfile($path);
} else {
die('Invalid Path');
}
return sfView::NONE;
}
示例10: executeTemplate
public function executeTemplate(sfWebRequest $request)
{
$this->name = $request->getParameter('name', '');
if ('' !== $this->name) {
$this->forward404Unless(in_array($this->name, $this->generateMailTemplateNames($this->config)));
}
$obj = Doctrine::getTable('NotificationMail')->findOneByName($this->name);
if (!$obj) {
$obj = Doctrine::getTable('NotificationMail')->create(array('name' => $this->name));
}
$translation = $obj->Translation[sfDoctrineRecord::getDefaultCulture()];
$this->form = new NotificationMailTranslationForm($translation);
$this->form->updateDefaultsByConfig($this->getMailConfiguration($this->config, $this->name));
if ($this->request->isMethod(sfWebRequest::POST)) {
$this->form->bind($request->getParameter('notification_mail_translation'));
if ($this->form->isValid()) {
if (!$this->form->getObject()->exists()) {
if ($this->form->getObject()->id instanceof Doctrine_Record) {
$this->form->getObject()->id->save();
}
}
$this->form->save();
$this->getUser()->setFlash('notice', 'Saved.');
$this->redirect('@mail_template_specified?name=' . $this->name);
}
$this->getUser()->setFlash('error', (string) $this->form->getErrorSchema());
}
}
示例11: executeIndex
/**
* Executes index action
*
* @param sfRequest $request A request object
*/
public function executeIndex(sfWebRequest $request)
{
// Recuperar el Tramite y el Proceso
$this->setLayout('descarga');
$template = Doctrine::getTable('ClaDocumentos')->findOneByClaTramiteIdAndClaProcesoId($request->getParameter('tramite'), $request->getParameter('proceso'));
$seguimiento = Doctrine::getTable('ProcSeguimiento')->getTramite($request->getParameter('seguimiento'));
$PHPWord = new PHPWord();
$filename = 'carta_' . $request->getParameter('tramite') . '_' . $request->getParameter('proceso') . '.docx';
$document = $PHPWord->loadTemplate(sfConfig::get('sf_root_dir') . '/archivos/templates/' . $template->getPath());
date_default_timezone_set('America/La_Paz');
setlocale(LC_TIME, 'spanish');
$document->setValue('fecha_carta', strftime("%d de %B de %Y"));
foreach ($seguimiento->ProcFormularios as $formulario) {
$tabla = Doctrine::getTable($formulario->ClaTabla->getDescripcion())->findOneById($formulario->getGetId());
if ($formulario->ClaTabla->getDescripcion() == 'DatPersonas') {
$document->setValue('nombre_estudiante', $tabla->getNombreCompleto());
}
}
$document->save(sfConfig::get('sf_root_dir') . '/archivos/generados/' . $filename);
// $guardar = new ClaDocumentos();
// $guardar->setClaTramiteId(1);
// $guardar->setClaProcesoId(1);
// $guardar->setPath($filename);
// $guardar->save();
$this->filename = $filename;
$this->enlace = sfConfig::get('sf_root_dir') . '/archivos/generados//' . $filename;
}
示例12: executeIndex
public function executeIndex(sfWebRequest $request)
{
// get the name of the form object we are building the validation for
$form = $request->getParameter('form');
// make sure that the form class specified actually exists
// and it is really a symfony form
$this->forward404Unless($this->isValidSfFormName($form));
// errors have to be disabled because any kind of warning message will break
// the outputted javascript
// error_reporting('E_NONE'); // Very bad practice
// create an instance of the sfJqueryFormValidationRules object
$this->sf_jq_rules = new sfJqueryFormValidationRules(new $form);
// add embedded forms
$embedded_form = $request->getParameter('embedded_form');
if (is_array($embedded_form)) {
foreach($embedded_form as $name => $form) {
if ($this->isValidSfFormName($form)) {
$this->sf_jq_rules->addEmbeddedForm($name, new $form);
}
}
}
}
示例13: executeBuild
public function executeBuild(sfWebRequest $request)
{
if (!$request->isMethod("post")) {
return;
}
$this->new_url = "http://imgmky.com/gen?key=" . $request->getParameter("key") . '&url=' . urlencode($request->getParameter("url")) . '&size=' . $request->getParameter("size");
}
示例14: processForm
protected function processForm(sfWebRequest $request, sfForm $form)
{
$form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
if ($form->isValid())
{
Doctrine_Manager::connection()->beginTransaction();
$Question = $form->save();
if ($Question->getIdQualifAgent() == 3) {
$venteForm = new VenteForm();
$venteForm->bind($request->getParameter('vente'));
if ($venteForm->isValid()) {
$vente = $venteForm->save();
Doctrine_Manager::connection()->commit();
} else {
Doctrine_Manager::connection()->rollback();
}
} else if ($Question->getIdQualifAgent() == 1) {
$rappelForm = new RappelForm();
$rappelForm->bind($request->getParameter('rappel'));
if ($rappelForm->isValid()) {
$rappel = $rappelForm->save();
Doctrine_Manager::connection()->commit();
} else {
Doctrine_Manager::connection()->rollback();
}
} else {
Doctrine_Manager::connection()->commit();
}
$this->redirect('question/next');
}
}
示例15: execute
/**
* @param sfWebRequest $request
* @return application/json data
*/
public function execute($request)
{
$con = Propel::getConnection();
$con->beginTransaction();
$html = '';
try {
$type = $request->getParameter('type');
$this->forward404Unless($type, 'Comment Type Not Found');
$id = $request->getParameter('id');
$this->forward404Unless($id, 'Comment ID Not Found');
$aComment = CommentQuery::create()->filterByType($type)->filterById($id)->findOne();
$this->forward404Unless($aComment, sprintf('%s Comment Not Found', ucfirst($type)));
$this->forward404Unless($aComment->getUserId() == $this->getUser()->getId(), 'Your are not authorized to delete this comment');
// construction of returns array
switch ($type) {
case CommentPeer::TYPE_BRANCH:
$returns = array('id' => $aComment->getBranchId(), 'type' => $type);
break;
case CommentPeer::TYPE_FILE:
$returns = array('id' => $aComment->getFileId(), 'type' => $type);
break;
}
$aComment->delete($con);
$html = $this->getComponent('default', 'commentGlobal', $returns);
$con->commit();
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
// returns a json object
$this->getResponse()->setContentType('application/json');
return $this->renderText(json_encode(array('html' => $html)));
}