DemoDeleteFromBorrower.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/Delete.php';
00027 
00028 // }}}
00029 // {{{ class FF_Action_Delete_DemoFromBorrower
00030 
00041 // }}}
00042 class FF_Action_Delete_DemoFromBorrower extends FF_Action_Delete {
00043     // {{{ run()
00044     
00051     function run()
00052     {
00053         if (!$this->checkPerms()) {
00054             return $this->o_nextAction;
00055         }
00056 
00057         $this->o_model->setId(FF_Request::getParam('objectId','pg'));
00058         $o_result =& $this->o_model->removeDemoFromBorrower(FF_Request::getParam('borrowerId', 'pg'));
00059         if ($o_result->isSuccess()) {
00060             $this->o_output->setMessage($this->getSuccessMessage(), FASTFRAME_SUCCESS_MESSAGE);
00061             $this->setSuccessActionId();
00062         }
00063         else {
00064             $o_result->addMessage($this->getProblemMessage());
00065             $this->o_output->setMessage($o_result->getMessages(), FASTFRAME_ERROR_MESSAGE);
00066             $this->setProblemActionId();
00067         }
00068         
00069         return $this->o_nextAction;
00070     }
00071 
00072     // }}}
00073     // {{{ getSingularText()
00074 
00081     function getSingularText()
00082     {
00083         return _('demo');
00084     }
00085 
00086     // }}}
00087     // {{{ setSuccessActionId()
00088 
00095     function setSuccessActionId()
00096     {
00097         $this->o_nextAction->setNextActionId(ACTION_LIST_BORROWER_DEMOS);
00098     }
00099 
00100     // }}}
00101     // {{{ checkPerms()
00102 
00109     function checkPerms()
00110     {
00111         if ($this->o_perms->hasPerm('can_delete_borrower_demo')) {
00112             return true;
00113         } 
00114         else {
00115             $this->o_nextAction->setNextActionId(ACTION_PROBLEM);
00116             $this->o_output->setMessage(_('You do not have permission to delete demos'), FASTFRAME_ERROR_MESSAGE);
00117             return false;
00118         }
00119     }
00120 
00121     // }}}
00122 }
00123 ?>

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