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 require_once FASTFRAME_ROOT . 'lib/FastFrame/Action/Form.php';
00026 require_once FASTFRAME_ROOT . 'lib/FastFrame/Util.php';
00027
00028
00029
00030
00041
00042 class FF_Action_Form_Priority extends FF_Action_Form {
00043
00044
00051 function renderAdditionalLinks()
00052 {
00053 $this->o_output->o_tpl->append('page_links', $this->o_output->link(
00054 FastFrame::selfURL(array('actionId' => ACTION_LIST)),
00055 sprintf(_('Return to %s List'), $this->getSingularText())));
00056 }
00057
00058
00059
00060
00068 function createFormElements()
00069 {
00070 $this->o_form->addElement('hidden', 'actionId');
00071 $this->o_form->addElement('hidden', 'objectId');
00072 $this->o_form->addElement('submit', 'submitbutton');
00073 $this->o_form->addElement('text', 'name', null, array('maxlength' => 150, 'size' => 30));
00074 $this->o_form->addElement('select', 'points', null, FF_Util::createNumericOptionList(0, 100, 5, '%d'));
00075 $this->o_form->addElement('checkbox', 'is_default');
00076 $this->o_form->addElement('text', 'alert_message', null, array('maxlength' => 255, 'size' => 50));
00077 $this->o_form->addRule('name', _('Name cannot be blank.'), 'required', null, 'client');
00078 }
00079
00080
00081
00082
00089 function getSingularText()
00090 {
00091 return _('Priority');
00092 }
00093
00094
00095
00096
00104 function getPluralText()
00105 {
00106 return _('Prioritys');
00107 }
00108
00109
00110
00111
00120 function getTableData()
00121 {
00122 $a_headers = array();
00123 $a_headers[] = array(
00124 'title' => '* ' . _('Name'),
00125 'titleStyle' => 'style="font-weight: bold;"',
00126 'data' => $this->o_renderer->elementToHtml('name'),
00127 );
00128 $tmp_help = _('The priority of a mayday is based on how many points it has.');
00129 $a_headers[] = array(
00130 'title' => sprintf(_('Points %s'), $this->o_output->getHelpLink($tmp_help)),
00131 'data' => $this->o_renderer->elementToHtml('points'),
00132 );
00133 $tmp_help = sprintf(_('If this is to be the default %s for new maydays then check this box.'), $this->getSingularText());
00134 $a_headers[] = array(
00135 'title' => sprintf(_('Default %s'), $this->o_output->getHelpLink($tmp_help)),
00136 'data' => $this->o_renderer->elementToHtml('is_default'),
00137 );
00138
00139 $tmp_help = _('This message will be displayed to the user when they select this priority for a mayday.');
00140 $a_headers[] = array(
00141 'title' => sprintf(_('Alert Message (optional) %s'), $this->o_output->getHelpLink($tmp_help)),
00142 'data' => $this->o_renderer->elementToHtml('alert_message'),
00143 );
00144 return $a_headers;
00145 }
00146
00147
00148
00149
00157 function getFormDefaults()
00158 {
00159 $a_fields = array();
00160 $a_fields['objectId'] = $this->o_model->getId();
00161 $a_fields['name'] = $this->o_model->getName();
00162 $a_fields['points'] = $this->o_model->getPoints();
00163 $a_fields['is_default'] = $this->o_model->getIsDefault();
00164 $a_fields['alert_message'] = $this->o_model->getAlertMessage();
00165 return $a_fields;
00166 }
00167
00168
00169 }
00170 ?>