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/Display.php';
00026
00027
00028
00029
00039
00040 class FF_Action_Display_Borrower extends FF_Action_Display {
00041
00042
00050 function fillModelWithData()
00051 {
00052 if ( $this->currentActionId != ACTION_BORROWER_INFO ) {
00053 $b_result = $this->o_model->fillById(FF_Request::getParam('objectId', 'gp'));
00054 }
00055 else {
00056 $b_result = $this->o_model->fillById(FF_Request::getParam('borrowerId', 's'));
00057 FF_Request::setParam('borrowerId',null,'s');
00058 }
00059 if (!$b_result) {
00060 $this->o_output->setMessage(
00061 sprintf(_('Could not find the specified %s'), $this->getSingularText()),
00062 FASTFRAME_ERROR_MESSAGE
00063 );
00064 $this->o_nextAction->setNextActionId(ACTION_LIST);
00065 return false;
00066 }
00067
00068 return true;
00069 }
00070
00071
00072
00073
00080 function renderDisplay()
00081 {
00082 require_once FASTFRAME_ROOT . '/lib/FastFrame/Output/Table.php';
00083 $o_table =& new FF_Output_Table('twoColumn');
00084 $o_table->setTableHeaderText($this->getPageName());
00085 $o_table->setTableHeaders($this->getTableData());
00086 $o_table->setAlternateRowColors(true);
00087 $o_table->render();
00088 $o_tableWidget =& $o_table->getWidgetObject();
00089 $this->o_output->o_tpl->append('content_middle', $o_tableWidget->fetch());
00090 $this->renderAdditionalLinks();
00091 }
00092
00093
00094
00103 function renderSearchBox($in_focusSearch = true)
00104 {
00105
00106 if ($this->currentActionId == ACTION_BORROWER_INFO) {
00107 return false;
00108 }
00109 else {
00110 return parent::renderSearchBox($in_focusSearch);
00111 }
00112 }
00113
00114
00115
00116
00123 function renderAdditionalLinks()
00124 {
00125 if (FF_Request::getParam('isPopup', 'g', false)) {
00126 if ($this->o_perms->hasPerm('can_edit_borrower')) {
00127 $this->o_output->o_tpl->append('page_links',
00128 $this->o_output->link(FastFrame::selfURL(array(
00129 'actionId' => ACTION_EDIT, 'objectId' => $this->o_model->getId())),
00130 _('Edit this Borrower')));
00131 }
00132
00133 $this->o_output->o_tpl->append('page_links',
00134 $this->o_output->link('#', _('Close Window'),
00135 array('onclick' => 'self.close();')));
00136 }
00137 else if ( $this->currentActionId != ACTION_BORROWER_INFO) {
00138 if (FF_Request::getParam('returnActionId', 'g', false) !== false) {
00139
00140 FF_Request::setParam('borrower_returnActionId', FF_Request::getParam('returnActionId', 'g'), 's');
00141 }
00142
00143 $this->o_output->o_tpl->append('page_links',
00144 $this->o_output->link(FastFrame::selfURL(array(
00145 'actionId' => FF_Request::getParam('borrower_returnActionId', 's'))),
00146 sprintf(_('Return to %s List'), $this->getSingularText())));
00147 }
00148 else {
00149 $this->o_output->o_tpl->append('page_links',
00150 $this->o_output->link(FastFrame::selfURL(array(
00151 'actionId' => ACTION_BORROWER_LOOKUP)),
00152 _('Show Another Borrower')));
00153
00154 }
00155 }
00156
00157
00158
00159
00166 function getTableData()
00167 {
00168 $a_headers = array();
00169 $a_headers[] = array(
00170 'title' => _('First Name:'),
00171 'data' => $this->o_model->getFirstName(),
00172 );
00173 $a_headers[] = array(
00174 'title' => _('Last Name:'),
00175 'data' => $this->o_model->getLastName(),
00176 );
00177 $o_fileCache =& FF_FileCache::singleton();
00178 $tmp_path = $o_fileCache->exists(array('subdir' => 'borrower_images', 'name' => $this->o_model->getId()), true) ?
00179 $o_fileCache->getPath(array('subdir' => 'borrower_images', 'name' => $this->o_model->getId()), true, FASTFRAME_WEBPATH) :
00180 $this->o_registry->getRootFile('general/no_image.gif', 'graphics', FASTFRAME_WEBPATH);
00181 $a_headers[] = array(
00182 'title' => _('Image:'),
00183 'data' => $this->o_output->imgTag($tmp_path, null, array('style' => 'vertical-align: top;')),
00184 'dataIsSafe' => true,
00185 );
00186 $a_headers[] = array(
00187 'title' => _('Barcode:'),
00188 'data' => $this->o_model->getBarcode(),
00189 );
00190 $a_headers[] = array(
00191 'title' => _('Email Address:'),
00192 'data' => $this->o_model->getEmail(),
00193 );
00194 $a_headers[] = array(
00195 'title' => _('Type:'),
00196 'data' => $this->o_model->getFormattedType(),
00197 );
00198 $a_headers[] = array(
00199 'title' => _('Associated Profile:'),
00200 'data' => $this->o_model->getProfileUsername(),
00201 );
00202
00203
00204 foreach ($this->o_registry->getConfigParam('borrower/attributes') as $s_key => $s_desc) {
00205 $s_perm = "can_view_borrower_attrib_$s_key";
00206 if ($this->o_perms->hasPerm($s_perm)) {
00207 $a_headers[] = array(
00208 'title' => $s_desc . ':',
00209 'data' => $this->o_model->getAttribute($s_key),
00210 );
00211 }
00212 }
00213
00214 FF_Request::setParam('objectId', $this->o_model->getId(), 's');
00215 FF_Request::setParam('objectDesc', $this->o_model->getFirstName() . ' ' . $this->o_model->getLastName(), 's');
00216 if ($this->o_perms->hasPerm('can_view_loan_history')) {
00217 FF_Request::setParam('returnObjectId', $this->o_model->getId(), 's');
00218 FF_Request::setParam('returnModuleId', 'Borrower', 's');
00219 $a_headers[] = array(
00220 'title' => _('Borrower\'s Loan History:'),
00221 'data' => $this->o_output->link(
00222 FastFrame::selfURL(array('module' => 'Loan', 'actionId' => ACTION_LIST_BORROWER_LOANS)),
00223 _('Click Here To View')),
00224 'dataIsSafe' => true,
00225 );
00226 }
00227
00228 if ($this->o_perms->hasPerm(array('can_use_demo', 'can_view_borrower_demos'))) {
00229 $a_headers[] = array(
00230 'title' => _('Borrower\'s Demos:'),
00231 'data' => $this->o_output->link(
00232 FastFrame::selfURL(array('module' => 'Demo',
00233 'actionId' => ACTION_LIST_BORROWER_DEMOS,
00234 'returnObjectId'=> $this->o_model->getId())),
00235 _('Click Here To View')),
00236 'dataIsSafe' => true,
00237 );
00238 }
00239
00240 if ($this->o_perms->hasPerm('can_use_reddot')) {
00241 require_once dirname(__FILE__) . '/../Model/Reddot.php';
00242 $o_reddotModel =& new FF_Model_Reddot();
00243 $s_reddotCount = $o_reddotModel->getReddotCountForBorrower($this->o_model->getId());
00244 $s_penalty = $o_reddotModel->getProblemReddotCountForBorrower($this->o_model->getId());
00245 $s_block = $o_reddotModel->getBlockingReddotCountForBorrower($this->o_model->getId());
00246 $s_message = sprintf(_('Borrower has <b>%s</b> red dots in the last %s days (<b>%s</b> penalty and <b>%s</b> blocking).'), $s_reddotCount,
00247 $this->o_registry->getConfigParam('reddot/active_cutoff'), $s_penalty, $s_block);
00248
00249 if ($s_penalty >= 1 &&
00250 $s_reddotCount >= $this->o_registry->getConfigParam('reddot/max_active')) {
00251 $s_message .= _(' <b>The borrower is currently in a red dot penalty period.</b>');
00252 }
00253
00254 $a_headers[] = array(
00255 'title' => _('Borrower\'s Reddots:'),
00256 'data' => '<div>' . $s_message . '</div>'. $this->o_output->link(
00257 FastFrame::selfURL(array('module' => 'Reddot', 'actionId' => ACTION_LIST,
00258 'returnObjectId'=> $this->o_model->getId())),
00259 _('Click Here To View')),
00260 'dataIsSafe' => true,
00261 );
00262 }
00263
00264
00265 require_once dirname(__FILE__) . '/../Output/Checkout.php';
00266 require_once dirname(__FILE__) . '/../Model/Comment.php';
00267 $o_chkoutOutput =& new FF_Output_Checkout();
00268 $o_commentModel =& new FF_Model_Comment();
00269 foreach ($o_commentModel->getCommentsByTransactionId($this->o_model->getId()) as $a_data) {
00270 $o_commentModel->reset();
00271 $o_commentModel->importFromArray($a_data);
00272 $a_headers[] = array(
00273 'title' => _('Comment:'),
00274 'data' => $o_chkoutOutput->getCommentTable(array('o_comment' => &$o_commentModel), false),
00275 'dataIsSafe' => true,
00276 );
00277 }
00278
00279 return $a_headers;
00280 }
00281
00282
00283
00284
00291 function getSingularText()
00292 {
00293 return _('Borrower');
00294 }
00295
00296
00297
00298
00306 function getPluralText()
00307 {
00308 return _('Borrowers');
00309 }
00310
00311
00312 }
00313 ?>