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/slot.php

50 lines
1.2 KiB
PHP
Raw Normal View History

2011-06-24 01:27:21 +00:00
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* PTA Show Slot Item.
*
* @package PTA
* @subpackage TSM
* @category Helpers
* @author Deon George
* @copyright (c) 2010 phpTSMadmin Development Team
* @license http://phptsmadmin.sf.net/license.html
*/
class Slot {
private $data = array();
private $objects = array(
'VOLUME'=>'barcodelabel',
2011-06-26 12:20:12 +00:00
'LIBVOLUME'=>'element',
2011-06-24 01:27:21 +00:00
);
public function __construct(array $slot) {
$this->data = $slot;
}
public function __get($key) {
if (isset($this->data[$key]))
return $this->data[$key];
// @todo Volume names may not be unique if there is more than 1 library.
elseif (isset($this->objects[$key]))
return ORM::factory($key,$this->__get($this->objects[$key]));
else
throw new Kohana_Exception('Undefined property :class:::property',array(':class'=>get_class($this),':property'=>$key));
}
public function __toString() {
return $this->slot;
}
2011-06-24 23:46:26 +00:00
public function barcodelabel() {
2011-06-26 12:20:12 +00:00
if ($this->LIBVOLUME->VOLUME_NAME)
return $this->LIBVOLUME->VOLUME_NAME;
elseif ($this->status == 'Allocated' AND $this->barcode == 'not present')
2011-06-24 23:46:26 +00:00
return _('No Label');
elseif ($this->status == 'Unallocated')
return _('Slot Empty');
else
return $this->barcodelabel;
}
2011-06-24 01:27:21 +00:00
}
?>