More work on library display

This commit is contained in:
Deon George
2011-06-27 14:37:11 +10:00
parent b2c250c319
commit c4ef5e2275
11 changed files with 136 additions and 666 deletions

View File

@@ -19,6 +19,7 @@ class Model_VOLUME extends ORMTSM {
protected $_has_one = array(
'MEDIA'=>array('foreign_key'=>'VOLUME_NAME','far_key'=>'VOLUME_NAME'),
'STGPOOL'=>array('foreign_key'=>'STGPOOL_NAME','far_key'=>'STGPOOL_NAME'),
);
protected $_has_many = array(
'VOLUMEUSAGE'=>array('foreign_key'=>'VOLUME_NAME','far_key'=>'VOLUME_NAME'),
@@ -52,5 +53,17 @@ class Model_VOLUME extends ORMTSM {
public function location() {
return $this->display('LOCATION');
}
// Age of a volume, based on last read/write access.
public function age() {
if (! $this->LAST_READ_DATE AND ! $this->LAST_WRITE_DATE)
return 0;
else
return (int)((time()-(strtotime(strtotime($this->LAST_READ_DATE) > strtotime($this->LAST_WRITE_DATE) ? $this->LAST_WRITE_DATE : $this->LAST_READ_DATE)))/86400);
}
public function recycle() {
return Kohana::config('config.tsmtapeage') < $this->age() ? TRUE : FALSE;
}
}
?>