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/Display.php';
00027
00028
00029
00030
00041
00042 class FF_Action_Display_Item extends FF_Action_Display {
00043
00044
00051 function renderDisplay()
00052 {
00053 if ($this->o_model->getIsDeleted()) {
00054 $this->o_output->setMessage(_('Note that this item has been deleted.'), FASTFRAME_WARNING_MESSAGE);
00055 }
00056
00057 require_once FASTFRAME_ROOT . '/lib/FastFrame/Output/Table.php';
00058 $o_table =& new FF_Output_Table('twoColumn');
00059 $o_table->setTableHeaderText($this->getPageName());
00060 $o_table->setTableHeaders($this->getTableData());
00061 $o_table->setAlternateRowColors(true);
00062 $o_table->render();
00063 $o_tableWidget =& $o_table->getWidgetObject();
00064 $this->o_output->o_tpl->append('content_middle', $o_tableWidget->fetch());
00065 $this->renderAdditionalLinks();
00066 }
00067
00068
00069
00070
00077 function renderAdditionalLinks()
00078 {
00079 if (FF_Request::getParam('isPopup', 'g', false)) {
00080 if ($this->o_perms->hasPerm('can_edit_item')) {
00081 $this->o_output->o_tpl->append('page_links',
00082 $this->o_output->link(FastFrame::selfURL(array(
00083 'actionId' => ACTION_EDIT, 'module' => 'Item',
00084 'objectId' => $this->o_model->getId())), _('Edit this Item')));
00085 }
00086
00087 $this->o_output->o_tpl->append('page_links',
00088 $this->o_output->link('#', _('Close Window'),
00089 array('onclick' => 'self.close();')));
00090 }
00091 else {
00092 $this->o_output->o_tpl->append('page_links',
00093 $this->o_output->link(FastFrame::selfURL(array(
00094 'actionId' => FF_Request::getParam('returnActionId', 'gs'),
00095 'module' => 'Item')),
00096 sprintf(_('Return to %s List'), $this->getSingularText())));
00097 }
00098 }
00099
00100
00101
00102
00109 function getTableData()
00110 {
00111 require_once dirname(__FILE__) . '/../Output/Checkout.php';
00112 $o_chkoutOutput =& new FF_Output_Checkout();
00113 $a_headers = array();
00114 $a_headers[] = array(
00115 'title' => _('Name:'),
00116 'data' => $this->o_model->getName(),
00117 );
00118 $a_headers[] = array(
00119 'title' => _('Description:'),
00120 'data' => $this->o_model->getFormattedDescription(),
00121 'dataIsSafe' => true,
00122 );
00123 $o_fileCache =& FF_FileCache::singleton();
00124 $tmp_path = $o_fileCache->exists(array('subdir' => 'item_images', 'name' => $this->o_model->getId()), true) ?
00125 $o_fileCache->getPath(array('subdir' => 'item_images', 'name' => $this->o_model->getId()), true, FASTFRAME_WEBPATH) :
00126 $this->o_registry->getRootFile('general/no_image.gif', 'graphics', FASTFRAME_WEBPATH);
00127 $a_headers[] = array(
00128 'title' => _('Image:'),
00129 'data' => $this->o_output->imgTag($tmp_path, null, array('style' => 'vertical-align: top;')),
00130 'dataIsSafe' => true,
00131 );
00132 $a_headers[] = array(
00133 'title' => _('Barcode:'),
00134 'data' => $this->o_model->getBarcode(),
00135 );
00136 $a_headers[] = array(
00137 'title' => _('Serial Number:'),
00138 'data' => $this->o_model->getSerialNum(),
00139 );
00140 if ($this->o_perms->hasPerm('can_use_category')) {
00141 $a_headers[] = array(
00142 'title' => _('Category:'),
00143 'data' => $this->o_model->getCategoryName(),
00144 );
00145 }
00146
00147 if ($this->o_perms->hasPerm('can_use_vendor')) {
00148 $a_headers[] = array(
00149 'title' => _('Vendor:'),
00150 'data' => $this->o_model->getVendorName(),
00151 );
00152 }
00153
00154 $a_headers[] = array(
00155 'title' => _('Status:'),
00156 'data' => $this->o_model->getFormattedStatus(),
00157 );
00158 $a_headers[] = array(
00159 'title' => _('Shopper Viewable:'),
00160 'data' => $this->o_model->getShopperViewable() ? _('Yes') : _('No'),
00161 );
00162 $a_stores = $this->o_registry->getConfigParam('shopping/stores');
00163 $s_store = $this->o_model->getStoreId();
00164 $a_headers[] = array(
00165 'title' => _('Store:'),
00166 'data' => isset($a_stores[$s_store]) ? $a_stores[$s_store] : _('Invalid Store'),
00167 );
00168
00169
00170 foreach ($this->o_registry->getConfigParam('item/attributes') as $s_key => $s_desc) {
00171 $a_headers[] = array(
00172 'title' => $s_desc . ':',
00173 'data' => $this->o_model->getAttribute($s_key),
00174 );
00175 }
00176
00177 if ($this->o_perms->hasPerm('can_view_loan_history')) {
00178 FF_Request::setParam('returnActionId', FF_Request::getParam('returnActionId', 'gs'), 's');
00179 FF_Request::setParam('returnObjectId', $this->o_model->getId(), 's');
00180 FF_Request::setParam('returnModuleId', 'Item', 's');
00181 $a_headers[] = array(
00182 'title' => _('Item\'s Loan History:'),
00183 'data' => $this->o_output->link(
00184 FastFrame::selfURL(array('module' => 'Loan', 'actionId' => ACTION_LIST_ITEM_LOANS,
00185 'objectDesc' => $this->o_model->getName(), 'objectId' => $this->o_model->getId())),
00186 _('Click Here To View')),
00187 'dataIsSafe' => true,
00188 );
00189 }
00190
00191 $a_headers[] = array(
00192 'title' => _('Associated Files'),
00193 'data' => $o_chkoutOutput->getAttachmentList($this->o_model->getId(), false),
00194 'dataIsSafe' => true);
00195
00196
00197 require_once dirname(__FILE__) . '/../Model/Comment.php';
00198 $o_commentModel =& new FF_Model_Comment();
00199 foreach ($o_commentModel->getCommentsByTransactionId($this->o_model->getId()) as $a_data) {
00200 $o_commentModel->reset();
00201 $o_commentModel->importFromArray($a_data);
00202 $a_headers[] = array(
00203 'title' => _('Comment:'),
00204 'data' => $o_chkoutOutput->getCommentTable(array('o_comment' => &$o_commentModel), false),
00205 'dataIsSafe' => true,
00206 );
00207 }
00208
00209 return $a_headers;
00210 }
00211
00212
00213
00214
00221 function getSingularText()
00222 {
00223 return _('Item');
00224 }
00225
00226
00227
00228
00236 function getPluralText()
00237 {
00238 return _('Items');
00239 }
00240
00241
00242 }
00243 ?>