diff options
author | benakamoorthi <benaka.moorthi@gmail.com> | 2012-09-02 15:14:40 +0400 |
---|---|---|
committer | benakamoorthi <benaka.moorthi@gmail.com> | 2012-09-02 15:14:40 +0400 |
commit | 8e7cc3c95530187f39dc9edbe45cf2a26aa435e8 (patch) | |
tree | 1874dd52df5c7974b36e64fd6a7a22b875f09692 /core/QuickForm2.php | |
parent | aeaf2ab3471d24a5a074dd523ab30a12060991e8 (diff) |
Fixes #3334, redesigned the reset password functionality.
Notes:
* Resetting password is done through AJAX and the reset token does not need to be entered in a form.
* Moved password related utility functions in UsersManager_API to UsersManager as static functions.
* Added hidden _isPasswordHashed parameter to UsersManager::updateUser.
* Make sure superuser login is set in Access instance when setSuperUser(true) is used.
* Add ability to get rendered form data as array in QuickForm2 (moved existing logic in Piwik_View into new function).
git-svn-id: http://dev.piwik.org/svn/trunk@6900 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'core/QuickForm2.php')
-rw-r--r-- | core/QuickForm2.php | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/core/QuickForm2.php b/core/QuickForm2.php index 71cf9ef4a8..7ca6446c43 100644 --- a/core/QuickForm2.php +++ b/core/QuickForm2.php @@ -108,4 +108,29 @@ abstract class Piwik_QuickForm2 extends HTML_QuickForm2 $value = $this->getValue(); return isset($value[$elementName]) ? $value[$elementName] : null; } + + /** + * Returns the rendered form as an array. + * + * @param bool $groupErrors Whether to group errors together or not. + * @return array + */ + public function getFormData( $groupErrors = true ) + { + static $registered = false; + if(!$registered) + { + HTML_QuickForm2_Renderer::register('smarty', 'HTML_QuickForm2_Renderer_Smarty'); + $registered = true; + } + + // Create the renderer object + $renderer = HTML_QuickForm2_Renderer::factory('smarty'); + $renderer->setOption('group_errors', $groupErrors); + + // build the HTML for the form + $this->render($renderer); + + return $renderer->toArray(); + } } |