本文整理汇总了PHP中simbio_datagrid::setSQLorder方法的典型用法代码示例。如果您正苦于以下问题:PHP simbio_datagrid::setSQLorder方法的具体用法?PHP simbio_datagrid::setSQLorder怎么用?PHP simbio_datagrid::setSQLorder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类simbio_datagrid
的用法示例。
在下文中一共展示了simbio_datagrid::setSQLorder方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showLoanHist
function showLoanHist($num_recs_show = 1000000)
{
global $dbs;
require SIMBIO . 'simbio_GUI/table/simbio_table.inc.php';
require SIMBIO . 'simbio_DB/datagrid/simbio_dbgrid.inc.php';
require SIMBIO . 'simbio_GUI/paging/simbio_paging.inc.php';
require SIMBIO . 'simbio_UTILS/simbio_date.inc.php';
// table spec
$_table_spec = 'loan AS l
LEFT JOIN member AS m ON l.member_id=m.member_id
LEFT JOIN item AS i ON l.item_code=i.item_code
LEFT JOIN biblio AS b ON i.biblio_id=b.biblio_id';
// create datagrid
$_loan_hist = new simbio_datagrid();
$_loan_hist->disable_paging = true;
$_loan_hist->table_ID = 'loanhist';
$_loan_hist->setSQLColumn('l.item_code AS \'' . __('Item Code') . '\'', 'b.title AS \'' . __('Title') . '\'', 'l.loan_date AS \'' . __('Loan Date') . '\'', 'l.return_date AS \'' . __('Return Date') . '\'');
$_loan_hist->setSQLorder('l.loan_date DESC');
$_criteria = sprintf('m.member_id=\'%s\' AND l.is_lent=1 AND is_return=1 ', $_SESSION['mid']);
$_loan_hist->setSQLCriteria($_criteria);
/* callback function to show overdue */
function showOverdue($obj_db, $array_data)
{
$_curr_date = date('Y-m-d');
if (simbio_date::compareDates($array_data[3], $_curr_date) == $_curr_date) {
#return '<strong style="color: #f00;">'.$array_data[3].' '.__('OVERDUED').'</strong>';
} else {
return $array_data[3];
}
}
// modify column value
#$_loan_hist->modifyColumnContent(3, 'callback{showOverdue}');
// set table and table header attributes
$_loan_hist->table_attr = 'align="center" class="memberLoanList" cellpadding="5" cellspacing="0"';
$_loan_hist->table_header_attr = 'class="dataListHeader" style="font-weight: bold;"';
$_loan_hist->using_AJAX = false;
// return the result
$_result = $_loan_hist->createDataGrid($dbs, $_table_spec, $num_recs_show);
$_result = '<div class="memberLoanHistInfo">' . $_loan_hist->num_rows . ' ' . __('item(s) loan history') . '</div>' . "\n" . $_result;
return $_result;
}
示例2: __
<input type="submit" id="doSearch" value="<?php
echo __('Search');
?>
" class="button" />
</form>
</div>
</fieldset>
<?php
/* search form end */
/* STOCK TAKE LOGS LIST */
// table spec
$table_spec = 'system_log AS sl';
// create datagrid
$datagrid = new simbio_datagrid();
$datagrid->setSQLColumn('sl.log_date AS \'Time\'', 'sl.log_msg AS \'Message\'');
$datagrid->setSQLorder("sl.log_date DESC");
$criteria = 'sl.log_location=\'stock_take\' AND sl.log_msg LIKE \'Stock Take ERROR%\' ';
// 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 .= " (sl.log_date LIKE '%{$word}%' OR sl.log_msg LIKE '%{$word}%') AND";
}
// remove the last AND
$concat_sql = substr_replace($concat_sql, '', -3);
$concat_sql .= ') ';
$datagrid->setSQLCriteria($criteria . ' AND ' . $concat_sql);
} else {
示例3: array
//mfc
?>
</div>
</div>
</fieldset>
<?php
/* search form end */
/* ITEM LIST */
require SIMBIO_BASE_DIR . 'simbio_UTILS/simbio_tokenizecql.inc.php';
require LIB_DIR . 'biblio_list.inc.php';
// table spec
$table_spec = 'item LEFT JOIN biblio ON item.biblio_id=biblio.biblio_id';
// create datagrid
$datagrid = new simbio_datagrid();
$datagrid->setSQLColumn('item.item_code', 'item.item_code AS \'' . __('Item Code') . '\'', 'biblio.title AS \'' . __('Title') . '\'');
$datagrid->setSQLorder('item.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', 'itemcode');
$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);
$criteria = $biblio_list->setSQLcriteria($search_str);
示例4: explode
if (isset($_GET['type']) && $_GET['type'] == 'orphaned') {
$table_spec = 'mst_topic AS t LEFT JOIN biblio_topic AS bt ON t.topic_id=bt.topic_id';
$sql_criteria = 'bt.biblio_id IS NULL OR bt.topic_id IS NULL';
} else {
$table_spec = 'mst_topic AS t';
}
$subj_type_fld = 1;
// create datagrid
$datagrid = new simbio_datagrid();
if ($can_read and $can_write) {
$subj_type_fld = 2;
$datagrid->setSQLColumn('t.topic_id', 't.topic AS \'' . __('Subject') . '\'', 't.topic_type AS \'' . __('Subject Type') . '\'', 't.auth_list AS \'' . __('Authority Files') . '\'', 't.last_update AS \'' . __('Last Update') . '\'');
} else {
$datagrid->setSQLColumn('t.topic AS \'' . __('Subject') . '\'', 't.topic_type AS \'' . __('Subject Type') . '\'', 't.auth_list AS \'' . __('Authority Files') . '\'', 't.last_update AS \'' . __('Last Update') . '\'');
}
$datagrid->setSQLorder('topic ASC');
// 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 = ' AND (';
foreach ($words as $word) {
$concat_sql .= " t.topic LIKE '%{$word}%' AND";
}
// remove the last AND
$concat_sql = substr_replace($concat_sql, '', -3);
$concat_sql .= ') ';
$sql_criteria .= $concat_sql;
} else {
$sql_criteria .= " AND t.topic LIKE '%{$keyword}%'";
示例5:
<input type="hidden" name="tkn" value="<?php
echo $_SESSION['token'];
?>
" />
</form>
</div>
</div>
</fieldset>
<?php
/* BACKUP LOG LIST */
// table spec
$table_spec = 'backup_log AS bl LEFT JOIN user AS u ON bl.user_id=u.user_id';
// create datagrid
$datagrid = new simbio_datagrid();
$datagrid->setSQLColumn('u.realname AS \'Backup Executor\'', 'bl.backup_time AS \'Backup Time\'', 'bl.backup_file AS \'Backup File Location\'');
$datagrid->setSQLorder('backup_time DESC');
// is there any search
if (isset($_GET['keywords']) and $_GET['keywords']) {
$keywords = $dbs->escape_string($_GET['keywords']);
$datagrid->setSQLCriteria("bl.backup_time LIKE '%{$keywords}%' OR bl.backup_file LIKE '%{$keywords}%'");
}
// 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 delete proccess URL
$datagrid->delete_URL = $_SERVER['PHP_SELF'];
// put the result into variables
$datagrid_result = $datagrid->createDataGrid($dbs, $table_spec, 20, false);
if (isset($_GET['keywords']) and $_GET['keywords']) {
$msg = str_replace('{result->num_rows}', $datagrid->num_rows, __('Found <strong>{result->num_rows}</strong> from your keywords'));
//mfc
示例6: COUNT
$_output .= '<div style="float: right; width: 20px; height: 20px;" class="homeFlagIcon" title="Promoted To Homepage"> </div>';
}
return $_output;
}
// create datagrid
$datagrid = new simbio_datagrid();
if ($can_read and $can_write) {
$datagrid->setSQLColumn('biblio.biblio_id', 'biblio.biblio_id AS bid', 'biblio.title AS \'' . __('Title') . '\'', 'biblio.isbn_issn AS \'' . __('ISBN/ISSN') . '\'', 'IF(COUNT(item.item_id)>0, COUNT(item.item_id), \'<strong style="color: #f00;">' . __('None') . '</strong>\') AS \'' . __('Copies') . '\'', 'biblio.last_update AS \'' . __('Last Update') . '\'');
$datagrid->modifyColumnContent(2, 'callback{showTitleAuthors}');
} else {
$datagrid->setSQLColumn('biblio.biblio_id AS bid', 'biblio.title AS \'' . __('Title') . '\'', 'biblio.isbn_issn AS \'' . __('ISBN/ISSN') . '\'', 'IF(COUNT(item.item_id)>0, COUNT(item.item_id), \'<strong style="color: #f00;">' . __('None') . '</strong>\') AS \'' . __('Copies') . '\'', 'biblio.last_update AS \'' . __('Last Update') . '\'');
// modify column value
$datagrid->modifyColumnContent(1, 'callback{showTitleAuthors}');
}
$datagrid->invisible_fields = array(0);
$datagrid->setSQLorder('biblio.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', 'isbn', 'publisher');
if ($_GET['field'] != '0' and in_array($_GET['field'], $searchable_fields)) {
$field = $_GET['field'];
$search_str = $field . '=' . $keywords;
} else {
$search_str = '';
foreach ($searchable_fields as $search_field) {
$search_str .= $search_field . '=' . $keywords . ' OR ';
}
$search_str = substr_replace($search_str, '', -4);
}
$biblio_list = new biblio_list($dbs);
示例7: trim
// page title
$page_title = 'Member Loan List';
// start the output buffering
ob_start();
// check if there is member ID
if (isset($_SESSION['memberID']) and !empty($_SESSION['memberID'])) {
/* LOAN HISTORY LIST */
$memberID = trim($_SESSION['memberID']);
// table spec
$table_spec = 'loan AS l
LEFT JOIN item AS i ON l.item_code=i.item_code
LEFT JOIN biblio AS b ON i.biblio_id=b.biblio_id';
// create datagrid
$datagrid = new simbio_datagrid();
$datagrid->setSQLColumn('l.item_code AS \'' . __('Item Code') . '\'', 'b.title AS \'' . __('Title') . '\'', 'l.loan_date AS \'' . __('Loan Date') . '\'', 'IF(return_date IS NULL, \'<i>' . __('Not Returned Yet') . '</i>\', return_date) AS \'' . __('Returned Date') . '\'');
$datagrid->setSQLorder("l.loan_date DESC");
$criteria = 'l.member_id=\'' . $dbs->escape_string($memberID) . '\' ';
// is there any search
if (isset($_GET['keywords']) and $_GET['keywords']) {
$keyword = $dbs->escape_string($_GET['keywords']);
$criteria .= " AND (l.item_code LIKE '%{$keyword}%' OR b.title LIKE '%{$keyword}%')";
}
$datagrid->setSQLCriteria($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;"';
$datagrid->icon_edit = SENAYAN_WEB_ROOT_DIR . 'admin/' . $sysconf['admin_template']['dir'] . '/' . $sysconf['admin_template']['theme'] . '/edit.gif';
// special properties
$datagrid->using_AJAX = false;
$datagrid->column_width = array(1 => '70%');
$datagrid->disableSort('Return Date');
示例8: showLoanHist
function showLoanHist($num_recs_show = 20)
{
global $dbs;
// table spec
$_table_spec = 'loan AS l
LEFT JOIN member AS m ON l.member_id=m.member_id
LEFT JOIN item AS i ON l.item_code=i.item_code
LEFT JOIN biblio AS b ON i.biblio_id=b.biblio_id';
// create datagrid
$_loan_hist = new simbio_datagrid();
$_loan_hist->disable_paging = true;
$_loan_hist->table_ID = 'loanhist';
$_loan_hist->setSQLColumn('l.item_code AS \'' . __('Item Code') . '\'', 'b.title AS \'' . __('Title') . '\'', 'l.loan_date AS \'' . __('Loan Date') . '\'', 'l.return_date AS \'' . __('Return Date') . '\'');
$_loan_hist->setSQLorder('l.loan_date DESC');
$_criteria = sprintf('m.member_id=\'%s\' AND l.is_lent=1 AND is_return=1 ', $_SESSION['mid']);
$_loan_hist->setSQLCriteria($_criteria);
// modify column value
#$_loan_hist->modifyColumnContent(3, 'callback{showOverdue}');
// set table and table header attributes
$_loan_hist->table_attr = 'align="center" class="memberLoanList" cellpadding="5" cellspacing="0"';
$_loan_hist->table_header_attr = 'class="dataListHeader" style="font-weight: bold;"';
$_loan_hist->using_AJAX = false;
// return the result
$_result = $_loan_hist->createDataGrid($dbs, $_table_spec, $num_recs_show);
$_result = '<div class="memberLoanHistInfo"> ' . $_loan_hist->num_rows . ' ' . __('item(s) loan history') . ' | <a href="?p=download_loan_history">Download All Loan History</a></div>' . "\n" . $_result;
return $_result;
}
示例9: array
return $sysconf['node'][$array_data[4]]['name'];
}
// create datagrid
$datagrid = new simbio_datagrid();
if ($can_read and $can_write) {
$datagrid->setSQLColumn('biblio.biblio_id', 'biblio.biblio_id AS bid', 'biblio.title AS \'' . __('Title') . '\'', 'biblio.isbn_issn AS \'' . __('ISBN/ISSN') . '\'', 'biblio.node_id AS \'' . __('Node') . '\'', 'biblio.last_update AS \'' . __('Last Update') . '\'');
$datagrid->modifyColumnContent(2, 'callback{showTitleAuthors}');
$datagrid->modifyColumnContent(4, 'callback{showNodeName}');
} else {
$datagrid->setSQLColumn('biblio.biblio_id AS bid', 'biblio.title AS \'' . __('Title') . '\'', 'biblio.isbn_issn AS \'' . __('ISBN/ISSN') . '\'', 'biblio.node_id AS \'' . __('Node') . '\'', 'biblio.last_update AS \'' . __('Last Update') . '\'');
// modify column value
$datagrid->modifyColumnContent(1, 'callback{showTitleAuthors}');
$datagrid->modifyColumnContent(3, 'callback{showNodeName}');
}
$datagrid->invisible_fields = array(0);
$datagrid->setSQLorder('biblio.input_date 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', 'isbn', 'publisher');
if ($_GET['field'] != '0' and in_array($_GET['field'], $searchable_fields)) {
$field = $_GET['field'];
$search_str = $field . '=' . $keywords;
} else {
$search_str = '';
foreach ($searchable_fields as $search_field) {
$search_str .= $search_field . '=' . $keywords . ' OR ';
}
$search_str = substr_replace($search_str, '', -4);
}
$biblio_list = new biblio_list($dbs);
示例10:
//mfc
}
// print out the form object
echo $form->printOut();
} else {
/* SUPPLIER LIST */
// table spec
$table_spec = 'mst_supplier AS sp';
// create datagrid
$datagrid = new simbio_datagrid();
if ($can_read and $can_write) {
$datagrid->setSQLColumn('sp.supplier_id', 'sp.supplier_name AS \'' . __('Supplier Name') . '\'', 'sp.contact AS \'' . __('Contact') . '\'', 'sp.phone AS \'' . __('Phone Number') . '\'', 'sp.fax AS \'' . __('Fax Number') . '\'', 'sp.last_update AS \'' . __('Last Update') . '\'');
} else {
$datagrid->setSQLColumn('sp.supplier_name AS \'' . __('Supplier Name') . '\'', 'sp.contact AS \'' . __('Contact') . '\'', 'sp.phone AS \'' . __('Phone Number') . '\'', 'sp.fax AS \'' . __('Fax Number') . '\'', 'sp.last_update AS \'' . __('Last Update') . '\'');
}
$datagrid->setSQLorder('supplier_name ASC');
// is there any search
if (isset($_GET['keywords']) and $_GET['keywords']) {
$keywords = $dbs->escape_string($_GET['keywords']);
$datagrid->setSQLCriteria("sp.supplier_name LIKE '%{$keywords}%' OR sp.supplier_id LIKE '%{$keywords}%'\n OR sp.contact LIKE '%{$keywords}%' OR sp.address LIKE '%{$keywords}%'");
}
// set table and table header attributes
$datagrid->table_attr = 'align="center" class="dataList" cellpadding="5" cellspacing="0"';
$datagrid->table_header_attr = 'class="dataListHeader" style="font-weight: bold;"';
// set delete proccess URL
$datagrid->chbox_form_URL = $_SERVER['PHP_SELF'];
// put the result into variables
$datagrid_result = $datagrid->createDataGrid($dbs, $table_spec, 20, $can_read and $can_write);
if (isset($_GET['keywords']) and $_GET['keywords']) {
$msg = str_replace('{result->num_rows}', $datagrid->num_rows, __('Found <strong>{result->num_rows}</strong> from your keywords'));
//mfc
示例11: array
$_output .= '<div style="font-weight: bold; font-size: 110%;">' . $array_data[1] . '</div>';
$_output .= '<div style="font-weight: bold; font-size: 90%;"><a href="' . MODULES_WEB_ROOT_DIR . 'serial_control/kardex.php?serialID=' . $array_data[0] . '" title="' . __('View/Edit Kardex Detail') . '">' . __('View/Edit Kardex Detail') . '</a></div>';
return $_output;
}
// table spec
$table_spec = 'serial AS s';
// create datagrid
$datagrid = new simbio_datagrid();
$datagrid->setSQLColumn('s.serial_id', 's.period AS \'' . __('Period Name') . '\'', 's.date_start AS \'' . __('Subscription Start') . '\'', 's.notes AS \'' . __('Subscription Notes') . '\'');
if ($can_read and $can_write) {
$datagrid->modifyColumnContent(1, 'callback{serialTitle}');
} else {
$datagrid->invisible_fields = array(0);
$datagrid->modifyColumnContent(1, 'callback{serialTitle}');
}
$datagrid->setSQLorder('s.date_start DESC');
$criteria = 's.biblio_id=' . $biblioID;
// is there any search
if (isset($_GET['keywords']) and $_GET['keywords']) {
$keyword = $dbs->escape_string($_GET['keywords']);
$criteria .= " AND (s.period LIKE '%{$keyword}%' OR s.notes LIKE '%{$keyword}%')";
}
$datagrid->setSQLCriteria($criteria);
// set table and table header attributes
$datagrid->table_attr = 'align="center" id="dataList" style="width: 100%;" cellpadding="5" cellspacing="0"';
$datagrid->table_header_attr = 'class="dataListHeader" style="font-weight: bold;"';
$datagrid->using_AJAX = false;
// set delete proccess URL
$datagrid->chbox_form_URL = $_SERVER['PHP_SELF'];
// special properties
$datagrid->column_width = array(0 => '45%');
示例12:
//mfc
}
// print out the form object
echo $form->printOut();
} else {
/* LOCATION LIST */
// table spec
$table_spec = 'mst_location AS l';
// create datagrid
$datagrid = new simbio_datagrid();
if ($can_read and $can_write) {
$datagrid->setSQLColumn('l.location_id', 'l.location_id AS \'' . __('Location Code') . '\'', 'l.location_name AS \'' . __('Location Name') . '\'', 'l.last_update AS \'' . __('Last Update') . '\'');
} else {
$datagrid->setSQLColumn('l.location_id AS \'' . __('Location Code') . '\'', 'l.location_name AS \'' . __('Location Name') . '\'', 'l.last_update AS \'' . __('Last Update') . '\'');
}
$datagrid->setSQLorder('location_name ASC');
// is there any search
if (isset($_GET['keywords']) and $_GET['keywords']) {
$keywords = $dbs->escape_string($_GET['keywords']);
$datagrid->setSQLCriteria("l.location_name LIKE '%{$keywords}%'");
}
// 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 delete proccess URL
$datagrid->chbox_form_URL = $_SERVER['PHP_SELF'];
// put the result into variables
$datagrid_result = $datagrid->createDataGrid($dbs, $table_spec, 20, $can_read and $can_write);
if (isset($_GET['keywords']) and $_GET['keywords']) {
$msg = str_replace('{result->num_rows}', $datagrid->num_rows, __('Found <strong>{result->num_rows}</strong> from your keywords'));
//mfc
示例13: AND
//mfc
}
// print out the form object
echo $form->printOut();
} else {
/* GMD LIST */
// table spec
$table_spec = 'mst_label AS lb';
// create datagrid
$datagrid = new simbio_datagrid();
if ($can_read and $can_write) {
$datagrid->setSQLColumn('lb.label_id', 'lb.label_desc AS \'' . __('Label Description') . '\'', 'lb.label_name AS \'' . __('Label Name') . '\'', 'lb.last_update AS \'' . __('Last Update') . '\'');
} else {
$datagrid->setSQLColumn('lb.label_desc AS \'' . __('Label Description') . '\'', 'lb.label_name AS \'' . __('Label Name') . '\'', 'lb.last_update AS \'' . __('Last Update') . '\'');
}
$datagrid->setSQLorder('label_name ASC');
// is there any search
$criteria = 'lb.label_id IS NOT NULL';
if (isset($_GET['keywords']) and $_GET['keywords']) {
$keywords = $dbs->escape_string($_GET['keywords']);
$criteria = " AND (lb.label_name LIKE '%{$keywords}%' OR lb.label_desc LIKE '%{$keywords}%')";
}
$datagrid->setSQLCriteria($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 delete proccess URL
$datagrid->chbox_form_URL = $_SERVER['PHP_SELF'];
// put the result into variables
$datagrid_result = $datagrid->createDataGrid($dbs, $table_spec, 20, $can_read and $can_write);
if (isset($_GET['keywords']) and $_GET['keywords']) {
示例14: urldecode
<input type="submit" id="doSearch" class="button" />
</form>
</div>
</div>
</fieldset>
<?php
/* ITEM LIST */
// table spec
$table_spec = 'loan AS l
LEFT JOIN member AS m ON l.member_id=m.member_id
LEFT JOIN item AS i ON l.item_code=i.item_code
LEFT JOIN biblio AS b ON i.biblio_id=b.biblio_id';
// create datagrid
$datagrid = new simbio_datagrid();
$datagrid->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
示例15:
// table spec
$sql_criteria = 'pl.place_id > 1';
if (isset($_GET['type']) && $_GET['type'] == 'orphaned') {
$table_spec = 'mst_place AS pl LEFT JOIN biblio AS b ON pl.place_id = b.publish_place_id';
$sql_criteria = 'b.publish_place_id IS NULL';
} else {
$table_spec = 'mst_place AS pl';
}
// create datagrid
$datagrid = new simbio_datagrid();
if ($can_read and $can_write) {
$datagrid->setSQLColumn('pl.place_id', 'pl.place_name AS \'' . __('Place Name') . '\'', 'pl.last_update AS \'' . __('Last Update') . '\'');
} else {
$datagrid->setSQLColumn('pl.place_name AS \'' . __('Place Name') . '\'', 'pl.last_update AS \'' . __('Last Update') . '\'');
}
$datagrid->setSQLorder('place_name ASC');
// is there any search
if (isset($_GET['keywords']) and $_GET['keywords']) {
$keywords = $dbs->escape_string($_GET['keywords']);
$sql_criteria .= " AND pl.place_name LIKE '%{$keywords}%'";
}
$datagrid->setSQLCriteria($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;"';
// set delete proccess URL
$datagrid->chbox_form_URL = $_SERVER['PHP_SELF'];
// put the result into variable
$datagrid_result = $datagrid->createDataGrid($dbs, $table_spec, 20, $can_read and $can_write);
if (isset($_GET['keywords']) and $_GET['keywords']) {
$msg = str_replace('{result->num_rows}', $datagrid->num_rows, __('Found <strong>{result->num_rows}</strong> from your keywords'));