本文整理汇总了PHP中sfForm::getValues方法的典型用法代码示例。如果您正苦于以下问题:PHP sfForm::getValues方法的具体用法?PHP sfForm::getValues怎么用?PHP sfForm::getValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfForm
的用法示例。
在下文中一共展示了sfForm::getValues方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getLicense
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;
}
}
示例2: getEducation
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;
}
示例3: getLanguage
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;
}
}
示例4: processCommentForm
protected function processCommentForm(sfWebRequest $request, sfForm $form)
{
$form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
if ($form->isValid()) {
$comment = $form->save();
//save cookie with user info
$user_info = $form->getValues();
unset($user_info['id'], $user_info['article_id'], $user_info['message']);
$this->getUser()->setAttribute('zs_commenter_info', $user_info);
$this->redirect($this->generateUrl('zs_blog_article', $comment->getArticle()) . '#comment-' . $comment->getId());
}
}
示例5: getSkill
private function getSkill(sfForm $form)
{
$post = $form->getValues();
$skill = $this->getEmployeeService()->getEmployeeSkills($post['emp_number'], $post['code']);
if (!$skill instanceof EmployeeSkill) {
$skill = new EmployeeSkill();
}
$skill->emp_number = $post['emp_number'];
$skill->skillId = $post['code'];
$skill->years_of_exp = $post['years_of_exp'];
$skill->comments = $post['comments'];
return $skill;
}
示例6: getLanguage
private function getLanguage(sfForm $form)
{
$post = $form->getValues();
$language = $this->getEmployeeService()->getLanguage($post['emp_number'], $post['code'], $post['lang_type']);
if (!$language instanceof EmployeeLanguage) {
$language = new EmployeeLanguage();
}
$language->empNumber = $post['emp_number'];
$language->langId = $post['code'];
$language->fluency = $post['lang_type'];
$language->competency = $post['competency'];
$language->comments = $post['comments'];
return $language;
}
示例7: getLicense
private function getLicense(sfForm $form)
{
$post = $form->getValues();
$license = $this->getEmployeeService()->getLicense($post['emp_number'], $post['code']);
if (!$license instanceof EmployeeLicense) {
$license = new EmployeeLicense();
}
$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;
}
示例8: getWorkExperience
private function getWorkExperience(sfForm $form)
{
$post = $form->getValues();
$workExperience = $this->getEmployeeService()->getEmployeeWorkExperienceRecords($post['emp_number'], $post['seqno']);
if (!$workExperience instanceof EmpWorkExperience) {
$workExperience = new EmpWorkExperience();
}
$workExperience->emp_number = $post['emp_number'];
$workExperience->seqno = $post['seqno'];
$workExperience->employer = $post['employer'];
$workExperience->jobtitle = $post['jobtitle'];
$workExperience->from_date = $post['from_date'];
$workExperience->to_date = $post['to_date'];
$workExperience->comments = $post['comments'];
return $workExperience;
}
示例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.';
try {
$values = $form->getValues();
if ($form->getObject()->hasAlreadyMedailleWithParameters($values['visiteur_id'], $values['medaille_id'])) {
$message = sprintf("The medal %s is unique for this visitor %s", $values['medaille_id'], $values['visiteur_id']);
$this->getUser()->setFlash('error', $message);
return sfView::SUCCESS;
}
$visiteur_medaille = $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' => $visiteur_medaille)));
if ($request->hasParameter('_save_and_add')) {
$this->getUser()->setFlash('notice', $notice . ' You can add another one below.');
$this->redirect('@visiteur_medaille_new');
} else {
$this->getUser()->setFlash('notice', $notice);
$route = 'visiteur_medaille';
$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'] = $visiteur_medaille;
}
$this->redirect($url);
}
} else {
$this->getUser()->setFlash('error', 'The item has not been saved due to some errors.', false);
}
}
示例10: getEducation
private function getEducation(sfForm $form)
{
$post = $form->getValues();
if (!empty($post['id'])) {
$education = $this->getEmployeeService()->getEducation($post['id']);
}
if (!$education instanceof EmployeeEducation) {
$education = new EmployeeEducation();
}
$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;
}
示例11: processMembershipForm
protected function processMembershipForm(sfWebRequest $request, sfForm $form)
{
$form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
if ($form->isValid()) {
$auth_key = $this->getUser()->getApiAuthKey();
if ($form->getValue('id')) {
// Update existing item.
$values = $form->getValues();
$id = $form->getValue('id');
$membership = $form->getObject();
$membership_array = $membership->toArray();
foreach ($membership_array as $key => $value) {
if (array_key_exists($key, $values) && $values[$key] == $membership_array[$key]) {
unset($values[$key]);
}
}
if (array_key_exists('display_membership', $values)) {
$values['display_membership'] = (bool) $values['display_membership'] ? 1 : 0;
}
if (count($values)) {
$result = Api::getInstance()->setUser($auth_key)->put('subredditmembership/' . $id, $values);
$success = $this->checkHttpCode($result, 'put', 'subredditmembership/' . $id, json_encode($values));
if ($success) {
$this->getUser()->setFlash('notice', 'Membership was edited successfully.');
}
}
}
$this->redirect('subreddit/membership?id=' . $id);
}
}
示例12: processTopicForm
/**
*
* @param sfWebRequest $request
* @param sfForm $form
* @param Room $room
* @return <bool> false if preview action
*/
protected function processTopicForm(sfWebRequest $request, sfForm $form, Room $room, User $user)
{
$form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
if ($form->isValid()) {
if ($this->getRequestParameter('submitAct')) {
$values = $form->getValues();
// topic saving
$topic = new Topic();
$topic->setTitle($values['title']);
$topic->setIdRoom($room->getId());
$topic->setIdUser($user->getId());
$topic->save();
// post saving
$post = new Post();
$post->setContent($values['post']['content']);
$post->setIdTopic($topic->getId());
$post->setIdUser($user->getId());
$post->save();
$this->redirect('room_topic_show', $topic);
} else {
if ($this->getRequestParameter('prevSubmitAct')) {
return;
} else {
return false;
}
}
}
}
示例13: processForm
/**
* Process general forms
*
* @param sfWebRequest $request Request object
* @param sfForm $form Form object
*/
protected function processForm(sfWebRequest $request, sfForm $form)
{
$form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
if ($form->isValid()) {
$form_values = $form->getValues();
// Reset session variable
$this->getVoucherManager()->resetSessionVoucher();
// Add data to session
$this->getVoucherManager()->setSessionVoucherArray($form_values);
$this->getUser()->setFlash('notice', 'Voucher has been ' . ($request->getParameter('action') == 'update' ? 'updated' : 'created'));
$this->updateUserSession();
// Redirect to referer page
$referer = $this->getReferer($request);
if ($referer) {
$this->cleanReferer();
$this->redirect($referer);
}
// No referer, go to edit voucher
$this->redirect('rt_shop_voucher_edit');
}
$this->getUser()->setFlash('default_error', true, false);
}
示例14: _setLeapYearLeavePeriodDetails
private function _setLeapYearLeavePeriodDetails(sfForm $form)
{
$post = $form->getValues();
if ($post['cmbStartMonth'] == 2 && $post['cmbStartDate'] == 29) {
$nonLeapYearLeavePeriodStartDate = $post['cmbStartMonthForNonLeapYears'];
$nonLeapYearLeavePeriodStartDate .= '-';
$nonLeapYearLeavePeriodStartDate .= $post['cmbStartDateForNonLeapYears'];
ParameterService::setParameter('nonLeapYearLeavePeriodStartDate', $nonLeapYearLeavePeriodStartDate);
ParameterService::setParameter('isLeavePeriodStartOnFeb29th', 'Yes');
ParameterService::setParameter('leavePeriodStartDate', '');
} else {
$leavePeriodStartDate = $post['cmbStartMonth'];
$leavePeriodStartDate .= '-';
$leavePeriodStartDate .= $post['cmbStartDate'];
ParameterService::setParameter('leavePeriodStartDate', $leavePeriodStartDate);
ParameterService::setParameter('nonLeapYearLeavePeriodStartDate', '');
ParameterService::setParameter('isLeavePeriodStartOnFeb29th', 'No');
}
}
示例15: processForm
protected function processForm(sfWebRequest $request, sfForm $form)
{
$form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
if ($form->isValid()) {
try {
$dataArray = $form->getValues();
if ($form->getObject()->isNew()) {
$user_id = $this->getUser()->getGuardUser()->getId();
$folioData = Doctrine::getTable('Folio')->findOneBy('user_id', $user_id);
$clientData = Doctrine::getTable('Client')->findOneBy('id', $dataArray['client_id']);
$basePath = sfConfig::get('app_enviroment_basepath');
$javaWebPath = $basePath . '/java/SifactJava/dist/';
$webBasePath = $basePath . '/web/';
$cfdUserBasePath = $webBasePath . 'cfdiData/' . $user_id . '/';
// if($dataArray['status'] == 'Active'){
/*
* Se verifica que el directorio de facturas exista, si no lo crea
*/
if (!is_dir($cfdUserBasePath)) {
mkdir($cfdUserBasePath, 0777);
mkdir($cfdUserBasePath . 'out/', 0777);
}
$userData = $this->getUser()->getGuardUser()->getProfile();
$invoiceData['Emisor']['rfc'] = $userData->getRfc();
$invoiceData['Emisor']['nombre'] = $userData->getIssuingCompany();
$invoiceData['Emisor']['calle'] = $userData->getStreet();
$invoiceData['Emisor']['noExterior'] = $userData->getExtNumber();
$invoiceData['Emisor']['noInterior'] = $userData->getIntNumber();
$invoiceData['Emisor']['colonia'] = $userData->getCity();
$invoiceData['Emisor']['codigoPostal'] = $userData->getPostalCode();
$invoiceData['Emisor']['municipio'] = $userData->getMunicipality();
$invoiceData['Emisor']['estado'] = $userData->getState();
$invoiceData['Emisor']['pais'] = $userData->getCountry();
$invoiceData['Emisor']['RegimenFiscal'] = $userData->getFiscalRegime();
$invoiceData['version'] = sfConfig::get('app_sat_version');
$invoiceData['serie'] = $folioData['series'];
$invoiceData['folio'] = $folioData['start'];
$invoiceData['noAprobacion'] = $folioData['num_approval'];
$invoiceData['anoAprobacion'] = $folioData['year_approval'];
####
$invoiceData['fecha'] = $this->isoDate(date("Y-m-d h:i:s"));
$invoiceData['formaDePago'] = $dataArray['means_payment'];
//$dataArray['tipoDePago']; // VALORES: EFECTIVO. TRANSFERENCIA ELECTRONICA, TARJETA DE CREDITO, DEPOSITO BANCARIO, DINEROMAIL
$invoiceData['subTotal'] = number_format($dataArray['subtotal'], 6, '.', '');
// FORMATEADO A DOS DIGITOS
$invoiceData['tipoDeComprobante'] = 'ingreso';
// ingreso,egreso,traslado
$invoiceData['metodoDePago'] = $dataArray['method_payment'];
$invoiceData['idSistema'] = 1;
$invoiceData['idbanco'] = $dataArray['idbanco'];
$invoiceData['comentario'] = $dataArray['comment'];
$invoiceData['descuento'] = number_format($dataArray['discount'] * $dataArray['subtotal'] / 100, 6, '.', '');
$invoiceData['NumCtaPago'] = $dataArray['comment'];
$preTotal = $dataArray['subtotal'] - $invoiceData['descuento'];
$invoiceData['iva'] = number_format($preTotal * 0.16, 6, '.', '');
// FORMATEADO A DOS DIGITOS
$invoiceData['total'] = number_format($preTotal + $invoiceData['iva'], 6, '.', '');
// DATOS DEL CLIENTE
$invoiceData['Receptor']['rfc'] = $clientData['rfc'];
$invoiceData['Receptor']['nombre'] = $clientData['issuing_company'];
$invoiceData['Receptor']['calle'] = $clientData['street'];
$invoiceData['Receptor']['noExterior'] = $clientData['ext_number'];
$invoiceData['Receptor']['noInterior'] = $clientData['int_number'];
$invoiceData['Receptor']['colonia'] = $clientData['city'];
$invoiceData['Receptor']['municipio'] = $clientData['municipality'];
$invoiceData['Receptor']['estado'] = $clientData['state'];
$invoiceData['Receptor']['pais'] = $clientData['country'];
$invoiceData['Receptor']['codigoPostal'] = $clientData['postal_code'];
$invoiceData['Receptor']['telefono1'] = $clientData['phone1'];
$invoiceData['Receptor']['telefono2'] = $clientData['phone2'];
## Conceptos
for ($i = 0; $i <= $dataArray['count']; $i++) {
// CONCEPTOS
$concept = Doctrine::getTable('Concept')->find($dataArray["Concepts{$i}"]['concept_id']);
$invoiceData['Conceptos'][$i]['cantidad'] = $dataArray["Concepts{$i}"]['quantity'];
$invoiceData['Conceptos'][$i]['idconcepto'] = $dataArray["Concepts{$i}"]['concept_id'];
$invoiceData['Conceptos'][$i]['descripcion'] = $concept->getDescription();
$invoiceData['Conceptos'][$i]['unidad'] = $concept->getMeasuringUnit();
$invoiceData['Conceptos'][$i]['valorUnitario'] = number_format($dataArray["Concepts{$i}"]['price'], 6, '.', '');
$invoiceData['Conceptos'][$i]['descuento'] = $dataArray["Concepts{$i}"]['discount'];
$invoiceData['Conceptos'][$i]['importe'] = number_format($dataArray["Concepts{$i}"]['total'], 6, '.', '');
}
$invoiceM = new InvoiceManage($invoiceData);
$invoiceData['cadenaOriginal'] = $invoiceM->generateOriginalString();
// $file='dabc820821n34.cer.pem'; // Ruta al archivo de Llave publica
$userCer = $this->getUser()->getGuardUser()->getFiles()->getFileCer();
$userKey = $this->getUser()->getGuardUser()->getFiles()->getFileKey();
$userPass = $this->getUser()->getGuardUser()->getFiles()->getCerPass();
$command = 'openssl x509 -inform DER -outform PEM -in ' . $webBasePath . $userCer . ' -pubkey > ' . $webBasePath . $userCer . '.pem';
system($command);
$file = $webBasePath . $userCer . ".pem";
$datos = file($file);
$certificado = "";
$carga = false;
for ($i = 0; $i < sizeof($datos); $i++) {
if (strstr($datos[$i], "END CERTIFICATE")) {
$carga = false;
}
if ($carga) {
$certificado .= trim($datos[$i]);
//.........这里部分代码省略.........