obj_db = $obj_db;
$this->num2show = $int_num_show;
}
/**
* Method to set search criteria
* Extend this method
*
* @param string $str_criteria
* @return void
*/
public function setSQLcriteria($str_criteria) { }
/**
* Method to compile SQL statement based on criteria
*
* @param string $str_criteria
* @return void
*/
protected function compileSQL() { }
/**
* Method to get string of authors data of bibliographic record
*
* @param object $obj_db
* @param integer $int_biblio_id
* @param boolean $bool_return_array
* @return mixed
*/
public static function getAuthors($obj_db, $int_biblio_id, $bool_return_array = false) {
$_authors = '';
$_authors_arr = array();
$_sql_str = 'SELECT a.author_name, a.author_id FROM biblio_author AS ba
LEFT JOIN biblio AS b ON ba.biblio_id=b.biblio_id
LEFT JOIN mst_author AS a ON ba.author_id=a.author_id WHERE ba.biblio_id='.$int_biblio_id;
// query the author
$_author_q = $obj_db->query($_sql_str);
// concat author data
while ($_author_d = $_author_q->fetch_row()) {
$counter = count ($_author_d);
$_authors .= $_author_d[0];
if ($bool_return_array) {
$_authors_arr[] = $_author_d[0];
}
$_authors .= ' - ';
}
if ($bool_return_array) {
return $_authors_arr;
} else {
return $_authors;
}
}
/**
* Method to get list of document IDs of result
*
* @return mixed
*/
public function getDocumentIds() {
$_temp_resultset = $this->resultset;
while ($_biblio_d = $_temp_resultset->fetch_assoc()) { $this->biblio_ids[] = $_biblio_d['biblio_id']; }
unset($_temp_resultset);
return $this->biblio_ids;
}
/**
* Method to print out document records
*
* @param object $obj_db
* @param integer $int_num2show
* @param boolean $bool_return_output
* @return string
*/
public function getDocumentList($bool_return_output = true) {
global $sysconf;
$_sql_str = $this->compileSQL();
// start time
$_start = function_exists('microtime')?microtime(true):time();
// execute query
$this->resultset = $this->obj_db->query($_sql_str);
if ($this->obj_db->error) {
$this->query_error = $this->obj_db->error;
}
// get total number of rows from query
$_total_q = $this->obj_db->query('SELECT FOUND_ROWS()');
$_total_d = $_total_q->fetch_row();
$this->num_rows = $_total_d[0];
// end time
$_end = function_exists('microtime')?microtime(true):time();
$this->query_time = round($_end-$_start, 5);
if ($bool_return_output) {
// return the html result
return $this->makeOutput();
}
}
/**
* Method to make an output of document records
*
* @return string
*/
protected function makeOutput() {
global $sysconf;
// init the result buffer
$_buffer = '';
// keywords from last search
$_keywords = '';
// loop data
$_i = 0;
if (!$this->resultset) {
return '
Query error : '.$this->query_error.'
';
}
if (isset($_GET['keywords'])) {
$_keywords = urlencode(trim(urldecode($_GET['keywords'])));
}
// include biblio list HTML template callback
include SB.$sysconf['template']['dir'].'/'.$sysconf['template']['theme'].'/biblio_list_template.php';
$settings = '';
$settings = get_object_vars($this);
$settings['keywords'] = $_keywords;
while ($_biblio_d = $this->resultset->fetch_assoc()) {
$_buffer .= biblio_list_format($this->obj_db, $_biblio_d, $_i, $settings, $return_back);
$_i++;
}
// free resultset memory
$this->resultset->free_result();
// paging
if (($this->num_rows > $this->num2show)) {
$_paging = '