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


PHP sfForm::getValue方法代码示例

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


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

示例1: 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

示例2: processForm

 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;
 }
开发者ID:limitium,项目名称:uberlov,代码行数:25,代码来源: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()) {
         $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

示例4: redirectFromCreate

 protected function redirectFromCreate(sfForm $form)
 {
     if (is_numeric($form->getValue('project_id'))) {
         $this->redirect('@projects_show?id=' . $form->getValue('project_id'));
     } else {
         if (is_numeric($form->getValue('entity_id'))) {
             $this->redirect('@contacts_show?id=' . $form->getValue('entity_id'));
         } else {
             throw new Exception('Must provide project or entity id');
         }
     }
 }
开发者ID:jackbravo,项目名称:amaranto,代码行数:12,代码来源:actions.class.php

示例5: processForm

 protected function processForm(sfWebRequest $request, sfForm $form, $accion)
 {
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     if ($form->isValid()) {
         $cliente = ClientePeer::retrieveByPk($form->getValue('cliente_id'));
         $this->forward404Unless($cliente, sprintf('Cliente no encontrado (%s).', $form->getValue('cliente_id')));
         $contacto = $form->save();
         $this->messageBox = new MessageBox("success", "El contacto ha sido {$accion} correctamente", $this->getUser());
         $this->redirect('cliente/show?id=' . $contacto->getCliente()->getId());
     } else {
         $this->messageBox = new MessageBox("error", "Verifique los datos ingresados", $this->getUser());
     }
 }
开发者ID:lapuntasoft,项目名称:facturacionafip,代码行数:13,代码来源:actions.class.php

示例6: 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 {
             if ($form->isNew() && $form->getValue("password") == "" || is_null($form->getValue("password"))) {
                 throw new Exception("invalid password");
             }
             $sf_guard_user = $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;
         } catch (Doctrine_Connection_Mysql_Exception $e) {
             $message = "An object with this label already exist";
             $this->getUser()->setFlash('error', $message);
             return sfView::SUCCESS;
         } catch (Exception $e) {
             $message = "The password is mandatory";
             $this->getUser()->setFlash('error', $message);
             return sfView::SUCCESS;
         }
         $this->dispatcher->notify(new sfEvent($this, 'admin.save_object', array('object' => $sf_guard_user)));
         if ($request->hasParameter('_save_and_add')) {
             $this->getUser()->setFlash('notice', $notice . ' You can add another one below.');
             $this->redirect('@sf_guard_user_new');
         } else {
             $this->getUser()->setFlash('notice', $notice);
             $route = 'sf_guard_user';
             $action = $form->getObject()->isNew() ? 'new' : 'edit';
             $redirection = strtolower($this->configuration->getValue($action . '.redirection'));
             if (isset($redirection) && 'list' !== $redirection) {
                 $route .= '_' . $redirection;
             }
             $url = array('sf_route' => $route);
             if (isset($redirection) && 'list' !== $redirection) {
                 $url['sf_subject'] = $sf_guard_user;
             }
             $this->redirect($url);
         }
     } else {
         $this->getUser()->setFlash('error', 'The item has not been saved due to some errors.', false);
     }
 }
开发者ID:pmoutet,项目名称:navinum,代码行数:50,代码来源:actions.class.php

示例7: 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

示例8: processForm

 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $arrayFromRequest = $request->getParameter($form->getName());
     $typologies = Doctrine_Core::getTable('Typologie')->findAll();
     $arrayResultScore = array();
     foreach ($typologies as $typologie) {
         $id = 'score_' . $typologie->getGuid();
         $arrayResultScore[$typologie->getGuid()] = $arrayFromRequest[$id];
         unset($arrayFromRequest[$id]);
     }
     $arrayFromRequest["score"] = json_encode($arrayResultScore);
     $form->bind($arrayFromRequest, $request->getFiles($form->getName()));
     if ($form->isValid()) {
         $notice = $form->getObject()->isNew() ? 'The item was created successfully.' : 'The item was updated successfully.';
         try {
             $validatedFile = $form->getValue('file');
             unset($form['file']);
             if ($validatedFile) {
                 $validatedFile->save($form->getObject()->getInteractifDataPath() . "/source.zip");
             }
             $interactif = $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;
         } catch (Doctrine_Connection_Mysql_Exception $e) {
             $message = "An object with this label already exist";
             $this->getUser()->setFlash('error', $message);
             return sfView::SUCCESS;
         }
         $this->dispatcher->notify(new sfEvent($this, 'admin.save_object', array('object' => $interactif)));
         if ($request->hasParameter('_save_and_add')) {
             $this->getUser()->setFlash('notice', $notice . ' You can add another one below.');
             $this->redirect('@interactif_new');
         } else {
             $this->getUser()->setFlash('notice', $notice);
             $route = 'interactif';
             $action = $form->getObject()->isNew() ? 'new' : 'edit';
             $redirection = strtolower($this->configuration->getValue($action . '.redirection'));
             if (isset($redirection) && 'list' !== $redirection) {
                 $route .= '_' . $redirection;
             }
             $url = array('sf_route' => $route);
             if (isset($redirection) && 'list' !== $redirection) {
                 $url['sf_subject'] = $interactif;
             }
             $this->redirect($url);
         }
     } else {
         $this->getUser()->setFlash('error', 'The item has not been saved due to some errors.', false);
     }
 }
开发者ID:pmoutet,项目名称:navinum,代码行数:57,代码来源:actions.class.php

示例9: 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.';
         // NEW: deal with tags
         if ($form->getValue('remove_tags')) {
             foreach (preg_split('/\\s*,\\s*/', $form->getValue('remove_tags')) as $tag) {
                 $form->getObject()->removeTag($tag);
             }
         }
         if ($form->getValue('new_tags')) {
             foreach (preg_split('/\\s*,\\s*/', $form->getValue('new_tags')) as $tag) {
                 // sorry, it would be better to not hard-code this string
                 if ($tag == 'Add tags with commas') {
                     continue;
                 }
                 $form->getObject()->addTag($tag);
             }
         }
         try {
             $peanut_posts = $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' => $peanut_posts)));
         if ($request->hasParameter('_save_and_add')) {
             $this->getUser()->setFlash('notice', $notice . ' You can add another one below.');
             $this->redirect('@peanut_posts_new');
         } else {
             $this->getUser()->setFlash('notice', $notice);
             $this->redirect(array('sf_route' => 'peanut_posts_edit', 'sf_subject' => $peanut_posts));
         }
     } else {
         $this->getUser()->setFlash('error', 'The item has not been saved due to some errors.', false);
     }
 }
开发者ID:pocky,项目名称:peanutPostsPlugin,代码行数:44,代码来源: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()) {
         if (!is_null($form->getValue('home_automation_controller'))) {
             $nb = $form->getValue('home_automation_controller');
             // Récupère le contrôleur domotique sélectionné (grâce à sa position dans le ConfigurationHelper)
             $hac = ConfigurationHelper::getParameter(null, 'home_automation_controller' . ($nb + 1));
             $hac .= $nb + 1;
             $controller = ConfigurationHelper::getParameter($hac, 'controller_name');
             $name = EnergyactionPeer::buildName($controller, $form->getvalue('name'));
             $energyaction = $form->save();
             $energyaction->setName($name);
             $energyaction->save();
         } else {
             $energyaction = $form->save();
         }
         $this->redirect('energyaction/index');
     }
 }
开发者ID:jfesquet,项目名称:tempos,代码行数:20,代码来源:actions.class.php

示例11: processForm

 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $form->bind($request->getParameter($form->getName()));
     if ($form->isValid()) {
         $this->getUser()->setFlash('notice', $form->getObject()->isNew() ? 'The item was created successfully.' : 'The item was updated successfully.');
         $sf_guard_user = $form->save();
         $this->redirect('@contacts_show?id=' . $form->getValue('person_id'));
     } else {
         $this->getUser()->setFlash('error', 'The item has not been saved due to some errors.');
     }
 }
开发者ID:jackbravo,项目名称:amaranto,代码行数:11,代码来源:actions.class.php

示例12: processAddNeedForm

 /**
  * Processes the "need time" form
  */
 protected function processAddNeedForm(sfWebRequest $request, sfForm $form)
 {
     $form->bind($request->getParameter($form->getName()));
     if ($form->isValid()) {
         $time = $form->save();
         $request->setAttribute('resource', $time);
         $body = $this->getController()->getPresentationFor('time', 'needEmail');
         $message = $this->getMailer()->compose(sfConfig::get('app_email_from'), $form->getValue('email'), dnConfig::getEmailSubject('need_time_creation'), $body);
         $message->setContentType('text/html');
         $this->getMailer()->send($message);
         $this->getUser()->setOwner($time);
         $this->redirect($this->generateUrl('time_show', array('sf_subject' => $time)));
     }
     $this->getUser()->setFlash('error', 'You are missing some of the required fields below.');
 }
开发者ID:bshaffer,项目名称:Donate-Nashville,代码行数:18,代码来源: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()) {
         $nb = $form->getValue('physical_access_controller');
         // Récupère le contrôle d'accès physique sélectionné (grâce à sa position dans le ConfigurationHelper)
         $pac = ConfigurationHelper::getParameter(null, 'physical_access_controller' . ($nb + 1));
         $pac .= $nb + 1;
         $controller = ConfigurationHelper::getParameter($pac, 'controller_name');
         $name = RoomprofilePeer::buildName($controller, $form->getvalue('name'));
         $roomprofile = $form->save();
         $roomprofile->setName($name);
         $roomprofile->save();
         $this->redirect('roomprofile/index?roomId=' . $roomprofile->getRoomId());
     }
     $this->setTemplate('edit');
 }
开发者ID:jfesquet,项目名称:tempos,代码行数:17,代码来源:actions.class.php

示例14: processForm

	protected function processForm(sfWebRequest $request, sfForm $form)
	{
		//$form->bind($request->getParameter($form->getName()));
		$form->bind($request->getParameter($form->getName('ficheros')), $request->getFiles('ficheros'));
		 
		if ($form->isValid())
		{
			//Este metodo es para formularios doctrine
			//$form->saveFile ($field, $filename = null, $file = null);

			//Recoge archivo
			$file = $form->getValue('file');
			//Ruta de subida
			$directorio=sfConfig::get('sf_upload_dir').'/ficheros';

			//Si el directorio no existe le creo
			if (!is_dir($directorio))
			{
				mkdir ($directorio,0777);
			}

			$this-> existe_fichero = false;

			if (is_file($directorio.'/'.$file->getOriginalName()))
			{
				$this->logMessage("EXISTE UN FICHERO CON EL MISMO NOMBRE: " . $file->getOriginalName() ,"debug" );
				$this-> existe_fichero = true;
				$this->getUser()->setFlash('error', 'YA EXISTE UN FICHERO CON EL MISMO NOMBRE');
			}
			else{//si no existe el fichero lo guardamos
				//Guardo (subo) el fichero
				$file->save($directorio.'/'.$file->getOriginalName());
				//Actualizo el objeto del formulario
				$form->updateObject();
				//Añado los campos "propios"
				$form->getObject()->setFile($file->getOriginalName());
				//guardo el objeto
				$form->getObject()->save();
			}
			$this->redirect('ficheros/new');
		}
	}
开发者ID:nhpatt,项目名称:gestor-de-estados,代码行数:42,代码来源: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()) {
         $notice = $form->getObject()->isNew() ? 'The item was created successfully.' : 'The item was updated successfully.';
         try {
             $rfid_groupe_visiteur = $form->save();
             $rfid_groupe_visiteur->createAnonymousVisitor($form->getValue('contexte_creation_id'));
         } 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' => $rfid_groupe_visiteur)));
         if ($request->hasParameter('_save_and_add')) {
             $this->getUser()->setFlash('notice', $notice . ' You can add another one below.');
             $this->redirect('@rfid_groupe_visiteur_new');
         } else {
             $this->getUser()->setFlash('notice', $notice);
             $route = 'rfid_groupe_visiteur';
             $action = $form->getObject()->isNew() ? 'new' : 'edit';
             $redirection = strtolower($this->configuration->getValue($action . '.redirection'));
             if (isset($redirection) && 'list' !== $redirection) {
                 $route .= '_' . $redirection;
             }
             $url = array('sf_route' => $route);
             if (isset($redirection) && 'list' !== $redirection) {
                 $url['sf_subject'] = $rfid_groupe_visiteur;
             }
             $this->redirect($url);
         }
     } else {
         $this->getUser()->setFlash('error', 'The item has not been saved due to some errors.', false);
     }
 }
开发者ID:pmoutet,项目名称:navinum,代码行数:40,代码来源:actions.class.php


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