'.__('You are not authorized to view this section').''); } /* search form */ ?> setSQLColumn("i.item_code AS '".__('Item Code')."'", "m.member_id AS '".__('Member ID')."'", "b.title AS '".__('Title')."'", "l.loan_date AS '".__('Loan Date')."'", "l.due_date AS '".__('Due Date')."'"); $datagrid->setSQLorder("l.loan_date DESC"); // change the record order if (isset($_GET['fld']) AND isset($_GET['dir'])) { $datagrid->setSQLorder("'".urldecode($_GET['fld'])."' ".$dbs->escape_string($_GET['dir'])); } $checkout_criteria = ' (l.is_lent=1 AND l.is_return=0) '; // 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 .= " (b.title LIKE '%$word%' OR i.item_code LIKE '%$word%') AND"; } // remove the last AND $concat_sql = substr_replace($concat_sql, '', -3); $concat_sql .= ') '; $datagrid->setSQLCriteria($checkout_criteria.' AND '.$concat_sql); } else { $datagrid->setSQLCriteria($checkout_criteria." AND (b.title LIKE '%$keyword%' OR i.item_code LIKE '%$keyword%')"); } } else { $datagrid->setSQLCriteria($checkout_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;"'; // set column width $datagrid->column_width = array(0 => '12%', 1 => '12%', 2 => '50%'); // put the result into variables $datagrid_result = $datagrid->createDataGrid($dbs, $table_spec, 20, false); if (isset($_GET['keywords']) AND $_GET['keywords']) { echo '
'; $msg = str_replace('{result->num_rows}', $datagrid->num_rows, __('Found {result->num_rows} from your keywords')); //mfc echo $msg.' : "'.$_GET['keywords'].'"
'; } echo $datagrid_result; /* main content end */