当前位置: 首页>>代码示例>>PHP>>正文


PHP sfForm::getName方法代码示例

本文整理汇总了PHP中sfForm::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP sfForm::getName方法的具体用法?PHP sfForm::getName怎么用?PHP sfForm::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sfForm的用法示例。


在下文中一共展示了sfForm::getName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: processForm

 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     if ($form->isValid()) {
         try {
             $peticion = $form->save();
             $aux = Doctrine_Query::create()->from('sfGuardUser s')->where('s.email_address = ?', $peticion->getEmailAddress());
             $aux1 = $aux->fetchOne();
             if (!$aux1) {
                 $auxU = Doctrine_Query::create()->from('sfGuardUser s')->where('s.username = ?', $peticion->getUsername());
                 $auxU1 = $auxU->fetchOne();
                 if (!$auxU1) {
                     $this->redirect('peticion/notificacion');
                 } else {
                     $peticion->delete();
                     $this->getUser()->setFlash('error', 'El nombre de usuario "' . $peticion->getUsername() . '" no esta disponible.', false);
                 }
             } else {
                 $peticion->delete();
                 $this->getUser()->setFlash('error', 'El correo electrónico "' . $peticion->getEmailAddress() . '" ya se encuentra registrado.', false);
             }
         } catch (Exception $e) {
             $this->getUser()->setFlash('error', 'El correo electrónico ingresado ya se encuentra registrado.', false);
         }
     }
 }
开发者ID:edulima1989,项目名称:Sistema-Radiotaxi,代码行数:26,代码来源:actions.class.php

示例2: 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);
     }
 }
开发者ID:jaspertomas,项目名称:tmcprogram_tacloban,代码行数:31,代码来源:actions.class.php

示例3: processForm

 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     if ($form->isValid()) {
         $form->save();
     }
 }
开发者ID:nubee,项目名称:bee,代码行数:7,代码来源:actions.class.php

示例4: processForm

 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $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.';
         try {
             $stock = $form->save();
             $stock->calc($stock->getDate());
         } catch (Doctrine_Validator_Exception $e) {
             $errorStack = $form->getObject()->getErrorStack();
             $message = get_class($form->getObject()) . ' has ' . count($errorStack) . " field" . (count($errorStack) > 1 ? 's' : null) . " with validation errors: ";
             foreach ($errorStack as $field => $errors) {
                 $message .= "{$field} (" . implode(", ", $errors) . "), ";
             }
             $message = trim($message, ', ');
             $this->getUser()->setFlash('error', $message);
             return sfView::SUCCESS;
         }
         $this->dispatcher->notify(new sfEvent($this, 'admin.save_object', array('object' => $stock)));
         if ($request->hasParameter('_save_and_add')) {
             $this->getUser()->setFlash('notice', $notice . ' You can add another one below.');
             $this->redirect('@stock_new');
         } else {
             $this->getUser()->setFlash('notice', $notice);
             $this->redirect("stock/view?id=" . $stock->getId());
         }
     } else {
         $this->getUser()->setFlash('error', 'The item has not been saved due to some errors.', false);
     }
 }
开发者ID:jaspertomas,项目名称:tmcprogram_tacloban,代码行数:30,代码来源:actions.class.php

示例5: processForm

 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     if ($form->isValid()) {
         $this->getUser()->setFlash('notice', $form->getObject()->isNew() ? 'The item was created successfully.' : 'The item was updated successfully.');
         $new = !$form->getObject()->exists();
         $site = $form->save();
         if ($new) {
             $dispatcher = $this->getContext()->getEventDispatcher();
             $formatter = new sfFormatter();
             chdir(sfConfig::get('sf_root_dir'));
             $task = new sfGenerateAppTask($dispatcher, $formatter);
             $task->run(array($site->slug));
             $task = new sfSympalEnableForAppTask($dispatcher, $formatter);
             $task->run(array($site->slug));
             $task = new sfSympalCreateSiteTask($dispatcher, $formatter);
             $task->run(array($site->slug), array('no-confirmation'));
             $site = Doctrine_Core::getTable('sfSympalSite')->findOneByTitle($site->title);
         }
         $this->dispatcher->notify(new sfEvent($this, 'admin.save_object', array('object' => $site)));
         if ($request->hasParameter('_save_and_add')) {
             $this->getUser()->setFlash('notice', $this->getUser()->getFlash('notice') . ' You can add another one below.');
             $this->redirect('@sympal_sites_new');
         } else {
             $this->redirect('@sympal_sites_edit?id=' . $site->getId());
         }
     } else {
         $this->getUser()->setFlash('error', 'The item has not been saved due to some errors.', false);
     }
 }
开发者ID:sympal,项目名称:sympal,代码行数:30,代码来源:Basesympal_sitesActions.class.php

示例6: processForm

 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     if ($form->isValid()) {
         // kommt vom multiupload-gedingse
         $notice = $form->getObject()->isNew() ? 'The item was created successfully.' : 'The item was updated successfully.';
         $sf_filebase_file = $form->save();
         $this->dispatcher->notify(new sfEvent($this, 'admin.save_object', array('object' => $sf_filebase_file)));
         if (!$request->hasParameter('swfupload_filesource')) {
             if ($request->hasParameter('_save_and_add')) {
                 $this->getUser()->setFlash('notice', $notice . ' You can add another one below.');
                 $this->redirect('@sf_filebase_file_new');
             } else {
                 $this->getUser()->setFlash('notice', $notice);
                 $this->redirect(array('sf_route' => 'sf_filebase_file_edit', 'sf_subject' => $sf_filebase_file));
             }
         }
         return true;
     } else {
         if (!$request->hasParameter('swfupload_filesource')) {
             $this->getUser()->setFlash('error', 'The item has not been saved due to some errors.', false);
         }
         return false;
     }
 }
开发者ID:joshiausdemwald,项目名称:sfFilebasePlugin,代码行数:25,代码来源:actions.class.php

示例7: processForm

 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     if ($form->isValid()) {
         $notice = $form->getObject()->isNew() ? 'Категория создана успешно.' : 'Категория изменена успешно.';
         $Category = $form->save();
         foreach ((array) $request->getParameter('category_preference') as $key => $value) {
             if (isset($value['id']) and $value['id'] != 0) {
                 $category_preference = CategoryPreferencePeer::retrieveByPk(intval($value['id']));
             } else {
                 $category_preference = new CategoryPreference();
                 $category_preference->setCategoryId($form->getObject()->getId());
             }
             if (isset($value['delete'])) {
                 $category_preference->delete();
             } elseif ($value['name'] != '') {
                 $category_preference->setKey($value['name']);
                 $category_preference->setPreferenceType($value['preference_type']);
                 $category_preference->setPreferenceUnit($value['preference_unit']);
                 $category_preference->setFilterStatus(isset($value['filter_status']) ? $value['filter_status'] : 0);
                 $category_preference->save();
             }
         }
         $this->dispatcher->notify(new sfEvent($this, 'admin.save_object', array('object' => $Category)));
         if ($request->hasParameter('_save_and_add')) {
             $this->getUser()->setFlash('notice', $notice . ' Вы можете создать еще одну.');
             $this->redirect('@category_new');
         } else {
             $this->getUser()->setFlash('notice', $notice);
             $this->redirect(array('sf_route' => 'category_edit', 'sf_subject' => $Category));
         }
     } else {
         $this->getUser()->setFlash('error', 'The item has not been saved due to some errors.', false);
     }
 }
开发者ID:Chipusy,项目名称:lkbroker,代码行数:35,代码来源:actions.class.php

示例8: 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');      
    }
  }
开发者ID:nacef,项目名称:juriste,代码行数:33,代码来源:actions.class.php

示例9: processForm

 protected function processForm(sfWebRequest $request, sfForm $form, $celulaId = null)
 {
     $asistencia = $request->getParameter('reunion')['asistencias'];
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     $fields = $form->getFormFieldSchema()->getValue();
     if ($form->isValid()) {
         $reunion = $form->save();
         foreach ($reunion->getAsistencias() as $borrable) {
             $borrable->delete();
         }
         $asistencias = explode(',', $asistencia);
         foreach ($asistencias as $key => $asistencia) {
             if ($asistencia > 0) {
                 $source = new Asistencia();
                 $source->setReunionId($reunion->getId());
                 $source->setMiembroCelulaId($asistencia);
                 $source->save();
             }
         }
         $this->getUser()->setFlash('notice', "Reunión guardada exitosamente", true);
         if (isset($celulaId)) {
             $this->redirect('celulas/show?id=' . $celulaId);
         } else {
             $this->forward('celulas', 'index');
         }
     }
     $this->getUser()->setFlash('error', "Error!!! " . $form->getErrorSchema(), true);
     if (isset($celulaId)) {
         $this->redirect('celulas/show?id=' . $celulaId);
     } else {
         $this->forward('celulas', 'index');
     }
 }
开发者ID:laiello,项目名称:tesiscdfeg12,代码行数:33,代码来源:actions.class.php

示例10: processForm

 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     if ($form->isValid()) {
         $value = $form->getValue('example');
         $example = Doctrine_Core::getTable('Example')->find(array($value));
         if ($example) {
             $comment = $form->save();
             $this->redirect('example/show?slug=' . $example->getSlug());
         }
         $value = $form->getValue('project');
         $project = Doctrine_Core::getTable('Project')->find(array($value));
         if ($project) {
             $comment = $form->save();
             $this->redirect('project/show?slug=' . $project->getSlug());
         }
         $value = $form->getValue('hint');
         $hint = Doctrine_Core::getTable('Hint')->find(array($value));
         if ($hint) {
             $comment = $form->save();
             $this->redirect('hint/show?slug=' . $hint->getSlug());
         }
         //????
         //jaka akcja ma byc podjeta gdy brak example, project, hint?
         //$comment = $form->save();
     }
 }
开发者ID:rafal2208,项目名称:by-examples,代码行数:27,代码来源:actions.class.php

示例11: processForm

  protected function processForm(sfWebRequest $request, sfForm $form)
  {
    $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
    if ($form->isValid())
    {
      $isNew = $form->getObject()->isNew();
      $notice = $isNew ? 'Your reply was saved successfully.' : 'The item was updated successfully.';

      $sf_nested_comment = $form->save();

      $this->dispatcher->notify(new sfEvent($this, 'admin.save_object', array('object' => $sf_nested_comment)));
      
      $email_pref = sfNestedCommentConfig::isMailEnabled();
      $enable_mail_alert = $email_pref === true || $email_pref == 'moderated';

      if ($isNew && $enable_mail_alert && $sf_nested_comment->isReply())
      {
        $userComment = $sf_nested_comment->getsfNestedCommentRelatedBySfCommentId();
        $params = $this->prepareMailParameter($sf_nested_comment, $userComment);
        sfNestedCommentTools::sendEmail($this->getMailer(), $params);
      }
      
      $this->getUser()->setFlash('notice', $notice);
      $this->redirect('@sf_nested_comment');
    }
    else
    {
      $this->getUser()->setFlash('error', 'The item has not been saved due to some errors.', false);
    }
  }
开发者ID:nibsirahsieu,项目名称:sfNestedCommentPlugin,代码行数:30,代码来源:BasesfNestedCommentAdminActions.class.php

示例12: processForm

 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $parameters = $request->getParameter($form->getName());
     $form->bind($parameters, $request->getFiles($form->getName()));
     if ($form->isValid()) {
         $this->getContext()->getConfiguration()->loadHelpers('Number');
         // On crée la transaction correspondante
         $transaction = new Transaction();
         $transaction->asso_id = $parameters['asso_id'];
         $transaction->compte_id = $parameters['compte_id'];
         $transaction->libelle = 'Remboursement ' . $parameters['nom'];
         $transaction->commentaire = "Remboursement des achats suivants :\n";
         // Voir ci-dessous
         $transaction->montant = 0;
         // On fera le total plus tard !
         $transaction->date_transaction = date('Y-m-d');
         $transaction->moyen_id = $parameters['moyen_id'];
         $transaction->moyen_commentaire = $parameters['moyen_commentaire'];
         $transaction->save();
         $form->setValue('transaction_id', $transaction->getPrimaryKey());
         $note_de_frais = $form->save();
         foreach ($parameters['transactions'] as $transaction_id) {
             $transaction2 = $note_de_frais->addAchatFromId($transaction_id);
             $transaction->commentaire .= $this->format_transaction($transaction2) . "\n";
         }
         $transaction->save();
         $this->redirect('ndf', $note_de_frais->getAsso());
     }
 }
开发者ID:TheoJD,项目名称:portail,代码行数:29,代码来源:actions.class.php

示例13: processForm

 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     if ($form->isValid()) {
         $file = '';
         $year = $form->getValue('years');
         $semester = $form->getValue('semester');
         $year = substr($year, 0, 4);
         $form->getObject()->setYear($year . $semester);
         if ($form->getValue('file_path') !== null || $form->getValue('file_path') != '') {
             $myfile = $this->form->getObject()->getFilePath();
             if ($myfile !== null || $myfile != '') {
                 //previously there was something there
                 $this->delExam($myfile);
             }
             $file = $form->getValue('file_path');
             $dateTime = new DateTime('now');
             $filename = '' . $dateTime->format(skuleadminConst::EXAM_FILE_DATEFORMAT) . '';
             $extension = $file->getOriginalExtension();
             $path = sfConfig::get('sf_web_dir') . skuleadminConst::INDIVIDUALEXAMFOLDER . $year . '/';
             if ($file->save($path . $filename . $extension)) {
                 $exam = $form->save();
                 $this->redirect('adminexam/edit?id=' . $exam->getId());
             } else {
                 $this->redirect('adminexam/failederr?msg=save');
             }
         } else {
             $exam = $form->save();
             $this->redirect('adminexam/edit?id=' . $exam->getId());
         }
     }
 }
开发者ID:jasonkouoft,项目名称:SkuleCourses,代码行数:32,代码来源:actions.class.php

示例14: processForm

 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $i18n = sfContext::getInstance()->getI18N();
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     $s = Doctrine::getTable('Service')->find($form->getValue('service_id'));
     $form->setValidator['uri'] = new sfValidatorRegex(array('pattern' => '/^' . $s->getEntitlementPrefix() . ':.*$/'));
     if ($form->isValid()) {
         $notice = $form->getObject()->isNew() ? $i18n->__('The entitlement has been created.') : $i18n->__('The entitlement has been updated');
         try {
             $entitlement = $form->save();
         } catch (Doctrine_Validator_Exception $e) {
             $errorStack = $form->getObject()->getErrorStack();
             $message = get_class($form->getObject()) . ' has ' . count($errorStack) . " field" . (count($errorStack) > 1 ? 's' : null) . " with validation errors: ";
             foreach ($errorStack as $field => $errors) {
                 $message .= "{$field} (" . implode(", ", $errors) . "), ";
             }
             $message = trim($message, ', ');
             $this->getUser()->setFlash('error', $message);
             return sfView::SUCCESS;
         }
         $this->dispatcher->notify(new sfEvent($this, 'admin.save_object', array('object' => $entitlement)));
         if ($request->hasParameter('_save_and_add')) {
             $this->getUser()->setFlash('notice', $notice . ' You can add another one below.');
             $this->redirect('@entitlement_new');
         } else {
             $this->getUser()->setFlash('notice', $notice);
             $this->redirect("show/index?id=" . $form->getObject()->getServiceId());
         }
     } else {
         $this->getUser()->setFlash('error', 'The item has not been saved due to some errors.', false);
     }
 }
开发者ID:br00k,项目名称:yavom,代码行数:32,代码来源:actions.class.php

示例15: processForm

 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     if ($form->isValid()) {
         $contact_req = new ContactRequest();
         $contact_req->setRequestDate(date('Y-m-d'));
         $contact_req->setTitle($request->getParameter('contact_request[title]'));
         $contact_req->setFirstName($request->getParameter('contact_request[first_name]'));
         $contact_req->setLastName($request->getParameter('contact_request[last_name]'));
         $contact_req->setAddress1($request->getParameter('contact_request[address1]'));
         $contact_req->setAddress2($request->getParameter('contact_request[address2]'));
         $contact_req->setCity($request->getParameter('contact_request[city]'));
         $contact_req->setState($request->getParameter('contact_request[state]'));
         $contact_req->setZipcode($request->getParameter('contact_request[zipcode]'));
         $contact_req->setCountry($request->getParameter('contact_request[country]'));
         $contact_req->setDayPhone($request->getParameter('contact_request[day_phone]'));
         $contact_req->setEvePhone($request->getParameter('contact_request[eve_phone]'));
         $contact_req->setFaxPhone($request->getParameter('contact_request[fax_phone]'));
         $contact_req->setMobilePhone($request->getParameter('contact_request[mobile_phone]'));
         $contact_req->setEmail($request->getParameter('contact_request[email]'));
         $contact_req->setRefSourceId($request->getParameter('contact_request[ref_source_id]'));
         $contact_req->setSendAppFormat($request->getParameter('contact_request[send_app_format]'));
         $contact_req->setComment($request->getParameter('contact_request[comment]'));
         //Set Session Id
         $sessionId = session_id();
         $contact_req->setSessionId($sessionId);
         //end set session id
         $contact_req->setIpAddress($request->getRemoteAddress());
         $contact_req->save();
         $this->redirect('contact_request/thankyou');
     }
 }
开发者ID:yasirgit,项目名称:afids,代码行数:32,代码来源:actions.class.php


注:本文中的sfForm::getName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。