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
00026 require_once FASTFRAME_ROOT . 'lib/FastFrame/Action/Form.php';
00027
00028
00029
00030
00040
00041 class FF_Action_Form_BorrowerDownload extends FF_Action_Form {
00042
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
00059
00067 function createFormElements()
00068 {
00069 $this->o_form->addElement('hidden', 'actionId');
00070 $this->o_form->addElement('submit', 'submitbutton');
00071 $this->o_form->addElement('select', 'download_fields', null,
00072 $this->o_model->getFields(), array('multiple' => true, 'size' => 5));
00073 $this->o_form->addElement('radio', 'download_limit', null, _('All Borrowers'), 'all',
00074 array('id' => 'all', 'onclick' => 'document.getElementById("limitFields").style.display = "none";'));
00075 $this->o_form->addElement('radio', 'download_limit', null, _('Limit Borrowers'), 'limited',
00076 array('id' => 'limited', 'onclick' => 'document.getElementById("limitFields").style.display = "block";'));
00077 $a_letters = array();
00078 foreach (range('A', 'Z') as $s_letter) {
00079 $a_letters[] = $s_letter;
00080 }
00081
00082 $this->o_form->addElement('select', 'barcode_field', null, $a_letters);
00083 $this->o_form->addElement('file', 'borrower_barcodes');
00084 }
00085
00086
00087
00088
00095 function getSingularText()
00096 {
00097 return _('Borrower');
00098 }
00099
00100
00101
00102
00110 function getPluralText()
00111 {
00112 return _('Borrowers');
00113 }
00114
00115
00116
00117
00124 function setSubmitActionId()
00125 {
00126 $this->formActionId = ACTION_DOWNLOAD;
00127 }
00128
00129
00130
00131
00140 function getTableData()
00141 {
00142 $a_headers = array();
00143 $a_headers[] = array(
00144 'title' => _('Which Borrowers to Download'),
00145 'data' => $this->o_renderer->elementToHtml('download_limit', 'all') . '<br />' .
00146 $this->o_renderer->elementToHtml('download_limit', 'limited') .
00147 '<div id="limitFields" style="display: none;">' .
00148 $this->o_renderer->elementToHtml('borrower_barcodes') . ' <i>' . _('Borrower Barcode File (CSV)') . '</i><br />' .
00149 $this->o_renderer->elementToHtml('barcode_field') . ' <i>' . _('Barcode Field in the File') . '</i>' .
00150 '</div>'
00151 );
00152 $a_headers[] = array(
00153 'title' => _('Which Fields to Download'),
00154 'data' => $this->o_renderer->elementToHtml('download_fields'),
00155 );
00156 return $a_headers;
00157 }
00158
00159
00160
00161
00168 function getTableHeaderText()
00169 {
00170 return _('Download Borrower Info');
00171 }
00172
00173
00174
00175
00182 function getFormConstants()
00183 {
00184 return array_merge(parent::getFormConstants(), array('download_limit' => 'all'));
00185 }
00186
00187
00188
00189
00196 function checkPerms()
00197 {
00198 if ($this->o_perms->hasPerm('can_download_borrowers')) {
00199 return true;
00200 }
00201 else {
00202 $this->o_nextAction->setNextActionId(ACTION_PROBLEM);
00203 $this->o_output->setMessage(_('You do not have permission to download borrower info'), FASTFRAME_ERROR_MESSAGE);
00204 return false;
00205 }
00206 }
00207
00208
00209 }
00210 ?>