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


PHP Zend_Form::getValues方法代码示例

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


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

示例1: saveAction

 public function saveAction()
 {
     $this->getRequest()->isPost();
     $this->buildForm("admin/group/save");
     if ($this->gForm->isValid($_POST)) {
         $values = $this->gForm->getValues();
     }
     //Build Group Object
     $group = new Group();
     //Upload Logo
     if (copy($values['logo'], Zend_Registry::get('config')->files->logo->dir . DIRECTORY_SEPARATOR . basename($values['logo']))) {
         $values['logo'] = Zend_Registry::get('config')->files->logo->dir . "/" . basename($values['logo']);
     }
     //Convert polygon cordenates
     preg_match_all("/\\(([0-9\\.\\,\\-\\s]*)\\)[\\,]?/", $values['area_coords'], $rawcoords);
     foreach ($rawcoords[1] as $coord) {
         $cvalues = explode(",", $coord);
         $cobj = new stdClass();
         $cobj->lat = trim($cvalues[0]);
         $cobj->lng = trim($cvalues[1]);
         $coords[] = $cobj;
     }
     $values['area_coords'] = json_encode($coords);
     //Register Administrators
     $admins = explode(",", $values['admins']);
     foreach ($admins as $adm) {
         if ($adm != "") {
             $group->Admins[]->user_id = $adm;
         }
     }
     //Go through Activity Types
     $actvTypes = Doctrine_Query::create()->from('ActivityType')->orderBy("weight")->execute();
     foreach ($actvTypes as $atype) {
         $atype_key = "atype_" . $atype->atype;
         $aSource = new ActivitySource();
         $aSource->atype = $atype->atype;
         $aSource->target = $values[$atype_key];
         $group->ActivitySources[] = $aSource;
     }
     //populate group
     $group->fromArray($values);
     //Save Group
     $group->save();
     var_dump($values, $group->toArray());
     //Grab pre-saved venues and tie group_id
     $venues = Doctrine_Query::create()->from('Venue')->where("Venue.name LIKE ?", array($values['tmp_id'] . '%'))->execute();
     foreach ($venues as $venue) {
         $venue->name = str_replace($values['tmp_id'] . "_", "", $venue->name);
         $venue->group_id = $group->id;
         $venue->save();
     }
     $this->_helper->flashMessenger("Group added!");
     //$this->_helper->redirector('index');
     $this->_helper->viewRenderer->setNoRender();
     $this->_helper->layout->disableLayout();
 }
开发者ID:rdohms,项目名称:ugDirectory,代码行数:56,代码来源:GroupController.php

示例2: nodeSave

 /**
  * Hook for node save - save parent (category)
  *
  * @param Zend_Form $form
  * @param array $arguments
  */
 public function nodeSave(&$form, &$arguments)
 {
     $item = array_shift($arguments);
     $arguments = $form->getValues();
     if (isset($arguments['rewrite_path'])) {
         $router = Zend_Controller_Front::getInstance()->getRouter();
         $default_url = $router->assemble(array('id' => $item->id), $item->type);
         $factory = new Rewrite_Path_Factory();
         $path = $factory->find($item->id)->current();
         if ($arguments['rewrite_path'] == $default_url) {
             if ($path) {
                 $path->delete();
             }
         } else {
             if (!$path) {
                 $path = $factory->createRow();
                 $path->nid = $item->id;
             }
             if ($arguments['rewrite_path'] != $path->path) {
                 $path->path = $arguments['rewrite_path'];
                 $path->save();
             }
         }
     }
 }
开发者ID:BGCX261,项目名称:zoocms-svn-to-git,代码行数:31,代码来源:Node.php

示例3: detailAction

 public function detailAction()
 {
     $newsUrl = $this->getRequest()->getParam('url', null);
     try {
         $news = $this->newsRepository->fetchEntityByUrl($newsUrl);
     } catch (\Exception $e) {
         throw new \Exception($e->getMessage(), 404);
     }
     $this->view->headTitle($news->headline);
     $this->view->headMeta()->setName('description', $this->_helper->truncate($news->content, 255));
     $configForm = $this->getInvokeArg('bootstrap')->getResource('configForm');
     $commentForm = new \Zend_Form($configForm->comment);
     if ($this->getRequest()->isPost()) {
         if ($commentForm->isValid($_POST)) {
             try {
                 $values = $commentForm->getValues();
                 unset($values['csrf']);
                 unset($values['firstname']);
                 # SpamDetection
                 $values['news'] = $news;
                 $this->commentRepository->saveEntity($values);
                 $commentForm->reset();
                 #$this->_helper->systemMessages('notice', 'Kommentar erfolgreich gespeichert');
             } catch (\Exception $e) {
                 $log = $this->getInvokeArg('bootstrap')->log;
                 $log->log($e->getMessage(), \Zend_Log::ERR, array('trace' => $e->getTraceAsString()));
                 #$this->_helper->systemMessages('error', 'Kommentar konnte nicht gespeichert werden');
             }
         }
     }
     $commentForm->setAction('/news/' . $newsUrl);
     $this->view->form = $commentForm;
     $this->view->news = $news;
 }
开发者ID:kromeyer,项目名称:MMK-Newsroom,代码行数:34,代码来源:NewsController.php

示例4: getValues

 public function getValues($supress = FALSE)
 {
     $data = parent::getValues($supress);
     if (NULL === $this->_object) {
         return $data;
     }
     try {
         $this->_object->setFromArray($data);
         return $this->_object;
     } catch (App_Class_Exception_FieldValidate $e) {
         $field = $e->getField();
         //field que deu erro na validação
         $message = $e->getMessage();
         //mensagem de erro
         //se exitir o campo no form
         if (isset($this->_elements[$field])) {
             $element = $this->_elements[$field];
             /* @var $element Zend_Form_Element_Xhtml */
             $element->addError($message);
             //adiciona um erro de validação no campo com a mensagem gerada na exception
         } else {
             $this->addError($message);
         }
     } catch (Exception $e) {
         $this->addError($e->getMessage());
     }
     return FALSE;
 }
开发者ID:alissonpirola,项目名称:site-drandre,代码行数:28,代码来源:Base.php

示例5: editAction

 public function editAction()
 {
     $configForm = $this->getInvokeArg('bootstrap')->getResource('configForm');
     $userForm = new Zend_Form($configForm->user);
     $userId = $this->getRequest()->getParam('id', null);
     if ($this->getRequest()->isPost()) {
         if ($userForm->isValid($_POST)) {
             try {
                 $values = $userForm->getValues();
                 unset($values['password_repeat']);
                 $userId = $this->userRepository->saveEntity($values);
                 $this->_helper->systemMessages('notice', 'Nutzer erfolgreich gespeichert');
             } catch (\Exception $e) {
                 $log = $this->getInvokeArg('bootstrap')->log;
                 $log->log($e->getMessage(), \Zend_Log::ERR, array('trace' => $e->getTraceAsString()));
                 $this->_helper->systemMessages('error', 'Nutzer konnte nicht gespeichert werden');
             }
         }
     } else {
         try {
             $entity = $this->userRepository->fetchEntity($userId);
             $userForm->populate($entity->toArray());
         } catch (\Exception $e) {
             throw new \Exception($e->getMessage(), 404);
         }
     }
     $userForm->setAction('/admin/user/edit/' . $userId);
     $this->view->form = $userForm;
 }
开发者ID:kromeyer,项目名称:MMK-Newsroom,代码行数:29,代码来源:UserController.php

示例6: getValues

 /**
  * Override to unset automatically added security fields
  *
  * @param bool $suppressArrayNotation
  * @return array
  */
 public function getValues($suppressArrayNotation = false)
 {
     $values = parent::getValues($suppressArrayNotation);
     unset($values[self::HONEYPOT_FIELD_KEY]);
     unset($values[self::TIMESTAMP_FIELD_KEY]);
     return $values;
 }
开发者ID:grrr-amsterdam,项目名称:garp3,代码行数:13,代码来源:Form.php

示例7: saveFormData

 public function saveFormData(Zend_Form $form)
 {
     $item = $this->_model;
     $item->setOptions($form->getValues());
     if ($this->_request->getParam('contentMarkdown')) {
         $context_html = Michelf\MarkdownExtra::defaultTransform($this->_request->getParam('contentMarkdown'));
         $item->setContentHtml($context_html);
     }
     $fullPath = $this->_request->getParam('path');
     if ($this->_request->getParam('parentId') != 0) {
         $parentCategory = $this->_modelMapper->find($this->_request->getParam('parentId'), new Pipeline_Model_PipelineCategories());
         if ($parentCategory) {
             $fullPath = $parentCategory->getFullPath();
         }
     }
     $item->setFullPath($fullPath);
     $this->setMetaData($item);
     $this->getModelMapper()->save($item);
     if ($item->getId() && $item->getId() != '') {
         $id = $item->getId();
     } else {
         $id = $this->getModelMapper()->getDbTable()->getAdapter()->lastInsertId();
     }
     $item = $this->getModelMapper()->find($id, $this->getModel());
     foreach ($form->getElements() as $key => $element) {
         if ($element instanceof Zend_Form_Element_File && $element->isUploaded()) {
             $item = $this->saveUploadFile($element, $item);
         }
     }
     return $item;
 }
开发者ID:Alpha-Hydro,项目名称:alpha-hydro-antares,代码行数:31,代码来源:PipelineCategoriesController.php

示例8: getValues

 /**
  * Get calculated form values
  *
  * Note: strips off input named 'submit'
  *
  * @return array
  */
 public function getValues($suppressArrayNotation = false)
 {
     $values = parent::getValues();
     if (isset($values['submit'])) {
         unset($values['submit']);
     }
     return $values;
 }
开发者ID:blerby,项目名称:blerby,代码行数:15,代码来源:Form.php

示例9: saveComment

 private function saveComment(Zend_Form $form, GC\Entity\BlogEntry $blogEntry)
 {
     $comment = new GC\Entity\Comment($form->getValues());
     $comment->blogEntry = $blogEntry;
     $this->_em->persist($comment);
     $this->_em->flush();
     // clear form values
     $form->populate(array('name' => '', 'email' => '', 'content' => ''));
 }
开发者ID:richardlawson,项目名称:gcblog,代码行数:9,代码来源:BlogController.php

示例10: _save

 protected function _save(Zend_Form $form, array $info, $defaults = array())
 {
     if (!$form->isValid($info)) {
         return false;
     }
     $data = $form->getValues();
     if (array_key_exists('passwd', $data) && '' != $data['passwd']) {
     }
 }
开发者ID:laiello,项目名称:teacherq,代码行数:9,代码来源:User.php

示例11: nodeSave

 /**
  * Hook for node save - if type is Comments Node, save extra fields
  *
  * @param Zend_Form $form
  * @param array $arguments
  */
 public function nodeSave(&$form, &$arguments)
 {
     $item = array_shift($arguments);
     $arguments = $form->getValues();
     if ($item->type == "comments_node") {
         $item->pid = $arguments['pid'];
         $item->save();
         Zoo::getService('cache')->remove("Comments_Block_List_" . $item->pid);
     }
 }
开发者ID:BGCX261,项目名称:zoocms-svn-to-git,代码行数:16,代码来源:Node.php

示例12: save

 private function save(Zend_Form $form)
 {
     $id = (int) $form->getValue('id');
     $category = new GC\Entity\Category(array('id' => $id));
     if ($id != 0) {
         $category = $this->_em->find('GC\\Entity\\Category', $id);
     }
     $category->populate($form->getValues());
     $this->_em->getRepository('GC\\Entity\\Category')->save($category);
 }
开发者ID:richardlawson,项目名称:gcblog,代码行数:10,代码来源:IndexController.php

示例13: testPopulateProxiesToSetDefaults

 public function testPopulateProxiesToSetDefaults()
 {
     $this->testCanAddAndRetrieveMultipleElements();
     $values = array('foo' => 'foovalue', 'bar' => 'barvalue', 'baz' => 'bazvalue', 'bat' => 'batvalue');
     $this->form->populate($values);
     $test = $this->form->getValues();
     $elements = $this->form->getElements();
     foreach (array_keys($values) as $name) {
         $this->assertEquals($values[$name], $test[$name]);
     }
 }
开发者ID:rafalwrzeszcz,项目名称:zf2,代码行数:11,代码来源:FormTest.php

示例14: contactFormAction

 public function contactFormAction()
 {
     //create the form
     $form = new Zend_Form();
     //this page should post back to itself
     $form->setAction($_SERVER['REQUEST_URI']);
     $form->setMethod('post');
     $name = $form->createElement('text', 'name');
     $name->setLabel($this->view->getTranslation('Your Name') . ': ');
     $name->setRequired(TRUE);
     $name->addFilter('StripTags');
     $name->addErrorMessage($this->view->getTranslation('Your name is required!'));
     $name->setAttrib('size', 30);
     $email = $form->createElement('text', 'email');
     $email->setLabel($this->view->getTranslation('Your Email') . ': ');
     $email->setRequired(TRUE);
     $email->addValidator('EmailAddress');
     $email->addErrorMessage($this->view->getTranslation('Invalid email address!'));
     $email->setAttrib('size', 30);
     $subject = $form->createElement('text', 'subject');
     $subject->setLabel($this->view->getTranslation('Subject') . ': ');
     $subject->setRequired(TRUE);
     $subject->addFilter('StripTags');
     $subject->addErrorMessage($this->view->getTranslation('The subject is required!'));
     $subject->setAttrib('size', 40);
     $message = $form->createElement('textarea', 'message');
     $message->setLabel($this->view->getTranslation('Message') . ': ');
     $message->setRequired(TRUE);
     $message->addErrorMessage($this->view->getTranslation('The message is required!'));
     $message->setAttrib('cols', 35);
     $message->setAttrib('rows', 10);
     $captcha = new Zend_Form_Element_Captcha('captcha', array('label' => $this->view->getTranslation('Please verify you\'re a human'), 'captcha' => array('captcha' => 'Figlet', 'wordLen' => 6, 'timeout' => 300)));
     $form->addElement($name);
     $form->addElement($email);
     $form->addElement($subject);
     $form->addElement($message);
     $form->addElement($captcha);
     $form->addElement('submit', 'submitContactForm', array('label' => $this->view->getTranslation('Send Message')));
     $this->view->form = $form;
     if ($this->_request->isPost() && Digitalus_Filter_Post::has('submitContactForm')) {
         if ($form->isValid($_POST)) {
             //get form data
             $data = $form->getValues();
             //get the module data
             $module = new Digitalus_Module();
             $moduleData = $module->getData();
             //render the message
             $this->view->data = $data;
             $htmlMessage = $this->view->render('public/message.phtml');
             $mail = new Digitalus_Mail();
             $this->view->isSent = $mail->send($moduleData->email, array($data['email'], $data['name']), $data['subject'], $htmlMessage);
         }
     }
 }
开发者ID:ngukho,项目名称:ducbui-cms,代码行数:54,代码来源:PublicController.php

示例15: getValues

 /**
  * Retrieve all form element values
  *
  * @param  bool $suppressArrayNotation
  * @param array $omit list of fields to ommit (usually submit, and token)
  * @return array
  */
 public function getValues($suppressArrayNotation = false, $omit = array('submit', 'hash'))
 {
     $return = parent::getValues($suppressArrayNotation);
     if (is_array($omit)) {
         foreach ($omit as $key) {
             if (!array_key_exists($key, $return)) {
                 continue;
             }
             unset($return[$key]);
         }
     }
     return $return;
 }
开发者ID:jager,项目名称:cms,代码行数:20,代码来源:Form.php


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