예제 #1
0
 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();
     }
 }
 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);
     }
 }
예제 #3
0
파일: actions.class.php 프로젝트: nubee/bee
 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     if ($form->isValid()) {
         $form->save();
     }
 }
 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;
     }
 }
 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);
     }
 }
예제 #6
0
  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');      
    }
  }
예제 #7
0
 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);
     }
 }
예제 #8
0
 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $params = $request->getParameter($form->getName());
     $this->forward404Unless($this->location = Doctrine::getTable('Location')->find(array($params['location_id'])), sprintf('Location does not exist (%s).', $params['location_id']));
     $form->bind($params);
     if ($form->isValid()) {
         $detailsData = (array) json_decode($form->getValue('details'));
         $photosData = (array) json_decode($form->getValue('photos'));
         print_r($photosData);
         die;
         $form->save()->updateDetails($detailsData)->updatePhotos($photosData);
         BotNet::create()->spammed($form->getObject(), 'description', $form->getObject()->getLocation()->getDateTimeObject('created_at')->format('U'));
         if ($cache = $this->getContext()->getViewCacheManager()) {
             $cache->remove('@sf_cache_partial?module=profit&action=_last&sf_cache_key=profit', '', 'all');
         }
         $this->redirect('profit/show?id=' . $form->getObject()->getId());
     } else {
         //            foreach ($form->getFormFieldSchema() as $name => $formField) {
         //                if ($formField->getError() != "") {
         //                    echo "ActionClassName::methodName( ): Field Error for :" . $name . " : " . $formField->getError();
         //                }
         //            }
     }
     return null;
 }
예제 #9
0
 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');
     }
 }
 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);
         }
     }
 }
예제 #11
0
 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());
         }
     }
 }
예제 #12
0
 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);
     }
 }
  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);
    }
  }
예제 #14
0
 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     if ($form->isValid()) {
         $job = $form->save();
         $this->redirect($this->generateUrl('job_show', $job));
     }
 }
예제 #15
0
 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $form->bind($request->getParameter($form->getName()));
     if ($form->isValid()) {
         $product = $form->save();
         $this->redirect('@product_show?id=' . $product->getId());
     }
 }
예제 #16
0
 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     if ($form->isValid()) {
         $user = $form->save();
         $this->redirect('@my_ruckus');
     }
 }
 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     if ($form->isValid()) {
         $seller = $form->save();
         $this->redirect('show_seller', $seller);
     }
 }
예제 #18
0
 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     if ($form->isValid()) {
         $usuario = $form->save();
         $this->redirect('login/edit?cod_usuario=' . $usuario->getCodUsuario());
     }
 }
예제 #19
0
파일: actions.class.php 프로젝트: hunde/bsc
 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     if ($form->isValid()) {
         $theme_scorecard = $form->save();
         $this->redirect('themescorecard/edit?id=' . $theme_scorecard->getId());
     }
 }
예제 #20
0
 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     if ($form->isValid()) {
         $phases_status = $form->save();
         $this->redirect('phasesStatus/index');
     }
 }
예제 #21
0
 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     if ($form->isValid()) {
         $department = $form->save();
         $this->redirect('admindepartment/edit?id=' . $department->getId());
     }
 }
예제 #22
0
 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     if ($form->isValid()) {
         $scss_troop_enrollment = $form->save();
         $this->redirect('troopEnrollment/edit?id=' . $scss_troop_enrollment->getId());
     }
 }
예제 #23
0
 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     if ($form->isValid()) {
         $activities = $form->save();
         $this->redirect('activities/edit?activity_id=' . $activities->getActivityId());
     }
 }
예제 #24
0
 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     if ($form->isValid()) {
         $student_center = $form->save();
         $this->redirect('studentcenter/edit?id=' . $student_center->getId());
     }
 }
예제 #25
0
 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     if ($form->isValid()) {
         $JobeetJob = $form->save();
         $this->redirect('job/edit?id=' . $JobeetJob->getId());
     }
 }
예제 #26
0
 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     if ($form->isValid()) {
         $extra_fields = $form->save();
         $this->redirect('extraFields/index?bind_type=' . $request->getParameter('bind_type'));
     }
 }
예제 #27
0
 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     if ($form->isValid()) {
         $encuestado_sanciones = $form->save();
         $this->redirect('EncuestadoSancionesVigentes/edit?id=' . $encuestado_sanciones->getId());
     }
 }
예제 #28
0
 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $form->bind($request->getParameter($form->getName()));
     if ($form->isValid()) {
         $block = $form->save();
         $this->redirect('block/edit?id=' . $block->getId());
     }
 }
예제 #29
0
 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     if ($form->isValid()) {
         $emprunt = $form->save();
         $this->redirect('materiel', $emprunt->getMateriel()->getAsso());
     }
 }
예제 #30
0
 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     if ($form->isValid()) {
         $account_invoice = $form->save();
         $this->redirect('invoice/edit?id=' . $account_invoice->getId());
     }
 }