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
00027
00028
00029
00040
00041 class FF_Action_BatchEdit_Assignment extends FF_Action_Form {
00042
00043
00048 var $editActionId = ACTION_BATCH_EDIT;
00049
00050
00051
00052
00059 function renderAdditionalLinks()
00060 {
00061 $this->o_output->o_tpl->append('page_links', $this->o_output->link(
00062 FastFrame::selfURL(array('actionId' => ACTION_LIST)),
00063 sprintf(_('Return to %s List'), $this->getSingularText())));
00064 }
00065
00066
00067
00068
00076 function createFormElements()
00077 {
00078 $this->o_form->addElement('hidden', 'actionId');
00079 $this->o_form->addElement('submit', 'submitbutton');
00080 foreach (array_keys(FF_Request::getParam('assignment', 'p', array())) as $s_id) {
00081 $this->o_form->addElement('hidden', "assignment[$s_id]");
00082 }
00083
00084 $this->o_form->addElement('text', 'update_open_time', null, array('maxlength' => 3, 'size' => 3));
00085 $this->o_form->addElement('text', 'update_late_time', null, array('maxlength' => 3, 'size' => 3));
00086 $this->o_form->addElement('text', 'update_close_time', null, array('maxlength' => 3, 'size' => 3));
00087 $this->o_form->addElement('select', 'new_session', null, $this->o_model->getSessionOptions(true));
00088 $this->o_form->addElement('select', 'new_course_code', null, $this->o_model->getClassOptions(true));
00089 $o_element =& $this->o_form->addElement('radio', 'requested_action', null, _('Update Selected Assignments to Above Settings'), 'edit');
00090 $o_element->setChecked(true);
00091 $this->o_form->addElement('radio', 'requested_action', null, _('Copy Selected Assignements with Above Settings'), 'copy');
00092 }
00093
00094
00095
00096
00104 function fillModelWithData()
00105 {
00106 return true;
00107 }
00108
00109
00110
00111
00118 function setSubmitActionId()
00119 {
00120 $this->formActionId = ACTION_BATCH_EDIT_SUBMIT;
00121 }
00122
00123
00124
00125
00132 function getSingularText()
00133 {
00134 return _('Assignments');
00135 }
00136
00137
00138
00139
00147 function getPluralText()
00148 {
00149 return _('Assignments');
00150 }
00151
00152
00153
00154
00163 function getTableData()
00164 {
00165 $a_headers = array();
00166 $a_headers[] = array(
00167 'title' => _('Selected Assignments:'),
00168 'data' => implode('<br />', $this->o_model->getDescriptionsById(array_keys(FF_Request::getParam('assignment', 'p', array())))),
00169 );
00170 $a_headers[] = array(
00171 'title' => _('Update Session:'),
00172 'data' => $this->o_renderer->elementToHtml('new_session'),
00173 );
00174 $a_headers[] = array(
00175 'title' => _('Update Course Codes:'),
00176 'data' => $this->o_renderer->elementToHtml('new_course_code'),
00177 );
00178 $a_headers[] = array(
00179 'title' => _('Update Open Dates:'),
00180 'data' => sprintf(_('By %s days'), $this->o_renderer->elementToHtml('update_open_time')),
00181 );
00182 $a_headers[] = array(
00183 'title' => _('Update Due Dates:'),
00184 'data' => sprintf(_('By %s days'), $this->o_renderer->elementToHtml('update_late_time')),
00185 );
00186 $a_headers[] = array(
00187 'title' => _('Update Close Dates:'),
00188 'data' => sprintf(_('By %s days'), $this->o_renderer->elementToHtml('update_close_time')),
00189 );
00190 $a_headers[] = array(
00191 'title' => _('Action to Take:'),
00192 'data' => '<div style="margin-bottom: 5px;">' .
00193 $this->o_renderer->elementToHtml('requested_action', 'edit') . '</div>' .
00194 $this->o_renderer->elementToHtml('requested_action', 'copy'),
00195 );
00196 return $a_headers;
00197 }
00198
00199
00200
00201
00208 function checkPerms()
00209 {
00210 if (!$this->o_perms->hasPerm('can_use_homework')) {
00211 $this->o_nextAction->setNextActionId(ACTION_PROBLEM);
00212 $this->o_output->setMessage(_('You cannot edit these assignments.'), FASTFRAME_ERROR_MESSAGE);
00213 return false;
00214 }
00215
00216 return true;
00217 }
00218
00219
00220 }
00221 ?>