'.__('You don\'t have enough privileges to access this area!').''); } // check if PEAR is installed ob_start(); include 'File/MARC.php'; ob_end_clean(); if (!class_exists('File_MARC')) { die('
'); } // clean print queue if (isset($_GET['action']) AND $_GET['action'] == 'clear') { // update print queue count object echo ''; utility::jsAlert(__('Export queue cleared!')); unset($_SESSION['marcexport']); exit(); } /* 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((integer)$_POST['itemID']); } // loop array if (isset($_SESSION['marcexport'])) { $print_count = count($_SESSION['marcexport']); } else { $print_count = 0; } // create AJAX request echo ''; echo ''; utility::jsAlert(__('Selected items added to print queue')); exit(); } // batch export if (isset($_POST['doExport'])) { if (!$can_read) { die(); } $format = $_POST['exportType']; $total = (integer)$_POST['recordNum']; $start = (integer)$_POST['recordOffset']; $start = $start-1; if ($format == 'XML') { header('Content-type: application/marcxml+xml'); header('Content-disposition: attachment; filename=slims-marc-export.xml'); } else if ($format == 'JSON') { header('Content-type: application/json'); header('Content-disposition: attachment; filename=slims-marc-export.json'); } else { header('Content-type: application/marc'); header('Content-disposition: attachment; filename=slims-marc-export.mrc'); } $biblio = new Biblio($dbs, null); echo $biblio->marc_export('BATCH', $start, $total, $format); exit(); } // Starting Export to MARC if (isset($_GET['action']) AND $_GET['action'] == 'export') { // check if label session array is available if (!isset($_SESSION['marcexport'])) { utility::jsAlert(__('There is no data to export!*')); } if (count($_SESSION['marcexport']) < 1) { utility::jsAlert(__('There is no data to export!')); } // concat all ID together $item_ids = ''; foreach ($_SESSION['marcexport'] as $id) { $item_ids .= '\''.$id.'\','; } // strip the last comma $item_ids = substr_replace($item_ids, '', -1); // unset the session unset($_SESSION['marcexport']); header('Content-type: application/marc'); header('Content-disposition: attachment; filename=slims-marc-export.mrc'); $biblio = new Biblio($dbs, null); echo $biblio->marc_export($item_ids); // utility::jsAlert('Done..'); exit(); } ?> submit_button_attr = 'name="doExport" value="'.__('Export Now').'" class="btn btn-default"'; // form table attributes $form->table_attr = 'align="center" id="dataList" cellpadding="5" cellspacing="0"'; $form->table_header_attr = 'class="alterCell" style="font-weight: bold;"'; $form->table_content_attr = 'class="alterCell2"'; /* Form Element(s) */ // record separator $rec_sep_options[] = array('RAW', 'MARC RAW'); $rec_sep_options[] = array('XML', 'MARCXML'); $rec_sep_options[] = array('JSON', 'MARCJSON'); $form->addSelectList('exportType', __('Export Type'), $rec_sep_options); // number of records to export $form->addTextField('text', 'recordNum', __('Number of Records To Export (0 for all records)'), '0', 'style="width: 10%;"'); // records offset $form->addTextField('text', 'recordOffset', __('Start From Record'), '1', 'style="width: 10%;"'); // output the form echo $form->printOut(); } else { // List of books $datagrid = new simbio_datagrid(); /* ITEM LIST */ require SIMBIO.'simbio_UTILS/simbio_tokenizecql.inc.php'; require LIB.'biblio_list_model.inc.php'; // index choice if ($sysconf['index']['type'] == 'index' || ($sysconf['index']['type'] == 'sphinx' && file_exists(LIB.'sphinx/sphinxapi.php'))) { if ($sysconf['index']['type'] == 'sphinx') { require LIB.'sphinx/sphinxapi.php'; require LIB.'biblio_list_sphinx.inc.php'; } else { require LIB.'biblio_list_index.inc.php'; } // table spec $table_spec = 'search_biblio'; $datagrid->setSQLColumn('biblio_id', 'title AS \''.__('Title').'\'', 'author AS \''.__('Author').'\''); } else { require LIB.'biblio_list.inc.php'; // table spec $table_spec = 'search_biblio'; $datagrid->setSQLColumn('biblio_id', 'title AS \''.__('Title').'\'', 'author AS \''.__('Author').'\''); } $datagrid->setSQLorder('last_update DESC'); // is there any search if (isset($_GET['keywords']) AND $_GET['keywords']) { $keywords = $dbs->escape_string(trim($_GET['keywords'])); $searchable_fields = array('title', 'author', 'subject'); $search_str = ''; // if no qualifier in fields if (!preg_match('@[a-z]+\s*=\s*@i', $keywords)) { foreach ($searchable_fields as $search_field) { $search_str .= $search_field.'='.$keywords.' OR '; } } else { $search_str = $keywords; } $biblio_list = new biblio_list($dbs, 20); $criteria = $biblio_list->setSQLcriteria($search_str); } if (isset($criteria)) { $datagrid->setSQLcriteria('('.$criteria['sql_criteria'].')'); } // set table and table header attributes $datagrid->table_attr = 'align="center" id="dataList" cellpadding="5" cellspacing="0"'; $datagrid->table_header_attr = 'class="dataListHeader" style="font-weight: bold;"'; // edit and checkbox property $datagrid->edit_property = false; $datagrid->chbox_property = array('itemID', __('Add')); $datagrid->chbox_action_button = __('Add To Export Queue'); $datagrid->chbox_confirm_msg = __('Add to export queue?'); $datagrid->column_width = array('50%', '45%'); // set checkbox action URL $datagrid->chbox_form_URL = $_SERVER['PHP_SELF']; // put the result into variables $datagrid_result = $datagrid->createDataGrid($dbs, $table_spec, 20, $can_read); if (isset($_GET['keywords']) AND $_GET['keywords']) { $msg = str_replace('{result->num_rows}', $datagrid->num_rows, __('Found {result->num_rows} from your keywords')); echo '