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/List.php';
00027 require_once dirname(__FILE__) . '/../Model/Category.php';
00028
00029
00030
00031
00043
00044 class FF_Action_List_Item extends FF_Action_List {
00045
00046
00051 var $allItemsId = 'all';
00052
00057 var $o_loanModel;
00058
00059
00060
00061
00070 function FF_Action_List_Item(&$in_model)
00071 {
00072 FF_Action_List::FF_Action_List($in_model);
00073
00074
00075 FF_Request::setParam('actionId', $this->currentActionId, 'gp');
00076
00077 if (FF_Request::getParam('chkoutCategoryId', 's', false) === false) {
00078 FF_Request::setParam('chkoutCategoryId', $this->allItemsId, 's');
00079 }
00080
00081
00082 if (FF_Request::getParam('categoryId', 'g', false) !== false) {
00083 FF_Request::setParam('chkoutCategoryId', FF_Request::getParam('categoryId', 'g'), 's');
00084 }
00085
00086 if ($this->currentActionId == ACTION_LIST_MISSING) {
00087 require_once dirname(__FILE__) . '/../Output/Checkout.php';
00088 $this->o_chkoutOutput =& new FF_Output_Checkout();
00089 }
00090
00091 if ($this->currentActionId == ACTION_LOAN_ITEM_SELECT ||
00092 $this->currentActionId == ACTION_LOAN_GROUP_SELECT ||
00093 $this->currentActionId == ACTION_SHOP) {
00094 require_once dirname(__FILE__) . '/../Model/Loan.php';
00095 $this->o_loanModel =& new FF_Model_Loan();
00096 }
00097 }
00098
00099
00100
00101
00105 function run()
00106 {
00107 if ($this->currentActionId == ACTION_SHOP) {
00108 $o_result =& $this->o_loanModel->setupStoreVars();
00109 if (!$o_result->isSuccess()) {
00110 $this->o_nextAction->setNextActionId(ACTION_PROBLEM);
00111 $this->o_output->setMessage($o_result->getMessages(), FASTFRAME_ERROR_MESSAGE);
00112 return $this->o_nextAction;
00113 }
00114 }
00115 else {
00116
00117 FF_Request::setParam('chkoutStoreId', null, 's');
00118 }
00119
00120 return parent::run();
00121 }
00122
00123
00124
00125
00132 function initList()
00133 {
00134 parent::initList();
00135 $a_stores = $this->o_registry->getConfigParam('shopping/stores', array());
00136 if ($this->currentActionId != ACTION_SHOP && count($a_stores) > 1) {
00137 $this->o_list->addSearchSelect(_('Store'), 'chkoutStoreId', $a_stores);
00138 }
00139 }
00140
00141
00142
00143
00150 function renderAdditionalLinks()
00151 {
00152 if ($this->currentActionId == ACTION_LIST_VENDOR_ITEMS) {
00153 $this->o_output->o_tpl->append('page_links', $this->o_output->link(FastFrame::selfURL(array(
00154 'actionId' => ACTION_DISPLAY, 'module' => 'Vendor',
00155 'objectId' => FF_Request::getParam('returnVendorId', 's'))),
00156 _('Return')));
00157 }
00158 elseif ($this->currentActionId == ACTION_LIST_RULE_ITEMS) {
00159 $this->o_output->o_tpl->append('page_links', $this->o_output->link(FastFrame::selfURL(array(
00160 'actionId' => ACTION_EDIT, 'module' => 'Rule',
00161 'objectId' => FF_Request::getParam('returnRuleId', 's'))),
00162 _('Return to Rule')));
00163 }
00164
00165 if (($this->currentActionId == ACTION_LIST ||
00166 $this->currentActionId == ACTION_LIST_VENDOR_ITEMS) &&
00167 $this->o_perms->hasPerm('can_add_item')) {
00168 $s_link = $this->o_output->link(
00169 FastFrame::selfURL(array('actionId' => ACTION_ADD)),
00170 sprintf(_('Add New %s'), $this->getSingularText()));
00171 }
00172 elseif ($this->currentActionId == ACTION_GROUP_LIST &&
00173 $this->o_perms->hasPerm('can_add_group')) {
00174 $s_link = $this->o_output->link(
00175 FastFrame::selfURL(array('actionId' => ACTION_ADD, 'module' => 'Group')),
00176 sprintf(_('Add New %s'), $this->getSingularText()));
00177 }
00178 elseif ($this->currentActionId == ACTION_SHOP) {
00179 $s_link = $this->o_output->link(
00180 FastFrame::selfURL(array(
00181 'actionId' => ACTION_SHOP_SUMMARY, 'module' => 'Loan',
00182 'storeId' => FF_Request::getParam('chkoutStoreId', 's'))),
00183 $this->o_output->imgTag('my_checkout.gif', 'general',
00184 array('app' => 'checkout', 'height' => 18, 'width' => 84)),
00185 array('class' => 'img', 'title' => _('My Checkout')));
00186 $s_link .= ' ';
00187 $s_link .= $this->o_output->link(
00188 FastFrame::selfURL(array(
00189 'actionId' => ACTION_SHOP_RESERVE, 'module' => 'Loan',
00190 'storeId' => FF_Request::getParam('chkoutStoreId', 's'))),
00191 $this->o_output->imgTag('create_reservation.gif', 'general',
00192 array('app' => 'checkout', 'height' => 18, 'width' => 135)),
00193 array('class' => 'img', 'title' => _('Create Reservation')));
00194 }
00195 else {
00196 $s_link = '';
00197 }
00198
00199 if (!empty($s_link)) {
00200 $this->o_output->o_tpl->append('page_links', $s_link);
00201 }
00202 }
00203
00204
00205
00206
00215 function getHighlightedRowUrl()
00216 {
00217 if ($this->currentActionId == ACTION_LIST_MISSING) {
00218 return null;
00219 }
00220 elseif ($this->currentActionId == ACTION_SHOP) {
00221 return $this->_getShopSelectUrl();
00222 }
00223 elseif ($this->currentActionId == ACTION_SELECT ||
00224 $this->currentActionId == ACTION_GROUP_SELECT ||
00225 $this->currentActionId == ACTION_ITEM_GROUP_SELECT ||
00226 $this->currentActionId == ACTION_LOAN_ITEM_SELECT ||
00227 $this->currentActionId == ACTION_LOAN_GROUP_SELECT) {
00228 return $this->_getSelectUrl();
00229 }
00230 else {
00231 $s_module = $this->o_model->getIsGroup() ? 'Group' : 'Item';
00232 $s_type = strtolower($s_module);
00233 if ($this->o_perms->hasPerm('can_edit_' . $s_type)) {
00234 return FastFrame::selfURL(array(
00235 'actionId' => ACTION_EDIT, 'module' => $s_module,
00236 'objectId' => $this->o_model->getId(),
00237 'returnActionId' => $this->currentActionId));
00238 }
00239 else {
00240 return FastFrame::selfURL(array(
00241 'actionId' => ACTION_DISPLAY, 'module' => $s_module,
00242 'objectId' => $this->o_model->getId(),
00243 'returnActionId' => $this->currentActionId));
00244 }
00245 }
00246 }
00247
00248
00249
00250
00257 function getDefaultDisplayLimit()
00258 {
00259 return 10;
00260 }
00261
00262
00263
00264
00272 function getFilter()
00273 {
00274 $s_catId = FF_Request::getParam('chkoutCategoryId', 's');
00275 $a_filterData = array('shopperViewable' => false);
00276 $a_filterData['storeId'] = FF_Request::getParam('chkoutStoreId', 's');
00277 if ($this->currentActionId == ACTION_LIST_MISSING) {
00278 return array(ITEMS_FILTER_MISSING, $a_filterData);
00279 }
00280 elseif ($this->currentActionId == ACTION_LIST_VENDOR_ITEMS) {
00281 $a_filterData['vendor_id'] = FF_Request::getParam('returnVendorId', 's');
00282 return array(ITEMS_FILTER_VENDOR, $a_filterData);
00283 }
00284 elseif ($this->currentActionId == ACTION_LIST_RULE_ITEMS) {
00285 $a_filterData['rule_id'] = FF_Request::getParam('returnRuleId', 's');
00286 return array(ITEMS_FILTER_RULE, $a_filterData);
00287 }
00288
00289 elseif ($this->currentActionId == ACTION_SHOP) {
00290
00291
00292 if ($s_catId == $this->allItemsId &&
00293 is_null($this->o_list->getSearchString())) {
00294 return array(ITEMS_FILTER_NO_RESULTS, array());
00295 }
00296
00297
00298 $a_filterData['shopperViewable'] = true;
00299
00300 $a_filterData['includeAllStore'] = true;
00301 $b_hasGroups = $this->o_perms->hasPerm('can_borrower_shop_groups');
00302 $b_hasItems = $this->o_perms->hasPerm('can_borrower_shop_items');
00303 }
00304 elseif ($this->currentActionId == ACTION_GROUP_LIST ||
00305 $this->currentActionId == ACTION_GROUP_SELECT ||
00306 $this->currentActionId == ACTION_LOAN_GROUP_SELECT) {
00307 $b_hasGroups = true;
00308 $b_hasItems = false;
00309 }
00310 elseif ($this->currentActionId == ACTION_ITEM_GROUP_SELECT) {
00311 $b_hasGroups = true;
00312 $b_hasItems = true;
00313 }
00314 else {
00315 $b_hasGroups = false;
00316 $b_hasItems = true;
00317 }
00318
00319 if ($s_catId == $this->allItemsId) {
00320 $s_filter = ($b_hasGroups && $b_hasItems) ? ITEMS_GROUPS_FILTER_ALL :
00321 ($b_hasItems ? ITEMS_FILTER_ALL : GROUPS_FILTER_ALL);
00322 }
00323 elseif ($s_catId == CATEGORIES_UNFILED_ID) {
00324 $s_filter = ($b_hasGroups && $b_hasItems) ? ITEMS_GROUPS_FILTER_UNFILED :
00325 ($b_hasItems ? ITEMS_FILTER_UNFILED : GROUPS_FILTER_UNFILED);
00326 }
00327 else {
00328 $s_filter = ($b_hasGroups && $b_hasItems) ? ITEMS_GROUPS_FILTER_CATEGORY :
00329 ($b_hasItems ? ITEMS_FILTER_CATEGORY : GROUPS_FILTER_CATEGORY);
00330 $a_filterData['catId'] = FF_Request::getParam('chkoutCategoryId', 's');
00331 }
00332
00333 return array($s_filter, $a_filterData);
00334 }
00335
00336
00337
00338
00345 function getDefaultSortField()
00346 {
00347 return 'name';
00348 }
00349
00350
00351
00352
00359 function getFieldMap()
00360 {
00361 $a_map = array(
00362 array('description' => _('Options'), 'method' => 'getOptions'),
00363 array('field' => 'name', 'description' => _('Name'), 'method' => 'getName'),
00364 array('field' => 'description', 'description' => _('Description'),
00365 'method' => 'getFormattedDescription', 'dataIsSafe' => true),
00366 );
00367
00368 if ($this->currentActionId == ACTION_SHOP) {
00369 $a_map[] = array('description' => _('Image'), 'object' => &$this, 'method' => '_getImageTag', 'dataIsSafe' => true);
00370 }
00371 elseif ($this->currentActionId != ACTION_GROUP_LIST &&
00372 $this->currentActionId != ACTION_GROUP_SELECT &&
00373 $this->currentActionId != ACTION_LOAN_GROUP_SELECT &&
00374 $this->currentActionId != ACTION_LOAN_ITEM_SELECT) {
00375 $a_map[] = array('field' => 'status', 'description' => _('Status'), 'method' => 'getFormattedStatus');
00376 $a_map[] = array('field' => 'barcode', 'description' => _('Bar Code'), 'method' => 'getBarCode');
00377 $a_map[] = array('field' => 'serial_num', 'description' => _('Serial Number'), 'method' => 'getSerialNum');
00378 }
00379
00380 if ($this->currentActionId == ACTION_GROUP_SELECT) {
00381 $a_map[] = array('description' => _('Is a Group'), 'method' => 'getFormattedIsGroup');
00382 }
00383
00384 if ($this->currentActionId == ACTION_LOAN_ITEM_SELECT ||
00385 $this->currentActionId == ACTION_LOAN_GROUP_SELECT ||
00386 $this->currentActionId == ACTION_SHOP) {
00387 $tmp_help = sprintf(_('The availabilty of the %1$s is shown in this column. A colored box means the %1$s is available while a grayed out box means it is unavailable. The different colors indicate the following: <div>%2$s</div>'),
00388 $this->getSingularText(), $this->_getAvailability(true));
00389 $a_map[] = array('description' => sprintf(_('Availability %s'), $this->o_output->getHelpLink($tmp_help)),
00390 'object' => &$this, 'method' => '_getAvailability', 'dataIsSafe' => true);
00391 }
00392
00393 if ($this->currentActionId == ACTION_LIST_MISSING) {
00394 $a_map[] = array('description' => _('Most Recent Borrower'), 'object' => &$this,
00395 'method' => '_getMostRecentBorrower', 'dataIsSafe' => true);
00396 }
00397
00398 return $a_map;
00399 }
00400
00401
00402
00403
00410 function getSingularText()
00411 {
00412 if ($this->currentActionId == ACTION_GROUP_SELECT ||
00413 $this->currentActionId == ACTION_LOAN_GROUP_SELECT ||
00414 $this->currentActionId == ACTION_GROUP_LIST) {
00415 return _('Group');
00416 }
00417 else {
00418 return $this->o_model->getIsGroup() ? _('Group') : _('Item');
00419 }
00420 }
00421
00422
00423
00424
00431 function getPluralText()
00432 {
00433 if ($this->currentActionId == ACTION_GROUP_SELECT ||
00434 $this->currentActionId == ACTION_GROUP_LIST ||
00435 $this->currentActionId == ACTION_LOAN_GROUP_SELECT) {
00436 return _('Groups');
00437 }
00438 else {
00439 return $this->o_model->getIsGroup() ? _('Groups') : _('Items');
00440 }
00441 }
00442
00443
00444
00445
00453 function getOptions()
00454 {
00455 $tmp_text = '';
00456 if ($this->currentActionId == ACTION_SHOP) {
00457 $tmp_text .= $this->o_output->link(
00458 $this->_getShopSelectUrl(),
00459 $this->o_output->imgTag('add_to_cart.gif', 'actions'),
00460 array('title' => sprintf(_('Add %s to Cart'), $this->getSingularText())));
00461 }
00462 elseif ($this->currentActionId == ACTION_LOAN_GROUP_SELECT ||
00463 $this->currentActionId == ACTION_LOAN_ITEM_SELECT) {
00464 $tmp_text .= $this->o_output->link(
00465 $this->_getSelectUrl(),
00466 $this->o_output->imgTag('add_to_cart.gif', 'actions'),
00467 array('title' => sprintf(_('Add %s to Cart'), $this->getSingularText())));
00468 }
00469 elseif ($this->currentActionId == ACTION_SELECT ||
00470 $this->currentActionId == ACTION_GROUP_SELECT ||
00471 $this->currentActionId == ACTION_ITEM_GROUP_SELECT) {
00472 $tmp_text .= $this->o_output->link(
00473 $this->_getSelectUrl(),
00474 $this->o_output->imgTag('select.gif', 'actions'),
00475 array('title' => sprintf(_('Select %s'), $this->getSingularText())));
00476 }
00477 else {
00478 $s_module = $this->o_model->getIsGroup() ? 'Group' : 'Item';
00479 $s_type = strtolower($s_module);
00480 if ($this->o_perms->hasPerm('can_edit_' . $s_type)) {
00481 if ($this->currentActionId == ACTION_LIST_MISSING) {
00482 $tmp_text .= $this->o_output->popupLink('itemWin',
00483 $this->o_output->imgTag('edit.gif', 'actions'),
00484 array('actionId' => ACTION_EDIT, 'module' => $s_module,
00485 'objectId' => $this->o_model->getId(), 'isPopup' => 1,
00486 'returnActionId' => $this->currentActionId),
00487 array('title' => sprintf(_('Edit %s'), $this->getSingularText())));
00488 }
00489 else {
00490 $tmp_text .= $this->o_output->link(
00491 FastFrame::selfURL(array(
00492 'actionId' => ACTION_EDIT, 'module' => $s_module,
00493 'objectId' => $this->o_model->getId(),
00494 'returnActionId' => $this->currentActionId)),
00495 $this->o_output->imgTag('edit.gif', 'actions'),
00496 array('title' => sprintf(_('Edit %s'), $this->getSingularText())));
00497 }
00498 }
00499
00500 if ($this->o_perms->hasPerm('can_delete_' . $s_type)) {
00501 $tmp_text .= ' ';
00502 $tmp_text .= $this->o_output->link(
00503 FastFrame::selfURL(array(
00504 'actionId' => ACTION_DELETE, 'returnActionId' => $this->currentActionId,
00505 'module' => $s_module, 'objectId' => $this->o_model->getId(),
00506 'returnActionId' => $this->currentActionId)),
00507 $this->o_output->imgTag('delete.gif', 'actions'),
00508 array('title' => sprintf(_('Delete %s'), $this->getSingularText()),
00509 'confirm' => sprintf(_('Are you sure you want to delete this %s?'), $this->getSingularText())));
00510 }
00511
00512 $tmp_text .= ' ';
00513 $tmp_text .= $this->o_output->link(
00514 FastFrame::selfURL(array(
00515 'actionId' => ACTION_DISPLAY, 'module' => $s_module,
00516 'objectId' => $this->o_model->getId(),
00517 'returnActionId' => $this->currentActionId)),
00518 $this->o_output->imgTag('view.gif', 'actions'),
00519 array('title' => sprintf(_('Display %s'), $this->getSingularText())));
00520 }
00521
00522 return $tmp_text;
00523 }
00524
00525
00526
00527
00534 function getTableHeaderText()
00535 {
00536 $s_catId = FF_Request::getParam('chkoutCategoryId', 's');
00537 if ($this->currentActionId == ACTION_LIST_MISSING) {
00538 $s_text = sprintf(_('List of Missing %1$s'), $this->getPluralText());
00539 }
00540 elseif ($this->currentActionId == ACTION_LIST_VENDOR_ITEMS) {
00541 $s_text = sprintf(_('List of Items for "%s" Vendor'), FF_Request::getParam('objectDesc', 's'));
00542 }
00543 elseif ($this->currentActionId == ACTION_LIST_RULE_ITEMS) {
00544 $s_text = sprintf(_('List of Items & Groups for "%s" Rule'), FF_Request::getParam('objectDesc', 's'));
00545 }
00546 elseif ($s_catId == $this->allItemsId) {
00547 $s_text = sprintf(_('List of %1$s in all Categories'), $this->getPluralText());
00548 }
00549 else {
00550 $s_link = $this->o_output->link(FastFrame::selfURL(array('categoryId' => $this->allItemsId)),
00551 sprintf(_('View %s in All Categories'), $this->getPluralText()));
00552 if ($s_catId == CATEGORIES_UNFILED_ID) {
00553 $s_text = sprintf(_('List of %1$s that are Unfiled (%2$s)'), $this->getPluralText(), $s_link);
00554 }
00555 else {
00556 $o_categoryModel =& new FF_Model_Category();
00557 $s_text = sprintf(_('List of %1$s in the \'%2$s\' Category (%3$s)'), $this->getPluralText(),
00558 $o_categoryModel->getNameById($s_catId), $s_link);
00559 }
00560 }
00561
00562 if ($this->currentActionId == ACTION_SHOP &&
00563 !FastFrame::isEmpty(FF_Request::getParam('chkoutStoreDesc', 's'))) {
00564 $s_text .= ' (' . FF_Request::getParam('chkoutStoreDesc', 's') . ')';
00565 }
00566
00567 return $s_text;
00568 }
00569
00570
00571
00572
00579 function getNoResultText()
00580 {
00581 if ($this->currentActionId == ACTION_SHOP &&
00582 FF_Request::getParam('chkoutCategoryId', 's') == $this->allItemsId &&
00583 is_null($this->o_list->getSearchString())) {
00584 return _('Enter search terms or select a category on the right to begin browsing.');
00585 }
00586 else {
00587 return parent::getNoResultText();
00588 }
00589 }
00590
00591
00592
00593
00600 function setNextAction()
00601 {
00602 if ($this->currentActionId != ACTION_LIST_MISSING &&
00603 $this->currentActionId != ACTION_LIST_VENDOR_ITEMS &&
00604 $this->currentActionId != ACTION_LIST_RULE_ITEMS) {
00605 $this->o_nextAction->setNextActionId(ACTION_BROWSE);
00606 $this->o_nextAction->setNextModuleId('Category');
00607 }
00608 else {
00609 parent::setNextAction();
00610 }
00611 }
00612
00613
00614
00615
00622 function checkPerms()
00623 {
00624 if ($this->currentActionId == ACTION_SHOP) {
00625 if (!$this->o_perms->hasPerm(array('can_borrower_shop_items', 'can_borrower_shop_groups', '||'))) {
00626 $this->o_nextAction->setNextActionId(ACTION_PROBLEM);
00627 $this->o_output->setMessage(_('You do not have permission to use the shopping module.'), FASTFRAME_ERROR_MESSAGE);
00628 return false;
00629 }
00630 }
00631
00632 return true;
00633 }
00634
00635
00636
00637
00644 function _getImageTag()
00645 {
00646 $o_fileCache =& FF_FileCache::singleton();
00647 $tmp_location = $this->o_model->getIsGroup() ? 'group_images' : 'item_images';
00648 $tmp_path = $o_fileCache->exists(array('subdir' => $tmp_location, 'name' => $this->o_model->getId()), true) ?
00649 $o_fileCache->getPath(array('subdir' => $tmp_location, 'name' => $this->o_model->getId()), true, FASTFRAME_WEBPATH) :
00650 $this->o_registry->getRootFile('general/no_image.gif', 'graphics', FASTFRAME_WEBPATH);
00651 return $this->o_output->imgTag($tmp_path);
00652 }
00653
00654
00655
00656
00663 function _getSelectUrl()
00664 {
00665 return FastFrame::selfURL(array(
00666 'actionId' => FF_Request::getParam('returnActionId', 's'),
00667 'module' => FF_Request::getParam('returnModule', 's'),
00668 'objectId' => FF_Request::getParam('returnObjectId', 's'),
00669 'selectedId' => $this->o_model->getId(),
00670 'selectedModel' => $this->o_model->getIsGroup() ? 'Group' : 'Item'));
00671 }
00672
00673
00674
00675
00684 function _getShopSelectUrl($in_params = array())
00685 {
00686 return FastFrame::selfURL(array_merge(array(
00687 'actionId' => ACTION_SHOP_ADD_ITEM,
00688 'module' => 'Loan',
00689 'selectedId' => $this->o_model->getId(),
00690 'selectedDesc' => $this->o_model->getName(),
00691 'barcode' => $this->o_model->getBarcode(),
00692 'isGroup' => $this->o_model->getIsGroup()),
00693 $in_params));
00694 }
00695
00696
00697
00698
00709 function _getAvailability($in_example = false)
00710 {
00711 static $s_css;
00712 if (!isset($s_css)) {
00713 $s_css = '';
00714 foreach ($this->o_registry->getConfigParam('checkout/availability_times', array()) as $s_color => $s_hours) {
00715 $s_css .= ".availBox$s_hours { width: 22px; line-height: 10px; height: 10px; float: left; margin-right: 2px !important; background: $s_color !important; border: 2px solid $s_color !important; color: #fff !important; display: block; }\n";
00716 $s_css .= "a.availBox$s_hours:hover { border-color: #ff3 !important; }\n";
00717 $s_css .= ".noavailBox$s_hours { width: 22px; line-height: 10px; height: 10px; float: left; margin-right: 2px; background: #bbb; border: 2px solid #bbb; color: #fff; display: block; }\n";
00718 }
00719
00720 $this->o_output->o_tpl->append('css', $s_css);
00721 }
00722
00723 $s_startDate = FF_Request::getParam('conflict_start_date', 's');
00724 $b_isEdit = FF_Request::getParam('conflict_is_edit', 's');
00725 $s_type = FF_Request::getParam('conflict_type', 's');
00726 $s_status = $this->o_model->getStatus();
00727 $s_html = '';
00728 $this->o_loanModel->reset();
00729 $this->o_loanModel->setId(0);
00730 $this->o_loanModel->setType($s_type);
00731 $this->o_loanModel->setItem($this->o_model->getId(), null, (bool) $this->o_model->getIsGroup());
00732
00733
00734
00735 $this->o_loanModel->setStartDate($s_startDate);
00736 $this->o_loanModel->setStartDateUsingRules(false);
00737 $s_startDate = $this->o_loanModel->getStartDate();
00738 $s_dueDate = $this->o_loanModel->getDueDate();
00739 foreach ($this->o_registry->getConfigParam('checkout/availability_times', array()) as $s_color => $s_hours) {
00740
00741 $this->o_loanModel->setStartDate(($s_type == LOANS_TYPE_LOAN ? $s_startDate : $s_startDate + ($s_hours * 3600)));
00742 $this->o_loanModel->setDueDate($s_dueDate + ($s_hours * 3600));
00743 if (!$in_example &&
00744 ($s_status == ITEM_STATUS_UNAVAILABLE ||
00745 $s_status == ITEM_STATUS_REPAIR ||
00746 $s_status == ITEM_STATUS_MISSING ||
00747 $this->o_loanModel->getConflicts(false, $b_isEdit, true))) {
00748 $tmp_title = sprintf(_('Not Available from %s to %s'),
00749 date('m/d/Y h:ia (D.)', $this->o_loanModel->getStartDate()),
00750 date('m/d/Y h:ia (D.)', $this->o_loanModel->getDueDate()));
00751 $s_html .= '<div class="noavailBox' . $s_hours . '" title="' . $tmp_title . '">' . date('D', $this->o_loanModel->getStartDate()) . '</div>';
00752 }
00753 else {
00754 $tmp_title = sprintf(_('Available from %s to %s'),
00755 date('m/d/Y h:ia (D.)', $this->o_loanModel->getStartDate()),
00756 date('m/d/Y h:ia (D.)', $this->o_loanModel->getDueDate()));
00757 if ($in_example || $this->currentActionId != ACTION_SHOP) {
00758 $s_html .= '<div class="availBox' . $s_hours . '" title="' . $tmp_title . '">' . date('D', $this->o_loanModel->getStartDate()) . '</div>';
00759 if ($in_example) {
00760 $s_html .= '<div style="float: left; margin-bottom: 2px;">' .
00761 ($s_hours == 0 ? _('The loan or reservation time') : sprintf(_('%s hours after the loan or reservation time'), $s_hours)) .
00762 '</div><div style="clear: left; line-height: 0; height: 0;"> </div>';
00763 }
00764 }
00765 else {
00766
00767 $s_url = $this->_getShopSelectUrl(array('startDate' => $this->o_loanModel->getStartDate()));
00768 $s_html .= $this->o_output->link($s_url, date('D', $this->o_loanModel->getStartDate()), array('class' => "availBox$s_hours", 'title' => $tmp_title));
00769 }
00770 }
00771 }
00772
00773 $s_html .= '<div style="clear: left; line-height: 0; height: 0;"> </div>';
00774 return $s_html;
00775 }
00776
00777
00778
00779
00786 function _getMostRecentBorrower()
00787 {
00788 return $this->o_chkoutOutput->getLinkedBorrower($this->o_model->getMostRecentBorrower());
00789 }
00790
00791
00792 }
00793 ?>