You dont have enough privileges to view this section'); } // local settings $max_print = 10; // clean print queue if (isset($_GET['action']) AND $_GET['action'] == 'clear') { // update print queue count object echo ''; utility::jsAlert(__('Print queue cleared!')); unset($_SESSION['card']); exit(); } 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']); } // loop array if (isset($_SESSION['card'])) { $print_count = count($_SESSION['card']); } else { $print_count = 0; } // card size $size = 2; // create AJAX request echo ''; 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')); //mfc utility::jsAlert($msg); } else { // update print queue count object echo ''; utility::jsAlert(__('Selected items added to print queue')); } exit(); } // card pdf download if (isset($_GET['action']) AND $_GET['action'] == 'print') { // check if label session array is available if (!isset($_SESSION['card'])) { utility::jsAlert(__('There is no data to print!')); die(); } if (count($_SESSION['card']) < 1) { utility::jsAlert(__('There is no data to print!')); die(); } // concat all ID together $member_ids = ''; foreach ($_SESSION['card'] as $id) { $member_ids .= '\''.$id.'\','; } // strip the last comma $member_ids = substr_replace($member_ids, '', -1); // send query to database $member_q = $dbs->query('SELECT m.member_name, m.member_id, m.member_image, mt.member_type_name FROM member AS m LEFT JOIN mst_member_type AS mt ON m.member_type_id=mt.member_type_id WHERE m.member_id IN('.$member_ids.')'); $member_datas = array(); while ($member_d = $member_q->fetch_assoc()) { if ($member_d['member_id']) { $member_datas[] = $member_d; } } // 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; } // chunk cards array $chunked_card_arrays = array_chunk($member_datas, $card_items_per_row); // create html ouput $html_str = ''."\n"; $html_str .= 'Member card Label Print Result'."\n"; $html_str .= ''; $html_str .= ''; $html_str .= ''."\n"; $html_str .= ''."\n"; $html_str .= ''."\n"; $html_str .= 'Print Again'."\n"; $html_str .= ''."\n"; // loop the chunked arrays to row foreach ($chunked_card_arrays as $card_rows) { $html_str .= ''."\n"; foreach ($card_rows as $card) { $html_str .= ''; } $html_str .= ''."\n"; } $html_str .= '
'; $html_str .= '
'; if (trim($card_header_text) != '') { $html_str .= '
'.$card_header_text.'
'; } $html_str .= '
'; $html_str .= ''; $html_str .= '
'; $html_str .= '
'; $html_str .= '
'.( $card_include_field_label?__('Member ID').' : ':'' ).''.$card['member_id'].'
'; $html_str .= '
'.( $card_include_field_label?__('Member Name').' : ':'' ).''.$card['member_name'].'
'; $html_str .= '
'.( $card_include_field_label?__('Membership Type').' : ':'' ).''.$card['member_type_name'].'
'; $html_str .= '
'; $html_str .= '
'; $html_str .= '
'; $html_str .= '
'."\n"; $html_str .= ''."\n"; $html_str .= ''."\n"; // unset the session unset($_SESSION['card']); // write to file $print_file_name = 'member_card_gen_print_result_'.strtolower(str_replace(' ', '_', $_SESSION['uname'])).'.html'; $file_write = @file_put_contents(UPLOAD.$print_file_name, $html_str); if ($file_write) { // update print queue count object echo ''; // open result in window echo ''; } else { utility::jsAlert('ERROR! Cards failed to generate, possibly because '.SB.FLS.' directory is not writable'); } exit(); } ?> setSQLColumn('m.member_id', 'm.member_id AS \''.__('Member ID').'\'', 'm.member_name AS \''.__('Member Name').'\'', 'mt.member_type_name AS \''.__('Membership Type').'\''); $datagrid->setSQLorder('m.last_update DESC'); // is there any search if (isset($_GET['keywords']) AND $_GET['keywords']) { $keyword = $dbs->escape_string(trim($_GET['keywords'])); $words = explode(' ', $keyword); if (count($words) > 1) { $concat_sql = ' ('; foreach ($words as $word) { $concat_sql .= " (m.member_id LIKE '%$word%' OR m.member_name LIKE '%$word%'"; } // remove the last AND $concat_sql = substr_replace($concat_sql, '', -3); $concat_sql .= ') '; $datagrid->setSQLCriteria($concat_sql); } else { $datagrid->setSQLCriteria("m.member_id LIKE '%$keyword%' OR m.member_name LIKE '%$keyword%'"); } } // 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 Print Queue'); $datagrid->chbox_confirm_msg = __('Add to print queue?'); $datagrid->column_width = array('10%', '70%', '15%'); // 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']) { echo '
'.__('Found').' '.$datagrid->num_rows.' '.__('from your search with keyword').': "'.$_GET['keywords'].'"
'; //mfc } echo $datagrid_result; /* main content end */