00001 <?php
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 require_once FASTFRAME_ROOT . 'lib/FastFrame/Action/Form.php';
00027
00028
00029
00030
00041
00042 class FF_Action_Form_Comment extends FF_Action_Form {
00043
00044
00051 function renderSearchBox()
00052 {
00053 return;
00054 }
00055
00056
00057
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
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
00105
00112 function getSingularText()
00113 {
00114 return $this->o_registry->getConfigParam('comment/singular_text');
00115 }
00116
00117
00118
00119
00127 function getPluralText()
00128 {
00129 return $this->o_registry->getConfigParam('comment/plural_text');
00130 }
00131
00132
00133
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
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 ?>