This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
phptsmadmin/application/classes/database/tsm/show.php
2011-06-24 11:27:49 +10:00

62 lines
1.9 KiB
PHP

<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* TSM database show result. See [Results](/database/results) for usage and examples.
*
* @package PTA
* @subpackage TSM
* @category Query/Show
* @author Deon George
* @copyright (c) 2010 phpTSMadmin Development Team
* @license http://phptsmadmin.sf.net/license.html
*/
class Database_TSM_Show extends Database_Result {
public function __construct($result, $sql, $as_object = FALSE, array $params = NULL) {
parent::__construct($result, $sql, $as_object, $params);
$sql = strtolower($sql);
$start = FALSE;
foreach ($result as $line) {
if (! trim($line))
continue;
if (preg_match('/^show slots /',$sql))
if (preg_match('/^Slot /',$line)) {
if ($start)
$this->_internal_row++;
$slot = array();
foreach ((preg_split('/,\s*/',$line,-1)) as $slotkey => $val)
if (preg_match('/^element number\s+/',$val))
$slot['element'] = preg_replace('/^element number\s+/','',$val);
elseif (preg_match('/^Slot\s+/',$val))
$slot['slot'] = preg_replace('/^Slot\s+/','',$val);
elseif (preg_match('/^status\s+/',$val))
$slot['status'] = preg_replace('/^status\s+/','',$val);
elseif (preg_match('/^barcode value </',$val))
$slot['barcodelabel'] = preg_replace('/^barcode value <(.*)>/',"$1",$val);
elseif (preg_match('/^barcode\s+/',$val))
$slot['barcode'] = preg_replace('/^barcode /','',$val);
$slot['library'] = preg_replace('/^show slots /','',$sql);
$this->_rows[$this->_internal_row] = new Slot($slot);
$start = TRUE;
} elseif (preg_match('/busy.$/',$line)) {
SystemMessage::add(array(
'title'=>_('Library is Busy'),
'type'=>'info',
'body'=>_('The library appears busy at the moment.'),
));
return;
}
}
$this->_total_rows = $this->_internal_row;
$this->_internal_row = 0;
}
}
?>