function showLoanList($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_list = new simbio_datagrid();
     $_loan_list->disable_paging = true;
     $_loan_list->table_ID = 'loanlist';
     $_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 = sprintf('m.member_id=\'%s\' AND l.is_lent=1 AND is_return=0 ', $_SESSION['mid']);
     $_loan_list->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_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 . ' ' . __('Current Loan item(s)') . '</div>' . "\n" . $_result;
     return $_result;
 }
Esempio n. 2
0
            $concat_sql = substr_replace($concat_sql, '', -3);
            $concat_sql .= ') ';
            $sql_criteria .= $concat_sql;
        } else {
            $sql_criteria .= " AND t.topic LIKE '%{$keyword}%'";
        }
    }
    $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'];
    // 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]];
    }
    // modify column content
    $datagrid->modifyColumnContent($subj_type_fld, 'callback{callbackSubjectType}');
    // 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 */
Esempio n. 3
0
     $_output = '<div style="float: left;"><b>' . $_title . '</b><br /><i>' . $_authors . '</i></div>';
     // check for opac hide flag
     if ($_opac_hide) {
         $_output .= '<div style="float: right; width: 20px; height: 20px;" class="lockFlagIcon" title="Hidden in OPAC">&nbsp;</div>';
     }
     // check for promoted flag
     if ($_promoted) {
         $_output .= '<div style="float: right; width: 20px; height: 20px;" class="homeFlagIcon" title="Promoted To Homepage">&nbsp;</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 {
Esempio n. 4
0
    // 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("a.author_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'];
    // callback function to change value of authority type
    function callbackAuthorType($obj_db, $rec_d)
    {
        global $sysconf, $auth_type_fld;
        return $sysconf['authority_type'][$rec_d[$auth_type_fld]];
    }
    // modify column content
    $datagrid->modifyColumnContent($auth_type_fld, 'callback{callbackAuthorType}');
    // 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, lang_sys_common_search_result_info);
        echo '<div class="infoBox">' . $msg . ' : "' . $_GET['keywords'] . '"</div>';
    }
    echo $datagrid_result;
}
/* main content end */
Esempio n. 5
0
 function showLoanList($num_recs_show = 20)
 {
     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_list = new simbio_datagrid();
     $_loan_list->disable_paging = true;
     $_loan_list->table_ID = 'loanlist';
     $_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 = sprintf('m.member_id=\'%s\' AND l.is_lent=1 AND is_return=0 ', $_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') . ' | <a href="?p=download_current_loan">Download All Current Loan</a></div>' . "\n" . $_result;
     return $_result;
 }
Esempio n. 6
0
 if (!($can_read and $can_write) or $_SESSION['uid'] != 1) {
     die('<div class="errorBox">' . __('You don\'t have enough privileges to view this section') . '</div>');
 }
 /* USER LIST */
 // table spec
 $table_spec = 'user AS u';
 // create datagrid
 $datagrid = new simbio_datagrid();
 if ($can_read and $can_write) {
     $datagrid->setSQLColumn('u.user_id', 'u.realname AS \'' . __('Real Name') . '\'', 'u.username AS \'' . __('Login Username') . '\'', 'u.user_type AS \'' . __('User Type') . '\'', 'u.last_login AS \'' . __('Last Login') . '\'', 'u.last_update AS \'' . __('Last Update') . '\'');
     $col = 3;
 } else {
     $datagrid->setSQLColumn('u.realname AS \'' . __('Real Name') . '\'', 'u.username AS \'' . __('Real Name') . '\'', 'u.user_type AS \'' . __('User Type') . '\'', 'u.last_login AS \'' . __('Last Login') . '\'', 'u.last_update AS \'' . __('Last Update') . '\'');
     $col = 2;
 }
 $datagrid->modifyColumnContent($col, 'callback{getUserType}');
 $datagrid->setSQLorder('username ASC');
 // is there any search
 $criteria = 'u.user_id != 1 ';
 if (isset($_GET['keywords']) and $_GET['keywords']) {
     $keywords = $dbs->escape_string($_GET['keywords']);
     $criteria .= " AND (u.username LIKE '%{$keywords}%' OR u.realname 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);
Esempio n. 7
0
    if ($can_read and $can_write) {
        $_output .= ' <a href="#" class="addSubscription" onclick="javascript: $(\'subscriptionListCont' . $count . '\').show(); setIframeContent(\'subscriptionList' . $count . '\', \'' . MODULES_WEB_ROOT_DIR . 'serial_control/subscription.php?biblioID=' . $array_data[0] . '&action=detail\');" title="' . __('Add New Subscription') . '">&nbsp;</a> ';
    }
    $_output .= ' <a href="#" class="viewSubscription" onclick="$(\'subscriptionListCont' . $count . '\').show(); setIframeContent(\'subscriptionList' . $count . '\', \'' . MODULES_WEB_ROOT_DIR . 'serial_control/subscription.php?biblioID=' . $array_data[0] . '\');" title="' . __('View Subscriptions') . '">&nbsp;</a> ';
    $_output .= '<div id="subscriptionListCont' . $count . '" style="clear: both; display: none;">';
    $_output .= '<div><a href="#" style="font-weight: bold; color: red;" title="Close Box" onclick="$(\'subscriptionListCont' . $count . '\').hide()">' . __('CLOSE') . '</a></div>';
    $_output .= '<iframe id="subscriptionList' . $count . '" src="' . MODULES_WEB_ROOT_DIR . 'serial_control/subscription.php?biblioID=' . $array_data[0] . '" style="width: 100%; height: 270px;"></iframe>';
    $_output .= '</div>';
    $count++;
    return $_output;
}
// create datagrid
$datagrid = new simbio_datagrid();
$datagrid->setSQLColumn('b.biblio_id', 'b.title AS \'' . __('Serial Title') . '\'', 'fr.frequency AS \'Frequency\'');
$datagrid->invisible_fields = array(0, 2);
$datagrid->modifyColumnContent(1, 'callback{subscriptionDetail}');
$datagrid->setSQLorder('b.last_update DESC');
// table alias and field relation
$tables['bsub'] = array('title', 'isbn_issn');
$tables['mt'] = array('topic');
if (isset($_GET['field']) and !empty($_GET['field'])) {
    foreach ($tables as $table_alias => $fields) {
        if (!in_array($_GET['field'], $fields)) {
            // remove unneeded array
            unset($tables[$table_alias]);
        }
    }
    // check if fields array is empty to prevent SQL error
    if (!$tables) {
        $tables['bsub'] = array('title', 'isbn_issn');
        $tables['mt'] = array('topic');
} else {
    /* SUBSCRIPTION LIST */
    function serialTitle($obj_db, $array_data)
    {
        $_output = '';
        $_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;"';
Esempio n. 9
0
    }
    $datagrid->setSQLorder('name ASC');
    // criteria
    $criteria = 'ms.server_id IS NOT NULL';
    // is there any search
    if (isset($_GET['keywords']) and $_GET['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'];
    // callback function to change value of authority type
    function callbackServerType($obj_db, $rec_d)
    {
        global $sysconf, $lookupType;
        return $lookupType[$rec_d[3]];
    }
    // modify column content
    $datagrid->modifyColumnContent(3, 'callback{callbackServerType}');
    // 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>';
    }
    // print datagrid
    echo $datagrid_result;
}
Esempio n. 10
0
/* NODES POLL LIST */
// table spec
$table_spec = 'nodes_poll AS npl';
function showStatus($obj_db, $array_data)
{
    if ($array_data[4] == 1) {
        return '<span style="font-weight: bold;" class="isOnline">ONLINE</span>';
    }
    return '<span class="isOffline">Offline</span>';
}
// create datagrid
$datagrid = new simbio_datagrid();
$datagrid->setSQLColumn('node_id AS \'' . __('Node') . '\'', 'node_ip AS \'' . __('IP Address') . '\'', 'node_poll_time AS \'' . __('Request Start') . '\'', 'node_poll_end AS \'' . __('Request End') . '\'', 'is_online AS \'' . __('Status') . '\'');
$datagrid->setSQLorder('node_poll_time DESC');
// modify column value
$datagrid->modifyColumnContent(4, 'callback{showStatus}');
// 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 .= " (node_id LIKE '%{$word}%' OR node_poll_time LIKE '%{$word}%') AND";
        }
        // remove the last AND
        $concat_sql = substr_replace($concat_sql, '', -3);
        $concat_sql .= ') ';
        $datagrid->setSQLCriteria($concat_sql);
    } else {
        $datagrid->setSQLCriteria("node_id LIKE '%{$keyword}%' OR node_poll_time LIKE '%{$keyword}%'");