PortalBlockForm.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 
00027 // }}}
00028 // {{{ class FF_Action_Form_PortalBlock
00029 
00040 // }}}
00041 class FF_Action_Form_PortalBlock extends FF_Action_Form {
00042     // {{{ renderAdditionalLinks()
00043 
00050     function renderAdditionalLinks()
00051     {
00052         $this->o_output->o_tpl->append('page_links', $this->o_output->link(
00053                     FastFrame::selfURL(array('actionId' => ACTION_LIST)),
00054                     sprintf(_('Return to %s List'), $this->getSingularText())));
00055     }
00056 
00057     // }}}
00058     // {{{ createFormElements()
00059 
00067     function createFormElements()
00068     {
00069         $this->o_form->addElement('hidden', 'actionId');
00070         $this->o_form->addElement('hidden', 'objectId');
00071         $this->o_form->addElement('submit', 'submitbutton');
00072         $this->o_form->addElement('text', 'name', null, array('maxlength' => 150, 'size' => 30));
00073         $this->o_form->addElement('checkbox', 'nl2br');
00074         $this->o_form->addElement('textarea', 'content', null, array('cols' => 100, 'rows' => 15));
00075         $this->o_form->addRule('name', _('Name cannot be blank.'), 'required', null, 'client');
00076     }
00077 
00078     // }}}
00079     // {{{ getSingularText()
00080 
00087     function getSingularText()
00088     {
00089         return _('Portal Block');
00090     }
00091 
00092     // }}}
00093     // {{{ getPluralText()
00094 
00102     function getPluralText()
00103     {
00104         return _('Portal Blocks');
00105     }
00106 
00107     // }}}
00108     // {{{ getTableData()
00109 
00118     function getTableData()
00119     {
00120         $a_headers = array();
00121         $a_headers[] = array(
00122             'title' => '* ' . _('Name'),
00123                         'titleStyle' => 'style="font-weight: bold;"',
00124             'data' => $this->o_renderer->elementToHtml('name'), 
00125         );
00126         $a_headers[] = array(
00127             'title' => _('Convert Linebreaks'),
00128             'data' => $this->o_renderer->elementToHtml('nl2br'), 
00129         );
00130         $tmp_help = nl2br(_('The following tags can be used to format the text:
00131 [b]<b>bold text</b>[/b]
00132 [i]<i>italic text</i>[/i]
00133 [u]<u>underlined text</u>[/u]
00134 [ulist]
00135 [*]unordered item 1
00136 [/ulist]
00137 [url=http://www.example.com]<u>A Link</u>[/url]
00138 [url=portal:1]<u>A Link to Portal Block 1</u>[/url]
00139 [email=bob@example.com]<u>Email Bob</u>[/email]'));
00140         $a_headers[] = array(
00141             'title' => sprintf(_('Content %s'), $this->o_output->getHelpLink($tmp_help)),
00142             'data' => $this->o_renderer->elementToHtml('content'), 
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['nl2br'] = $this->o_model->getNl2Br();
00163         $a_fields['content'] = $this->o_model->getContent();
00164         return $a_fields;
00165     }
00166 
00167     // }}}
00168     // {{{ checkPerms()
00169 
00176     function checkPerms()
00177     {
00178         if ($this->o_perms->hasPerm('can_edit_block')) {
00179             return true;
00180         }
00181         else {
00182             $this->o_nextAction->setNextActionId(ACTION_PROBLEM);
00183             $this->o_output->setMessage(_('You do not have permission to edit portal blocks.'), FASTFRAME_ERROR_MESSAGE);
00184             return false;
00185         }
00186     }
00187 
00188     // }}}
00189 }
00190 ?>

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