本文整理汇总了PHP中simbio_datagrid::setSQLCriteria方法的典型用法代码示例。如果您正苦于以下问题:PHP simbio_datagrid::setSQLCriteria方法的具体用法?PHP simbio_datagrid::setSQLCriteria怎么用?PHP simbio_datagrid::setSQLCriteria使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类simbio_datagrid
的用法示例。
在下文中一共展示了simbio_datagrid::setSQLCriteria方法的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:
//mfc
}
// print out the form object
echo $form->printOut();
} else {
/* MODULE LIST */
// table spec
$table_spec = 'mst_module AS mdl';
// create datagrid
$datagrid = new simbio_datagrid();
$datagrid->setSQLColumn('mdl.module_id', 'mdl.module_name AS \'' . __('Module Name') . '\'', 'mdl.module_desc AS \'' . __('Module Description') . '\'');
$datagrid->setSQLorder('module_name ASC');
// is there any search
if (isset($_GET['keywords']) and $_GET['keywords']) {
$keywords = $dbs->escape_string($_GET['keywords']);
$datagrid->setSQLCriteria("mdl.module_name LIKE '%{$keywords}%'");
}
// set table and table header attributes
$datagrid->icon_edit = $sysconf['admin_template']['dir'] . '/' . $sysconf['admin_template']['theme'] . '/edit.gif';
$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, true);
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
echo '<div class="infoBox">' . $msg . ' : "' . $_GET['keywords'] . '"</div>';
}
echo $datagrid_result;
示例3:
/* PUBLISHER LIST */
// table spec
$table_spec = 'mst_publisher AS p';
// create datagrid
$datagrid = new simbio_datagrid();
if ($can_read and $can_write) {
$datagrid->setSQLColumn('p.publisher_id', 'p.publisher_name AS \'' . __('Publisher Name') . '\'', 'p.last_update AS \'' . __('Last Update') . '\'');
} else {
// TODO: publisher_place was dropped in stable7...?
$datagrid->setSQLColumn('p.publisher_name AS \'' . __('Publisher Name') . '\'', 'p.publisher_place AS \'' . lang_mod_masterfile_publisher_form_field_place . '\'', 'p.last_update AS \'' . __('Last Update') . '\'');
}
$datagrid->setSQLorder('publisher_name ASC');
// is there any search
if (isset($_GET['keywords']) and $_GET['keywords']) {
$keywords = $dbs->escape_string($_GET['keywords']);
$datagrid->setSQLCriteria("p.publisher_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 variable
$datagrid_result = $datagrid->createDataGrid($dbs, $table_spec, 20, $can_read and $can_write);
if (isset($_GET['keywords']) and $_GET['keywords']) {
echo '<table cellpadding="3" cellspacing="0" class="infoBox">';
$msg = str_replace('{result->num_rows}', $datagrid->num_rows, __('Found <strong>{result->num_rows}</strong> from your keywords'));
//mfc
echo '<tr><th>' . $msg . ' : "' . $_GET['keywords'] . '"</th></tr>';
echo '</table>';
}
示例4: AND
if ($can_read and $can_write) {
$datagrid->setSQLColumn('m.member_id', 'm.member_id AS \'' . __('Member ID') . '\'', 'm.member_name AS \'' . __('Member Name') . '\'', 'mt.member_type_name AS \'' . __('Membership Type') . '\'', 'm.member_email AS \'' . __('E-mail') . '\'', 'm.last_update AS \'' . __('Last Updated') . '\'');
} else {
$datagrid->setSQLColumn('m.member_id AS \'' . __('Member ID') . '\'', 'm.member_name AS \'' . __('Member Name') . '\'', 'mt.member_type_name AS \'' . __('Membership Type') . '\'', 'm.member_email AS \'' . __('E-mail') . '\'', 'm.last_update AS \'' . __('Last Updated') . '\'');
}
$datagrid->setSQLorder('member_name ASC');
// is there any search
$criteria = 'm.member_id IS NOT NULL ';
if (isset($_GET['keywords']) and $_GET['keywords']) {
$keywords = $dbs->escape_string($_GET['keywords']);
$criteria .= " AND (m.member_name LIKE '%{$keywords}%' OR m.member_id LIKE '%{$keywords}%') ";
}
if (isset($_GET['expire'])) {
$criteria .= " AND TO_DAYS('" . date('Y-m-d') . "')>TO_DAYS(m.expire_date)";
}
$datagrid->setSQLCriteria($criteria);
// set table and table header attributes
$datagrid->icon_edit = SENAYAN_WEB_ROOT_DIR . 'admin/' . $sysconf['admin_template']['dir'] . '/' . $sysconf['admin_template']['theme'] . '/edit.gif';
$datagrid->table_name = 'memberList';
$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'] or isset($_GET['expire'])) {
echo '<div class="infoBox">';
if (isset($_GET['expire'])) {
echo '<b style="color: #FF0000;">' . __('Expired Member List') . '</b><hr size="1" />';
echo '<div><input type="button" value="' . __('Extend Selected Member(s)') . '" onclick="javascript: if (confirm(\'' . __('Are you sure to EXTEND membership for selected members?') . '\')) { setContent(\'mainContent\', \'' . MODULES_WEB_ROOT_DIR . 'membership/index.php?expire=1\', \'post\', $H($(\'memberList\').serialize(true)).update({ batchExtend: \'true\' }) ); }" class="button" /></div>';
if (isset($_GET['numExtended']) and $_GET['numExtended'] > 0) {
示例5:
" />
</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
echo '<div class="infoBox">' . $msg . ' : "' . $_GET['keywords'] . '"</div>';
}
echo $datagrid_result;
示例6:
} else {
/* DOCUMENT LANGUAGE LIST */
// table spec
$table_spec = 'mst_language AS l';
// create datagrid
$datagrid = new simbio_datagrid();
if ($can_read and $can_write) {
$datagrid->setSQLColumn('l.language_id', 'l.language_name AS \'' . __('Language') . '\'', 'l.last_update AS \'' . __('Last Update') . '\'');
} else {
$datagrid->setSQLColumn('l.language_name AS \'' . __('Language') . '\'', 'l.last_update AS \'' . __('Last Update') . '\'');
}
$datagrid->setSQLorder('language_name ASC');
// is there any search
if (isset($_GET['keywords']) and $_GET['keywords']) {
$keywords = $dbs->escape_string($_GET['keywords']);
$datagrid->setSQLCriteria("l.language_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
echo '<div class="infoBox">' . $msg . ' : "' . $_GET['keywords'] . '"</div>';
}
echo $datagrid_result;
}
示例7:
$table_spec = 'mst_loan_rules AS lr
LEFT JOIN mst_member_type AS mt ON lr.member_type_id=mt.member_type_id
LEFT JOIN mst_coll_type AS ct ON lr.coll_type_id=ct.coll_type_id
LEFT JOIN mst_gmd AS g ON lr.gmd_id=g.gmd_id';
// create datagrid
$datagrid = new simbio_datagrid();
if ($can_read and $can_write) {
$datagrid->setSQLColumn('lr.loan_rules_id', 'mt.member_type_name AS \'' . __('Member Type') . '\'', 'ct.coll_type_name AS \'' . __('Collection Type') . '\'', 'g.gmd_name AS \'' . __('GMD') . '\'', 'lr.loan_limit AS \'' . __('Loan Limit') . '\'', 'lr.loan_periode AS \'' . __('Loan Period') . '\'', 'lr.last_update AS \'' . __('Last Update') . '\'');
} else {
$datagrid->setSQLColumn('mt.member_type_name AS \'' . __('Member Type') . '\'', 'ct.coll_type_name AS \'' . __('Collection Type') . '\'', 'g.gmd_name AS \'' . __('GMD') . '\'', 'lr.loan_limit AS \'' . __('Loan Limit') . '\'', 'lr.loan_periode AS \'' . __('Loan Period') . '\'', 'lr.last_update AS \'' . __('Last Update') . '\'');
}
$datagrid->setSQLorder('mt.member_type_name ASC');
// is there any search
if (isset($_GET['keywords']) and $_GET['keywords']) {
$keywords = $dbs->escape_string($_GET['keywords']);
$datagrid->setSQLCriteria("mt.member_type_name LIKE '%{$keywords}%'");
}
// set table and table header attributes
$datagrid->icon_edit = $sysconf['admin_template']['dir'] . '/' . $sysconf['admin_template']['theme'] . '/edit.gif';
$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
echo '<div class="infoBox">' . $msg . ' : "' . $_GET['keywords'] . '"</div>';
}
echo $datagrid_result;
示例8: explode
$datagrid->setSQLColumn('st.stock_take_id', 'st.stock_take_name AS \'' . __('Stock Take Name') . '\'', 'st.start_date AS \'' . __('Start Date') . '\'', 'st.end_date AS \'' . __('End Date') . '\'', 'CONCAT(\'<a class="notAJAX" href="' . SENAYAN_WEB_ROOT_DIR . FILES_DIR . '/' . REPORT_DIR . '/\', st.report_file, \'" target="_blank">\', st.report_file, \'</a>\') AS \'' . __('Report') . '\'');
$datagrid->setSQLorder('st.start_date DESC');
$datagrid->disableSort('Report');
// 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 .= " (stock_take_name LIKE '%{$word}%' OR init_user LIKE '%{$word}%') AND";
}
// remove the last AND
$concat_sql = substr_replace($concat_sql, '', -3);
$concat_sql .= ') ';
$datagrid->setSQLCriteria($concat_sql);
} else {
$datagrid->setSQLCriteria("stock_take_name LIKE '%{$keyword}%' OR init_user LIKE '%{$keyword}%'");
}
}
// set table and table header attributes
$datagrid->icon_edit = $sysconf['admin_template']['dir'] . '/' . $sysconf['admin_template']['theme'] . '/edit.gif';
$datagrid->table_attr = 'align="center" id="dataList" cellpadding="5" cellspacing="0"';
$datagrid->table_header_attr = 'class="dataListHeader" style="font-weight: bold;"';
$datagrid->chbox_property = false;
// set delete proccess URL
$datagrid->delete_URL = $_SERVER['PHP_SELF'];
// put the result into variables
$datagrid_result = $datagrid->createDataGrid($dbs, $table_spec, 20, true);
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'));
示例9: urldecode
$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 '<div class="infoBox">';
示例10: urldecode
// create datagrid
$datagrid = new simbio_datagrid();
if ($can_read and $can_write) {
$datagrid->setSQLColumn('ct.coll_type_id', 'ct.coll_type_name AS \'' . __('Collection Type') . '\'', 'ct.last_update AS \'' . __('Last Update') . '\'');
} else {
$datagrid->setSQLColumn('ct.coll_type_name AS \'' . __('Collection Type') . '\'', 'ct.last_update AS \'' . __('Last Update') . '\'');
}
$datagrid->setSQLorder('coll_type_name ASC');
// change the record order
if (isset($_GET['fld']) and isset($_GET['dir'])) {
$datagrid->setSQLorder("'" . urldecode($_GET['fld']) . "' " . $dbs->escape_string($_GET['dir']));
}
// is there any search
if (isset($_GET['keywords']) and $_GET['keywords']) {
$keywords = $dbs->escape_string($_GET['keywords']);
$datagrid->setSQLCriteria("ct.coll_type_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
echo '<div class="infoBox">' . $msg . ' : "' . $_GET['keywords'] . '"</div>';
}
echo $datagrid_result;
}
示例11: explode
$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 {
$datagrid->setSQLCriteria($criteria . " AND sl.log_date LIKE '%{$keyword}%' OR sl.log_msg LIKE '%{$keyword}%'");
}
}
$datagrid->setSQLCriteria($criteria);
// set table and table header attributes
$datagrid->icon_edit = SENAYAN_WEB_ROOT_DIR . 'admin/' . $sysconf['admin_template']['dir'] . '/' . $sysconf['admin_template']['theme'] . '/edit.gif';
$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'];
$datagrid->column_width = array('18%', '82%');
$datagrid->disableSort('Message');
// put the result into variables
$datagrid_result = $datagrid->createDataGrid($dbs, $table_spec, 50, false);
示例12:
} else {
/* GMD LIST */
// table spec
$table_spec = 'mst_' . $type . '_type AS g';
// create datagrid
$datagrid = new simbio_datagrid();
if ($can_read and $can_write) {
$datagrid->setSQLColumn('g.id', 'g.code AS \'' . __('Code') . '\'', 'g.' . $type . '_type AS \'' . __('Name') . '\'', 'g.last_update AS \'' . __('Last Update') . '\'');
} else {
$datagrid->setSQLColumn('g.code AS \'' . __('Code') . '\'', 'g.' . $type . '_type AS \'' . __('Name') . '\'', 'g.last_update AS \'' . __('Last Update') . '\'');
}
$datagrid->setSQLorder($type . '_type ASC');
// is there any search
if (isset($_GET['keywords']) and $_GET['keywords']) {
$keywords = $dbs->escape_string($_GET['keywords']);
$datagrid->setSQLCriteria("g." . $type . "_type LIKE '%{$keywords}%' OR g.code 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'] . '?type=' . $type;
// 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
echo '<div class="infoBox">' . $msg . ' : "' . $_GET['keywords'] . '"</div>';
}
echo $datagrid_result;
}
示例13: showLoanList
function showLoanList($num_recs_show = 20)
{
global $dbs;
require SIMBIO_BASE_DIR . 'simbio_GUI/table/simbio_table.inc.php';
require SIMBIO_BASE_DIR . 'simbio_DB/datagrid/simbio_dbgrid.inc.php';
require SIMBIO_BASE_DIR . 'simbio_GUI/paging/simbio_paging.inc.php';
require SIMBIO_BASE_DIR . '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_list = new simbio_datagrid();
$_loan_list->setSQLColumn('l.item_code AS \'' . __('Item Code') . '\'', 'b.title AS \'' . __('Title') . '\'', 'l.loan_date AS \'' . __('Loan Date') . '\'', 'l.due_date AS \'' . __('Due Date') . '\'');
$_loan_list->setSQLorder('l.loan_date DESC');
$_criteria = 'm.member_id=\'' . $_SESSION['mid'] . '\' ';
$_loan_list->setSQLCriteria($_criteria);
// modify column value
$_loan_list->modifyColumnContent(3, 'callback{showOverdue}');
// set table and table header attributes
$_loan_list->table_attr = 'align="center" class="memberLoanList" cellpadding="5" cellspacing="0"';
$_loan_list->table_header_attr = 'class="dataListHeader" style="font-weight: bold;"';
$_loan_list->using_AJAX = false;
// return the result
$_result = $_loan_list->createDataGrid($dbs, $_table_spec, $num_recs_show);
$_result = '<div class="memberLoanListInfo">' . $_loan_list->num_rows . ' ' . __('item(s) currently on loan') . '</div>' . "\n" . $_result;
return $_result;
}
示例14: explode
$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 = ' (';
foreach ($words as $word) {
$concat_sql .= " t.topic LIKE '%{$word}%' AND";
}
// remove the last AND
$concat_sql = substr_replace($concat_sql, '', -3);
$concat_sql .= ') ';
$datagrid->setSQLCriteria($concat_sql);
} else {
$datagrid->setSQLCriteria("t.topic 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;"';
// set delete proccess URL
$datagrid->chbox_form_URL = $_SERVER['PHP_SELF'];
// callback function to change value of subject type
function callbackSubjectType($obj_db, $rec_d)
{
global $sysconf, $subj_type_fld;
return $sysconf['subject_type'][$rec_d[$subj_type_fld]];
}
示例15:
} else {
/* HOLIDAY LIST */
// table spec
$table_spec = 'holiday';
// create datagrid
$datagrid = new simbio_datagrid();
if ($can_read and $can_write) {
$datagrid->setSQLColumn('holiday_id', "holiday_dayname AS '" . __('Day name') . "'", "holiday_date AS '" . __('Holiday Date Start') . "'", "description AS '" . __('Holiday Description') . "'");
} else {
$datagrid->setSQLColumn("holiday_dayname AS '" . __('Day name') . "'", "holiday_date AS '" . __('Holiday Date Start') . "'", "description AS '" . __('Holiday Description') . "'");
}
$datagrid->setSQLorder('holiday_date DESC');
// is there any search
if (isset($_GET['keywords']) and $_GET['keywords']) {
$keywords = $dbs->escape_string($_GET['keywords']);
$datagrid->setSQLCriteria("holiday_description LIKE '%{$keywords}%' OR holiday_date LIKE '%{$keywords}%'");
} else {
$datagrid->setSQLCriteria('holiday_date IS NOT NULL');
}
// set table and table header attributes
$datagrid->icon_edit = SWB . 'admin/' . $sysconf['admin_template']['dir'] . '/' . $sysconf['admin_template']['theme'] . '/edit.gif';
$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
echo '<div class="infoBox">' . $msg . ' : "' . $_GET['keywords'] . '"</div>';