本文整理汇总了PHP中simbio_datagrid::createDataGrid方法的典型用法代码示例。如果您正苦于以下问题:PHP simbio_datagrid::createDataGrid方法的具体用法?PHP simbio_datagrid::createDataGrid怎么用?PHP simbio_datagrid::createDataGrid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类simbio_datagrid
的用法示例。
在下文中一共展示了simbio_datagrid::createDataGrid方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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:
/* GMD LIST */
// table spec
$table_spec = 'mst_gmd AS g';
// create datagrid
$datagrid = new simbio_datagrid();
if ($can_read and $can_write) {
$datagrid->setSQLColumn('g.gmd_id', 'g.gmd_code AS \'' . __('GMD Code') . '\'', 'g.gmd_name AS \'' . __('GMD Name') . '\'', 'g.last_update AS \'' . __('Last Update') . '\'');
} else {
$datagrid->setSQLColumn('g.gmd_code AS \'' . __('GMD Code') . '\'', 'g.gmd_name AS \'' . __('GMD Name') . '\'', 'g.last_update AS \'' . __('Last Update') . '\'');
}
$datagrid->setSQLorder('gmd_name ASC');
// is there any search
if (isset($_GET['keywords']) and $_GET['keywords']) {
$keywords = $dbs->escape_string($_GET['keywords']);
$datagrid->setSQLCriteria("g.gmd_name LIKE '%{$keywords}%' OR g.gmd_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'];
// 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;
}
/* main content end */
示例3:
} else {
/* GROUP LIST */
// table spec
$table_spec = 'user_group AS ug';
// create datagrid
$datagrid = new simbio_datagrid();
$datagrid->setSQLColumn('ug.group_id', 'ug.group_name AS \'' . __('Group Name') . '\'', 'ug.last_update AS \'' . __('Last Update') . '\'');
$datagrid->setSQLorder('group_name ASC');
// is there any search
$criteria = 'ug.group_id != 1';
if (isset($_GET['keywords']) and $_GET['keywords']) {
$keywords = $dbs->escape_string($_GET['keywords']);
$criteria .= " AND ug.group_name LIKE '%{$keywords}%'";
}
$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->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;
}
/* main content end */
示例4:
}
$search_str = substr_replace($search_str, '', -4);
}
$biblio_list = new biblio_list($dbs);
$criteria = $biblio_list->setSQLcriteria($search_str);
}
if (isset($criteria)) {
$datagrid->setSQLcriteria('(' . $criteria['sql_criteria'] . ')');
}
// table spec
$table_spec = 'biblio LEFT JOIN item ON biblio.biblio_id=item.biblio_id';
// set group by
$datagrid->sql_group_by = 'biblio.biblio_id';
// 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'];
$datagrid->debug = true;
$biblio_result_num = $sysconf['biblio_result_num'] > 100 ? 100 : $sysconf['biblio_result_num'];
// put the result into variables
$datagrid_result = $datagrid->createDataGrid($dbs, $table_spec, $biblio_result_num, $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>' . __('Query took') . ' <b>' . $datagrid->query_time . '</b> ' . __('second(s) to complete') . '</div></div>';
//mfc
}
echo $datagrid_result;
}
/* main content end */
示例5: 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;
}
示例6: explode
$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($concat_sql);
} else {
$datagrid->setSQLCriteria("sl.log_date LIKE '%{$keyword}%' OR sl.log_msg 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->delete_URL = $_SERVER['PHP_SELF'];
$datagrid->column_width = array('18%', '10%', '72%');
$datagrid->disableSort('Message');
// put the result into variables
$datagrid_result = $datagrid->createDataGrid($dbs, $table_spec, 50, 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;
/* main content end */
示例7: foreach
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);
}
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;"';
// 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>'.__('Query took').' <b>'.$datagrid->query_time.'</b> '.__('second(s) to complete').'</div></div>'; //mfc
}
echo $datagrid_result;
}
/* main content end */
?>
示例8: 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;
}