'.__('You are not authorized to view this section').''); } $max_print = 50; /* RECORD OPERATION */ if (isset($_POST['itemID']) AND !empty($_POST['itemID']) AND isset($_POST['itemAction'])) { if (!$can_read) { die(); } if (!is_array($_POST['itemID'])) { // make an array $_POST['itemID'] = array($_POST['itemID']); } /* LABEL SESSION ADDING PROCESS */ $print_count = 0; if (isset($_SESSION['labels']['biblio'])) { $print_count_biblio = count($_SESSION['labels']['biblio']); } if (isset($_SESSION['labels']['item'])) { $print_count_item = count($_SESSION['labels']['item']); } // loop array foreach ($_POST['itemID'] as $itemID) { if ($print_count == $max_print) { $limit_reach = true; break; } if (stripos($itemID, 'b', 0) !== false) { // Biblio ID $biblioID = str_ireplace('b', '', $itemID); if (isset($_SESSION['labels']['biblio'][$biblioID])) { continue; } $_SESSION['labels']['biblio'][$biblioID] = $biblioID; $print_count_biblio++; } else { // Item ID $itemID = (integer)$itemID; if (isset($_SESSION['labels']['item'][$itemID])) { continue; } $_SESSION['labels']['item'][$itemID] = $itemID; $print_count_item++; } } $print_count = $print_count_item + $print_count_biblio; echo ''; if (isset($limit_reach)) { $msg = str_replace('{max_print}', $max_print, __('Selected items NOT ADDED to print queue. Only {max_print} can be printed at once')); utility::jsAlert($msg); } else { // update print queue count object utility::jsAlert(__('Selected items added to print queue')); } exit(); } // clean print queue if (isset($_GET['action']) AND $_GET['action'] == 'clear') { utility::jsAlert(__('Print queue cleared!')); echo ''; unset($_SESSION['labels']); exit(); } // on print action if (isset($_GET['action']) AND $_GET['action'] == 'print') { // check if label session array is available if (!isset($_SESSION['labels']['item']) && !isset($_SESSION['labels']['biblio'])) { utility::jsAlert(__('There is no data to print!')); die(); } // concat item ID $item_ids = ''; if (isset($_SESSION['labels']['item'])) { foreach ($_SESSION['labels']['item'] as $id) { $item_ids .= $id.','; } } // concat biblio ID $biblio_ids = ''; if (isset($_SESSION['labels']['biblio'])) { foreach ($_SESSION['labels']['biblio'] as $id) { $biblio_ids .= $id.','; } } // strip the last comma $item_ids = substr_replace($item_ids, '', -1); $biblio_ids = substr_replace($biblio_ids, '', -1); // SQL criteria if ($item_ids) { $criteria = "i.item_id IN($item_ids)"; } if ($biblio_ids) { $criteria = "b.biblio_id IN($biblio_ids)"; } if ($item_ids && $biblio_ids) { $criteria = "i.item_id IN($item_ids) OR b.biblio_id IN($biblio_ids)"; } // send query to database $biblio_q = $dbs->query('SELECT IF(i.call_number<>\'\', i.call_number, b.call_number) FROM biblio AS b LEFT JOIN item AS i ON b.biblio_id=i.biblio_id WHERE '.$criteria); // echo 'SELECT IF(i.call_number!=\'\', i.call_number, b.call_number) FROM biblio AS b LEFT JOIN item AS i ON b.biblio_id=i.biblio_id WHERE '.$criteria; $label_data_array = array(); while ($biblio_d = $biblio_q->fetch_row()) { if ($biblio_d[0]) { $label_data_array[] = $biblio_d[0]; } } // include printed settings configuration file include SB.'admin'.DS.'admin_template'.DS.'printed_settings.inc.php'; // check for custom template settings $custom_settings = SB.'admin'.DS.$sysconf['admin_template']['dir'].DS.$sysconf['template']['theme'].DS.'printed_settings.inc.php'; if (file_exists($custom_settings)) { include $custom_settings; } // load print settings from database to override value from printed_settings file loadPrintSettings($dbs, 'label'); // chunk label array $chunked_label_arrays = array_chunk($label_data_array, $sysconf['print']['label']['items_per_row']); // create html ouput of images $html_str = ''."\n"; $html_str .= '
';
$html_str .= ' ';
if ($sysconf['print']['label']['include_header_text']) { $html_str .= ' ';
$html_str .= ''.($sysconf['print']['label']['header_text']?$sysconf['print']['label']['header_text']:$sysconf['library_name']).' '; }
// explode label data by space
$sliced_label = explode(' ', $label, 5);
foreach ($sliced_label as $slice_label_item) {
$html_str .= $slice_label_item.''; } $html_str .= ' | ';
}
$html_str .= '