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


PHP ContactForm::getValues方法代码示例

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


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

示例1: editAction

 /** Edit staff profile
  * @access public
  * @return void
  * @throws Pas_Exception_Param
  */
 public function editAction()
 {
     $form = new ContactForm();
     $form->submit->setLabel('Save');
     $form->removeElement('role');
     $form->removeElement('alumni');
     $form->removeElement('identifier');
     $form->removeElement('role');
     $form->removeElement('dbaseID');
     $this->view->form = $form;
     if ($this->_request->isPost()) {
         $formData = $this->_request->getPost();
         if ($form->isValid($formData)) {
             $address = $form->getValue('address_1') . ',' . $form->getValue('address_2') . ',' . $form->getValue('town') . ',' . $form->getValue('county') . ',' . $form->getValue('postcode') . ', UK';
             $coords = $this->_geocoder->getCoordinates($address);
             if ($coords) {
                 $lat = $coords['lat'];
                 $lon = $coords['lon'];
                 $pm = new Pas_Service_Geo_GeoPlanet($this->_helper->config()->webservice->ydnkeys->appid);
                 $place = $pm->reverseGeoCode($lat, $lon);
                 $woeid = $place['woeid'];
             } else {
                 $lat = null;
                 $lon = null;
                 $woeid = null;
             }
             $updateData = $form->getValues();
             $updateData['latitude'] = $lat;
             $updateData['longitude'] = $lon;
             $updateData['woeid'] = $woeid;
             $where = array();
             $where[] = $this->_contacts->getAdapter()->quoteInto('dbaseID = ?', $this->getIdentityForForms());
             $this->_contacts->update($updateData, $where);
             $this->getFlash()->addMessage('Contact information updated!');
             $this->redirect('/users/account/');
         } else {
             $form->populate($formData);
         }
     } else {
         $contact = $this->_contacts->fetchRow($this->_contacts->select()->where('dbaseID = ' . $this->getIdentityForForms()));
         if (is_null($contact)) {
             throw new Pas_Exception_Param('Admin has not yet set up a profile for you', 500);
         } else {
             $form->populate($contact->toArray());
         }
     }
 }
开发者ID:lesleyauk,项目名称:findsorguk,代码行数:52,代码来源:ProfileController.php

示例2: editAction

 /** Edit a contact's details
  * @access public
  * @return void
  */
 public function editAction()
 {
     $form = new ContactForm();
     $form->submit->setLabel('Save');
     $this->view->form = $form;
     if ($this->_request->isPost()) {
         $formData = $this->_request->getPost();
         if ($form->isValid($this->_request->getPost())) {
             $address = $form->getValue('address_1') . ',' . $form->getValue('address_2') . ',' . $form->getValue('town') . ',' . $form->getValue('county') . ',' . $form->getValue('postcode') . ', UK';
             $coords = $this->getGeoCoder()->getCoordinates($address);
             if ($coords) {
                 $lat = $coords['lat'];
                 $lon = $coords['lon'];
                 $place = $this->getGeoPlanet()->reverseGeoCode($lat, $lon);
                 $woeid = $place['woeid'];
             } else {
                 $lat = null;
                 $lon = null;
                 $woeid = null;
             }
             $updateData = $form->getValues();
             $updateData['latitude'] = $lat;
             $updateData['longitude'] = $lon;
             $updateData['woeid'] = $woeid;
             $where = array();
             $where[] = $this->getContacts()->getAdapter()->quoteInto('id = ?', $this->getParam('id'));
             $this->getContacts()->update($updateData, $where);
             $this->getFlash()->addMessage('Contact information updated!');
             $this->redirect($this->_redirectUrl . 'contact/id/' . $this->getParam('id'));
         } else {
             $form->populate($this->_request->getPost());
         }
     } else {
         $id = (int) $this->_request->getParam('id', 0);
         if ($id > 0) {
             $contact = $this->getContacts()->fetchRow('id=' . $id);
             $form->populate($contact->toArray());
         }
     }
 }
开发者ID:lesleyauk,项目名称:findsorguk,代码行数:44,代码来源:ContactsController.php

示例3: define

$form->Build();
$form->enforceRules();
$showForm = !($form->submitted() && $form->validate());
$intro_id = $showForm ? AMP_CONTENT_PUBLICPAGE_ID_CONTACT_US : AMP_CONTENT_PUBLICPAGE_ID_CONTACT_US_RESPONSE;
$modid = AMP_MODULE_ID_CONTACT_US;
require_once "AMP/BaseTemplate.php";
$flash =& AMP_System_Flash::instance();
print $flash->execute();
require_once "AMP/BaseModuleIntro.php";
if (!isset($MM_email_contact)) {
    $MM_email_contact = false;
}
if (!defined('AMP_SITE_EMAIL_CONTACT')) {
    define('AMP_SITE_EMAIL_CONTACT', $MM_email_contact);
}
if ($showForm) {
    print $form->output();
} elseif (AMP_SITE_EMAIL_CONTACT) {
    $data = $form->getValues();
    require_once 'AMP/System/Email.inc.php';
    $email_maker = new AMPSystem_Email();
    $email_maker->setRecipient(AMP_SITE_EMAIL_CONTACT);
    $email_maker->setMessage($data['message']);
    $email_maker->setSender($data['sender_email']);
    $email_maker->setSenderName(false);
    $email_maker->setSubject($data['subject']);
    $email_maker->execute();
} else {
    print AMP_TEXT_ERROR_TOOL_NOT_CONFIGURED;
}
require_once "AMP/BaseFooter.php";
开发者ID:radicaldesigns,项目名称:amp,代码行数:31,代码来源:contactus.php


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