CommentForm.php

Go to the documentation of this file.
00001 <?php
00003 // {{{ license
00004 
00005 // +----------------------------------------------------------------------+
00006 // | FastFrame Application Framework                                      |
00007 // +----------------------------------------------------------------------+
00008 // | Copyright (c) 2002-2006 The Codejanitor Group                        |
00009 // +----------------------------------------------------------------------+
00010 // | This source file is subject to the GNU Lesser Public License (LGPL), |
00011 // | that is bundled with this package in the file LICENSE, and is        |
00012 // | available at through the world-wide-web at                           |
00013 // | http://www.fsf.org/copyleft/lesser.html                              |
00014 // | If you did not receive a copy of the LGPL and are unable to          |
00015 // | obtain it through the world-wide-web, you can get it by writing the  |
00016 // | Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, |
00017 // | MA 02111-1307, USA.                                                  |
00018 // +----------------------------------------------------------------------+
00019 // | Authors: Jason Rust <jrust@codejanitor.com>                          |
00020 // | Authors: Greg Gilbert <ggilbert@codejanitor.com>                          |
00021 // +----------------------------------------------------------------------+
00022 
00023 // }}}
00024 // {{{ requires
00025 
00026 require_once FASTFRAME_ROOT . 'lib/FastFrame/Action/Form.php';
00027 
00028 // }}}
00029 // {{{ class FF_Action_Form_Comment
00030 
00041 // }}}
00042 class FF_Action_Form_Comment extends FF_Action_Form {
00043     // {{{ renderSearchBox()
00044 
00051     function renderSearchBox()
00052     {
00053         return;
00054     }
00055 
00056     // }}}
00057     // {{{ createFormElements()
00058 
00066     function createFormElements()
00067     {
00068         $this->o_form->addElement('hidden', 'actionId');
00069         $this->o_form->addElement('hidden', 'objectId');
00070         $this->o_form->addElement('submit', 'submitbutton');
00071         $this->o_form->addElement('text', 'name', null, array('maxlength' => 150, 'size' => 30));
00072         if ($this->o_registry->getConfigParam('comment/show_phone')) {
00073             $this->o_form->addElement('text', 'phone', null, array('maxlength' => 150, 'size' => 30));
00074         }
00075 
00076         if ($this->o_registry->getConfigParam('comment/show_email')) {
00077             $this->o_form->addElement('text', 'email', null, array('maxlength' => 150, 'size' => 30));
00078         }
00079 
00080         if ($this->o_registry->getConfigParam('comment/show_nominee_info')) {
00081             $this->o_form->addElement('text', 'nominee', null, array('maxlength' => 150, 'size' => 30));
00082             $this->o_form->addElement('select', 'nominee_type', null, array('Staff' => _('Staff'), 'Faculty' => _('Faculty')));
00083         }
00084 
00085         $this->o_form->addElement('textarea', 'comment', null, array('rows' => 10, 'cols' => 70));
00086         $this->o_form->addRule('comment', _('Comment cannot be blank.'), 'required', null, 'client');
00087     }
00088 
00089     // }}}
00090     // {{{ renderAdditionalLinks()
00091 
00098     function renderAdditionalLinks()
00099     {
00100         $this->o_output->o_tpl->append('page_explanation', $this->o_registry->getConfigParam('comment/page_explanation'));
00101     }
00102 
00103     // }}}
00104     // {{{ getSingularText()
00105 
00112     function getSingularText()
00113     {
00114         return $this->o_registry->getConfigParam('comment/singular_text');
00115     }
00116 
00117     // }}}
00118     // {{{ getPluralText()
00119 
00127     function getPluralText()
00128     {
00129         return $this->o_registry->getConfigParam('comment/plural_text');
00130     }
00131 
00132     // }}}
00133     // {{{ getTableData()
00134 
00143     function getTableData()
00144     {
00145         $a_headers = array();
00146         $a_headers[] = array(
00147             'title' => _('Your Name'),
00148             'data' => $this->o_renderer->elementToHtml('name'), 
00149         );
00150 
00151         if ($this->o_registry->getConfigParam('comment/show_phone')) {
00152             $a_headers[] = array(
00153                 'title' => _('Phone'),
00154                 'data' => $this->o_renderer->elementToHtml('phone'), 
00155             );
00156         }
00157         
00158         if ($this->o_registry->getConfigParam('comment/show_email')) {
00159             $a_headers[] = array(
00160                 'title' => _('Email Address'),
00161                 'data' => $this->o_renderer->elementToHtml('email'),
00162             );
00163         }
00164 
00165         if ($this->o_registry->getConfigParam('comment/show_nominee_info')) {
00166             $a_headers[] = array(
00167                 'title' => _('Nominee\'s Name'),
00168                 'data' => $this->o_renderer->elementToHtml('nominee'),
00169             );
00170             $a_headers[] = array(
00171                 'title' => _('Nominee Type'),
00172                 'data' => $this->o_renderer->elementToHtml('nominee_type'),
00173             );
00174         }
00175 
00176         $a_headers[] = array(
00177             'title' => '* ' . _('Comment'),
00178             'titleStyle' => 'style="font-weight: bold;"',
00179             'data' => $this->o_renderer->elementToHtml('comment'),
00180         );
00181         
00182         return $a_headers;
00183     }
00184 
00185     // }}}
00186     // {{{ getFormDefaults()
00187 
00195     function getFormDefaults()
00196     {
00197         $a_fields = array();
00198         $a_fields['objectId'] = $this->o_model->getId();
00199         return $a_fields;
00200     }
00201 
00202     // }}}
00203 }
00204 ?>

Generated on Fri Jun 23 11:38:15 2006 for FastFrame by  doxygen 1.4.4