Ejemplo n.º 1
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;
 }
 /**
  * Embeds this widget into the form. Sets label and validator for this widget.
  * @param sfForm $form
  */
 public function embedWidgetIntoForm(sfForm &$form)
 {
     $widgetSchema = $form->getWidgetSchema();
     //        $validatorSchema = $form->getValidatorSchema();
     $widgetSchema[$this->attributes['id']] = $this;
     //        $widgetSchema[$this->attributes['id']]->setLabel(ucwords(str_replace("_", " ", $this->attributes['id'])));
 }
 protected function doPreSave(Doctrine_Record $record, sfForm $form)
 {
     // loop through relations
     if ($relations = $form->getOption('dynamic_relations')) {
         foreach ($relations as $field => $config) {
             $collection = $record->get($config['relation']->getAlias());
             // collect form objects for comparison
             $search = array();
             foreach ($form->getEmbeddedForm($field)->getEmbeddedForms() as $i => $embed) {
                 $search[] = $embed->getObject();
             }
             foreach ($collection as $i => $object) {
                 if (false === ($pos = array_search($object, $search, true))) {
                     // if a related object exists in the record but isn't represented
                     // in the form, the reference has been removed
                     $collection->remove($i);
                     // if the foreign column is a notnull columns, delete the object
                     $column = $config['relation']->getTable()->getColumnDefinition($config['relation']->getForeignColumnName());
                     if ($object->exists() && isset($column['notnull']) && $column['notnull']) {
                         $object->delete();
                     }
                 }
             }
         }
     }
 }
 public function configure()
 {
     $object = $this->getObject();
     $this->useFields(array('egreso', 'complicaciones', 'riesgoqx_id', 'contaminacionqx_id', 'eventoqx_id', 'clasificacionqx', 'destino_px', 'status', 'ev_adversos_anestesia'));
     //$this->widgetSchema['paciente_id'] = new sfWidgetFormInputHidden();
     $this->widgetSchema['egreso'] = new sfWidgetFormInputText();
     $this->widgetSchema['complicaciones'] = new sfWidgetFormTextarea();
     $this->widgetSchema['status'] = new sfWidgetFormInputHidden();
     $this->widgetSchema['status']->setAttribute('value', '100');
     $this->setWidget('destino_px', new sfWidgetFormChoice(array('choices' => array('Recuperación', 'Intensivos', 'Sala', 'Defunción'), 'expanded' => true)));
     $this->setWidget('clasificacionqx', new sfWidgetFormChoice(array('choices' => array(null, 'Mayor', 'Menor'), 'expanded' => false)));
     $this->widgetSchema->setLabels(AgendaPeer::getLabels());
     /* Ajustes a los validadores */
     $this->validatorSchema['egreso']->setOption('required', true);
     $this->validatorSchema['egreso']->setMessage('required', 'Falta hora');
     // Agregando las personas del transoperatorio
     $this->widgetSchema['egreso']->setAttributes(array('id' => 'datahora'));
     $transPersonal = $object->getPersonalTransoperatorio();
     $tmp = new sfForm();
     if ($transPersonal != null) {
         foreach ($transPersonal as $personal) {
             if ($personal->getPersonalNombre()) {
                 $x = new PersonalcirugiaForm($personal);
                 $x->useFields(array('finaliza', 'personal_nombre'));
                 $tmp->embedForm('personal' . $personal->getId(), $x);
             }
         }
         $this->embedForm('temporal', $tmp);
     }
     $this->validatorSchema['clasificacionqx']->setOption('required', true);
     $this->validatorSchema['clasificacionqx']->setMessage('required', 'Falta clasificación de la cirugía');
 }
Ejemplo n.º 5
0
 protected function processForm(sfWebRequest $request, sfForm $form, $new = false)
 {
     $req_param = $request->getParameter($form->getName());
     $req_param['login']['login'] = strtolower($req_param['login']['login']);
     if (!isset($req_param['login']['is_moderator'])) {
         $req_param['login']['is_moderator'] = 'off';
     }
     if (!isset($req_param['login']['locked']) || is_null($req_param['login']['locked'])) {
         $req_param['login']['locked'] = 0;
     }
     $form->bind($req_param);
     if ($form->isValid()) {
         if (!$form->getObject()->isNew() || ModeratorManagement::checkForDoubloon($req_param['login']['login'])) {
             $moderator = $form->save();
             if ($new) {
                 ModeratorManagement::createXML($moderator->getLogin()->getLogin());
                 $this->getUser()->setFlash('notice', 'The moderator has been added.');
             } else {
                 $this->getUser()->setFlash('notice', 'The moderator has been updated.');
             }
             $this->redirect('moderator/index');
         } else {
             $this->getUser()->setFlash('error', 'This login already exists, please choose another.');
         }
     } else {
         $this->getUser()->setFlash('error', 'Required field(s) are missing or some field(s) are incorrect.', false);
     }
 }
 protected function doPreSave(Doctrine_Record $record, sfForm $form)
 {
     // loop through relations
     if ($relations = $form->getOption('dynamic_relations')) {
         foreach ($relations as $field => $config) {
             $collection = $record->get($config['relation']->getAlias());
             // collect form objects for comparison
             $search = array();
             try {
                 foreach ($form->getEmbeddedForm($field)->getEmbeddedForms() as $i => $embed) {
                     $search[] = $embed->getObject();
                 }
             } catch (InvalidArgumentException $e) {
                 // previously embedded form was removed at the end of form.filter_values as there were no values for it.
                 // @see sfDoctrineDynamicFormRelations::correctValidators()
             }
             foreach ($collection as $i => $object) {
                 $pos = array_search($object, $search, true);
                 if (false === $pos && $this->filterObject($object, $config['arguments'])) {
                     // if a related object exists in the record but isn't represented
                     // in the form, the reference has been removed
                     $collection->remove($i);
                     // if the foreign column is a notnull columns, delete the object
                     $column = $config['relation']->getTable()->getColumnDefinition($config['relation']->getForeignColumnName());
                     if ($object->exists() && isset($column['notnull']) && $column['notnull']) {
                         $object->delete();
                     }
                 }
             }
         }
     }
 }
Ejemplo n.º 7
0
 protected function processForm(sfWebRequest $request, sfForm $form, $emetteur, $asso)
 {
     $parameters = $request->getParameter($form->getName());
     $form->bind($parameters, $request->getFiles($form->getName()));
     if ($form->isValid()) {
         $montant = abs($parameters['montant']);
         var_dump(Doctrine);
         $t = new Transaction();
         // Transaction côté asso
         $t_e = new Transaction();
         // Transaction côté pôle
         // Asso
         $t->Asso = $asso;
         $t_e->Asso = $emetteur;
         // Compte
         $t->compte_id = $parameters['asso_compte_id'];
         $t_e->compte_id = $parameters['emetteur_compte_id'];
         // Libellé
         $t_e->libelle = sprintf('Avance de Trésorie %s', $asso->getName());
         $t->libelle = sprintf('Avance de Trésorie %s', $emetteur->getName());
         $t_e->montant = -($t->montant = $montant);
         $t_e->commentaire = $t->commentaire = $parameters['commentaire'];
         $t->moyen_id = $t_e->moyen_id = $parameters['moyen_id'];
         $t->moyen_commentaire = $t_e->moyen_commentaire = $parameters['moyen_commentaire'];
         $t->date_transaction = $t_e->date_transaction = date('Y-m-d');
         $t->save();
         $t_e->save();
         $form->setValue('transaction_emetteur_id', $t_e);
         $form->setValue('transaction_id', $t);
         $form->setValue('asso_id', $asso->getPrimaryKey());
         $avance_treso = $form->save();
         $this->redirect('avances', $emetteur);
     }
 }
Ejemplo n.º 8
0
 /**
  * A central place to render global errors for both BaseFormPropel subclasses, and mySfForm subclasses.
  * Works in conjunction with hasGlobalErrors above.
  * @param sfForm $form
  * @return string The errors, formatted appropriately.
  */
 public static function renderGlobalErrors($form)
 {
     //$globalErrorsText = parent::renderGlobalErrors();
     $globalErrorsText = '';
     //treat any error as a global error.
     $nonGlobalErrors = $form->getErrorSchema()->getErrors();
     $nonGlobalErrorCount = count($nonGlobalErrors);
     if ($nonGlobalErrorCount > 0) {
         //$globalErrorsText .= '(1) ';//<br />The following fields are required: ';
         $count = 1;
         ////print_r($nonGlobalErrors);
         foreach ($nonGlobalErrors as $key => $nonGlobalError) {
             //$globalErrorsText .= '<br />'.$key . ': ' . $nonGlobalError->getMessage() . '<br />';
             $labelName = '';
             if (isset($form[$key])) {
                 $labelName = $form[$key]->renderLabelName();
             }
             $globalErrorsText .= $labelName . ': ' . $nonGlobalError . ' ';
             //put a comma after each if it isn't the last, otherwise a full stop.
             if ($count < $nonGlobalErrorCount) {
                 //$globalErrorsText .= sprintf(" (%s) ", $count+1);
             } else {
                 $globalErrorsText .= ".";
             }
             $count++;
         }
     }
     return $globalErrorsText;
 }
 /**
  * Embeds a form like "mergeForm" does, but will still
  * save the input data.
  */
 public function embedMergeForm($name, sfForm $form)
 {
     // This starts like sfForm::embedForm
     $name = (string) $name;
     if (true === $this->isBound() || true === $form->isBound()) {
         throw new LogicException('A bound form cannot be merged');
     }
     $this->embeddedForms[$name] = $form;
     $form = clone $form;
     unset($form[self::$CSRFFieldName]);
     // But now, copy each widget instead of the while form into the current
     // form. Each widget ist named "formname|fieldname".
     foreach ($form->getWidgetSchema()->getFields() as $field => $widget) {
         $widgetName = "{$name}|{$field}";
         if (isset($this->widgetSchema[$widgetName])) {
             throw new LogicException("The forms cannot be merged. A field name ’{$widgetName’} already exists.");
         }
         $this->widgetSchema[$widgetName] = $widget;
         // Copy widget
         $this->validatorSchema[$widgetName] = $form->validatorSchema[$field];
         // Copy schema
         $this->setDefault($widgetName, $form->getDefault($field));
         // Copy default value
         if (!$widget->getLabel()) {
             // Re-create label if not set (otherwise it would be named ’ucfirst($widgetName)’)
             $label = $form->getWidgetSchema()->getFormFormatter()->generateLabelName($field);
             $this->getWidgetSchema()->setLabel($widgetName, $label);
         }
     }
     // And this is like in sfForm::embedForm
     $this->resetFormFields();
 }
 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $isnew = $form->getObject()->isNew();
     $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 {
             $product = $form->save();
             if ($product->getDescription() == "") {
                 $product->setDescription($product->getName());
                 $product->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' => $product)));
         if ($request->hasParameter('_save_and_add')) {
             $this->getUser()->setFlash('notice', $notice . ' You can add another one below.');
             $this->redirect('@product_new');
         } else {
             $this->getUser()->setFlash('notice', $notice);
             $this->redirect(array('sf_route' => 'product_edit', 'sf_subject' => $product));
         }
     } else {
         $this->getUser()->setFlash('error', 'The item has not been saved due to some errors.', false);
     }
 }
 private function getLanguage(sfForm $form)
 {
     $post = $form->getValues();
     $language = $this->getEmployeeService()->getEmployeeLanguages($post['emp_number'], $post['code'], $post['lang_type']);
     $isAllowed = FALSE;
     if (!$language instanceof EmployeeLanguage) {
         if ($this->languagePermissions->canCreate()) {
             $language = new EmployeeLanguage();
             $isAllowed = TRUE;
         }
     } else {
         if ($this->languagePermissions->canUpdate()) {
             $isAllowed = TRUE;
         } else {
             $this->getUser()->setFlash('warning', __("You don't have update permission"));
         }
     }
     if ($isAllowed) {
         $language->empNumber = $post['emp_number'];
         $language->langId = $post['code'];
         $language->fluency = $post['lang_type'];
         $language->competency = $post['competency'];
         $language->comments = $post['comments'];
         return $language;
     } else {
         return NULL;
     }
 }
Ejemplo n.º 12
0
 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');
     }
 }
 private function getEducation(sfForm $form)
 {
     $post = $form->getValues();
     $isAllowed = FALSE;
     if (!empty($post['id'])) {
         if ($this->educationPermissions->canUpdate()) {
             $education = $this->getEmployeeService()->getEducation($post['id']);
             $isAllowed = TRUE;
         }
     }
     if (!$education instanceof EmployeeEducation) {
         if ($this->educationPermissions->canCreate()) {
             $education = new EmployeeEducation();
             $isAllowed = TRUE;
         }
     }
     if ($isAllowed) {
         $education->empNumber = $post['emp_number'];
         $education->educationId = $post['code'];
         $education->institute = $post['institute'];
         $education->major = $post['major'];
         $education->year = $post['year'];
         $education->score = $post['gpa'];
         $education->startDate = $post['start_date'];
         $education->endDate = $post['end_date'];
     }
     return $education;
 }
 private function getLicense(sfForm $form)
 {
     $post = $form->getValues();
     $license = $this->getEmployeeService()->getEmployeeLicences($post['emp_number'], $post['code']);
     $isAllowed = FALSE;
     if (!$license instanceof EmployeeLicense) {
         if ($this->licensePermissions->canCreate()) {
             $license = new EmployeeLicense();
             $isAllowed = TRUE;
         }
     } else {
         if ($this->licensePermissions->canUpdate()) {
             $isAllowed = TRUE;
         }
     }
     if ($isAllowed) {
         $license->empNumber = $post['emp_number'];
         $license->licenseId = $post['code'];
         $license->licenseNo = $post['license_no'];
         $license->licenseIssuedDate = $post['date'];
         $license->licenseExpiryDate = $post['renewal_date'];
         return $license;
     } else {
         return NULL;
     }
 }
Ejemplo n.º 15
0
 public static function setup(sfForm $form)
 {
     $formatter = new pmWidgetFormSchemaFormatterTable($form);
     $form->getWidgetSchema()->addFormFormatter("pm_table", $formatter);
     $form->getWidgetSchema()->setFormFormatterName("pm_table");
     $form->unsetFields();
     // auto configure widgets
     pmWidgetFactory::replaceWidgets($form);
     // auto configure validators
     pmValidatorFactory::replaceValidators($form);
     $form->configureWidgets();
     $form->configureValidators();
     if ($form instanceof pmFormPropel) {
         $sf_user = sfContext::getInstance()->getUser();
         if (method_exists($sf_user, "getGuardUser")) {
             $user_id = $sf_user->getGuardUser()->getId();
             if (array_key_exists("created_by", $form->getWidgetSchema()->getFields()) && $form->getObject()->isNew()) {
                 $form->getObject()->setCreatedBy($user_id);
             }
             if (array_key_exists("updated_by", $form->getWidgetSchema()->getFields())) {
                 $form->getObject()->setUpdatedBy($user_id);
             }
         }
     }
 }
Ejemplo n.º 16
0
 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());
     }
 }
Ejemplo n.º 17
0
 /**
  * Embeds this widget into the form. Sets label and validator for this widget.
  * @param sfForm $form
  */
 public function embedWidgetIntoForm(sfForm &$form)
 {
     $activeProjectFound = false;
     $userRoleManager = sfContext::getInstance()->getUserRoleManager();
     $projectList = $userRoleManager->getAccessibleEntities('Project');
     foreach ($projectList as $project) {
         if ($project->getIsDeleted() != 0) {
             $activeProjectFound = true;
             break;
         }
     }
     $requiredMess = __('Select a project');
     if (!$activeProjectFound) {
         $requiredMess = __("No Projects Defined");
     }
     $widgetSchema = $form->getWidgetSchema();
     $widgetSchema[$this->attributes['id']] = $this;
     $label = __(ucwords(str_replace("_", " ", $this->attributes['id'])));
     $validator = new sfValidatorString();
     if ($this->attributes['required'] == "true") {
         $label .= "<span class='required'> * </span>";
         $validator = new sfValidatorString(array('required' => true), array('required' => $requiredMess));
     }
     $widgetSchema[$this->attributes['id']]->setLabel($label);
     $form->setValidator($this->attributes['id'], $validator);
 }
Ejemplo n.º 18
0
 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $i18n = sfContext::getInstance()->getI18N();
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     if ($form->isValid()) {
         $notice = $form->getObject()->isNew() ? $i18n->__('The entitlement package has been created.') : $i18n->__('The entitlement package has been updated.');
         try {
             $entitlement_pack = $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_pack)));
         if ($request->hasParameter('_save_and_add')) {
             $this->getUser()->setFlash('notice', $notice . ' You can add another one below.');
             $this->redirect('@entitlement_pack_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);
     }
 }
Ejemplo n.º 19
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());
     }
 }
Ejemplo n.º 20
0
 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $form->bind($request->getParameter($form->getName()));
     if ($form->isValid()) {
         $team = $form->save();
         $this->redirect('@team');
     }
 }
 /**
  * Embeds this widget into the form.
  * @param sfForm $form
  */
 public function embedWidgetIntoForm(sfForm &$form)
 {
     $widgetSchema = $form->getWidgetSchema();
     $widgetSchema[$this->attributes['id']] = $this;
     $label = ucwords(str_replace("_", " ", $this->attributes['id']));
     $widgetSchema[$this->attributes['id']]->setLabel($label);
     $form->setValidator($this->attributes['id'], new sfValidatorPass());
 }
Ejemplo n.º 22
0
 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     if ($form->isValid()) {
         $dayperiod = $form->save();
         $this->redirect('dayperiod/index?roomId=' . $dayperiod->getRoomId());
     }
 }
Ejemplo n.º 23
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());
     }
 }
Ejemplo n.º 24
0
 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $form->bind($request->getParameter($form->getName()));
     if ($form->isValid()) {
         $form->save();
         $this->redirect('opFreepagePlugin/list');
     }
 }
Ejemplo n.º 25
0
 /**
  * Embeds this widget into the form. Sets label and validator for this widget.
  * @param sfForm $form
  */
 public function embedWidgetIntoForm(sfForm &$form)
 {
     $widgetSchema = $form->getWidgetSchema();
     $validatorSchema = $form->getValidatorSchema();
     $widgetSchema[$this->attributes['id']] = $this;
     $widgetSchema[$this->attributes['id']]->setLabel(__(ucwords(str_replace("_", " ", $this->attributes['id']))));
     $validatorSchema[$this->attributes['id']] = new ohrmValidatorDateRange(array(), array("invalid" => "Insert a correct date"));
 }
Ejemplo n.º 26
0
 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $form->bind($request->getParameter($form->getName()));
     if ($form->isValid()) {
         $milestone = $form->save();
         $this->redirect('@projects_show?id=' . $milestone['project_id']);
     }
 }
Ejemplo n.º 27
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('job_show', $job);
     }
 }
Ejemplo n.º 28
0
 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     if ($form->isValid()) {
         $tag = $form->save();
         $this->redirect('tag/edit?id=' . $tag->getId());
     }
 }
Ejemplo n.º 29
0
 public function processRegisterForm(sfWebRequest $request, sfForm $form)
 {
     $form->bind($request->getParameter($form->getName()));
     if ($form->isValid()) {
         $user = $form->save();
         $this->redirect('sf_guard_signin');
     }
 }
 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $form->bind($request->getParameter($form->getName()));
     if ($form->isValid()) {
         $jobeet_job = $form->save();
         $this->redirect('job/edit?id=' . $jobeet_job['id']);
     }
 }