PriorityForm.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 // +----------------------------------------------------------------------+
00021 
00022 // }}}
00023 // {{{ requires
00024 
00025 require_once FASTFRAME_ROOT . 'lib/FastFrame/Action/Form.php';
00026 require_once FASTFRAME_ROOT . 'lib/FastFrame/Util.php';
00027 
00028 // }}}
00029 // {{{ class FF_Action_Form_Priority
00030 
00041 // }}}
00042 class FF_Action_Form_Priority extends FF_Action_Form {
00043     // {{{ renderAdditionalLinks()
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     // {{{ createFormElements()
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     // {{{ getSingularText()
00082 
00089     function getSingularText()
00090     {
00091         return _('Priority');
00092     }
00093 
00094     // }}}
00095     // {{{ getPluralText()
00096 
00104     function getPluralText()
00105     {
00106         return _('Prioritys');
00107     }
00108 
00109     // }}}
00110     // {{{ getTableData()
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     // {{{ getFormDefaults()
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 ?>

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