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/Delete.php';
00026
00027
00028
00029
00040
00041 class FF_Action_BatchDelete_Assignment extends FF_Action_Delete {
00042
00043
00050 function remove()
00051 {
00052 $o_result = new FF_Result();
00053 foreach (array_keys(FF_Request::getParam('assignment', 'p', array())) as $s_id) {
00054 if (!$this->o_model->fillById($s_id) ||
00055 $this->o_model->getOwnerId() != FF_Auth::getCredential('userId')) {
00056 continue;
00057 }
00058
00059 $tmp_result =& $this->o_model->remove();
00060 if (!$tmp_result->isSuccess()) {
00061 $o_result->setSuccess(false);
00062 $o_result->addMessage($tmp_result->getMessages());
00063 }
00064 }
00065
00066 return $o_result;
00067 }
00068
00069
00070
00071
00078 function getSingularText()
00079 {
00080 return _('assignments');
00081 }
00082
00083
00084
00085
00092 function checkPerms()
00093 {
00094 if (!$this->o_perms->hasPerm('can_use_homework')) {
00095 $this->o_nextAction->setNextActionId(ACTION_PROBLEM);
00096 $this->o_output->setMessage(_('You do not have permission to delete these assignments.'), FASTFRAME_ERROR_MESSAGE);
00097 return false;
00098 }
00099
00100 return true;
00101 }
00102
00103
00104 }
00105 ?>